hotfix for wallet3inbox connection (#469)
This commit is contained in:
parent
43d41d40b4
commit
e362091b17
@ -39,8 +39,6 @@ export class SmartAccountLib {
|
|||||||
throw new Error('A Pimlico API Key is required')
|
throw new Error('A Pimlico API Key is required')
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('investigate 2', chain, privateKey, sponsored)
|
|
||||||
|
|
||||||
this.chain = chain
|
this.chain = chain
|
||||||
this.sponsored = sponsored
|
this.sponsored = sponsored
|
||||||
this.#signerPrivateKey = privateKey
|
this.#signerPrivateKey = privateKey
|
||||||
|
@ -179,7 +179,7 @@ export function styledToast(message: string, type: string) {
|
|||||||
style: {
|
style: {
|
||||||
borderRadius: '10px',
|
borderRadius: '10px',
|
||||||
background: '#333',
|
background: '#333',
|
||||||
color: '#fff'
|
color: '#fff',
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,6 @@ export const USDC_FAUCET_URL = 'https://faucet.circle.com/'
|
|||||||
export const VITALIK_ADDRESS = '0xd8da6bf26964af9d7eed9e03e53415d37aa96045' as Hex
|
export const VITALIK_ADDRESS = '0xd8da6bf26964af9d7eed9e03e53415d37aa96045' as Hex
|
||||||
|
|
||||||
export const publicRPCUrl = ({ chain }: UrlConfig) => {
|
export const publicRPCUrl = ({ chain }: UrlConfig) => {
|
||||||
console.log("investigate", chain)
|
|
||||||
return RPC_URLS[chain?.name]
|
return RPC_URLS[chain?.name]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,41 +242,47 @@ export default function SessionProposalModal() {
|
|||||||
const onApprove = useCallback(async () => {
|
const onApprove = useCallback(async () => {
|
||||||
if (proposal) {
|
if (proposal) {
|
||||||
setIsLoadingApprove(true)
|
setIsLoadingApprove(true)
|
||||||
|
|
||||||
|
try {
|
||||||
// get keys of namespaces
|
// get keys of namespaces
|
||||||
const namespaceKeys = Object.keys(namespaces)
|
const namespaceKeys = Object.keys(namespaces)
|
||||||
const [nameSpaceKey] = namespaceKeys
|
const [nameSpaceKey] = namespaceKeys
|
||||||
|
|
||||||
// get chain ids from namespaces
|
// get chain ids from namespaces
|
||||||
const [chainIds] = namespaceKeys.map(key => namespaces[key].chains)
|
const [chainIds] = namespaceKeys.map(key => namespaces[key].chains)
|
||||||
|
|
||||||
if (chainIds) {
|
if (chainIds) {
|
||||||
const allowedChainIds = chainIds.filter(id => {
|
const allowedChainIds = chainIds.filter(id => {
|
||||||
const chainId = id.replace(`${nameSpaceKey}:`, '')
|
const chainId = id.replace(`${nameSpaceKey}:`, '')
|
||||||
return allowedChains.map(chain => chain.id.toString()).includes(chainId)
|
return allowedChains.map(chain => chain.id.toString()).includes(chainId)
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log('allowedChainIds', allowedChainIds)
|
console.log('allowedChainIds', allowedChainIds)
|
||||||
|
|
||||||
const chainIdParsed = allowedChainIds[0].replace(`${nameSpaceKey}:`, '')
|
if (allowedChainIds.length) {
|
||||||
const signerAddress = namespaces[nameSpaceKey].accounts[0].split(':')[2]
|
const chainIdParsed = allowedChainIds[0].replace(`${nameSpaceKey}:`, '')
|
||||||
const wallet = eip155Wallets[signerAddress]
|
|
||||||
const chain = allowedChains.find(chain => chain.id.toString() === chainIdParsed)!
|
|
||||||
|
|
||||||
const smartAccountClient = new SmartAccountLib({
|
|
||||||
privateKey: wallet.getPrivateKey() as Hex,
|
|
||||||
chain: allowedChains.find(chain => chain.id.toString() === chainIdParsed)!,
|
|
||||||
sponsored: smartAccountSponsorshipEnabled,
|
|
||||||
})
|
|
||||||
|
|
||||||
const smartAccountAddress = await smartAccountClient.getAccount()
|
if (namespaces[nameSpaceKey].accounts) {
|
||||||
if (wallet && smartAccountAddress) {
|
const signerAddress = namespaces[nameSpaceKey].accounts[0].split(':')[2]
|
||||||
namespaces.eip155.accounts = [...namespaces.eip155.accounts, `${nameSpaceKey}:${chain.id}:${smartAccountAddress.address}`]
|
const wallet = eip155Wallets[signerAddress]
|
||||||
|
const chain = allowedChains.find(chain => chain.id.toString() === chainIdParsed)!
|
||||||
|
|
||||||
|
const smartAccountClient = new SmartAccountLib({
|
||||||
|
privateKey: wallet.getPrivateKey() as Hex,
|
||||||
|
chain: allowedChains.find(chain => chain.id.toString() === chainIdParsed)!,
|
||||||
|
sponsored: smartAccountSponsorshipEnabled,
|
||||||
|
})
|
||||||
|
|
||||||
|
const smartAccountAddress = await smartAccountClient.getAccount()
|
||||||
|
if (wallet && smartAccountAddress) {
|
||||||
|
namespaces.eip155.accounts = [...namespaces.eip155.accounts, `${nameSpaceKey}:${chain.id}:${smartAccountAddress.address}`]
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('approving namespaces:', namespaces.eip155.accounts)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('approving namespaces:', namespaces.eip155.accounts)
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await web3wallet.approveSession({
|
await web3wallet.approveSession({
|
||||||
id: proposal.id,
|
id: proposal.id,
|
||||||
namespaces
|
namespaces
|
||||||
|
Loading…
Reference in New Issue
Block a user