Skip to content

Commit

Permalink
fix wc
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbaut committed Dec 2, 2024
1 parent 708504e commit cd8aa6b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ const WalletConnectSessionProposal = ({ onClose, className, sessionProposal }: P
[sessionProposal?.params]
)

console.log('currentNamespace', currentNamespace)
console.log('chains.includes(currentNamespace)', chains.includes(currentNamespace))
console.log('chains', chains)
useEffect(() => {
if (!web3wallet || !sessionProposal) return

Expand All @@ -57,6 +60,8 @@ const WalletConnectSessionProposal = ({ onClose, className, sessionProposal }: P
- Requested: ${chains}
- Current: ${currentNamespace}`
)
} else {
setErrorMessage('')
}
}, [chains, currentNamespace, sessionProposal, web3wallet])

Expand Down
6 changes: 5 additions & 1 deletion packages/ui/src/hooks/useWalletConnectNamespace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ export const useGetWalletConnectNamespace = () => {

client
.getChainSpecData()
.then((data) => setGenesisHash(data.genesisHash))
.then((data) => {
console.log('---> data', data.genesisHash)
setGenesisHash(data.genesisHash)
})
.catch(console.error)
}, [client])

const genesisTruncated = useMemo(() => genesisHash.substring(2, 34), [genesisHash])

const namespace = useMemo(() => `polkadot:${genesisTruncated}`, [genesisTruncated])

console.log('namespace', namespace)
const getAccountsWithNamespace = useCallback(
(accounts: string[]) => {
return accounts.map((address) => `${namespace}:${address}`)
Expand Down

0 comments on commit cd8aa6b

Please sign in to comment.