Accessing Accounts
After the wallet connection is established, you can access the accounts connected with the OneKey wallet.
User accounts are used in a variety of contexts in OneKey, including as identifiers and for signing transactions.
const res = await provider.request({
method: 'near_accounts',
});
const accountId = res?.accounts?.[0]?.accountId || '';
const publicKey = res?.accounts?.[0]?.publicKey || '';
// An empty accounts array means no account is exposed to this site
console.log('near_accounts', res?.accounts, accountId, publicKey);Last updated on