Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xodex support #5406

Open
wants to merge 4 commits into
base: x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/shared/src/config/networkIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type INetworkShortCode =
| 'onekeyall'
| 'eth'
| 'goerli'
| 'xodex'
| 'arbitrum'
| 'optimism'
| 'avalanche'
Expand Down
84 changes: 84 additions & 0 deletions packages/shared/src/config/presetNetworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,86 @@ const sepolia: IServerNetwork = {
'updatedAt': '2023-05-31T00:29:24.951Z',
};

const xodexTestnet: IServerNetwork = {
'balance2FeeDecimals': 9,
'chainId': '2416',
'code': 'xodex',
'decimals': 18,
'extensions': {
'providerOptions': {
'EIP1559Enabled': true,
'preferMetamask': true,
},
},
'id': 'evm--2416',
'impl': 'evm',
'isTestnet': true,
'logoURI':
'https://i.postimg.cc/XqDnc4g2/XODEX-Avatar-02-2-copy.png',
'name': 'Xodex Testnet',
'shortcode': 'xodex',
'shortname': 'Xodex',
'symbol': 'XODEX',
'feeMeta': {
'code': 'xodex',
'decimals': 9,
'symbol': 'Gwei',
},
'defaultEnabled': false,
'priceConfigs': [],
'explorers': [
{
'address': 'https://explorer.xo-dex.com/address/{address}',
'block': 'https://explorer.xo-dex.com/block/{block}',
'name': 'https://explorer.xo-dex.com/',
'transaction': 'https://explorer.xo-dex.com/tx/{transaction}',
},
],
'status': ENetworkStatus.LISTED,
'createdAt': '2023-05-31T00:29:24.951Z',
'updatedAt': '2023-05-31T00:29:24.951Z',
};

const xodex: IServerNetwork = {
'balance2FeeDecimals': 9,
'chainId': '2415',
'code': 'xodex',
'decimals': 18,
'extensions': {
'providerOptions': {
'EIP1559Enabled': true,
'preferMetamask': true,
},
},
'id': 'evm--2415',
'impl': 'evm',
'isTestnet': false,
'logoURI':
'https://i.postimg.cc/XqDnc4g2/XODEX-Avatar-02-2-copy.png',
'name': 'Xodex',
'shortcode': 'xodex',
'shortname': 'Xodex',
'symbol': 'XODEX',
'feeMeta': {
'code': 'xodex',
'decimals': 9,
'symbol': 'Gwei',
},
'defaultEnabled': false,
'priceConfigs': [],
'explorers': [
{
'address': 'https://explorer.xo-dex.com/address/{address}',
'block': 'https://explorer.xo-dex.com/block/{block}',
'name': 'https://explorer.xo-dex.com/',
'transaction': 'https://explorer.xo-dex.com/tx/{transaction}',
},
],
'status': ENetworkStatus.LISTED,
'createdAt': '2023-05-31T00:29:24.951Z',
'updatedAt': '2023-05-31T00:29:24.951Z',
};

const btc: IServerNetwork = {
'balance2FeeDecimals': 0,
'chainId': '0',
Expand Down Expand Up @@ -2993,6 +3073,8 @@ export const presetNetworksMap = {
// evm
eth,
sepolia,
xodex,
xodexTestnet,
op,
xdai,
ethw,
Expand Down Expand Up @@ -3069,6 +3151,8 @@ export const getPresetNetworks = memoFn((): IServerNetwork[] => [
// evm
eth,
sepolia,
xodex,
xodexTestnet,
op,
xdai,
ethw,
Expand Down
23 changes: 23 additions & 0 deletions packages/shared/types/swap/SwapProvider.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,29 @@ export const swapDefaultSetTokens: Record<
'isNative': false,
},
},
'evm--2415': {
fromToken: {
'networkId': 'evm--2415',
'contractAddress': '',
'name': 'Xodex',
'symbol': 'xodex',
'decimals': 18,
'logoURI':
'https://i.postimg.cc/XqDnc4g2/XODEX-Avatar-02-2-copy.png',

'isNative': true,
},
toToken: {
'networkId': 'evm--2415',
'contractAddress': '0x04068da6c83afcfa0e13ba15a6696662335d5b75',
'name': 'USD Coin',
'symbol': 'USDC',
'decimals': 6,
'logoURI':
'https://uni-test.onekey-asset.com/server-service-onchain/evm--250/tokens/0x04068da6c83afcfa0e13ba15a6696662335d5b75.png',
'isNative': false,
},
},
Comment on lines +271 to +293
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

添加 'evm--2415' 网络的代币交换配置看起来不错!

但是请注意,'toToken'(USD Coin)的 logoURI 当前指向了 'evm--250' 网络的代币图标。为了保持一致性和正确性,请确保使用 'evm--2415' 网络特定的 USD Coin 图标 URL。

建议将 'toToken' 的 logoURI 更新为:

-  'logoURI':
-    'https://uni-test.onekey-asset.com/server-service-onchain/evm--250/tokens/0x04068da6c83afcfa0e13ba15a6696662335d5b75.png',
+  'logoURI':
+    'https://uni-test.onekey-asset.com/server-service-onchain/evm--2415/tokens/0x04068da6c83afcfa0e13ba15a6696662335d5b75.png',
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'evm--2415': {
fromToken: {
'networkId': 'evm--2415',
'contractAddress': '',
'name': 'Xodex',
'symbol': 'xodex',
'decimals': 18,
'logoURI':
'https://i.postimg.cc/XqDnc4g2/XODEX-Avatar-02-2-copy.png',
'isNative': true,
},
toToken: {
'networkId': 'evm--2415',
'contractAddress': '0x04068da6c83afcfa0e13ba15a6696662335d5b75',
'name': 'USD Coin',
'symbol': 'USDC',
'decimals': 6,
'logoURI':
'https://uni-test.onekey-asset.com/server-service-onchain/evm--250/tokens/0x04068da6c83afcfa0e13ba15a6696662335d5b75.png',
'isNative': false,
},
},
'evm--2415': {
fromToken: {
'networkId': 'evm--2415',
'contractAddress': '',
'name': 'Xodex',
'symbol': 'xodex',
'decimals': 18,
'logoURI':
'https://i.postimg.cc/XqDnc4g2/XODEX-Avatar-02-2-copy.png',
'isNative': true,
},
toToken: {
'networkId': 'evm--2415',
'contractAddress': '0x04068da6c83afcfa0e13ba15a6696662335d5b75',
'name': 'USD Coin',
'symbol': 'USDC',
'decimals': 6,
'logoURI':
'https://uni-test.onekey-asset.com/server-service-onchain/evm--2415/tokens/0x04068da6c83afcfa0e13ba15a6696662335d5b75.png',
'isNative': false,
},
},

'evm--324': {
fromToken: {
'networkId': 'evm--324',
Expand Down