diff --git a/public/images/chains/146.png b/public/images/chains/146.png new file mode 100644 index 00000000..9a68d2e9 Binary files /dev/null and b/public/images/chains/146.png differ diff --git a/public/images/networks/sonic.svg b/public/images/networks/sonic.svg new file mode 100644 index 00000000..07e5f05b --- /dev/null +++ b/public/images/networks/sonic.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/config/chains.ts b/src/config/chains.ts index 21400958..c4bd221e 100644 --- a/src/config/chains.ts +++ b/src/config/chains.ts @@ -16,6 +16,9 @@ const chains = networks.reduce((result, { shortName, chainId }) => { return result }, {}) +// Keep Sonic available until protocol-kit ships the shortName mapping in this app's pinned version. +chains.sonic = '146' + const ChainLogos = { [chains.eth]: '/images/networks/mainnet.svg', [chains.bnb]: '/images/networks/bnb.svg', @@ -29,6 +32,7 @@ const ChainLogos = { [chains.celo]: '/images/networks/celo.svg', [chains.arb1]: '/images/networks/arb.svg', [chains.avax]: '/images/networks/avax.svg', + [chains.sonic]: '/images/networks/sonic.svg', [chains.sep]: '/images/networks/sep.png', } diff --git a/src/config/supportedChains.ts b/src/config/supportedChains.ts index 0c0f8770..e4fb4961 100644 --- a/src/config/supportedChains.ts +++ b/src/config/supportedChains.ts @@ -196,6 +196,75 @@ const SUPPORTED_CHAINS = [ backgroundColor: '#8248E5', }, }, + { + chainId: '146', + chainName: 'Sonic', + description: '', + chainLogoUri: null, + l2: true, + isTestnet: false, + nativeCurrency: { + name: 'Sonic', + symbol: 'S', + decimals: 18, + logoUri: '/images/chains/146.png', + }, + transactionService: 'https://safe-transaction-sonic.safe.global', + blockExplorerUriTemplate: { + address: 'https://sonicscan.org/address/{{address}}', + txHash: 'https://sonicscan.org/tx/{{txHash}}', + api: 'https://api.sonicscan.org/api?module={{module}}&action={{action}}&address={{address}}&apiKey={{apiKey}}', + }, + disabledWallets: [ + 'keystone', + 'NONE', + 'opera', + 'operaTouch', + 'safeMobile', + 'socialSigner', + 'tally', + 'trezor', + 'trust', + 'walletConnect', + ], + ensRegistryAddress: null, + features: [ + 'CONTRACT_INTERACTION', + 'COUNTERFACTUAL', + 'DEFAULT_TOKENLIST', + 'EIP1271', + 'EIP1559', + 'ERC721', + 'MOONPAY_MOBILE', + 'NATIVE_WALLETCONNECT', + 'PUSH_NOTIFICATIONS', + 'RECOVERY', + 'RISK_MITIGATION', + 'SAFE_APPS', + 'SAFE_TX_GAS_OPTIONAL', + 'SOCIAL_LOGIN', + 'SPENDING_LIMIT', + 'TX_SIMULATION', + ], + gasPrice: [], + publicRpcUri: { + authentication: 'NO_AUTHENTICATION', + value: 'https://rpc.soniclabs.com', + }, + rpcUri: { + authentication: 'NO_AUTHENTICATION', + value: 'https://rpc.soniclabs.com', + }, + safeAppsRpcUri: { + authentication: 'NO_AUTHENTICATION', + value: 'https://rpc.soniclabs.com', + }, + shortName: 'sonic', + theme: { + textColor: '#ffffff', + backgroundColor: '#fe9a4c', + }, + }, { chainId: '1101', chainName: 'Polygon zkEVM', diff --git a/src/hooks/__tests__/useChainId.test.ts b/src/hooks/__tests__/useChainId.test.ts index 521e8714..7e810056 100644 --- a/src/hooks/__tests__/useChainId.test.ts +++ b/src/hooks/__tests__/useChainId.test.ts @@ -86,6 +86,15 @@ describe('useChainId hook', () => { expect(result.current).toBe('100') }) + it('should return the chainId based on the Sonic chain query', () => { + ;(useParams as any).mockImplementation(() => ({ + chain: 'sonic', + })) + + const { result } = renderHook(() => useChainId()) + expect(result.current).toBe('146') + }) + it('should return the chainId from the safe address', () => { ;(useParams as any).mockImplementation(() => ({ safe: 'matic:0x0000000000000000000000000000000000000000',