From b8fc0dc1369a39d871dca9adf6d0c9038275d3cb Mon Sep 17 00:00:00 2001 From: oleksiivinogradov Date: Mon, 24 Jun 2024 16:46:38 +0300 Subject: [PATCH] feat: add dchain (#2354) * adding dchain (testnet and mainnet) * format * remove lockb * revert bun.lockb * Update dchainTestnet.ts * Update dchainTestnet.ts * Update dchain.ts * removal bun and have fun )) --------- Co-authored-by: jxom --- .changeset/proud-baboons-scream.md | 5 +++++ src/chains/definitions/dchain.ts | 24 ++++++++++++++++++++++ src/chains/definitions/dchainTestnet.ts | 27 +++++++++++++++++++++++++ src/chains/index.ts | 2 ++ 4 files changed, 58 insertions(+) create mode 100644 .changeset/proud-baboons-scream.md create mode 100644 src/chains/definitions/dchain.ts create mode 100644 src/chains/definitions/dchainTestnet.ts diff --git a/.changeset/proud-baboons-scream.md b/.changeset/proud-baboons-scream.md new file mode 100644 index 0000000000..cd117ddb0c --- /dev/null +++ b/.changeset/proud-baboons-scream.md @@ -0,0 +1,5 @@ +--- +"viem": patch +--- + +Added dchain chain diff --git a/src/chains/definitions/dchain.ts b/src/chains/definitions/dchain.ts new file mode 100644 index 0000000000..c08748fa65 --- /dev/null +++ b/src/chains/definitions/dchain.ts @@ -0,0 +1,24 @@ +import { chainConfig } from '../../op-stack/chainConfig.js' +import { defineChain } from '../../utils/chain/defineChain.js' + +export const dchain = /*#__PURE__*/ defineChain({ + ...chainConfig, + id: 2716446429837000, + name: 'Dchain', + nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, + rpcUrls: { + default: { + http: ['https://dchain-2716446429837000-1.jsonrpc.sagarpc.io'], + }, + }, + blockExplorers: { + default: { + name: 'Dchain Explorer', + url: 'https://dchain-2716446429837000-1.sagaexplorer.io', + apiUrl: 'https://api-dchain-2716446429837000-1.sagaexplorer.io/api', + }, + }, + contracts: { + ...chainConfig.contracts, + }, +}) diff --git a/src/chains/definitions/dchainTestnet.ts b/src/chains/definitions/dchainTestnet.ts new file mode 100644 index 0000000000..8f451db405 --- /dev/null +++ b/src/chains/definitions/dchainTestnet.ts @@ -0,0 +1,27 @@ +import { chainConfig } from '../../op-stack/chainConfig.js' +import { defineChain } from '../../utils/chain/defineChain.js' + +export const dchainTestnet = /*#__PURE__*/ defineChain({ + ...chainConfig, + id: 2713017997578000, + name: 'Dchain Testnet', + nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, + rpcUrls: { + default: { + http: [ + 'https://dchaintestnet-2713017997578000-1.jsonrpc.testnet.sagarpc.io', + ], + }, + }, + blockExplorers: { + default: { + name: 'Dchain Explorer', + url: 'https://dchaintestnet-2713017997578000-1.testnet.sagaexplorer.io', + apiUrl: + 'https://api-dchaintestnet-2713017997578000-1.testnet.sagaexplorer.io/api', + }, + }, + contracts: { + ...chainConfig.contracts, + }, +}) diff --git a/src/chains/index.ts b/src/chains/index.ts index eca2b72951..46f228ed19 100644 --- a/src/chains/index.ts +++ b/src/chains/index.ts @@ -62,6 +62,8 @@ export { crossbell } from './definitions/crossbell.js' export { cyber } from './definitions/cyber.js' export { cyberTestnet } from './definitions/cyberTestnet.js' export { darwinia } from './definitions/darwinia.js' +export { dchain } from './definitions/dchain.js' +export { dchainTestnet } from './definitions/dchainTestnet.js' export { defichainEvm } from './definitions/defichainEvm.js' export { defichainEvmTestnet } from './definitions/defichainEvmTestnet.js' export { degen } from './definitions/degen.js'