Skip to content

Commit

Permalink
fix: wrong case checking for deprecated chain id on solanaDevnet (#3290)
Browse files Browse the repository at this point in the history
  • Loading branch information
zoruka authored Nov 20, 2024
1 parent 8236837 commit ac1845e
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 4 deletions.
24 changes: 24 additions & 0 deletions .changeset/lovely-cougars-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
'@reown/appkit': patch
'@apps/demo': patch
'@apps/gallery': patch
'@apps/laboratory': patch
'@reown/appkit-adapter-ethers': patch
'@reown/appkit-adapter-ethers5': patch
'@reown/appkit-adapter-polkadot': patch
'@reown/appkit-adapter-solana': patch
'@reown/appkit-adapter-wagmi': patch
'@reown/appkit-utils': patch
'@reown/appkit-cdn': patch
'@reown/appkit-common': patch
'@reown/appkit-core': patch
'@reown/appkit-experimental': patch
'@reown/appkit-polyfills': patch
'@reown/appkit-scaffold-ui': patch
'@reown/appkit-siwe': patch
'@reown/appkit-siwx': patch
'@reown/appkit-ui': patch
'@reown/appkit-wallet': patch
---

Fix for wrong checking on Solana devnet id
27 changes: 24 additions & 3 deletions packages/appkit/src/tests/utils/HelpersUtil.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,23 @@ const mockSolanaNetwork = {
}
} as const

const mockSolanaDevnetNetwork = {
id: 'EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
chainNamespace: ConstantsUtil.CHAIN.SOLANA,
caipNetworkId: 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
name: 'Solana',
nativeCurrency: {
name: 'Solana',
decimals: 9,
symbol: 'SOL'
},
rpcUrls: {
default: {
http: ['https://api.mainnet-beta.solana.com']
}
}
} as const

describe('WcHelpersUtil', () => {
describe('getMethodsByChainNamespace', () => {
test('returns correct methods for solana', () => {
Expand Down Expand Up @@ -100,7 +117,8 @@ describe('WcHelpersUtil', () => {
const caipNetworks: CaipNetwork[] = [
mockEthereumNetwork,
mockPolygonNetwork,
mockSolanaNetwork
mockSolanaNetwork,
mockSolanaDevnetNetwork
]

const namespaces = WcHelpersUtil.createNamespaces(caipNetworks)
Expand Down Expand Up @@ -141,10 +159,13 @@ describe('WcHelpersUtil', () => {
events: ['accountsChanged', 'chainChanged'],
chains: [
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
'solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ'
'solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ',
'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
'solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K'
],
rpcMap: {
'5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp': 'https://api.mainnet-beta.solana.com'
'5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp': 'https://api.mainnet-beta.solana.com',
EtWTRABZaYq6iMfeYKouRu166VU2xqa1: 'https://api.mainnet-beta.solana.com'
}
}
})
Expand Down
2 changes: 1 addition & 1 deletion packages/appkit/src/utils/HelpersUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const WcHelpersUtil = {
case solana.caipNetworkId:
namespace.chains.push(solana.deprecatedCaipNetworkId)
break
case solanaDevnet.deprecatedCaipNetworkId:
case solanaDevnet.caipNetworkId:
namespace.chains.push(solanaDevnet.deprecatedCaipNetworkId)
break
default:
Expand Down

0 comments on commit ac1845e

Please sign in to comment.