Private
Readonly
_accountPrivate
Readonly
managerProtected
providerReturns infomation about the account.
Current balance of account on network.
Create a Transaction that can be used to build actions like transfer, createAccount, etc. Then once built can be signed and transmitted. E.g.
const result = await account.batch(bob).transfer(NEAR.parse("1N")).transact();
account that the transaction is addressed to.
Convenient wrapper around lower-level callRaw
that returns only successful result of call, or throws error encountered during call. Example:
await call('lol.testnet', 'set_status', { message: 'hello' }, new BN(30 * 10**12), '0')
any parsed return value, or throws with an error if call failed
Call a NEAR contract and return full results with raw receipts, etc. Example:
await callRaw('lol.testnet', 'set_status', { message: 'hello' }, {gas: new BN(30 * 10**12), attachedDeposit: new BN(10**24)})
//`gas` and `initialBalance` as strings can be either numbers, e.g. `1_000_000` or have units, `30 Tgas`
await callRaw('lol.testnet', 'set_status', { message: 'hello' }, {gas:"10 Tgas", attachedDeposit: "1 N"})
Promise
Create a subaccount from this account
full accountId with current account name as suffix.
keyPair
is key to be added to keystore, otherwise random one will be added.
initialBalance
how much yoctoNear to transfer to new account.
Optional
initialOptional
isOptional
keyCreate a subaccount from this account
prefix of accountId with current account name as suffix.
keyPair
is key to be added to keystore, otherwise random one will be added.
initialBalance
how much yoctoNear to transfer to new account.
Optional
initialOptional
isOptional
keyDelete account and sends funds to beneficiaryId
Optional
keyPair: KeyPairDeploy contract to the current account
Creates an account with random accoundId
Promise
Creates an account for a contract and then deploys a Wasm binary to it.
If method arguments are provided a function call to method
will be added to the transaction so that
the contract can be initialized in the same step.
path or data of contract binary
If any method is passed it will be added to the transaction so that contract will be initialized
gas
and initialBalance
as strings can be either numbers, e.g. 1_000_000
or have units, 30 Tgas
Get the account with given full accountId
Private
getAdds suffix to accountIdPrefix and get that account
Create an account, copying Wasm bytes and contract name from a given testnetContract
or mainnetContract
.
This makes use of Sandbox's patch state feature, and so only works in Sandbox mode.
You can include withData: true
to copy account data as well, but this is
currently limited by the default RPC limit of 50kB. You could set up your
own RPC server to get around this limit (using your own RPC endpoint will
be easier soon).
Optional
blockOptional
initialOptional
keyOptional
mainnetOptional
testnetOptional
withProtected
internalPrivate
recordTransfer yoctoNear to another account.
If amount is string it can be either numbers, e.g. "1_000_000_000_000_000_000_000_000"
or have units, "1 N"
Add AccessKey to account.
Uses patchStateRecords to update the account without a transaction. Only works with network: 'sandbox'.
Optional
access_key_data: AccessKeyDataUpdate the account balance, storage usage, locked_amount.
Uses patchStateRecords to update the account without a transaction. Only works with network: 'sandbox'.
Optional
accountData: Partial<AccountData>Update contract data of account.
Uses patchStateRecords to update the account without a transaction. Only works with network: 'sandbox'.
Base64 encoded string or Buffer to be encoded as Base64
Base64 encoded string or Buffer to be encoded as Base64
Get the parsed result returned by view method
contract method
args to pass to method if required
Get the access key associated to the account id and public key.
ID of the account we want to get the access key from.
Which particular access key we want to retrieve.
Get all access keys associated to the account id.
ID of the account we want to get the access keys from.
Get full response from RPC about result of view method
contract method
args to pass to method if required
Get the data of a contract as a map of raw key/values
optional prefix of key in storage. Default is ''.
Generated using TypeDoc
Full account id for given account.