Skip to main content
Version: near-api-js@1.1.0

Class: AccountMultisig

account_multisig.AccountMultisig

This class provides common account related RPC calls including signing transactions with a KeyPair.

Hint

Use WalletConnection in the browser to redirect to NEAR Wallet for Account/key management using the BrowserLocalStorageKeyStore.

See

Hierarchy

Constructors

constructor

new AccountMultisig(connection, accountId, options)

Parameters

NameType
connectionConnection
accountIdstring
optionsany

Overrides

Account.constructor

Defined in

account_multisig.ts:55

Properties

accountId

Readonly accountId: string

Inherited from

Account.accountId

Defined in

account.ts:161


connection

Readonly connection: Connection

Inherited from

Account.connection

Defined in

account.ts:160


onAddRequestResult

onAddRequestResult: (any: any) => any

Type declaration

(any): any

Parameters
NameType
anyany
Returns

any

Defined in

account_multisig.ts:53


storage

storage: any

Defined in

account_multisig.ts:52

Methods

addKey

addKey(publicKey, contractId?, methodNames?, amount?): Promise<FinalExecutionOutcome>

See

https://docs.near.org/concepts/basics/accounts/access-keys

Todo

expand this API to support more options.

Parameters

NameTypeDescription
publicKeystring | PublicKeyA public key to be associated with the contract
contractId?stringNEAR account where the contract is deployed
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.
amount?BNPayment in yoctoⓃ that is sent to the contract during this function call

Returns

Promise<FinalExecutionOutcome>

Inherited from

Account.addKey

Defined in

account.ts:443


checkMultisigCodeAndStateStatus

checkMultisigCodeAndStateStatus(contractBytes?): Promise<{ codeStatus: MultisigCodeStatus ; stateStatus: MultisigStateStatus }>

Parameters

NameType
contractBytes?Uint8Array

Returns

Promise<{ codeStatus: MultisigCodeStatus ; stateStatus: MultisigStateStatus }>

Defined in

account_multisig.ts:121


createAccount

createAccount(newAccountId, publicKey, amount): Promise<FinalExecutionOutcome>

Parameters

NameTypeDescription
newAccountIdstringNEAR account name to be created
publicKeystring | PublicKeyA public key created from the masterAccount
amountBN-

Returns

Promise<FinalExecutionOutcome>

Inherited from

Account.createAccount

Defined in

account.ts:374


createAndDeployContract

createAndDeployContract(contractId, publicKey, data, amount): Promise<Account>

Create a new account and deploy a contract to it

Parameters

NameTypeDescription
contractIdstringNEAR account where the contract is deployed
publicKeystring | PublicKeyThe public key to add to the created contract account
dataUint8ArrayThe compiled contract code
amountBNof NEAR to transfer to the created contract account. Transfer enough to pay for storage https://docs.near.org/docs/concepts/storage-staking

Returns

Promise<Account>

Inherited from

Account.createAndDeployContract

Defined in

account.ts:349


deleteAccount

deleteAccount(beneficiaryId): Promise<FinalExecutionOutcome>

Parameters

NameTypeDescription
beneficiaryIdstringThe NEAR account that will receive the remaining Ⓝ balance from the account being deleted

Returns

Promise<FinalExecutionOutcome>

Inherited from

Account.deleteAccount

Defined in

account.ts:385


deleteAllRequests

deleteAllRequests(): Promise<void>

Returns

Promise<void>

Defined in

account_multisig.ts:160


deleteKey

deleteKey(publicKey): Promise<FinalExecutionOutcome>

Parameters

NameTypeDescription
publicKeystring | PublicKeyThe public key to be deleted

Returns

Promise<FinalExecutionOutcome>

Inherited from

Account.deleteKey

Defined in

account.ts:466


deleteRequest

deleteRequest(request_id): Promise<FinalExecutionOutcome>

Parameters

NameType
request_idany

Returns

Promise<FinalExecutionOutcome>

Defined in

account_multisig.ts:153


deleteUnconfirmedRequests

deleteUnconfirmedRequests(): Promise<void>

Returns

Promise<void>

Defined in

account_multisig.ts:167


deployContract

deployContract(data): Promise<FinalExecutionOutcome>

Parameters

NameTypeDescription
dataUint8ArrayThe compiled contract code

Returns

Promise<FinalExecutionOutcome>

Inherited from

Account.deployContract

Defined in

account.ts:398


findAccessKey

findAccessKey(receiverId, actions): Promise<{ accessKey: AccessKeyView ; publicKey: PublicKey }>

Finds the AccessKeyView associated with the accounts PublicKey stored in the KeyStore.

Todo

Find matching access key based on transaction (i.e. receiverId and actions)

Parameters

NameTypeDescription
receiverIdstringcurrently unused (see todo)
actionsAction[]currently unused (see todo)

Returns

Promise<{ accessKey: AccessKeyView ; publicKey: PublicKey }>

{ publicKey PublicKey; accessKey: AccessKeyView }

Inherited from

Account.findAccessKey

Defined in

account.ts:297


functionCall

functionCall(__namedParameters): Promise<FinalExecutionOutcome>

Execute function call

Parameters

NameType
__namedParametersChangeFunctionCallOptions

Returns

Promise<FinalExecutionOutcome>

Inherited from

Account.functionCall

Defined in

account.ts:414


getAccessKeys

getAccessKeys(): Promise<AccessKeyInfoView[]>

Get all access keys for the account

See

https://docs.near.org/api/rpc/access-keys#view-access-key-list

Returns

Promise<AccessKeyInfoView[]>

Inherited from

Account.getAccessKeys

Defined in

account.ts:595


getAccountBalance

getAccountBalance(): Promise<AccountBalance>

Returns calculated account balance

Returns

Promise<AccountBalance>

Inherited from

Account.getAccountBalance

Defined in

account.ts:629


getAccountDetails

getAccountDetails(): Promise<{ authorizedApps: AccountAuthorizedApp[] }>

Returns a list of authorized apps

Todo

update the response value to return all the different keys, not just app keys.

Returns

Promise<{ authorizedApps: AccountAuthorizedApp[] }>

Inherited from

Account.getAccountDetails

Defined in

account.ts:609


getActiveDelegatedStakeBalance

getActiveDelegatedStakeBalance(): Promise<ActiveDelegatedStakeBalance>

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.

NOTE: If the tokens are delegated to a staking pool that is currently on pause or does not have enough tokens to participate in validation, they won't be accounted for.

Returns

Promise<ActiveDelegatedStakeBalance>

Inherited from

Account.getActiveDelegatedStakeBalance

Defined in

account.ts:653


getRequest

getRequest(): any

Returns

any

Defined in

account_multisig.ts:195


getRequestIds

getRequestIds(): Promise<string[]>

Returns

Promise<string[]>

Defined in

account_multisig.ts:189


sendMoney

sendMoney(receiverId, amount): Promise<FinalExecutionOutcome>

Parameters

NameTypeDescription
receiverIdstringNEAR account receiving Ⓝ
amountBNAmount to send in yoctoⓃ

Returns

Promise<FinalExecutionOutcome>

Inherited from

Account.sendMoney

Defined in

account.ts:363


setRequest

setRequest(data): any

Parameters

NameType
dataany

Returns

any

Defined in

account_multisig.ts:202


signAndSendTransaction

Protected signAndSendTransaction(__namedParameters): Promise<FinalExecutionOutcome>

Sign a transaction to preform a list of actions and broadcast it using the RPC API.

See

JsonRpcProvider.sendTransaction

Parameters

NameType
__namedParametersSignAndSendTransactionOptions

Returns

Promise<FinalExecutionOutcome>

Overrides

Account.signAndSendTransaction

Defined in

account_multisig.ts:65


signAndSendTransactionWithAccount

signAndSendTransactionWithAccount(receiverId, actions): Promise<FinalExecutionOutcome>

Parameters

NameType
receiverIdstring
actionsAction[]

Returns

Promise<FinalExecutionOutcome>

Defined in

account_multisig.ts:61


signTransaction

Protected signTransaction(receiverId, actions): Promise<[Uint8Array, SignedTransaction]>

Create a signed transaction which can be broadcast to the network

See

JsonRpcProvider.sendTransaction

Parameters

NameTypeDescription
receiverIdstringNEAR account receiving the transaction
actionsAction[]list of actions to perform as part of the transaction

Returns

Promise<[Uint8Array, SignedTransaction]>

Inherited from

Account.signTransaction

Defined in

account.ts:208


stake

stake(publicKey, amount): Promise<FinalExecutionOutcome>

See

https://near-nodes.io/validator/staking-and-delegation

Parameters

NameTypeDescription
publicKeystring | PublicKeyThe public key for the account that's staking
amountBNThe account to stake in yoctoⓃ

Returns

Promise<FinalExecutionOutcome>

Inherited from

Account.stake

Defined in

account.ts:479


state

state(): Promise<AccountView>

Returns basic NEAR account information via the view_account RPC query method

See

https://docs.near.org/api/rpc/contracts#view-account

Returns

Promise<AccountView>

Inherited from

Account.state

Defined in

account.ts:172


viewFunction

viewFunction(...restArgs): Promise<any>

Invoke a contract view function using the RPC API.

See

https://docs.near.org/api/rpc/contracts#call-a-contract-function

Parameters

NameType
...restArgsany

Returns

Promise<any>

Inherited from

Account.viewFunction

Defined in

account.ts:512


viewFunctionV1

viewFunctionV1(contractId, methodName, args?, __namedParameters?): Promise<any>

Parameters

NameType
contractIdstring
methodNamestring
argsany
__namedParametersObject
__namedParameters.blockQuery?BlockReference
__namedParameters.jsContract?boolean
__namedParameters.parse?(response: Uint8Array) => any
__namedParameters.stringify?(input: any) => Buffer

Returns

Promise<any>

Inherited from

Account.viewFunctionV1

Defined in

account.ts:524


viewFunctionV2

viewFunctionV2(__namedParameters): Promise<any>

Parameters

NameType
__namedParametersViewFunctionCallOptions

Returns

Promise<any>

Inherited from

Account.viewFunctionV2

Defined in

account.ts:535


viewState

viewState(prefix, blockQuery?): Promise<{ key: Buffer ; value: Buffer }[]>

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.

See

https://docs.near.org/api/rpc/contracts#view-contract-state

Parameters

NameTypeDescription
prefixstring | Uint8Arrayallows to filter which keys should be returned. Empty prefix means all keys. String prefix is utf-8 encoded.
blockQueryBlockReferencespecifies which block to query state at. By default returns last "optimistic" block (i.e. not necessarily finalized).

Returns

Promise<{ key: Buffer ; value: Buffer }[]>

Inherited from

Account.viewState

Defined in

account.ts:577