Switch Network

A web application may request Adena to switch the current network settings to a new one via the SwitchNetwork method. Upon the user's approval, Adena will switch the network to the one requested by the app.

Code

adena.SwitchNetwork(chainId: string)

Params

KeyTypeDescription

network.chainId

string

Chain ID

Response

KeyTypeDescription

code

number

Code (success: 0)

status

string

Returns success or failure

type

string

Response type

message

string

Descriptive message of the result

data

object

Switch Network Result Model

Switch Network Result Model

KeyTypeDescription

chainId

string

Chain ID

Sample Request

await adena.SwitchNetwork('dev-1')

Sample Response

{
    "code": 0,
    "status": "success",
    "type": "SWITCH_NETWORK_SUCCESS",
    "message": "The network has been successfully changed.",
    "data": {
        "chainId": "dev-1"
    }
}

Last updated