Skip to main content
Version: 30.0.x

Class: AccountManagement

Defined in: src/api/client/AccountManagement.ts:52

Handles functionality related to Account Management

Methods

acceptPrimaryKey()

acceptPrimaryKey(args: AcceptPrimaryKeyRotationParams, opts?: ProcedureOpts): Promise<GenericPolymeshTransaction<void, void>>

Defined in: src/api/client/AccountManagement.ts:383

Accepts the authorization to become the new primary key of the issuing identity.

If a CDD service provider approved this change (or this is not required), primary key of the Identity is updated.

Parameters

ParameterType

args

AcceptPrimaryKeyRotationParams

opts?

ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

The caller (new primary key) must be either a secondary key of the issuing identity, or unlinked to any identity.

Note

this method is of type ProcedureMethod, which means you can call acceptPrimaryKey.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it


acceptSubsidy()

acceptSubsidy(args: AcceptSubsidyParams, opts?: ProcedureOpts): Promise<GenericPolymeshTransaction<void, void>>

Defined in: src/api/client/AccountManagement.ts:230

Accepts a pending subsidy request from subsidizer

Parameters

ParameterType

args

AcceptSubsidyParams

opts?

ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

Only the beneficiary can accept an already approved subsidy request. Pending subsidies for a beneficiary can be fetched by calling subsides.getPendingSubsidies.

Note

this is only available from chain v8

Note

this method is of type ProcedureMethod, which means you can call acceptSubsidy.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it


addSecondaryAccounts()

addSecondaryAccounts(args: AddSecondaryAccountsParams, opts?: ProcedureOpts): Promise<GenericPolymeshTransaction<Identity, Identity>>

Defined in: src/api/client/AccountManagement.ts:165

Adds a list of secondary Accounts to the signing Identity

Parameters

ParameterType

args

AddSecondaryAccountsParams

opts?

ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<Identity, Identity>>

Throws

if the signing Account is not the primary Account of the Identity

Note

this method is of type ProcedureMethod, which means you can call addSecondaryAccounts.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it


approveSubsidy()

approveSubsidy(args: SubsidizeAccountParams, opts?: ProcedureOpts): Promise<GenericPolymeshTransaction<void, void>>

Defined in: src/api/client/AccountManagement.ts:222

Approves a subsidy request

This is to be called in by the paying key to approve allowance with respect to a beneficiary key.

Parameters

ParameterType

args

SubsidizeAccountParams

opts?

ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

this will create a pending subsidies entry, which has to be accepted by the beneficiary Account. Pending subsidies for a beneficiary can be fetched by calling subsides.getPendingSubsidies.

Throws

  • if called for a v7 chain
  • if same allowance amount is pending for acceptance with respect to same beneficiary

Note

this method is of type ProcedureMethod, which means you can call approveSubsidy.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it


createMultiSigAccount()

createMultiSigAccount(args: CreateMultiSigParams, opts?: ProcedureOpts): Promise<GenericPolymeshTransaction<MultiSig, MultiSig>>

Defined in: src/api/client/AccountManagement.ts:247

Create a MultiSig Account

Parameters

ParameterType

args

CreateMultiSigParams

opts?

ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<MultiSig, MultiSig>>

Note

this will create an Authorization Request for each signing Account which will have to be accepted before they can approve transactions. None of the signing Accounts can be associated with an Identity when accepting the Authorization An Account or Identity can fetch its pending Authorization Requests by calling authorizations.getReceived. Also, an Account or Identity can directly fetch the details of an Authorization Request by calling authorizations.getOne

Note

this method is of type ProcedureMethod, which means you can call createMultiSigAccount.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it


freezeSecondaryAccounts()

freezeSecondaryAccounts(opts?: ProcedureOpts): Promise<GenericPolymeshTransaction<void, void>>

Defined in: src/api/client/AccountManagement.ts:193

Freeze all of the secondary Accounts in the signing Identity. This means revoking their permission to perform any operation on the blockchain and freezing their funds until the Accounts are unfrozen via unfreezeSecondaryAccounts

Parameters

ParameterType

opts?

ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

this method is of type NoArgsProcedureMethod, which means you can call freezeSecondaryAccounts.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it


generateOffChainAuthSignature()

generateOffChainAuthSignature(args: object): Promise<`0x${string}`>

Defined in: src/api/client/AccountManagement.ts:392

Generate an offchain authorization signature with a specified signer

Parameters

ParameterTypeDescription

args

{ expiry: Date; signer: string | Account; target: string | Identity; }

args.expiry

Date

date after which the authorization expires

args.signer

string | Account

Signer to be used to generate the off chain auth signature

args.target

string | Identity

DID of the identity to which signer is targeting the authorization

Returns

Promise<`0x${string}`>


getAccount()

getAccount(args: object): Promise<Account | MultiSig>

Defined in: src/api/client/AccountManagement.ts:321

Return an Account instance from an address. If the Account has multiSig signers, the returned value will be a MultiSig instance

Parameters

ParameterType

args

{ address: string; }

args.address

string

Returns

Promise<Account | MultiSig>


getAccountBalance()

Call Signature

getAccountBalance(args?: object): Promise<Balance>

Defined in: src/api/client/AccountManagement.ts:256

Get the free/locked POLYX balance of an Account

Parameters
ParameterTypeDescription

args?

{ account: string | Account; }

args.account?

string | Account

The account to get balance for (defaults to the signing Account)

Returns

Promise<Balance>

The account's POLYX balance information

Note

can be subscribed to, if connected to node using a web socket

Call Signature

getAccountBalance(callback: SubCallback<Balance>): Promise<UnsubCallback>

Defined in: src/api/client/AccountManagement.ts:265

Get the free/locked POLYX balance of the signing Account (with subscription)

Parameters
ParameterTypeDescription

callback

SubCallback<Balance>

Callback function to receive balance updates

Returns

Promise<UnsubCallback>

An unsubscribe function

Note

can be subscribed to, if connected to node using a web socket

Call Signature

getAccountBalance(args: object, callback: SubCallback<Balance>): Promise<UnsubCallback>

Defined in: src/api/client/AccountManagement.ts:275

Get the free/locked POLYX balance of an Account (with subscription)

Parameters
ParameterTypeDescription

args

{ account: string | Account; }

args.account

string | Account

The account to get balance for

callback

SubCallback<Balance>

Callback function to receive balance updates

Returns

Promise<UnsubCallback>

An unsubscribe function

Note

can be subscribed to, if connected to node using a web socket


getSigningAccount()

getSigningAccount(): Account | null

Defined in: src/api/client/AccountManagement.ts:328

Return the signing Account, or null if no signing Account has been set

Returns

Account | null


getSigningAccounts()

getSigningAccounts(): Promise<Account[]>

Defined in: src/api/client/AccountManagement.ts:341

Return a list that contains all the signing Accounts associated to the SDK instance's Signing Manager

Returns

Promise<Account[]>

Throws

— if there is no Signing Manager attached to the SDK


getSubsidy()

getSubsidy(args: object): Subsidy

Defined in: src/api/client/AccountManagement.ts:348

Return an Subsidy instance for a pair of beneficiary and subsidizer Account

Parameters

ParameterType

args

{ beneficiary: string | Account; subsidizer: string | Account; }

args.beneficiary

string | Account

args.subsidizer

string | Account

Returns

Subsidy


inviteAccount()

inviteAccount(args: InviteAccountParams, opts?: ProcedureOpts): Promise<GenericPolymeshTransaction<AuthorizationRequest, AuthorizationRequest>>

Defined in: src/api/client/AccountManagement.ts:188

Send an invitation to an Account to join the signing Identity as a secondary Account

Parameters

ParameterType

args

InviteAccountParams

opts?

ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<AuthorizationRequest, AuthorizationRequest>>

Note

this will create an Authorization Request which has to be accepted by the targetAccount. An Account or Identity can fetch its pending Authorization Requests by calling authorizations.getReceived. Also, an Account or Identity can directly fetch the details of an Authorization Request by calling authorizations.getOne

Note

this method is of type ProcedureMethod, which means you can call inviteAccount.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it


isValidAddress()

isValidAddress(args: object): boolean

Defined in: src/api/client/AccountManagement.ts:365

Returns true

Parameters

ParameterTypeDescription

args

{ address: string; }

args.address

string

is a valid ss58 address for the connected network

Returns

boolean


leaveIdentity()

leaveIdentity(opts?: ProcedureOpts): Promise<GenericPolymeshTransaction<void, void>>

Defined in: src/api/client/AccountManagement.ts:153

Disassociate the signing Account from its Identity. This operation can only be done if the signing Account is a secondary Account

Parameters

ParameterType

opts?

ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

this method is of type NoArgsProcedureMethod, which means you can call leaveIdentity.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it


modifyPermissions()

modifyPermissions(args: ModifySignerPermissionsParams, opts?: ProcedureOpts): Promise<GenericPolymeshTransaction<void, void>>

Defined in: src/api/client/AccountManagement.ts:179

Modify all permissions of a list of secondary Accounts associated with the signing Identity

Parameters

ParameterType

args

ModifySignerPermissionsParams

opts?

ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<void, void>>

Throws

if the signing Account is not the primary Account of the Identity whose secondary Account permissions are being modified

Note

this method is of type ProcedureMethod, which means you can call modifyPermissions.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it


removeSecondaryAccounts()

removeSecondaryAccounts(args: RemoveSecondaryAccountsParams, opts?: ProcedureOpts): Promise<GenericPolymeshTransaction<void, void>>

Defined in: src/api/client/AccountManagement.ts:158

Remove a list of secondary Accounts associated with the signing Identity

Parameters

ParameterType

args

RemoveSecondaryAccountsParams

opts?

ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

this method is of type ProcedureMethod, which means you can call removeSecondaryAccounts.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it


revokePermissions()

revokePermissions(args: object, opts?: ProcedureOpts): Promise<GenericPolymeshTransaction<void, void>>

Defined in: src/api/client/AccountManagement.ts:172

Revoke all permissions of a list of secondary Accounts associated with the signing Identity

Parameters

ParameterType

args

{ secondaryAccounts: (string | Account)[]; }

args.secondaryAccounts

(string | Account)[]

opts?

ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<void, void>>

Throws

if the signing Account is not the primary Account of the Identity whose secondary Account permissions are being revoked

Note

this method is of type ProcedureMethod, which means you can call revokePermissions.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it


revokeSubsidy()

revokeSubsidy(args: RevokeSubsidyParams, opts?: ProcedureOpts): Promise<GenericPolymeshTransaction<void, void>>

Defined in: src/api/client/AccountManagement.ts:238

Revokes an already approved subsidy request

Parameters

ParameterType

args

RevokeSubsidyParams

opts?

ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

Only the subsidizer can revoke an already approved subsidy request. Pending subsidies for a beneficiary can be fetched by calling subsides.getPendingSubsidies.

Note

this is only available from chain v8

Note

this method is of type ProcedureMethod, which means you can call revokeSubsidy.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it


subsidizeAccount()

subsidizeAccount(args: SubsidizeAccountParams, opts?: ProcedureOpts): Promise<GenericPolymeshTransaction<AuthorizationRequest, AuthorizationRequest>>

Defined in: src/api/client/AccountManagement.ts:209

Send an Authorization Request to an Account to subsidize its transaction fees

Parameters

ParameterType

args

SubsidizeAccountParams

opts?

ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<AuthorizationRequest, AuthorizationRequest>>

Note

this will create an Authorization Request which has to be accepted by the beneficiary Account. An Account or Identity can fetch its pending Authorization Requests by calling authorizations.getReceived. Also, an Account or Identity can directly fetch the details of an Authorization Request by calling authorizations.getOne

Deprecated

use approveSubsidy instead from chain v8

Note

this method is of type ProcedureMethod, which means you can call subsidizeAccount.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it


unfreezeSecondaryAccounts()

unfreezeSecondaryAccounts(opts?: ProcedureOpts): Promise<GenericPolymeshTransaction<void, void>>

Defined in: src/api/client/AccountManagement.ts:198

Unfreeze all of the secondary Accounts in the signing Identity. This will restore their permissions as they were before being frozen

Parameters

ParameterType

opts?

ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

this method is of type NoArgsProcedureMethod, which means you can call unfreezeSecondaryAccounts.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it