useWallet

  • required provider: WalletProvider

  • parameters

    • wallets: AdapterInjection[] (required)

    • enables: string[] (required)

    • autoConnect: boolean

    • localStorageKey: string (default: 'walletId')

    • onError: (error: WalletError, adapter?: Adapter) => void

Properties

NameDescriptionTypeDefault

autoConnect

Connect wallet automatically when refresh dapp site

boolean;

false

wallets

Wallet list to be used

Wallet[];

[]

enables

Blockchain list to be used

string[];

[]

wallet

Selected wallet

Wallet | null;

null

address

Address

string | null;

null

connected

State that wallet is connected

boolean;

false

connecting

State that wallet is connecting

boolean;

false

disconnecting

State that wallet is disconnecting

boolean;

false

selectedBlockChain

Connected blockchain

string | null;

null

isNotInstalled

State that wallet is not installed

boolean

false

provider

Connected provider

unknown

null

selectedChainId

Connected network

string[] | string | null;

null

Methods

NameDescriptionType

selectWallet

Choose wallet type to connect

(

walletId: string | null,

chainId: string | null,

callback?: (

error: Error,

typeError: TypeConnectError,

addNetwork?: () => Promise<void>,

provider?: unknown,

) => Promise<void>,

) => void;

getAvailableWallet

Retrieve list of available wallets to choose from Note: this method is only available in Coin98 Wallet

() => Promise<WalletReturnType<AvailableWalletType, string>>;

disconnect

Disconnect wallet

() => Promise;

connect

Connect to the selected wallet

(callbackAddChain?: (error: Error) => Promise) => Promise;

switchNetwork

Request wallet to switch its current chain to the requested chain (when switching between EVM chains)

(

chainId: string,

callBackAddChain?: (

error: Error,

typeError?: TypeConnectError,

addNetwork?: () => Promise<void>,

provider?: unknown,

) => Promise<void>,

) => Promise<WalletReturnType<boolean, string> | undefined>;

switchBlockchain

Request wallet to switch its current chain to the requested chain (when switching between EVM chain and non-EVM chain) Note: this method is only available in Coin98 Wallet

(blockChainName: string, callback?: (error: Error) => Promise) => Promise;

requestInstall

Show the install wallet request modal

(value: boolean) => void

sendTransaction

Creates a new transaction confirmation from the user's wallet address

(transaction: Transaction)=> Promise<WalletReturnType<string[] | string, string>>;

signMessage

Presents a plain text signature challenge to the user and returns the signed response

(message: string) => Promise<WalletReturnType<string[], string>>;

signTypedData

Presents a structured and readable data message for the user to sign, then returns a signed response

(msgParams: TypedMessageV3 | TypedMessageV4 | TypedMessage[], type: 'v1' | 'v3' | 'v4' ) => Promise<WalletReturnType<string, string>>;

ethSign

Presents a data message for the user to sign arbitrary messages

(message: string) => Promise<WalletReturnType<string, string>>;

watchAsset

Request to track a specific token in wallet

(params: WatchAssetType)=>Promise<WalletReturnType<boolean, string>>;

getEncryptionPublicKey

Requests to get user wallet address's public encryption key

() => Promise<WalletReturnType<string, string>>;

ethDecrypt

Request to decrypt a specific encrypted message

(message: string, address?: string) => Promise<WalletReturnType<unknown, string>>;

Last updated