Wallet API
Initializing
Instantiating the Wallet API.
// web3Api.ts
import naxios from '@wpdas/naxios'
const naxiosInstance = new naxios({
contractId: "hello.near-examples.near",
network: 'mainnet', // or testnet, localnet
})
/**
* NEAR Wallet API (Must be a single instance)
*/
export const walletApi = naxiosInstance.walletApi()API Reference
accounts: Signed-in Accounts.accountId: Main/first signed-in account ID in the accounts list.contractId: Contract ID.initNear: Initializes a connection to the NEAR blockchain. This is called automatically when there's any contract interaction.network: Current network (testnet,mainnetorlocalnet).recentlySignedInWallets: Returns ID-s of 5 recently signed in wallets.selectedWalletId: Selected Wallet IdsignInModal: Open up the Signin Wallet Modal.wallet: Wallet instance.walletSelector: WalletSelector instance.
Opening the Sign-in Wallet Selector Modal
You can open up the NEAR Wallet Selector modal by calling signInModal():

Customizing the Wallets Options for NEAR Wallet Selector
By default, naxios only uses @near-wallet-selector/my-near-wallet as a means of connecting the wallet. However, you can add other wallet selectors as follows:
Then, you can start naxius as follows:
Find out all the NEAR wallet selectors here: NEAR Wallet Selector
Last updated