Skip to content
docs

WalletAccountReadOnlyNear

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

A NEAR account without a key: balances, NEP-141 tokens and storage, fee estimates, simulation, receipts and signature checks.

  • IWalletAccountReadOnly

new WalletAccountReadOnlyNear(address, config?, publicKey?): WalletAccountReadOnlyNear

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

string

account id; an implicit (64-hex) id also fixes the public key.

NearConfig = {}

Uint8Array<ArrayBufferLike> | NearPublicKey

required for a named account (the key the account signs with).

WalletAccountReadOnlyNear

protected readonly _client: NearFetch | undefined

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


protected readonly _config: NearConfig

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


protected readonly _rpc: NearRpc | undefined

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


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.


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”.

IWalletAccountReadOnly.chain


readonly publicKey: NearPublicKey

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

get publicKeyString(): string

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

“ed25519:”

string

accountExists(accountId): Promise<boolean>

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

True when the account exists on chain.

string

Promise<boolean>


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


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>


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>


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

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

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

boolean

Promise<NearFeeEstimate>


estimateFee(tx): Promise<NearFeeEstimate>

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

Gas and cost of a transaction.

string | NearTransaction

Promise<NearFeeEstimate>


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>


getAddress(): Promise<string>

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

The account id.

Promise<string>

IWalletAccountReadOnly.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>


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>

IWalletAccountReadOnly.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>


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>


getTokenBalance(token): Promise<bigint>

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

NEP-141 ft_balance_of.

string

Promise<bigint>

IWalletAccountReadOnly.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>>


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>

IWalletAccountReadOnly.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>

IWalletAccountReadOnly.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>

IWalletAccountReadOnly.quoteTransfer


protected requireRpc(what): NearRpc

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

string

NearRpc


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>


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; }>


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>

IWalletAccountReadOnly.verify


static depositOf(actions): bigint

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

NearAction[]

bigint


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


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


static txHash(tx): string

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

NearBuiltTransaction

string