Change the adapter network
On the Aptos (and Movement M1) adapters there is an option to change the network adapter-wise. To achieve this, you can either specify the network while calling the connect function on the adapter, or call a method changeNetwork()
.
The first method requires you to simply pass the networkInfo object, into the connect()
function, like so.
note
Keep in mind, the networkInfo object, must conform with the type NetworkInfo
from @aptos-labs/wallet-standard
, which looks like this.
interface NetworkInfo {
name: Network;
chainId: number;
url?: string;
}
Where Network
is also a type from the same library, specifying the network type.
await adapter.features['aptos:connect'].connect(SILENT_CONNECT, networkInfo)
The second method, allow you to change the network even after the adapter is already instantiated, like so.
await adapter.features['aptos:changeNetwork']!.changeNetwork(networkInfo);