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

Id 933 #3473

Merged
merged 6 commits into from
Dec 28, 2024
Merged

Id 933 #3473

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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"ng-inline-svg-2": "^15.0.1",
"ngx-cookie-service": "^16.0.0",
"querystring-es3": "^0.2.1",
"rubic-sdk": "5.49.8",
"rubic-sdk": "5.49.9",
"rxjs": "7.8.1",
"ts-cacheable": "^1.0.5",
"viem": "^1.21.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ export const blockchainsToFetch: BlockchainName[] = [
BLOCKCHAIN_NAME.FLARE,
BLOCKCHAIN_NAME.TON,
BLOCKCHAIN_NAME.SCROLL,
BLOCKCHAIN_NAME.GRAVITY
BLOCKCHAIN_NAME.GRAVITY,
BLOCKCHAIN_NAME.SONIC
];

export const blockchainsWithOnePage: BlockchainName[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1057,5 +1057,8 @@ export const defaultTokens: Record<BlockchainName, Token[]> = {
],
[BLOCKCHAIN_NAME.GRAVITY]: [
{ ...nativeTokensList[BLOCKCHAIN_NAME.GRAVITY], ...defaultTokenParams } as Token
],
[BLOCKCHAIN_NAME.SONIC]: [
{ ...nativeTokensList[BLOCKCHAIN_NAME.SONIC], ...defaultTokenParams } as Token
]
};
20 changes: 18 additions & 2 deletions src/app/core/services/gas-service/gas.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ const supportedBlockchains = [
BLOCKCHAIN_NAME.ROOTSTOCK,
BLOCKCHAIN_NAME.SEI,
BLOCKCHAIN_NAME.BITLAYER,
BLOCKCHAIN_NAME.GRAVITY
BLOCKCHAIN_NAME.GRAVITY,
BLOCKCHAIN_NAME.SONIC
] as const;

type SupportedBlockchain = (typeof supportedBlockchains)[number];
Expand Down Expand Up @@ -85,7 +86,8 @@ export class GasService {
[BLOCKCHAIN_NAME.ROOTSTOCK]: this.fetchRootstockGas.bind(this),
[BLOCKCHAIN_NAME.SEI]: this.fetchSeiGas.bind(this),
[BLOCKCHAIN_NAME.BITLAYER]: this.fetchBitlayerGas.bind(this),
[BLOCKCHAIN_NAME.GRAVITY]: this.fetchGravityGas.bind(this)
[BLOCKCHAIN_NAME.GRAVITY]: this.fetchGravityGas.bind(this),
[BLOCKCHAIN_NAME.SONIC]: this.fetchSonicGas.bind(this)
};

private static isSupportedBlockchain(
Expand Down Expand Up @@ -646,4 +648,18 @@ export class GasService {
})
);
}

@Cacheable({
maxAge: GasService.requestInterval
})
private fetchSonicGas(): Observable<GasPrice | null> {
const blockchainAdapter = Injector.web3PublicService.getWeb3Public(BLOCKCHAIN_NAME.SONIC);
return from(blockchainAdapter.getGasPrice()).pipe(
map((gasPriceInWei: string) => {
return {
gasPrice: new BigNumber(gasPriceInWei).dividedBy(10 ** 18).toFixed()
};
})
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -222,5 +222,9 @@ export const defaultBlockchainData: Partial<Record<EvmBlockchainName, DefaultBlo
[BLOCKCHAIN_NAME.GRAVITY]: {
name: 'Gravity',
rpc: 'https://rpc.gravity.xyz'
},
[BLOCKCHAIN_NAME.SONIC]: {
name: 'Sonic',
rpc: 'https://rpc.soniclabs.com'
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,11 @@ export const blockchainsList: RankedBlockchain[] = [
rank: 0.5,
tags: ['ETH', BlockchainTags.POPULAR, BlockchainTags.EVM, BlockchainTags.LAYER_2]
},

{
name: BLOCKCHAIN_NAME.SONIC,
rank: 0.5,
tags: ['ETH', BlockchainTags.EVM, BlockchainTags.POPULAR, BlockchainTags.NEW]
},
{
name: BLOCKCHAIN_NAME.GRAVITY,
rank: 0.5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ export const blockchainImageKey: Record<BlockchainName, string> = {
[BLOCKCHAIN_NAME.SEI]: 'sei',
[BLOCKCHAIN_NAME.CORE]: 'core',
[BLOCKCHAIN_NAME.BAHAMUT]: 'bahamut',
[BLOCKCHAIN_NAME.GRAVITY]: 'gravity'
[BLOCKCHAIN_NAME.GRAVITY]: 'gravity',
[BLOCKCHAIN_NAME.SONIC]: 'sonic'
};
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ const onChainBlacklist: Record<SupportedOnChainNetworks, OnChainTradeType[]> = {
[BLOCKCHAIN_NAME.BAHAMUT]: [],
[BLOCKCHAIN_NAME.BITLAYER]: [],
[BLOCKCHAIN_NAME.GRAVITY]: [],
[BLOCKCHAIN_NAME.UNICHAIN_SEPOLIA_TESTNET]: []
[BLOCKCHAIN_NAME.UNICHAIN_SEPOLIA_TESTNET]: [],
[BLOCKCHAIN_NAME.SONIC]: []
};

export const onChainBlacklistProviders: OnChainTradeType[] = [
Expand Down
3 changes: 2 additions & 1 deletion src/app/shared/constants/blockchain/blockchain-color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,6 @@ export const blockchainColor: Record<BlockchainName, string> = {
[BLOCKCHAIN_NAME.BAHAMUT]: '#FFFFFF',
[BLOCKCHAIN_NAME.BITLAYER]: '#E36E1B',
[BLOCKCHAIN_NAME.GRAVITY]: '#FFFFFF',
[BLOCKCHAIN_NAME.UNICHAIN_SEPOLIA_TESTNET]: '#FFFFFF'
[BLOCKCHAIN_NAME.UNICHAIN_SEPOLIA_TESTNET]: '#FFFFFF',
[BLOCKCHAIN_NAME.SONIC]: '#131315'
};
3 changes: 2 additions & 1 deletion src/app/shared/constants/blockchain/blockchain-icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,6 @@ export const blockchainIcon: Record<BlockchainName, string> = {
[BLOCKCHAIN_NAME.BAHAMUT]: `${basePath}bahamut.svg`,
[BLOCKCHAIN_NAME.BITLAYER]: `${basePath}bitlayer.svg`,
[BLOCKCHAIN_NAME.GRAVITY]: `${basePath}gravity.svg`,
[BLOCKCHAIN_NAME.UNICHAIN_SEPOLIA_TESTNET]: `${basePath}unichain-testnet.svg`
[BLOCKCHAIN_NAME.UNICHAIN_SEPOLIA_TESTNET]: `${basePath}unichain-testnet.svg`,
[BLOCKCHAIN_NAME.SONIC]: `${basePath}sonic.svg`
};
3 changes: 2 additions & 1 deletion src/app/shared/constants/blockchain/blockchain-label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,6 @@ export const blockchainLabel: Record<BlockchainName, string> = {
[BLOCKCHAIN_NAME.BAHAMUT]: 'Bahamut',
[BLOCKCHAIN_NAME.BITLAYER]: 'Bitlayer',
[BLOCKCHAIN_NAME.GRAVITY]: 'Gravity',
[BLOCKCHAIN_NAME.UNICHAIN_SEPOLIA_TESTNET]: 'Unichain'
[BLOCKCHAIN_NAME.UNICHAIN_SEPOLIA_TESTNET]: 'Unichain',
[BLOCKCHAIN_NAME.SONIC]: 'Sonic'
};
8 changes: 8 additions & 0 deletions src/app/shared/constants/blockchain/blockchain-scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1178,5 +1178,13 @@ export const blockchainScanner: Record<BlockchainName, ScannerObject> = {
[ADDRESS_TYPE.TOKEN]: 'token/',
[ADDRESS_TYPE.TRANSACTION]: 'tx/',
[ADDRESS_TYPE.BLOCK]: 'block/'
},
[BLOCKCHAIN_NAME.SONIC]: {
baseUrl: 'https://sonicscan.org/',
nativeCoinUrl: '',
[ADDRESS_TYPE.WALLET]: 'address/',
[ADDRESS_TYPE.TOKEN]: 'token/',
[ADDRESS_TYPE.TRANSACTION]: 'tx/',
[ADDRESS_TYPE.BLOCK]: 'block/'
}
};
3 changes: 2 additions & 1 deletion src/app/shared/constants/blockchain/rpc-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,5 +351,6 @@ export const rpcList: Record<EvmBlockchainName, string[]> &
'https://sepolia.unichain.org',
'https://1301.rpc.thirdweb.com/'
],
[BLOCKCHAIN_NAME.BITCOIN]: ['']
[BLOCKCHAIN_NAME.BITCOIN]: [''],
[BLOCKCHAIN_NAME.SONIC]: ['https://rpc.soniclabs.com', 'https://sonic.drpc.org']
};
3 changes: 2 additions & 1 deletion src/app/shared/models/blockchain/should-calculate-gas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ export const shouldCalculateGas: Record<BlockchainName, boolean> = {
[BLOCKCHAIN_NAME.ROOTSTOCK]: true,
[BLOCKCHAIN_NAME.SEI]: true,
[BLOCKCHAIN_NAME.BITLAYER]: true,
[BLOCKCHAIN_NAME.GRAVITY]: true
[BLOCKCHAIN_NAME.GRAVITY]: true,
[BLOCKCHAIN_NAME.SONIC]: true
};
17 changes: 17 additions & 0 deletions src/assets/images/icons/coins/sonic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17503,10 +17503,10 @@ rpc-websockets@^9.0.2:
bufferutil "^4.0.1"
utf-8-validate "^5.0.2"

[email protected].8:
version "5.49.8"
resolved "https://registry.yarnpkg.com/rubic-sdk/-/rubic-sdk-5.49.8.tgz#9c4f467026216d27caeca712b8cbdb5b00a2c6c2"
integrity sha512-dN9ZrUnL9NT2zOSz3GDQmPmxkANQ3q3SXxTRWs3/5Uq3F11N7REBkXR/hAYe/fGqztw+UbvnmxFGKHPQk2NJ/Q==
[email protected].9:
version "5.49.9"
resolved "https://registry.yarnpkg.com/rubic-sdk/-/rubic-sdk-5.49.9.tgz#8d6f271dc164e416cd449f53b8b8424d1ba7efc3"
integrity sha512-d0ZfMXCHJuvnsLivnrwj6ixiFuxSxrmSTBPda1YsLPBYG/PAVx8go9E/TFy9L+8SOcoLPlH0LwDHVKdO1T1U1Q==
dependencies:
"@1inch/limit-order-protocol-utils" "3.0.1"
"@arbitrum/sdk" "^3.1.3"
Expand Down
Loading