Skip to content

Commit

Permalink
feat: common package add Gnosis Chain information
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff-CCH committed Nov 22, 2023
1 parent a049a96 commit e01cd7e
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/smart-tools-provide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@protocolink/common': patch
---

add Gnosis Chain information
23 changes: 23 additions & 0 deletions packages/common/src/networks/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,29 @@
"multicall2Address": "0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696",
"multicall3Address": "0xcA11bde05977b3631167028862bE2a173976CA11"
},
{
"id": "gnosis",
"chainId": 100,
"name": "Gnosis Chain",
"explorerUrl": "https://gnosisscan.io/",
"rpcUrl": "https://rpc.ankr.com/gnosis",
"nativeToken": {
"chainId": 100,
"address": "0x0000000000000000000000000000000000000000",
"decimals": 18,
"symbol": "xDAI",
"name": "xDai"
},
"wrappedNativeToken": {
"chainId": 100,
"address": "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",
"decimals": 18,
"symbol": "WXDAI",
"name": "Wrapped XDAI"
},
"multicall2Address": "0xecC4d9410c1a5276733cEF29d1C9015571f56BDC",
"multicall3Address": "0xcA11bde05977b3631167028862bE2a173976CA11"
},
{
"id": "polygon",
"chainId": 137,
Expand Down
20 changes: 20 additions & 0 deletions packages/common/src/networks/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe('Test isSupportedChainId', function () {
const testCases = [
{ chainId: ChainId.mainnet, expected: true },
{ chainId: ChainId.optimism, expected: true },
{ chainId: ChainId.gnosis, expected: true },
{ chainId: ChainId.polygon, expected: true },
{ chainId: ChainId.zksync, expected: true },
{ chainId: ChainId.metis, expected: true },
Expand All @@ -35,6 +36,7 @@ describe('Test isSupportedNetworkId', function () {
const testCases = [
{ networkId: NetworkId.mainnet, expected: true },
{ networkId: NetworkId.optimism, expected: true },
{ networkId: NetworkId.gnosis, expected: true },
{ networkId: NetworkId.polygon, expected: true },
{ networkId: NetworkId.zksync, expected: true },
{ networkId: NetworkId.metis, expected: true },
Expand Down Expand Up @@ -89,6 +91,24 @@ describe('Test newExplorerUrl', function () {
data: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
expected: 'https://optimistic.etherscan.io/token/0xdAC17F958D2ee523a2206206994597C13D831ec7',
},
{
chainId: ChainId.gnosis,
type: ExplorerType.tx,
data: '0xc371ef1ef7f36da374c9d1dbbf124bc0fc137245377d6acbf0d392addb6620dc',
expected: 'https://gnosisscan.io/tx/0xc371ef1ef7f36da374c9d1dbbf124bc0fc137245377d6acbf0d392addb6620dc',
},
{
chainId: ChainId.gnosis,
type: ExplorerType.address,
data: '0x157253E7012bf08b24dDA7Fc16229d14d9f9833D',
expected: 'https://gnosisscan.io/address/0x157253E7012bf08b24dDA7Fc16229d14d9f9833D',
},
{
chainId: ChainId.gnosis,
type: ExplorerType.token,
data: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d',
expected: 'https://gnosisscan.io/token/0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d',
},
{
chainId: ChainId.polygon,
type: ExplorerType.tx,
Expand Down
2 changes: 2 additions & 0 deletions packages/common/src/networks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export function toChainId(networkId: string) {
export enum ChainId {
mainnet = 1,
optimism = 10,
gnosis = 100,
polygon = 137,
zksync = 324,
metis = 1088,
Expand All @@ -76,6 +77,7 @@ export enum ChainId {
export enum NetworkId {
mainnet = 'mainnet',
optimism = 'optimism',
gnosis = 'gnosis',
polygon = 'polygon',
zksync = 'zksync',
metis = 'metis',
Expand Down

0 comments on commit e01cd7e

Please sign in to comment.