Skip to content

Commit

Permalink
feat: add dchain (#2354)
Browse files Browse the repository at this point in the history
* 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 <j@wevm.dev>
  • Loading branch information
oleksiivinogradov and jxom committed Jun 24, 2024
1 parent 00b353b commit b8fc0dc
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/proud-baboons-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"viem": patch
---

Added dchain chain
24 changes: 24 additions & 0 deletions src/chains/definitions/dchain.ts
Original file line number Diff line number Diff line change
@@ -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,
},
})
27 changes: 27 additions & 0 deletions src/chains/definitions/dchainTestnet.ts
Original file line number Diff line number Diff line change
@@ -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,
},
})
2 changes: 2 additions & 0 deletions src/chains/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit b8fc0dc

Please sign in to comment.