getWalletNames()

Othent JS SDK getWalletNames() function

Similarly to ArConnect, each wallet in Othent has a nickname. This is either:

To provide better UX, you can retrieve these names from the active (authenticated) user account and display them to make it easier for the user to recognize which wallet they're using.

API

getWalletNames(): Promise<Record<B64UrlString, string>>;

return Promise<Record<B64UrlString, string>>

A Promise containing an object that maps each wallet addresses of the active user to their nickname, or an empty Object if the user is not authenticated.

Example usage

import { Othent } from "@othent/kms";

const othent = new Othent({ appInfo, throwErrors: false, ... });

// Make sure the user is authenticated, or prompt them to authenticate:
await othent.requireAuth();

// Obtain the user's wallet names from:
const walletNames = await othent.getWalletNames();

// Obtain the user's active wallet address:
const activeAddress = await othent.getActiveAddress();

console.log(`Your active wallet's nickname is ${ walletNames[activeAddress] }.`);

Last updated