Skip to content
Merged
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
Binary file added public/images/chains/146.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions public/images/networks/sonic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/config/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const chains = networks.reduce<Chains>((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',
Expand All @@ -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',
}

Expand Down
69 changes: 69 additions & 0 deletions src/config/supportedChains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
9 changes: 9 additions & 0 deletions src/hooks/__tests__/useChainId.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Loading