Skip to content
docs

WalletAccountNear

Defined in: wallet-near/src/account.ts:33

Signing NEAR account. The key lives in an ed25519 Signer (a local key zeroized by dispose(), or an external hardware / MPC / backend signer). The account builds the transaction (nonce + block hash from the node), checks it, runs the preflight, has the signer sign sha256(borsh(tx)) (context near-tx) and broadcasts it with send_tx.

By default the account id is the implicit one (hex of the public key). Pass accountId for a named account whose full-access key this is.

  • IWalletAccount

new WalletAccountNear(signer, publicKey, path, config?, accountId?): WalletAccountNear

Defined in: wallet-near/src/account.ts:49

Signer

Uint8Array

string

NearConfig = {}

string

WalletAccountNear

WalletAccountReadOnlyNear.constructor

protected readonly _client: NearFetch | undefined

Defined in: wallet-near/src/read-only-account.ts:49

WalletAccountReadOnlyNear._client


protected readonly _config: NearConfig

Defined in: wallet-near/src/read-only-account.ts:48

WalletAccountReadOnlyNear._config


protected readonly _rpc: NearRpc | undefined

Defined in: wallet-near/src/read-only-account.ts:50

WalletAccountReadOnlyNear._rpc


readonly address: string

Defined in: wallet-near/src/read-only-account.ts:45

Account id: the implicit hex id of the key, or a named account bound to it.

WalletAccountReadOnlyNear.address


readonly chain: string

Defined in: wallet-near/src/read-only-account.ts:46

CAIP-2 chain id, e.g. “eip155:1”, “solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp”, “ton:-239”, “tron:0x2b6653dc”, “bip122:000000000019d6689c085ae165831e93”.

IWalletAccount.chain

WalletAccountReadOnlyNear.chain


readonly needsNetwork: true = true

Defined in: wallet-near/src/account.ts:35

nonce / block hash come from the node, so building needs the network.

IWalletAccount.needsNetwork


readonly path: string

Defined in: wallet-near/src/account.ts:37

Derivation path, or external for an external signer.


readonly publicKey: NearPublicKey

Defined in: wallet-near/src/read-only-account.ts:47

WalletAccountReadOnlyNear.publicKey


readonly signerKind: "seed" | "key" | "external"

Defined in: wallet-near/src/account.ts:45

What holds the key: seed, key (one imported key) or external.

get index(): number | undefined

Defined in: wallet-near/src/account.ts:62

Account index for the standard m/44’/397’/i’ path.

number | undefined


get publicKeyString(): string

Defined in: wallet-near/src/read-only-account.ts:71

“ed25519:”

string

WalletAccountReadOnlyNear.publicKeyString

accountExists(accountId): Promise<boolean>

Defined in: wallet-near/src/read-only-account.ts:103

True when the account exists on chain.

string

Promise<boolean>

WalletAccountReadOnlyNear.accountExists


assertSafe(tx, fee?): void

Defined in: wallet-near/src/read-only-account.ts:288

Refuse what cannot be right: a foreign signer or key, no actions, a dangerous action (unless allowDangerousActions), an invalid receiver, prepaid gas over 300 Tgas, a fee above transactionMaxFee.

NearBuiltTransaction

bigint

void

WalletAccountReadOnlyNear.assertSafe


buildTransaction(tx): Promise<NearBuiltTransaction>

Defined in: wallet-near/src/read-only-account.ts:166

Fill signerId / publicKey / nonce / blockHash (the last two from the node when missing).

string | NearTransaction

Promise<NearBuiltTransaction>

WalletAccountReadOnlyNear.buildTransaction


describeTransactionOnline(tx, ctx?): Promise<NearTxDescription>

Defined in: wallet-near/src/read-only-account.ts:310

describeTransaction plus the recipient-existence check against the node.

NearTransaction

DescribeContext = {}

Promise<NearTxDescription>

WalletAccountReadOnlyNear.describeTransactionOnline


dispose(): void

Defined in: wallet-near/src/account.ts:174

Dispose the signer (zeroizes a local key). Idempotent.

void

IWalletAccount.dispose


protected estimate(tx, recipientExists?): Promise<NearFeeEstimate>

Defined in: wallet-near/src/read-only-account.ts:211

Pick<NearBuiltTransaction, "receiverId" | "actions">

boolean

Promise<NearFeeEstimate>

WalletAccountReadOnlyNear.estimate


estimateFee(tx): Promise<NearFeeEstimate>

Defined in: wallet-near/src/read-only-account.ts:222

Gas and cost of a transaction.

string | NearTransaction

Promise<NearFeeEstimate>

WalletAccountReadOnlyNear.estimateFee


getAccountView(accountId?): Promise<NearAccountView | undefined>

Defined in: wallet-near/src/read-only-account.ts:82

The account as the node sees it; undefined when it does not exist yet.

string = ...

Promise<NearAccountView | undefined>

WalletAccountReadOnlyNear.getAccountView


getAddress(): Promise<string>

Defined in: wallet-near/src/read-only-account.ts:79

The account id.

Promise<string>

IWalletAccount.getAddress

WalletAccountReadOnlyNear.getAddress


getAvailableBalance(): Promise<bigint>

Defined in: wallet-near/src/read-only-account.ts:98

What can actually be spent: total − locked (staked) − storage reservation.

Promise<bigint>

WalletAccountReadOnlyNear.getAvailableBalance


getBalance(): Promise<bigint>

Defined in: wallet-near/src/read-only-account.ts:93

Total NEAR balance in yoctoNEAR (0 for an account that does not exist yet).

Promise<bigint>

IWalletAccount.getBalance

WalletAccountReadOnlyNear.getBalance


getStorageBalance(token, accountId?): Promise<{ available: bigint; total: bigint; } | null>

Defined in: wallet-near/src/read-only-account.ts:121

NEP-145 storage registration of accountId on a token contract (null = not registered).

string

string = ...

Promise<{ available: bigint; total: bigint; } | null>

WalletAccountReadOnlyNear.getStorageBalance


getStorageDepositMin(token): Promise<bigint>

Defined in: wallet-near/src/read-only-account.ts:127

Minimum deposit a token contract wants for a registration (storage_balance_bounds.min).

string

Promise<bigint>

WalletAccountReadOnlyNear.getStorageDepositMin


getTokenBalance(token): Promise<bigint>

Defined in: wallet-near/src/read-only-account.ts:108

NEP-141 ft_balance_of.

string

Promise<bigint>

IWalletAccount.getTokenBalance

WalletAccountReadOnlyNear.getTokenBalance


getTokenBalances(tokens): Promise<Record<string, bigint>>

Defined in: wallet-near/src/read-only-account.ts:114

Several NEP-141 balances in parallel, keyed by the token contracts as given.

string[]

Promise<Record<string, bigint>>

WalletAccountReadOnlyNear.getTokenBalances


getTransactionReceipt(hash): Promise<NearReceipt | undefined>

Defined in: wallet-near/src/read-only-account.ts:317

Status of one of this account’s transactions (the tx RPC needs the sender).

string

Promise<NearReceipt | undefined>

IWalletAccount.getTransactionReceipt

WalletAccountReadOnlyNear.getTransactionReceipt


quoteSendTransaction(tx): Promise<NearQuote>

Defined in: wallet-near/src/read-only-account.ts:227

Fee of a transaction in yoctoNEAR.

string | NearTransaction

Promise<NearQuote>

IWalletAccount.quoteSendTransaction

WalletAccountReadOnlyNear.quoteSendTransaction


quoteTransfer(o): Promise<NearQuote>

Defined in: wallet-near/src/read-only-account.ts:233

Fee of a transfer in yoctoNEAR, for the same actions transfer would send.

NearTransferOptions

Promise<NearQuote>

IWalletAccount.quoteTransfer

WalletAccountReadOnlyNear.quoteTransfer


protected requireRpc(what): NearRpc

Defined in: wallet-near/src/read-only-account.ts:73

string

NearRpc

WalletAccountReadOnlyNear.requireRpc


sendTransaction(tx, options?): Promise<NearTransferResult>

Defined in: wallet-near/src/account.ts:150

Sign and broadcast. Accepts a transaction, or base64 borsh of an unsigned / already-signed transaction (a signed one is checked, not re-signed).

string | NearTransaction

WriteOptions = {}

Promise<NearTransferResult>

IWalletAccount.sendTransaction


sign(message): Promise<string>

Defined in: wallet-near/src/account.ts:89

Raw ed25519 signature over the message bytes, as NEAR tooling prints it: “ed25519:”. A 32-byte message — string or bytes — is refused with MessageIsTransactionError: a NEAR transaction is signed over its 32-byte sha256, so those bytes could be one. Bytes that carry this account’s public key are refused as well: one ed25519 key (an external signer) may also be a Solana wallet, and a Solana transaction names its signer’s key. Sites asking a wallet to sign a message use signNep413.

string | Uint8Array<ArrayBufferLike>

Promise<string>

IWalletAccount.sign


signBuilt(tx): Promise<NearSignedTransaction>

Defined in: wallet-near/src/account.ts:102

Sign a fully built transaction. No checks — see signTransaction.

NearBuiltTransaction

Promise<NearSignedTransaction>


signNep413(payload): Promise<Nep413Signed>

Defined in: wallet-near/src/account.ts:96

NEP-413 off-chain message (what NEAR Intents and dApps ask wallets to sign).

Nep413Payload

Promise<Nep413Signed>


signTransaction(tx, options?): Promise<string>

Defined in: wallet-near/src/account.ts:123

Build, check, preflight and sign; returns the signed transaction as base64 borsh (what send_tx takes).

string | NearTransaction

WriteOptions = {}

Promise<string>

IWalletAccount.signTransaction


simulateTransaction(tx, estimate?): Promise<NearSimulation>

Defined in: wallet-near/src/read-only-account.ts:245

Predict failure without signing: the signer account and its access key exist, the spendable balance covers deposits + fee, a named recipient exists (an implicit one may be created, for ≥ 0.002 NEAR), the token balance covers an ft_transfer. Transport failures throw; predicted failures don’t.

NearTransaction | NearBuiltTransaction

NearFeeEstimate

Promise<NearSimulation>

WalletAccountReadOnlyNear.simulateTransaction


toReadOnlyAccount(): IWalletAccountReadOnly

Defined in: wallet-near/src/account.ts:168

The same account as a WalletAccountReadOnlyNear.

IWalletAccountReadOnly

IWalletAccount.toReadOnlyAccount


transfer(o, writeOptions?): Promise<NearTransferResult>

Defined in: wallet-near/src/account.ts:160

Native NEAR (no token) or NEP-141 ft_transfer (with storage_deposit when the recipient needs it).

NearTransferOptions

WriteOptions = {}

Promise<NearTransferResult>

IWalletAccount.transfer


transferActions(o): Promise<{ actions: NearAction[]; receiverId: string; }>

Defined in: wallet-near/src/read-only-account.ts:140

The actions for transfer: native → one Transfer; NEP-141 → ft_transfer (1 yocto, 30 Tgas), preceded by storage_deposit when the recipient is not registered on the token.

NearTransferOptions

Promise<{ actions: NearAction[]; receiverId: string; }>

WalletAccountReadOnlyNear.transferActions


verify(message, signature): Promise<boolean>

Defined in: wallet-near/src/read-only-account.ts:324

Verify an ed25519:<base58> (or bare base58 / hex) signature produced by sign.

string | Uint8Array<ArrayBufferLike>

string

Promise<boolean>

IWalletAccount.verify

WalletAccountReadOnlyNear.verify


withAccountId(accountId): WalletAccountNear

Defined in: wallet-near/src/account.ts:68

The same key bound to a named account (alice.near) that lists it as a full-access key.

string

WalletAccountNear


static depositOf(actions): bigint

Defined in: wallet-near/src/read-only-account.ts:201

NearAction[]

bigint

WalletAccountReadOnlyNear.depositOf


static fromPrivateKey(privateKey, publicKey, path, config?, accountId?): WalletAccountNear

Defined in: wallet-near/src/account.ts:57

Wrap a raw derived key (takes ownership; zeroized on dispose).

Uint8Array

Uint8Array

string

NearConfig = {}

string

WalletAccountNear


static gasOf(actions, createsAccount): bigint

Defined in: wallet-near/src/read-only-account.ts:188

Gas upper bound for the actions (prepaid function-call gas in full).

NearAction[]

boolean

bigint

WalletAccountReadOnlyNear.gasOf


static hashOf(tx): Uint8Array

Defined in: wallet-near/src/read-only-account.ts:332

sha256(borsh(tx)) — what gets signed; base58 of it is the transaction hash.

NearBuiltTransaction

Uint8Array

WalletAccountReadOnlyNear.hashOf


static txHash(tx): string

Defined in: wallet-near/src/read-only-account.ts:333

NearBuiltTransaction

string

WalletAccountReadOnlyNear.txHash