api.client.AccountManagement - PolymeshAssociation/polymesh-sdk GitHub Wiki
@polymeshassociation/polymesh-sdk / api/client/AccountManagement
Defined in: api/client/AccountManagement.ts:59
Handles functionality related to Account Management
acceptPrimaryKey(
args,opts?):Promise<GenericPolymeshTransaction<void,void>>
Defined in: api/client/AccountManagement.ts:448
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.
| Parameter | Type |
|---|---|
args |
AcceptPrimaryKeyRotationParams |
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<void, void>>
The caller (new primary key) must be either a secondary key of the issuing identity, or unlinked to any identity.
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(
args,opts?):Promise<GenericPolymeshTransaction<void,void>>
Defined in: api/client/AccountManagement.ts:264
Accepts a pending subsidy request from subsidizer
| Parameter | Type |
|---|---|
args |
AcceptSubsidyParams |
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<void, void>>
Only the beneficiary can accept an already approved subsidy request. Pending subsidies for a beneficiary can be fetched by calling subsidies.getPendingSubsidies.
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(
args,opts?):Promise<GenericPolymeshTransaction<Identity,Identity>>
Defined in: api/client/AccountManagement.ts:182
Adds a list of secondary Accounts to the signing Identity
| Parameter | Type |
|---|---|
args |
AddSecondaryAccountsParams |
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<Identity, Identity>>
if the signing Account is not the primary Account of the Identity
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(
args,opts?):Promise<GenericPolymeshTransaction<void,void>>
Defined in: api/client/AccountManagement.ts:257
Approves a subsidy request
This is to be called in by the paying key to approve allowance with respect to a beneficiary key.
| Parameter | Type |
|---|---|
args |
SubsidizeAccountParams |
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<void, void>>
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 subsidies.getPendingSubsidies.
if same allowance amount is pending for acceptance with respect to same beneficiary
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(
args,opts?):Promise<GenericPolymeshTransaction<MultiSig,MultiSig>>
Defined in: api/client/AccountManagement.ts:280
Create a MultiSig Account
| Parameter | Type |
|---|---|
args |
CreateMultiSigParams |
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<MultiSig, MultiSig>>
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
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(
opts?):Promise<GenericPolymeshTransaction<void,void>>
Defined in: api/client/AccountManagement.ts:210
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
| Parameter | Type |
|---|---|
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<void, void>>
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(
args):Promise<`0x${string}`>
Defined in: api/client/AccountManagement.ts:457
Generate an offchain authorization signature with a specified signer
| Parameter | Type | Description |
|---|---|---|
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 |
Promise<`0x${string}`>
Defined in: api/client/AccountManagement.ts:354
Return an Account instance from an address. If the Account has multiSig signers, the returned value will be a MultiSig instance
| Parameter | Type |
|---|---|
args |
{ address: string; } |
args.address |
string |
getAccountBalance(
args?):Promise<AccountBalance>
Defined in: api/client/AccountManagement.ts:289
Get the free/locked POLYX balance of an Account
| Parameter | Type | Description |
|---|---|---|
args? |
{ account: string | Account; } |
- |
args.account? |
string | Account
|
The account to get balance for (defaults to the signing Account) |
Promise<AccountBalance>
The account's POLYX balance information
can be subscribed to, if connected to node using a web socket
getAccountBalance(
callback):Promise<UnsubCallback>
Defined in: api/client/AccountManagement.ts:298
Get the free/locked POLYX balance of the signing Account (with subscription)
| Parameter | Type | Description |
|---|---|---|
callback |
SubCallback<AccountBalance> |
Callback function to receive balance updates |
Promise<UnsubCallback>
An unsubscribe function
can be subscribed to, if connected to node using a web socket
getAccountBalance(
args,callback):Promise<UnsubCallback>
Defined in: api/client/AccountManagement.ts:308
Get the free/locked POLYX balance of an Account (with subscription)
| Parameter | Type | Description |
|---|---|---|
args |
{ account: string | Account; } |
- |
args.account |
string | Account
|
The account to get balance for |
callback |
SubCallback<AccountBalance> |
Callback function to receive balance updates |
Promise<UnsubCallback>
An unsubscribe function
can be subscribed to, if connected to node using a web socket
Defined in: api/client/AccountManagement.ts:374
Return the Account the chain credits for an Ethereum (H160) address, mirroring the revive
pallet's address mapper
- if the address has been mapped via mapEvmAccount, this is the Account that mapped it
- otherwise it is the fallback Account
ss58(<address> ++ [0xEE; 12]), which is also the Account controlled by the Ethereum key itself whenaddressis a native Ethereum address
| Parameter | Type | Description |
|---|---|---|
args |
{ evmAddress: string; } |
- |
args.evmAddress |
string |
20 byte hex encoded Ethereum address. Checksummed or not |
this always resolves to an Account, so the result alone does not say whether a mapping exists. Use Account.getEvmAddressDetails on the Account you expect for that
if evmAddress is not a 20 byte hex encoded address
getSigningAccount():
Account|null
Defined in: api/client/AccountManagement.ts:393
Return the signing Account, or null if no signing Account has been set
Account | null
getSigningAccounts():
Promise<Account[]>
Defined in: api/client/AccountManagement.ts:406
Return a list that contains all the signing Accounts associated to the SDK instance's Signing Manager
Promise<Account[]>
— if there is no Signing Manager attached to the SDK
getSubsidy(
args):Subsidy
Defined in: api/client/AccountManagement.ts:413
Return an Subsidy instance for a pair of beneficiary and subsidizer Account
| Parameter | Type |
|---|---|
args |
{ beneficiary: string | Account; subsidizer: string | Account; } |
args.beneficiary |
string | Account
|
args.subsidizer |
string | Account
|
inviteAccount(
args,opts?):Promise<GenericPolymeshTransaction<AuthorizationRequest,AuthorizationRequest>>
Defined in: api/client/AccountManagement.ts:205
Send an invitation to an Account to join the signing Identity as a secondary Account
| Parameter | Type |
|---|---|
args |
InviteAccountParams |
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<AuthorizationRequest, AuthorizationRequest>>
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
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(
args):boolean
Defined in: api/client/AccountManagement.ts:430
Returns true
| Parameter | Type | Description |
|---|---|---|
args |
{ address: string; } |
- |
args.address |
string |
is a valid ss58 address for the connected network |
boolean
leaveIdentity(
opts?):Promise<GenericPolymeshTransaction<void,void>>
Defined in: api/client/AccountManagement.ts:170
Disassociate the signing Account from its Identity. This operation can only be done if the signing Account is a secondary Account
| Parameter | Type |
|---|---|
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<void, void>>
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
mapEvmAccount(
opts?):Promise<GenericPolymeshTransaction<void,void>>
Defined in: api/client/AccountManagement.ts:234
Register the signing Account against its derived Ethereum address, so that the chain can resolve that address back to the Account
The derived address (see Account.evmAddress)
is keccak256 of the Account, which the chain cannot invert on its own. Until it is mapped,
anything sent to the address is credited to the fallback Account reported by
Account.getEvmAddressDetails
instead, and recovering it needs the chain's revive.dispatchAsFallbackAccount. Map the
Account before advertising the address or receiving funds at it
| Parameter | Type |
|---|---|
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<void, void>>
this takes a deposit from the signing Account, released by unmapEvmAccount
if the signing Account is Ethereum-derived — the chain resolves its address by stripping the padding, so there is nothing to map
if the signing Account is already mapped
this method is of type NoArgsProcedureMethod, which means you can call mapEvmAccount.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it
modifyPermissions(
args,opts?):Promise<GenericPolymeshTransaction<void,void>>
Defined in: api/client/AccountManagement.ts:196
Modify all permissions of a list of secondary Accounts associated with the signing Identity
| Parameter | Type |
|---|---|
args |
ModifySignerPermissionsParams |
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<void, void>>
if the signing Account is not the primary Account of the Identity whose secondary Account permissions are being modified
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(
args,opts?):Promise<GenericPolymeshTransaction<void,void>>
Defined in: api/client/AccountManagement.ts:175
Remove a list of secondary Accounts associated with the signing Identity
| Parameter | Type |
|---|---|
args |
RemoveSecondaryAccountsParams |
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<void, void>>
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(
args,opts?):Promise<GenericPolymeshTransaction<void,void>>
Defined in: api/client/AccountManagement.ts:189
Revoke all permissions of a list of secondary Accounts associated with the signing Identity
| Parameter | Type |
|---|---|
args |
{ secondaryAccounts: (string | Account)[]; } |
args.secondaryAccounts |
(string | Account)[] |
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<void, void>>
if the signing Account is not the primary Account of the Identity whose secondary Account permissions are being revoked
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(
args,opts?):Promise<GenericPolymeshTransaction<void,void>>
Defined in: api/client/AccountManagement.ts:271
Revokes an already approved subsidy request
| Parameter | Type |
|---|---|
args |
RevokeSubsidyParams |
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<void, void>>
Only the subsidizer can revoke an already approved subsidy request. Pending subsidies for a beneficiary can be fetched by calling subsidies.getPendingSubsidies.
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
unfreezeSecondaryAccounts(
opts?):Promise<GenericPolymeshTransaction<void,void>>
Defined in: api/client/AccountManagement.ts:215
Unfreeze all of the secondary Accounts in the signing Identity. This will restore their permissions as they were before being frozen
| Parameter | Type |
|---|---|
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<void, void>>
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
unmapEvmAccount(
opts?):Promise<GenericPolymeshTransaction<void,void>>
Defined in: api/client/AccountManagement.ts:246
Unregister the signing Account from its derived Ethereum address, releasing the deposit taken by mapEvmAccount
| Parameter | Type |
|---|---|
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<void, void>>
after this, the chain can no longer resolve the derived address back to the Account, so anything sent to it is credited to the fallback Account instead. Only do this for an Account that will no longer be used
if the signing Account is not mapped
this method is of type NoArgsProcedureMethod, which means you can call unmapEvmAccount.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it