Files
explore/lib/web3/chains.ts
T
tom goriunovandGitHub 9908a53269 Arbitrum messages claiming (#2533)
* txn withdrawals page stub

* add base page layout

* add ConnectWallet alert

* save search term in page query param

* add links to the new page

* add functionality to claim button

* combine "Connect wallet" and "Claim" buttons

* Refactor rollup configuration to introduce ParentChain structure and deprecate legacy environment variables

* handle txn claim

* allow to pass array of RPC urls for parent chain config

* display token value and completion tx hash

* fix csp

* write tests for arbitrum l2 txn withdrawals

* fix ts

* review fixes

* update screenshots and hide button if the txn is not confirmed yet
2025-02-11 10:36:36 +01:00

58 lines
1.2 KiB
TypeScript

import { type Chain } from 'viem';
import config from 'configs/app';
export const currentChain: Chain = {
id: Number(config.chain.id),
name: config.chain.name ?? '',
nativeCurrency: {
decimals: config.chain.currency.decimals,
name: config.chain.currency.name ?? '',
symbol: config.chain.currency.symbol ?? '',
},
rpcUrls: {
'default': {
http: config.chain.rpcUrls,
},
},
blockExplorers: {
'default': {
name: 'Blockscout',
url: config.app.baseUrl,
},
},
testnet: config.chain.isTestnet,
};
export const parentChain: Chain | undefined = (() => {
const rollupFeature = config.features.rollup;
const parentChain = rollupFeature.isEnabled && rollupFeature.parentChain;
if (!parentChain) {
return;
}
if (!parentChain.id || !parentChain.name || !parentChain.rpcUrls || !parentChain.baseUrl || !parentChain.currency) {
return;
}
return {
id: parentChain.id,
name: parentChain.name,
nativeCurrency: parentChain.currency,
rpcUrls: {
'default': {
http: parentChain.rpcUrls,
},
},
blockExplorers: {
'default': {
name: 'Blockscout',
url: parentChain.baseUrl,
},
},
testnet: parentChain.isTestnet,
};
})();