Skip to content

Commit

Permalink
feat: mf-5990 add x1 chain
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleBill committed Jan 29, 2024
1 parent f75f594 commit aa73508
Show file tree
Hide file tree
Showing 14 changed files with 111 additions and 11 deletions.
1 change: 1 addition & 0 deletions packages/plugins/RedPacket/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const base: Plugin.Shared.Definition = {
ChainId.Conflux,
ChainId.Astar,
ChainId.Scroll,
ChainId.X1,
],
},
[NetworkPluginID.PLUGIN_FLOW]: { supportedChainIds: [] },
Expand Down
1 change: 1 addition & 0 deletions packages/plugins/Trader/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const TRADER_WEB3_CONFIG = {
ChainId.Fantom,
ChainId.Astar,
ChainId.Optimism,
ChainId.X1,
],
},
[NetworkPluginID.PLUGIN_FLOW]: { supportedChainIds: [] },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export function getEVMAvailableTraderProviders(networkType?: NetworkType) {
case NetworkType.Conflux:
case NetworkType.Moonbeam:
case NetworkType.CustomNetwork:
case NetworkType.X1:
console.error('To be implement network:', networkType)
return EMPTY_LIST
default:
Expand Down
1 change: 1 addition & 0 deletions packages/plugins/Trader/src/providers/ZeroX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ function getNativeTokenLabel(networkType: NetworkType) {
case NetworkType.Scroll:
case NetworkType.Moonbeam:
case NetworkType.CustomNetwork:
case NetworkType.X1:
return ZRX_NATIVE_TOKEN_ADDRESS
default:
safeUnreachable(networkType)
Expand Down
8 changes: 6 additions & 2 deletions packages/web3-constants/evm/ethereum.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
"Fantom": "0xc119574d5fb333f5ac018658d4d8b5035e16bf39",
"Aurora": "0xC119574D5Fb333F5AC018658D4d8b5035E16bf39",
"Astar": "0xf5056B96ab242C566002852d0b98ce0BcDf1af51",
"Scroll": "0xbC7d98985966f56A66B0cB5F23d865676dc2ac84"
"Scroll": "0xbC7d98985966f56A66B0cB5F23d865676dc2ac84",
"X1": "0x8A42F70047a99298822dD1dbA34b454fc49913F2",
"X1_Testnet": "0x8A42F70047a99298822dD1dbA34b454fc49913F2"
},
"MULTICALL_ADDRESS": {
"Mainnet": "0x1F98415757620B543A52E61c46B32eB19261F984",
Expand All @@ -44,7 +46,9 @@
"Aurora": "0x6cc1b1058F9153358278C35E0b2D382f1585854B",
"Conflux": "0x19f179d7e0d7d9f9d5386afff64271d98a91615b",
"Astar": "0x1410304B91a280ad083196B0B50e9d8df749d860",
"Scroll": "0x20Ee232E34B87061fE3ba0DB738A3531A3e915BF"
"Scroll": "0x20Ee232E34B87061fE3ba0DB738A3531A3e915BF",
"X1": "0xF8935Df67cAB7BfcA9532D1Ac2088C5c39b995b5",
"X1_Testnet": "0xF8935Df67cAB7BfcA9532D1Ac2088C5c39b995b5"
},
"ENS_REGISTRAR_ADDRESS": {
"Mainnet": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
Expand Down
8 changes: 6 additions & 2 deletions packages/web3-constants/evm/nft-red-packet.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"Aurora_Testnet": "0x97369fEE7db34E0BfE47861f2ec44b4378d13eB4",
"Conflux": "0x5b966f3a32db9c180843bcb40267a66b73e4f022",
"Astar": "0xc3e62b2CC70439C32a381Bfc056aCEd1d7162cef",
"Scroll": "0x727F8030964CCEC6B0E344399c8d8E2B4C837351"
"Scroll": "0x727F8030964CCEC6B0E344399c8d8E2B4C837351",
"X1": "0xd81c16d71432d7df04575ffe9fed76f837fea0cc",
"X1_Testnet": "0xd81c16d71432d7df04575ffe9fed76f837fea0cc"
},
"NFT_RED_PACKET_ADDRESS_BLOCK_HEIGHT": {
"Mainnet": 13229711,
Expand Down Expand Up @@ -41,6 +43,8 @@
"Aurora_Testnet": 0,
"Conflux": 0,
"Astar": 0,
"Scroll": 96705
"Scroll": 96705,
"X1": 0,
"X1_Testnet": 0
}
}
8 changes: 6 additions & 2 deletions packages/web3-constants/evm/red-packet.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
"Aurora_Testnet": "0xdB93cCd481012bB5D1E2c8d0aF7C5f2940c00fdC",
"Conflux": "0x96c7d011cdfd467f551605f0f5fce279f86f4186",
"Astar": "0x2cF46Db820e279c5fBF778367D49d9C931D54524",
"Scroll": "0x16f61cb37169523635B6761f3C946892fb3c18fB"
"Scroll": "0x16f61cb37169523635B6761f3C946892fb3c18fB",
"X1": "0x977baB5f7e2cEd0C91fDA890Ed1DBDfD3Ee9AE81",
"X1_Testnet": "0x977baB5f7e2cEd0C91fDA890Ed1DBDfD3Ee9AE81"
},
"HAPPY_RED_PACKET_ADDRESS_V4_BLOCK_HEIGHT": {
"Mainnet": 12939427,
Expand Down Expand Up @@ -64,6 +66,8 @@
"Aurora_Testnet": 77918765,
"Conflux": 37670572,
"Astar": 910985,
"Scroll": 96705
"Scroll": 96705,
"X1": 0,
"X1_Testnet": 0
}
}
12 changes: 9 additions & 3 deletions packages/web3-constants/evm/rpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@
"Aurora_Testnet": ["https://testnet.aurora.dev"],
"Conflux": ["https://evm.confluxrpc.com"],
"Astar": ["https://astar.api.onfinality.io/public"],
"Scroll": ["https://rpc.scroll.io"]
"Scroll": ["https://rpc.scroll.io"],
"X1": ["https://rpc.x1.tech"],
"X1_Testnet": ["https://testrpc.x1.tech"]
},
"RPC_URLS_OFFICIAL": {
"Mainnet": ["https://mainnet.infura.io/v3/d65858b010d249419cf8687eca12b094"],
Expand Down Expand Up @@ -98,7 +100,9 @@
"Aurora_Testnet": ["https://testnet.aurora.dev/"],
"Conflux": ["https://evm.confluxrpc.com"],
"Astar": ["https://rpc.astar.network:8545"],
"Scroll": ["https://rpc.scroll.io"]
"Scroll": ["https://rpc.scroll.io"],
"X1": ["https://rpc.x1.tech"],
"X1_Testnet": ["https://testrpc.x1.tech"]
},
"RPC_WEIGHTS": {
"Mainnet": [0, 1, 2, 3, 4],
Expand Down Expand Up @@ -126,6 +130,8 @@
"Aurora_Testnet": [0, 0, 0, 0, 0],
"Conflux": [0, 0, 0, 0, 0],
"Astar": [0, 0, 0, 0, 0],
"Scroll": [0, 0, 0, 0, 0]
"Scroll": [0, 0, 0, 0, 0],
"X1": [0, 0, 0, 0, 0],
"X1_Testnet": [0, 0, 0, 0, 0]
}
}
4 changes: 3 additions & 1 deletion packages/web3-constants/evm/token-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
"Aurora_Testnet": [],
"Conflux": ["https://tokens.r2d2.to/latest/1030/tokens.json"],
"Astar": ["https://tokens.r2d2.to/latest/592/tokens.json"],
"Scroll": ["https://tokens.r2d2.to/latest/534352/tokens.json"]
"Scroll": ["https://tokens.r2d2.to/latest/534352/tokens.json"],
"X1": [],
"X1_Testnet": []
}
}
4 changes: 3 additions & 1 deletion packages/web3-constants/evm/token.json
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,9 @@
"Aurora_Testnet": "0x0000000000000000000000000000000000000000",
"Conflux": "0x0000000000000000000000000000000000000000",
"Astar": "0x0000000000000000000000000000000000000000",
"Scroll": "0x0000000000000000000000000000000000000000"
"Scroll": "0x0000000000000000000000000000000000000000",
"X1": "0x0000000000000000000000000000000000000000",
"X1_Testnet": "0x0000000000000000000000000000000000000000"
},
"WETH_ADDRESS": {
"Mainnet": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
Expand Down
Binary file added packages/web3-shared/evm/src/assets/x1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions packages/web3-shared/evm/src/constants/chains.json
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,54 @@
}
]
},
{
"chainId": 200,
"type": "X1",
"name": "X1",
"fullName": "X1",
"network": "x1",
"shortName": "x1",
"features": [],
"nativeCurrency": {
"chainId": 200,
"name": "OKB",
"symbol": "OKB",
"decimals": 18,
"logoURL": "https://static.okx.com/cdn/wallet/logo/okb.png?x-oss-process=image/format,webp/ignore-error,1"
},
"infoURL": "https://www.okx.com/web3",
"explorers": [
{
"name": "X1 explorer",
"url": "https://www.okx.com/explorer/x1",
"standard": "EIP3091"
}
]
},
{
"chainId": 195,
"type": "X1",
"name": "X1 testnet",
"fullName": "X1 testnet",
"network": "x1_testnet",
"shortName": "x1",
"features": [],
"nativeCurrency": {
"chainId": 195,
"name": "OKB",
"symbol": "OKB",
"decimals": 18,
"logoURL": "https://static.okx.com/cdn/wallet/logo/okb.png?x-oss-process=image/format,webp/ignore-error,1"
},
"infoURL": "https://www.okx.com/web3",
"explorers": [
{
"name": "X1 explorer",
"url": "https://www.okx.com/explorer/x1-test",
"standard": "EIP3091"
}
]
},
{
"chainId": 25,
"name": "Cronos",
Expand Down
22 changes: 22 additions & 0 deletions packages/web3-shared/evm/src/constants/descriptors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,28 @@ export const NETWORK_DESCRIPTORS: ReadonlyArray<NetworkDescriptor<ChainId, Netwo
isMainnet: false,
averageBlockDelay: 10,
},
{
ID: `${PLUGIN_ID}_x1`,
networkSupporterPluginID: PLUGIN_ID,
chainId: ChainId.X1,
type: NetworkType.X1,
icon: new URL('../assets/x1.png', import.meta.url).href,
iconColor: 'rgb(255, 255, 255)',
name: 'X1',
isMainnet: true,
averageBlockDelay: 10,
},
{
ID: `${PLUGIN_ID}_x1_testnet`,
networkSupporterPluginID: PLUGIN_ID,
chainId: ChainId.X1_Testnet,
type: NetworkType.X1,
icon: new URL('../assets/x1.png', import.meta.url).href,
iconColor: 'rgb(255, 255, 255)',
name: 'X1_Testnet',
isMainnet: false,
averageBlockDelay: 10,
},
]

export const CHAIN_DESCRIPTORS: ReadonlyArray<ChainDescriptor<ChainId, SchemaType, NetworkType>> = CHAINS.map((x) => {
Expand Down
4 changes: 4 additions & 0 deletions packages/web3-shared/evm/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ export enum ChainId {

Wanchain = 888,

X1 = 200,
X1_Testnet = 195,

/** BitTorrent Chain Mainnet */
BitTorrent = 199,

Expand Down Expand Up @@ -294,6 +297,7 @@ export enum NetworkType {
Astar = 'Astar',
Scroll = 'Scroll',
Moonbeam = 'Moonbeam',
X1 = 'X1',
CustomNetwork = 'CustomNetwork',
}

Expand Down

0 comments on commit aa73508

Please sign in to comment.