api.entities.Account.Staking - PolymeshAssociation/polymesh-sdk GitHub Wiki
@polymeshassociation/polymesh-sdk / api/entities/Account/Staking
api/entities/Account/Staking
Classes
Staking
Defined in: api/entities/Account/Staking/index.ts:34
Handles Account staking related functionality
Extends
Namespace<Account>
Methods
getCommission()
getCommission(
args?):Promise<StakingCommission|null>
Defined in: api/entities/Account/Staking/index.ts:260
Fetch the commission settings for this validator account
Parameters
| Parameter | Type | Description |
|---|---|---|
args? |
{ era?: BigNumber; } |
- |
args.era? |
BigNumber |
read the commission the Account was elected for in a past era, rather than the one it is currently advertising. Defaults to the current settings |
Returns
Promise<StakingCommission | null>
The commission details, or null if the Account is not seeking nominations as a
validator — or, when an era is given, was not in that era's validator set
Note
the two are different questions. Without an era this reads what the Account is
advertising now, which it can change at any time. With one it reads what it was actually
elected on, which is fixed for that era and is what its rewards were calculated against
getController()
Call Signature
getController():
Promise<Account|null>
Defined in: api/entities/Account/Staking/index.ts:193
Fetch the controller associated to this account if there is one
Returns
Promise<Account | null>
The controller account or null if the account is not a stash
Note
a stash can be its own controller
Call Signature
getController(
callback):Promise<UnsubCallback>
Defined in: api/entities/Account/Staking/index.ts:204
Fetch the controller associated to this account if there is one
Parameters
| Parameter | Type | Description |
|---|---|---|
callback |
SubCallback<Account | null> |
Callback function that can be used to listen for changes to the controller |
Returns
Promise<UnsubCallback>
The controller account or null if the account is not a stash
Note
can be subscribed to, if connected to node using a web socket
Note
a stash can be its own controller
getExposure()
getExposure(
args?):Promise<AccountExposure[]>
Defined in: api/entities/Account/Staking/index.ts:307
Fetch the validators this Account's stake backed in an era, and how much each one carried
Parameters
| Parameter | Type | Description |
|---|---|---|
args? |
{ era?: BigNumber; } |
- |
args.era? |
BigNumber |
defaults to the active era |
Returns
Promise<AccountExposure[]>
one entry per validator backed, or an empty array where the Account backed none. A
validator's own self-bond is not included — read that as own from
getEraExposure
Throws
if the era has no exposure recorded, such as one outside the chain's history depth
Note
an era's assignments are fixed when it is elected, so this can name a validator the Account no longer nominates. getNomination reads intent; this reads what the election assigned
Note
reads every exposure page in the era, so it costs one paged storage request over the whole validator set
getLedger()
getLedger():
Promise<StakingLedger|null>
Defined in: api/entities/Account/Staking/index.ts:40
Fetch the ledger information for a stash account
Returns
Promise<StakingLedger | null>
The staking ledger information or null if the account is not a controller
getNomination()
Call Signature
getNomination():
Promise<StakingNomination|null>
Defined in: api/entities/Account/Staking/index.ts:133
Fetch this account's current nominations
Returns
Promise<StakingNomination | null>
The nomination details or null if the account is not a controller
Call Signature
getNomination(
callback):Promise<UnsubCallback>
Defined in: api/entities/Account/Staking/index.ts:143
Fetch this account's current nominations
Parameters
| Parameter | Type | Description |
|---|---|---|
callback |
SubCallback<StakingNomination | null> |
Callback function that can be used to listen for changes to the nominations |
Returns
Promise<UnsubCallback>
The nomination details or null if the account is not a controller
Note
can be subscribed to, if connected to node using a web socket
getNominationQuota()
getNominationQuota(
args?):Promise<BigNumber>
Defined in: api/entities/Account/Staking/index.ts:351
Fetch how many validators this Account may nominate
Parameters
| Parameter | Type | Description |
|---|---|---|
args? |
{ bonded?: BigNumber; } |
- |
args.bonded? |
BigNumber |
the total POLYX that will be bonded, for bonding and nominating in one batch. Defaults to what the Account has bonded now, or to the chain's minimum nominator bond where it has none |
Returns
Promise<BigNumber>
Note
the chain derives the cap from the amount bonded, so it is read rather than assumed. On Polymesh v8 it is always 16 whatever the bond, but that is a runtime setting and can change
getPayee()
Call Signature
getPayee():
Promise<StakingPayee|null>
Defined in: api/entities/Account/Staking/index.ts:64
Fetch the payee that will receive a stash account's rewards
Returns
Promise<StakingPayee | null>
The payee account or null if the account is not a stash
Call Signature
getPayee(
callback):Promise<UnsubCallback>
Defined in: api/entities/Account/Staking/index.ts:74
Fetch the payee that will receive a stash account's rewards
Parameters
| Parameter | Type | Description |
|---|---|---|
callback |
SubCallback<StakingPayee | null> |
Callback function that can be used to listen for changes to the staking payee |
Returns
Promise<UnsubCallback>
The payee account or null if the account is not a stash
Note
can be subscribed to, if connected to node using a web socket