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.
Extends
Section titled “Extends”Implements
Section titled “Implements”IWalletAccount
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WalletAccountNear(
signer,publicKey,path,config?,accountId?):WalletAccountNear
Defined in: wallet-near/src/account.ts:49
Parameters
Section titled “Parameters”signer
Section titled “signer”Signer
publicKey
Section titled “publicKey”Uint8Array
string
config?
Section titled “config?”NearConfig = {}
accountId?
Section titled “accountId?”string
Returns
Section titled “Returns”WalletAccountNear
Overrides
Section titled “Overrides”WalletAccountReadOnlyNear.constructor
Properties
Section titled “Properties”_client
Section titled “_client”
protectedreadonly_client:NearFetch|undefined
Defined in: wallet-near/src/read-only-account.ts:49
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear._client
_config
Section titled “_config”
protectedreadonly_config:NearConfig
Defined in: wallet-near/src/read-only-account.ts:48
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear._config
protectedreadonly_rpc:NearRpc|undefined
Defined in: wallet-near/src/read-only-account.ts:50
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear._rpc
address
Section titled “address”
readonlyaddress: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.
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.address
readonlychain: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”.
Implementation of
Section titled “Implementation of”IWalletAccount.chain
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.chain
needsNetwork
Section titled “needsNetwork”
readonlyneedsNetwork:true=true
Defined in: wallet-near/src/account.ts:35
nonce / block hash come from the node, so building needs the network.
Implementation of
Section titled “Implementation of”IWalletAccount.needsNetwork
readonlypath:string
Defined in: wallet-near/src/account.ts:37
Derivation path, or external for an external signer.
publicKey
Section titled “publicKey”
readonlypublicKey:NearPublicKey
Defined in: wallet-near/src/read-only-account.ts:47
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.publicKey
signerKind
Section titled “signerKind”
readonlysignerKind:"seed"|"key"|"external"
Defined in: wallet-near/src/account.ts:45
What holds the key: seed, key (one imported key) or external.
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get index():
number|undefined
Defined in: wallet-near/src/account.ts:62
Account index for the standard m/44’/397’/i’ path.
Returns
Section titled “Returns”number | undefined
publicKeyString
Section titled “publicKeyString”Get Signature
Section titled “Get Signature”get publicKeyString():
string
Defined in: wallet-near/src/read-only-account.ts:71
“ed25519:
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.publicKeyString
Methods
Section titled “Methods”accountExists()
Section titled “accountExists()”accountExists(
accountId):Promise<boolean>
Defined in: wallet-near/src/read-only-account.ts:103
True when the account exists on chain.
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
Returns
Section titled “Returns”Promise<boolean>
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.accountExists
assertSafe()
Section titled “assertSafe()”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.
Parameters
Section titled “Parameters”bigint
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.assertSafe
buildTransaction()
Section titled “buildTransaction()”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).
Parameters
Section titled “Parameters”string | NearTransaction
Returns
Section titled “Returns”Promise<NearBuiltTransaction>
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.buildTransaction
describeTransactionOnline()
Section titled “describeTransactionOnline()”describeTransactionOnline(
tx,ctx?):Promise<NearTxDescription>
Defined in: wallet-near/src/read-only-account.ts:310
describeTransaction plus the recipient-existence check against the node.
Parameters
Section titled “Parameters”DescribeContext = {}
Returns
Section titled “Returns”Promise<NearTxDescription>
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.describeTransactionOnline
dispose()
Section titled “dispose()”dispose():
void
Defined in: wallet-near/src/account.ts:174
Dispose the signer (zeroizes a local key). Idempotent.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IWalletAccount.dispose
estimate()
Section titled “estimate()”
protectedestimate(tx,recipientExists?):Promise<NearFeeEstimate>
Defined in: wallet-near/src/read-only-account.ts:211
Parameters
Section titled “Parameters”Pick<NearBuiltTransaction, "receiverId" | "actions">
recipientExists?
Section titled “recipientExists?”boolean
Returns
Section titled “Returns”Promise<NearFeeEstimate>
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.estimate
estimateFee()
Section titled “estimateFee()”estimateFee(
tx):Promise<NearFeeEstimate>
Defined in: wallet-near/src/read-only-account.ts:222
Gas and cost of a transaction.
Parameters
Section titled “Parameters”string | NearTransaction
Returns
Section titled “Returns”Promise<NearFeeEstimate>
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.estimateFee
getAccountView()
Section titled “getAccountView()”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.
Parameters
Section titled “Parameters”accountId?
Section titled “accountId?”string = ...
Returns
Section titled “Returns”Promise<NearAccountView | undefined>
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.getAccountView
getAddress()
Section titled “getAddress()”getAddress():
Promise<string>
Defined in: wallet-near/src/read-only-account.ts:79
The account id.
Returns
Section titled “Returns”Promise<string>
Implementation of
Section titled “Implementation of”IWalletAccount.getAddress
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.getAddress
getAvailableBalance()
Section titled “getAvailableBalance()”getAvailableBalance():
Promise<bigint>
Defined in: wallet-near/src/read-only-account.ts:98
What can actually be spent: total − locked (staked) − storage reservation.
Returns
Section titled “Returns”Promise<bigint>
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.getAvailableBalance
getBalance()
Section titled “getBalance()”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).
Returns
Section titled “Returns”Promise<bigint>
Implementation of
Section titled “Implementation of”IWalletAccount.getBalance
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.getBalance
getStorageBalance()
Section titled “getStorageBalance()”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).
Parameters
Section titled “Parameters”string
accountId?
Section titled “accountId?”string = ...
Returns
Section titled “Returns”Promise<{ available: bigint; total: bigint; } | null>
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.getStorageBalance
getStorageDepositMin()
Section titled “getStorageDepositMin()”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).
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<bigint>
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.getStorageDepositMin
getTokenBalance()
Section titled “getTokenBalance()”getTokenBalance(
token):Promise<bigint>
Defined in: wallet-near/src/read-only-account.ts:108
NEP-141 ft_balance_of.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<bigint>
Implementation of
Section titled “Implementation of”IWalletAccount.getTokenBalance
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.getTokenBalance
getTokenBalances()
Section titled “getTokenBalances()”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.
Parameters
Section titled “Parameters”tokens
Section titled “tokens”string[]
Returns
Section titled “Returns”Promise<Record<string, bigint>>
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.getTokenBalances
getTransactionReceipt()
Section titled “getTransactionReceipt()”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).
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<NearReceipt | undefined>
Implementation of
Section titled “Implementation of”IWalletAccount.getTransactionReceipt
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.getTransactionReceipt
quoteSendTransaction()
Section titled “quoteSendTransaction()”quoteSendTransaction(
tx):Promise<NearQuote>
Defined in: wallet-near/src/read-only-account.ts:227
Fee of a transaction in yoctoNEAR.
Parameters
Section titled “Parameters”string | NearTransaction
Returns
Section titled “Returns”Promise<NearQuote>
Implementation of
Section titled “Implementation of”IWalletAccount.quoteSendTransaction
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.quoteSendTransaction
quoteTransfer()
Section titled “quoteTransfer()”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.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<NearQuote>
Implementation of
Section titled “Implementation of”IWalletAccount.quoteTransfer
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.quoteTransfer
requireRpc()
Section titled “requireRpc()”
protectedrequireRpc(what):NearRpc
Defined in: wallet-near/src/read-only-account.ts:73
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.requireRpc
sendTransaction()
Section titled “sendTransaction()”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).
Parameters
Section titled “Parameters”string | NearTransaction
options?
Section titled “options?”WriteOptions = {}
Returns
Section titled “Returns”Promise<NearTransferResult>
Implementation of
Section titled “Implementation of”IWalletAccount.sendTransaction
sign()
Section titled “sign()”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:
Parameters
Section titled “Parameters”message
Section titled “message”string | Uint8Array<ArrayBufferLike>
Returns
Section titled “Returns”Promise<string>
Implementation of
Section titled “Implementation of”IWalletAccount.sign
signBuilt()
Section titled “signBuilt()”signBuilt(
tx):Promise<NearSignedTransaction>
Defined in: wallet-near/src/account.ts:102
Sign a fully built transaction. No checks — see signTransaction.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<NearSignedTransaction>
signNep413()
Section titled “signNep413()”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).
Parameters
Section titled “Parameters”payload
Section titled “payload”Returns
Section titled “Returns”Promise<Nep413Signed>
signTransaction()
Section titled “signTransaction()”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).
Parameters
Section titled “Parameters”string | NearTransaction
options?
Section titled “options?”WriteOptions = {}
Returns
Section titled “Returns”Promise<string>
Implementation of
Section titled “Implementation of”IWalletAccount.signTransaction
simulateTransaction()
Section titled “simulateTransaction()”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.
Parameters
Section titled “Parameters”NearTransaction | NearBuiltTransaction
estimate?
Section titled “estimate?”Returns
Section titled “Returns”Promise<NearSimulation>
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.simulateTransaction
toReadOnlyAccount()
Section titled “toReadOnlyAccount()”toReadOnlyAccount():
IWalletAccountReadOnly
Defined in: wallet-near/src/account.ts:168
The same account as a WalletAccountReadOnlyNear.
Returns
Section titled “Returns”IWalletAccountReadOnly
Implementation of
Section titled “Implementation of”IWalletAccount.toReadOnlyAccount
transfer()
Section titled “transfer()”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).
Parameters
Section titled “Parameters”writeOptions?
Section titled “writeOptions?”WriteOptions = {}
Returns
Section titled “Returns”Promise<NearTransferResult>
Implementation of
Section titled “Implementation of”IWalletAccount.transfer
transferActions()
Section titled “transferActions()”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.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<{ actions: NearAction[]; receiverId: string; }>
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.transferActions
verify()
Section titled “verify()”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.
Parameters
Section titled “Parameters”message
Section titled “message”string | Uint8Array<ArrayBufferLike>
signature
Section titled “signature”string
Returns
Section titled “Returns”Promise<boolean>
Implementation of
Section titled “Implementation of”IWalletAccount.verify
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.verify
withAccountId()
Section titled “withAccountId()”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.
Parameters
Section titled “Parameters”accountId
Section titled “accountId”string
Returns
Section titled “Returns”WalletAccountNear
depositOf()
Section titled “depositOf()”
staticdepositOf(actions):bigint
Defined in: wallet-near/src/read-only-account.ts:201
Parameters
Section titled “Parameters”actions
Section titled “actions”Returns
Section titled “Returns”bigint
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.depositOf
fromPrivateKey()
Section titled “fromPrivateKey()”
staticfromPrivateKey(privateKey,publicKey,path,config?,accountId?):WalletAccountNear
Defined in: wallet-near/src/account.ts:57
Wrap a raw derived key (takes ownership; zeroized on dispose).
Parameters
Section titled “Parameters”privateKey
Section titled “privateKey”Uint8Array
publicKey
Section titled “publicKey”Uint8Array
string
config?
Section titled “config?”NearConfig = {}
accountId?
Section titled “accountId?”string
Returns
Section titled “Returns”WalletAccountNear
gasOf()
Section titled “gasOf()”
staticgasOf(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).
Parameters
Section titled “Parameters”actions
Section titled “actions”createsAccount
Section titled “createsAccount”boolean
Returns
Section titled “Returns”bigint
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.gasOf
hashOf()
Section titled “hashOf()”
statichashOf(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.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Uint8Array
Inherited from
Section titled “Inherited from”WalletAccountReadOnlyNear.hashOf
txHash()
Section titled “txHash()”
statictxHash(tx):string
Defined in: wallet-near/src/read-only-account.ts:333
Parameters
Section titled “Parameters”Returns
Section titled “Returns”string