switchWalletNetwork

Allows NeoLine applications ('dapps') to request that the wallet switches its active Neo network.

Input Arguments

ParameterDescription

Switch the chainId of the network

Chain IDs Type

These are the IDs of the Neo chain supported by NeoLine.

chainIdDescription

1

ChainId 1 is the Neo2 MainNet

2

ChainId 2 is the Neo2 TestNet

3

ChainId 3 is the N3 MainNet

6

ChainId 6 is the N3 TestNet (Currently only N3 TestNet)

0

ChainId 0 is the N3 Private Network

Success Response

Null

Error Response

ParameterDescription

type: string

The type of error which has occured

description: string

A description of the error which has occured

data: string

Any raw data associated with the error

Example

Request

neoline.switchWalletNetwork({
  chainId: 3
})
.then(() => {})
.catch((error) => {
  const {type, description, data} = error;
  switch(type) {
    case UNKNOWN_ERROR:
        console.log(description);
        break;
    default:
        // Not an expected error object.  Just write the error to the console.
        console.error(error);
        break;
  }
});

Response

null

最后更新于