From e01cd7ed65ca641a13a8b29c59d04f54dbc4752e Mon Sep 17 00:00:00 2001 From: Jeff Huang Date: Wed, 22 Nov 2023 11:25:59 +0800 Subject: [PATCH] feat: common package add Gnosis Chain information --- .changeset/smart-tools-provide.md | 5 +++++ packages/common/src/networks/data.json | 23 ++++++++++++++++++++++ packages/common/src/networks/index.test.ts | 20 +++++++++++++++++++ packages/common/src/networks/index.ts | 2 ++ 4 files changed, 50 insertions(+) create mode 100644 .changeset/smart-tools-provide.md diff --git a/.changeset/smart-tools-provide.md b/.changeset/smart-tools-provide.md new file mode 100644 index 00000000..36949d69 --- /dev/null +++ b/.changeset/smart-tools-provide.md @@ -0,0 +1,5 @@ +--- +'@protocolink/common': patch +--- + +add Gnosis Chain information diff --git a/packages/common/src/networks/data.json b/packages/common/src/networks/data.json index 1aefb71f..bd516e84 100644 --- a/packages/common/src/networks/data.json +++ b/packages/common/src/networks/data.json @@ -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, diff --git a/packages/common/src/networks/index.test.ts b/packages/common/src/networks/index.test.ts index 3ff20437..970ea7c7 100644 --- a/packages/common/src/networks/index.test.ts +++ b/packages/common/src/networks/index.test.ts @@ -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 }, @@ -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 }, @@ -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, diff --git a/packages/common/src/networks/index.ts b/packages/common/src/networks/index.ts index 5acdce7a..e2afb672 100644 --- a/packages/common/src/networks/index.ts +++ b/packages/common/src/networks/index.ts @@ -65,6 +65,7 @@ export function toChainId(networkId: string) { export enum ChainId { mainnet = 1, optimism = 10, + gnosis = 100, polygon = 137, zksync = 324, metis = 1088, @@ -76,6 +77,7 @@ export enum ChainId { export enum NetworkId { mainnet = 'mainnet', optimism = 'optimism', + gnosis = 'gnosis', polygon = 'polygon', zksync = 'zksync', metis = 'metis',