Switch Network#
window.okxwallet.svm.changeNetwork({ genesisHash })
Description
Parameters
- genesisHash - string: The genesisHash of the target network.
Return value
- Promise<object>: The user’s current network, containing:
- genesisHash - string: The genesisHash of the user’s current network.
This method prompts the user to confirm whether they want to switch to the network with the specified genesisHash
and returns a confirmation value.
Like any method requiring user confirmation, window.okxwallet.svm.changeNetwork({ genesisHash })
can only be called as a direct result of a user action, such as clicking a button.
OKX Wallet will automatically reject the request in the following cases:
- The genesisHash format is incorrect.
- The network corresponding to the specified genesisHash hasn’t been added to OKX Wallet.
Example
const { genesisHash } = await window.okxwallet.svm.changeNetwork(
{
"genesisHash": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d"
}
)
Default genesisHash#
Below are the genesisHash values of the SVM networks that OKX Wallet supports by default:
Network | genesisHash |
---|---|
SOL | 5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d |
SONIC_TESTNET_VONE | E8nY8PG8PEdzANRsv91C2w28Dbw9w3AhLqRYfn5tNv2C |
SOONTEST_ETH | E41XcTqezgDG8GzWwnPW8Rjewv2o5UUtskPbuwA52Kjr |
ECLIPSE_ETH | EAQLJCV2mh23BsK2P9oYpV5CHVLDNHTxYss3URrNmg3s |
SOON_ETH | E8aYS7Vghmf1sZVSsCse9JdFHzccdE9QdpPF5SVNcGxr |
SONIC_SOL | 9qoRTAHGWBZHYzMJGkt62wBbFRASj6H7CvoNsNyRw2h4 |
SOON_BNB | 8MCzWLHk3FmrdW1gVtZe7NgDefMhYFZfTUmvMANn5r6X |