Sender Wallet Developer Documentation
  • Guide
    • Introduction
    • Getting Started
    • Sign in Applications
      • Sign in Applications in Near
      • Sign in Applications in Ethereum
    • Access Accounts
      • Access Accounts in Near
      • Access Account in Ethereum
    • Send Transactions
      • Send Transactions in Near
      • Send Transactions in Ethereum
  • API Reference
    • Near
      • NEAR Provider API
      • Deprecated APIs
    • Ethereum
      • Sign Data
      • Ethereum Provider API
    • Ton
      • Mobile Dapp Provider
  • Best Practices
    • Define App's Icon
Powered by GitBook
On this page
  • Current Account ID
  • Use Account Instance in Near Chain
  1. Guide
  2. Access Accounts

Access Accounts in Near

PreviousAccess AccountsNextAccess Account in Ethereum

Last updated 2 years ago

User accounts are used in a variety of contexts in NEAR, including as identifiers and for signing transactions. Once login successfully, you'll be able to access to the accountId and account instance.

Current Account ID

You can get the logged in account ID via the getAccountId() method in Near chain

// For version 1.11.7 and below
const accountId = window.near.getAccountId();

// For version 2.0.0 and above
const accountId = window.sender.near.getAccountId();

Use Account Instance in Near Chain

[Work In-Progress] You can also get access to the current account, and use its interface directly. The account is an instance of the account object in . The usage can be found in the .

const account = window.near.account();
await account.sendMoney(
  "receiver-account.testnet", // receiver account
  "1000000000000000000000000" // amount in yoctoNEAR
);
near-api-js
documentation here