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.
Extended by
Section titled “Extended by”Implements
Section titled “Implements”IWalletAccountReadOnly
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WalletAccountReadOnlyNear(
address,config?,publicKey?):WalletAccountReadOnlyNear
Defined in: wallet-near/src/read-only-account.ts:56
Parameters
Section titled “Parameters”address
Section titled “address”string
account id; an implicit (64-hex) id also fixes the public key.
config?
Section titled “config?”NearConfig = {}
publicKey?
Section titled “publicKey?”Uint8Array<ArrayBufferLike> | NearPublicKey
required for a named account (the key the account signs with).
Returns
Section titled “Returns”WalletAccountReadOnlyNear
Properties
Section titled “Properties”_client
Section titled “_client”
protectedreadonly_client:NearFetch|undefined
Defined in: wallet-near/src/read-only-account.ts:49
_config
Section titled “_config”
protectedreadonly_config:NearConfig
Defined in: wallet-near/src/read-only-account.ts:48
protectedreadonly_rpc:NearRpc|undefined
Defined in: wallet-near/src/read-only-account.ts:50
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.
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”IWalletAccountReadOnly.chain
publicKey
Section titled “publicKey”
readonlypublicKey:NearPublicKey
Defined in: wallet-near/src/read-only-account.ts:47
Accessors
Section titled “Accessors”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
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>
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
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>
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>
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>
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>
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>
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”IWalletAccountReadOnly.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>
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”IWalletAccountReadOnly.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>
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>
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”IWalletAccountReadOnly.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>>
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”IWalletAccountReadOnly.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”IWalletAccountReadOnly.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”IWalletAccountReadOnly.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”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>
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; }>
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”IWalletAccountReadOnly.verify
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
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
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
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