访问账户
钱包连接建立后,即可访问已连接到 OneKey 的账户。
用户账户在 OneKey 中有多种用途,包括作为标识符和用于签署交易。
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);最后更新于