Optional
signer: SignerAdd a full access key to the account
The public key to be added
The amount of NEAR this key can expend in gas
The contract that this key can call
The methods this key is allowed to call
The key to add to the account
A public key to be associated with the contract
Optional
contractId: stringNEAR account where the contract is deployed
Optional
methodNames: string | string[]The method names on the contract that should be allowed to be called. Pass null for no method names and '' or [] for any method names.
Optional
amount: bigintPayment in yoctoⓃ that is sent to the contract during this function call
please use addFullAccessKey or addFunctionAccessKey
Call a function on a smart contract
Arguments, either as a valid JSON Object or a raw Uint8Array
The contract in which to call the function
Optional
deposit?: string | number | bigint(optional) Amount of NEAR Tokens to attach to the call (default 0)
Optional
gas?: string | number | bigint(optional) Amount of GAS to use attach to the call (default 30TGas)
The method that will be called
Creates a new NEAR account with a given ID and public key.
This method can create two types of accounts:
Top-level accounts of the form name.tla
(e.g., bob.near
):
Sub-accounts of the current account (e.g., sub.ana.near
):
ana.near
, you can create sub.ana.near
the new account to create (e.g. bob.near or sub.ana.near)
the public part of the key that will control the account
Optional
nearToTransfer: string | number | biginthow much NEAR to transfer to the account in yoctoNEAR (default: 0)
NEAR account where the contract is deployed
The public key to add to the created contract account
The compiled contract code
of NEAR to transfer to the created contract account. Transfer enough to pay for storage https://docs.near.org/docs/concepts/storage-staking
Create a signed MetaTransaction that can be broadcasted to a relayer
NEAR account receiving the transaction
list of actions to perform as part of the meta transaction
Optional
blockHeightTtl: numbernumber of blocks after which a meta transaction will expire if not processed
Create a signed transaction ready to be broadcast by a Provider
Creates a sub account of this account. For example, if the account is ana.near, you can create sub.ana.near.
a prefix (e.g. sub
) or the full sub-account (sub.ana.near
)
the public part of the key that will control the account
Optional
nearToTransfer: string | number | biginthow much NEAR to transfer to the account (default: 0)
Deletes the account, transferring all remaining NEAR to a beneficiary account
Important: Deleting an account does not transfer FTs or NFTs
Will receive the account's remaining balance
The public key to be deleted
Deploy a smart contract in the account
The compiled contract code bytes
@deprecated, accounts will no longer handle keystores
Finds the AccessKeyView associated with the accounts PublicKey stored in the Keystore.
currently unused
currently unused
{ publicKey PublicKey; accessKey: AccessKeyView }
The options for the function call.
Options used to initiate a function call (especially a change function call)
Optional
args?: objectnamed arguments to pass the method { messageText: 'my message' }
Optional
attachedDeposit?: bigintamount of NEAR (in yoctoNEAR) to send together with the call
The NEAR account id where the contract is deployed
Optional
gas?: bigintmax amount of gas that method call can use
The name of the method to invoke
Optional
stringify?: (input: any) => BufferConvert input arguments into bytes array.
Optional
walletCallbackUrl?: stringCallback url to send the NEAR Wallet if using it to sign transactions.
Optional
walletMeta?: stringMetadata to send the NEAR Wallet if using it to sign transactions.
A promise that resolves to the final execution outcome of the function call.
Calls Provider.viewAccessKey to retrieve information for a specific key in the account
Calls Provider.viewAccessKeyList to retrieve the account's keys
please use getState instead
Returns the NEAR tokens balance and validators of a given account that is delegated to the staking pools that are part of the validators set in the current epoch.
Optional
token: NativeToken | FungibleTokenThe token to check the balance of. Defaults to Native NEAR.
The available balance of the account in units (e.g. yoctoNEAR).
@deprecated, accounts no longer use Connections since it's deprecated too
Calls Provider.viewContractCode to retrieve the account's contract code and its hash
Calls Provider.viewContractState to retrieve the keys and values stored on the account's contract
Optional
prefix: stringReturns an overview of the account's state, including the account's balance, storage usage, and code hash
NEAR account receiving Ⓝ
Amount to send in yoctoⓃ
please instead use transfer
Allows to set the signer used to control the account
holds the private key and can sign Transactions
Creates a transaction, signs it and broadcast it to the network
A promise that resolves to the final execution outcome of the transaction.
Optional
opts: { signer: Signer }A promise that resolves to the final execution outcome of the transaction.
please instead use signAndSendTransaction
Sign a transaction to perform a list of actions and broadcast it using the RPC API.
Options for the transaction.
Actions to be included in the meta transaction
Number of blocks past the current block height for which the SignedDelegate action may be included in a meta transaction
Receiver account of the meta transaction
please use Account.createSignedMetaTransaction instead
Compose and sign a SignedDelegate action to be executed in a transaction on behalf of this Account instance
This function simply calls the signNep413Message
method of the Signer
Optional
callbackUrl?: string(optional) Deprecated parameter used only by browser wallets
The message to be signed (e.g. "authenticating")
A challenge sent by the recipient
Who will receive the message (e.g. auth.app.com)
NEAR account receiving the transaction
list of actions to perform as part of the transaction
Optional
opts: { signer: Signer }use $createSignedTransaction Create a signed transaction which can be broadcast to the network
please use getState instead
Returns basic NEAR account information via the view_account
RPC query method
Transfers a token to the specified receiver.
Supports sending either the native NEAR token or any supported Fungible Token (FT).
Function call options.
Options used to initiate a function call (especially a change function call)
Optional
args?: objectnamed arguments to pass the method { messageText: 'my message' }
Optional
attachedDeposit?: bigintamount of NEAR (in yoctoNEAR) to send together with the call
Optional
blockQuery?: BlockReferenceThe NEAR account id where the contract is deployed
Optional
gas?: bigintmax amount of gas that method call can use
The name of the method to invoke
Optional
parse?: (response: Uint8Array) => anyOptional
stringify?: (input: any) => BufferConvert input arguments into bytes array.
allows to filter which keys should be returned. Empty prefix means all keys. String prefix is utf-8 encoded.
Optional
blockQuery: BlockReferencespecifies which block to query state at. By default returns last DEFAULT_FINALITY block (i.e. not necessarily finalized).
please use getContractState instead
Returns the state (key value pairs) of this account's contract based on the key prefix. Pass an empty string for prefix if you would like to return the entire state.
This class allows to access common account information. If a Signer is provider, then the account can be used to perform all common actions such as transferring tokens and calling functions