Closed florian-bellotti closed 1 year ago
The params is incorrect. It expects chainId
to be one of SN_MAIN
, SN_GOERLI
or SN_GOERLI2
. So your code will change to
getStarknet() // from get-starknet
.getAvailableWallets()
.then((wallets) => {
wallets
.filter((wallet) => wallet.id === 'argentX')[0]
.request({
type: 'wallet_switchStarknetChain',
params: { chainId: 'SN_GOERLI2' },
});
});```
Note: constants.StarknetChainId.TESTNET2 = `0x534e5f474f45524c4932`
Added a better solution. But will be available in next release. With this PR, you can continue using constants.StarknetChainId.TESTNET2
Just wanted to follow up on this, currently I am also having a timed out error when running wallet_switchStarknetChain request.
I am running
import { encodeShortString } from "starknet/dist/utils/shortString";
.request({
type: "wallet_switchStarknetChain",
params: {
chainId: encodeShortString("SN_MAIN"),
},
})
to switch to the mainnet network but seems to be having issues with mainnet only. Any idea why?
I could not succeed to configure the wallet_switchStarknetChain request. I always receive a
Error: Timeout
error.Here is a sample of code i am using. This code is triggered just after the connection to a ArgentX account.
I think that the error is triggered here, but I do not understand why.
requestMessageHandlers.ts