Skip to main content

Namespace: wallet

Functions

autoSwitchNetwork

autoSwitchNetwork(callbacks?, force?): Promise<void>

If non-default network is connected and if auto-switch is configured globally or requested by "force" parameter, switch wallet to the default network

Parameters

NameTypeDefault valueDescription
callbacks?IGenericTransactionCallbacksundefined-
forcebooleanfalseTrue to force switching to the default network

Returns

Promise<void>

Throws

Unsupported network error if the user is on incorrect network, and neither global settings nor the parameter requires the switch

Defined in

wallet/index.ts:160


connect

connect(): Promise<string>

Connects user's web3 wallet

Returns

Promise<string>

address of the connected account

Defined in

wallet/index.ts:67


getCurrentWalletAddress

getCurrentWalletAddress(): Promise<string>

Returns connected wallet account (Attempts to connect to the wallet if not connected)

Returns

Promise<string>

Account address

Defined in

wallet/index.ts:319


getNetwork

getNetwork(): Promise<Network>

Get parameters of the network that the wallet is connected to

Returns

Promise<Network>

Network info of where the wallet switched to

Throws

Error if no wallet is installed or if the user rejected adding or switching to the network

Defined in

wallet/index.ts:182


getSupportedNetworks

getSupportedNetworks(): Object

Get list of networks supported by the configuration

Returns

Object

List and parameters of all configured networks

Defined in

wallet/index.ts:206


getWeb3Provider

getWeb3Provider(): Promise<BrowserProvider>

Returns

Promise<BrowserProvider>

Defined in

wallet/index.ts:285


isCorrectNetworkConnected

isCorrectNetworkConnected(): Promise<boolean>

Checks, based on chainId comparison, if the wallet is connected to the default network

Returns

Promise<boolean>

true/false if the wallet is connected to the default network

Defined in

wallet/index.ts:215


isListening

isListening(): boolean

Check if the app is listening to account or network change

Returns

boolean

true if at least one of the listeners is active

Defined in

wallet/index.ts:267


isSupportedNetworkConnected

isSupportedNetworkConnected(): Promise<boolean>

Checks, based on chainId comparison, if the wallet is connected to one of the networks supported by the configuration

Returns

Promise<boolean>

true/false

Defined in

wallet/index.ts:225


isWeb3WalletConnected

isWeb3WalletConnected(): Promise<boolean>

Check if a web3 wallet is connected

Returns

Promise<boolean>

boolean

Throws

If this is not run in a browser

Defined in

wallet/index.ts:308


isWeb3WalletInstalled

isWeb3WalletInstalled(): boolean

Check if a web3 wallet is installed

Returns

boolean

boolean

Throws

If this is not run in a browser

Defined in

wallet/index.ts:295


startListening

startListening(onChangeWalletCallback): void

Start listening to change in wallet connection and run the callback function if the account changes

Parameters

NameTypeDescription
onChangeWalletCallback(walletAddress: string) => voidFunction to be called if the user changes a connected account

Returns

void

Defined in

wallet/index.ts:239


startListeningNetwork

startListeningNetwork(onChangeNetworkCallback): void

Listen to whether the wallet switches to another network and run the provided callback if yes

Parameters

NameTypeDescription
onChangeNetworkCallback(networkId: bigint) => voidFunction to be called when the wallet switches to another network

Returns

void

Defined in

wallet/index.ts:253


stopListening

stopListening(): void

Stop listening to wallet account changes

Returns

void

Defined in

wallet/index.ts:274


stopListeningNetwork

stopListeningNetwork(): void

Stop listening to network switch

Returns

void

Defined in

wallet/index.ts:281


switchNetwork

switchNetwork(name): Promise<DefaultNetwork>

Asks user's web3 wallet to switch to a selected network

Parameters

NameTypeDescription
nameDefaultNetworkName of one of the configured networks ('arbitrum', 'development', or 'goerli' in standard SDK installation)

Returns

Promise<DefaultNetwork>

Name of the network that the wallet was switched to.

Throws

Error if no wallet is present or the user rejected adding or switching to the network

Defined in

wallet/index.ts:97