pub struct TransactionApi;Implementations§
Source§impl TransactionApi
impl TransactionApi
Sourcepub fn join(&self, amount: Amount, pool_id: PoolId) -> StaticPayload<Join>
pub fn join(&self, amount: Amount, pool_id: PoolId) -> StaticPayload<Join>
Stakes funds with a pool by transferring the bonded amount from member to pool account.
§Permissions
- Must be signed
§Arguments
origin- Origin of the callamount- Amount to stakepool_id- Target pool ID
§Errors
- [
Error::MinimumBondNotMet] - Amount below minimum bond - [
Error::PoolNotFound] - Pool does not exist - [
Error::DefensiveError] - Reward pool not found
§Note
- Member must have
existential deposit + amountin account - Pool must be in [
PoolState::Open] state
Sourcepub fn bond_extra(
&self,
pool_id: PoolId,
extra: Extra,
) -> StaticPayload<BondExtra>
pub fn bond_extra( &self, pool_id: PoolId, extra: Extra, ) -> StaticPayload<BondExtra>
Bond additional funds into an existing pool position.
Additional funds can come from either free balance or accumulated rewards. Automatically pays out all pending rewards.
§Arguments
origin- Origin of the callpool_id- Target pool IDextra- Source and amount of additional funds
§Permissions
- Must be signed
- Must have permission to bond extra if not self
§Errors
- [
Error::PoolNotFound] - Pool does not exist - [
Error::DoesNotHavePermission] - Caller lacks permission - [
Error::DefensiveError] - Reward pool not found
§Note
- This transaction prioritizes readability and correctness over optimization
- Multiple storage reads/writes are performed to reuse code
- See
bond_extra_otherto bond pending rewards of other members
Sourcepub fn unbond(
&self,
member_account: MemberAccount,
pool_id: PoolId,
unbonding_points: UnbondingPoints,
) -> StaticPayload<Unbond>
pub fn unbond( &self, member_account: MemberAccount, pool_id: PoolId, unbonding_points: UnbondingPoints, ) -> StaticPayload<Unbond>
Unbond points from a member’s pool position, collecting any pending rewards.
§Arguments
origin- Origin of the callmember_account- Account to unbond frompool_id- Target pool IDunbonding_points- Amount of points to unbond
§Permissions
- Permissionless if:
- Pool is blocked and caller is root/bouncer (kick)
- Pool is destroying and member is not depositor
- Pool is destroying, member is depositor, and pool is empty
- Permissioned (caller must be member) if:
- Caller is not depositor
- Caller is depositor, pool is destroying, and pool is empty
§Errors
- [
Error::PoolNotFound] - Pool does not exist - [
Error::NoBalanceToUnbond] - Member has insufficient points - [
Error::DefensiveError] - Not enough space in unbond pool
§Note
If no unlocking chunks are available, [Call::pool_withdraw_unbonded] can be called
first. The staking interface will attempt this automatically but may still return
NoMoreChunks if chunks cannot be released.
Sourcepub fn pool_withdraw_unbonded(
&self,
pool_id: PoolId,
num_slashing_spans: NumSlashingSpans,
) -> StaticPayload<PoolWithdrawUnbonded>
pub fn pool_withdraw_unbonded( &self, pool_id: PoolId, num_slashing_spans: NumSlashingSpans, ) -> StaticPayload<PoolWithdrawUnbonded>
Withdraws unbonded funds from the pool’s staking account.
Useful for clearing unlocking chunks when there are too many to call unbond.
Prevents NoMoreChunks errors from the staking system.
§Permissions
- Can be signed by any account
§Arguments
origin- Origin of the callpool_id- Pool identifiernum_slashing_spans- Number of slashing spans to check
§Errors
- [
Error::PoolNotFound] - Pool does not exist - [
Error::NotDestroying] - Pool is in destroying state
Sourcepub fn withdraw_unbonded(
&self,
member_account: MemberAccount,
pool_id: PoolId,
num_slashing_spans: NumSlashingSpans,
) -> StaticPayload<WithdrawUnbonded>
pub fn withdraw_unbonded( &self, member_account: MemberAccount, pool_id: PoolId, num_slashing_spans: NumSlashingSpans, ) -> StaticPayload<WithdrawUnbonded>
Withdraw unbonded funds from a member account.
§Permissions
- Permissionless if:
- Pool is in destroy mode and target is not depositor
- Target is depositor and only member in sub pools
- Pool is blocked and caller is root/bouncer
- Permissioned if caller is target and not depositor
§Arguments
origin- Origin of the callmember_account- Account to withdraw frompool_id- Pool identifiernum_slashing_spans- Number of slashing spans
§Errors
- [
Error::PoolMemberNotFound] - Member account not found - [
Error::PoolNotFound] - Pool does not exist - [
Error::SubPoolsNotFound] - Sub pools not found - [
Error::CannotWithdrawAny] - No unbonded funds available
If target is depositor, pool will be destroyed.
Sourcepub fn create(
&self,
amount: Amount,
root: Root,
nominator: Nominator,
bouncer: Bouncer,
name: Name,
icon: Icon,
) -> StaticPayload<Create>
pub fn create( &self, amount: Amount, root: Root, nominator: Nominator, bouncer: Bouncer, name: Name, icon: Icon, ) -> StaticPayload<Create>
Create a new delegation pool.
§Permissions
- Must be signed by the account that will become the initial depositor
§Arguments
origin- Origin of the callamount- Amount to delegate to the poolroot- Account to set as pool rootnominator- Account to set as pool nominatorbouncer- Account to set as pool bouncername- Optional pool name bounded byT::MaxNameLengthicon- Optional pool icon bounded byT::MaxIconLength
§Errors
- [
Error::OverflowRisk] - Pool ID increment would overflow
§Note
Caller must have amount + existential_deposit transferable funds.
Sourcepub fn create_with_pool_id(
&self,
amount: Amount,
root: Root,
nominator: Nominator,
bouncer: Bouncer,
pool_id: PoolId,
name: Name,
icon: Icon,
) -> StaticPayload<CreateWithPoolId>
pub fn create_with_pool_id( &self, amount: Amount, root: Root, nominator: Nominator, bouncer: Bouncer, pool_id: PoolId, name: Name, icon: Icon, ) -> StaticPayload<CreateWithPoolId>
Create a new delegation pool with a previously used pool ID.
§Permissions
- Must be signed by the account that will become the depositor
§Arguments
origin- Origin of the callamount- Amount to delegate to the poolroot- Account to set as pool rootnominator- Account to set as pool nominatorbouncer- Account to set as pool bouncerpool_id- Pool ID to reusename- Optional pool nameicon- Optional pool icon
§Errors
- [
Error::PoolIdInUse] - Pool ID is already in use - [
Error::InvalidPoolId] - Pool ID is greater than last pool ID
§Note
Caller must have amount + existential_deposit transferable funds.
Sourcepub fn nominate(
&self,
pool_id: PoolId,
validators: Validators,
) -> StaticPayload<Nominate>
pub fn nominate( &self, pool_id: PoolId, validators: Validators, ) -> StaticPayload<Nominate>
Nominate validators on behalf of the pool.
§Permissions
- Pool nominator or root role can nominate validators
§Arguments
origin- Origin of the callpool_id- Pool identifiervalidators- List of validator accounts to nominate
§Errors
- [
Error::PoolNotFound] - Pool does not exist - [
Error::NotNominator] - Caller lacks nominator permissions
§Note
Forwards nomination call to staking pallet using pool’s bonded account.
Sourcepub fn set_state(
&self,
pool_id: PoolId,
state: State,
) -> StaticPayload<SetState>
pub fn set_state( &self, pool_id: PoolId, state: State, ) -> StaticPayload<SetState>
Updates the state of a pool. Once a pool is in Destroying state, its state cannot be
changed again under any circumstances.
§Permissions
- Pool bouncer or root role can set any state
- Any account can set state to
Destroyingif pool failsok_to_be_openconditions
§Arguments
origin- Origin of the callpool_id- Pool identifierstate- New state to set
§Errors
- [
Error::PoolNotFound] - Pool does not exist - [
Error::CanNotChangeState] - Pool is in destroying state or caller lacks permissions
§Note
State changes are validated through ok_to_be_open which checks pool properties like
commission, member count and roles.
Sourcepub fn set_metadata(
&self,
pool_id: PoolId,
metadata: Metadata,
) -> StaticPayload<SetMetadata>
pub fn set_metadata( &self, pool_id: PoolId, metadata: Metadata, ) -> StaticPayload<SetMetadata>
Updates the metadata for a given pool.
§Permissions
- Must be called by the pool bouncer or root role
§Arguments
origin- Origin of the callpool_id- Pool identifiermetadata- New metadata to set
§Errors
- [
Error::PoolNotFound] - Pool does not exist - [
Error::MetadataExceedsMaxLen] - Metadata length exceeds maximum allowed - [
Error::DoesNotHavePermission] - Caller lacks required permissions
Sourcepub fn set_configs(
&self,
min_join_bond: MinJoinBond,
min_create_bond: MinCreateBond,
max_pools: MaxPools,
global_max_commission: GlobalMaxCommission,
) -> StaticPayload<SetConfigs>
pub fn set_configs( &self, min_join_bond: MinJoinBond, min_create_bond: MinCreateBond, max_pools: MaxPools, global_max_commission: GlobalMaxCommission, ) -> StaticPayload<SetConfigs>
Updates the global configuration parameters for nomination pools.
§Permissions
- Must be called by Root
§Arguments
origin- Origin of the callmin_join_bond- Config operation for minimum bond to join a poolmin_create_bond- Config operation for minimum bond to create a poolmax_pools- Config operation for maximum number of poolsglobal_max_commission- Config operation for maximum global commission
§Errors
DispatchError::BadOrigin- Caller is not Root
Sourcepub fn update_roles(
&self,
pool_id: PoolId,
new_root: NewRoot,
new_nominator: NewNominator,
new_bouncer: NewBouncer,
) -> StaticPayload<UpdateRoles>
pub fn update_roles( &self, pool_id: PoolId, new_root: NewRoot, new_nominator: NewNominator, new_bouncer: NewBouncer, ) -> StaticPayload<UpdateRoles>
Update the roles of a pool.
Updates root, nominator and bouncer roles for a given pool. The depositor role cannot be
changed. Emits a RolesUpdated event on successful update.
§Permissions
- Origin must be Root or pool root
§Arguments
origin- Origin of the callpool_id- Pool identifiernew_root- New root role configurationnew_nominator- New nominator role configurationnew_bouncer- New bouncer role configuration
§Errors
- [
Error::PoolNotFound] - Pool does not exist - [
Error::DoesNotHavePermission] - Origin does not have permission
Sourcepub fn chill(&self, pool_id: PoolId) -> StaticPayload<Chill>
pub fn chill(&self, pool_id: PoolId) -> StaticPayload<Chill>
Chill on behalf of the pool by forwarding the call to the staking pallet.
§Permissions
- Origin must be signed by pool nominator or root role
§Arguments
origin- The origin of the callpool_id- Pool identifier
§Errors
- [
Error::PoolNotFound] - Pool does not exist - [
Error::NotNominator] - Origin lacks nomination permission
Sourcepub fn bond_extra_other(
&self,
member: Member,
pool_id: PoolId,
extra: Extra,
) -> StaticPayload<BondExtraOther>
pub fn bond_extra_other( &self, member: Member, pool_id: PoolId, extra: Extra, ) -> StaticPayload<BondExtraOther>
Bond additional funds for a pool member into their respective pool.
§Permissions
- Origin must match member account for bonding from free balance/pending rewards
- Any origin can bond from pending rewards if member has
PermissionlessAllorPermissionlessCompoundclaim permissions
§Arguments
origin- The origin of the callmember- Pool member account to bond forpool_id- Pool identifierextra- Amount to bond from free balance or pending rewards
§Errors
- [
Error::PoolNotFound] - Pool does not exist - [
Error::PoolMemberNotFound] - Account is not a member of pool - [
Error::NoPermission] - Origin lacks permission to bond for member
Sourcepub fn set_commission(
&self,
pool_id: PoolId,
new_commission: NewCommission,
) -> StaticPayload<SetCommission>
pub fn set_commission( &self, pool_id: PoolId, new_commission: NewCommission, ) -> StaticPayload<SetCommission>
Set or remove the commission rate and payee for a pool.
§Permissions
- Caller must have commission management permission for the pool
§Arguments
origin- The origin of the callpool_id- The pool identifiernew_commission- Optional commission rate and payee. None removes existing commission
§Errors
- [
Error::PoolNotFound] - The pool_id does not exist - [
Error::DoesNotHavePermission] - Caller lacks commission management permission
Sourcepub fn set_commission_max(
&self,
pool_id: PoolId,
max_commission: MaxCommission,
) -> StaticPayload<SetCommissionMax>
pub fn set_commission_max( &self, pool_id: PoolId, max_commission: MaxCommission, ) -> StaticPayload<SetCommissionMax>
Set the maximum commission rate for a pool. Initial max can be set to any value, with only lower values allowed thereafter. Current commission will be reduced if above new max.
§Permissions
- Caller must have commission management permission for the pool
§Arguments
origin- The origin of the callpool_id- The pool identifiermax_commission- The new maximum commission rate
§Errors
- [
Error::PoolNotFound] - The pool_id does not exist - [
Error::DoesNotHavePermission] - Caller lacks commission management permission
Sourcepub fn set_commission_change_rate(
&self,
pool_id: PoolId,
change_rate: ChangeRate,
) -> StaticPayload<SetCommissionChangeRate>
pub fn set_commission_change_rate( &self, pool_id: PoolId, change_rate: ChangeRate, ) -> StaticPayload<SetCommissionChangeRate>
Set the commission change rate for a pool.
Initial change rate is not bounded, whereas subsequent updates can only be more restrictive than the current.
§Arguments
origin- The origin of the call. Must be signed by an account with commission management permission.pool_id- The identifier of the pool to set commission change rate for.change_rate- The new commission change rate configuration.
Sourcepub fn claim_commission(
&self,
pool_id: PoolId,
) -> StaticPayload<ClaimCommission>
pub fn claim_commission( &self, pool_id: PoolId, ) -> StaticPayload<ClaimCommission>
Claim pending commission for a pool.
The dispatch origin of this call must be signed by an account with commission claim permission. Pending commission is paid out and added to total claimed commission. Total pending commission is reset to zero.
§Arguments
origin- The origin of the call. Must be signed by an account with commission claim permission.pool_id- The identifier of the pool to claim commission from.
Sourcepub fn adjust_pool_deposit(
&self,
pool_id: PoolId,
) -> StaticPayload<AdjustPoolDeposit>
pub fn adjust_pool_deposit( &self, pool_id: PoolId, ) -> StaticPayload<AdjustPoolDeposit>
Top up the deficit or withdraw the excess ED from the pool.
When a pool is created, the pool depositor transfers ED to the reward account of the pool. ED is subject to change and over time, the deposit in the reward account may be insufficient to cover the ED deficit of the pool or vice-versa where there is excess deposit to the pool. This call allows anyone to adjust the ED deposit of the pool by either topping up the deficit or claiming the excess.
§Arguments
origin- The origin of the call. Must be signed.pool_id- The identifier of the pool to adjust the deposit for.
Sourcepub fn set_commission_claim_permission(
&self,
pool_id: PoolId,
permission: Permission,
) -> StaticPayload<SetCommissionClaimPermission>
pub fn set_commission_claim_permission( &self, pool_id: PoolId, permission: Permission, ) -> StaticPayload<SetCommissionClaimPermission>
Set or remove a pool’s commission claim permission.
Only the Root role of the pool is able to configure commission claim permissions.
This determines which accounts are allowed to claim the pool’s pending commission.
§Arguments
origin- The origin of the call. Must be signed by the pool’s root account.pool_id- The identifier of the pool to set permissions for.permission- Optional commission claim permission configuration. If None, removes any existing permission.
pub fn set_last_pool_id(&self, pool_id: PoolId) -> StaticPayload<SetLastPoolId>
Auto Trait Implementations§
impl Freeze for TransactionApi
impl RefUnwindSafe for TransactionApi
impl Send for TransactionApi
impl Sync for TransactionApi
impl Unpin for TransactionApi
impl UnwindSafe for TransactionApi
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.