Struct TransactionApi

Source
pub struct TransactionApi;

Implementations§

Source§

impl TransactionApi

Source

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 call
  • amount - Amount to stake
  • pool_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 + amount in account
  • Pool must be in [PoolState::Open] state
Source

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 call
  • pool_id - Target pool ID
  • extra - 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_other to bond pending rewards of other members
Source

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 call
  • member_account - Account to unbond from
  • pool_id - Target pool ID
  • unbonding_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.

Source

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 call
  • pool_id - Pool identifier
  • num_slashing_spans - Number of slashing spans to check
§Errors
  • [Error::PoolNotFound] - Pool does not exist
  • [Error::NotDestroying] - Pool is in destroying state
Source

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 call
  • member_account - Account to withdraw from
  • pool_id - Pool identifier
  • num_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.

Source

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 call
  • amount - Amount to delegate to the pool
  • root - Account to set as pool root
  • nominator - Account to set as pool nominator
  • bouncer - Account to set as pool bouncer
  • name - Optional pool name bounded by T::MaxNameLength
  • icon - Optional pool icon bounded by T::MaxIconLength
§Errors
  • [Error::OverflowRisk] - Pool ID increment would overflow
§Note

Caller must have amount + existential_deposit transferable funds.

Source

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 call
  • amount - Amount to delegate to the pool
  • root - Account to set as pool root
  • nominator - Account to set as pool nominator
  • bouncer - Account to set as pool bouncer
  • pool_id - Pool ID to reuse
  • name - Optional pool name
  • icon - 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.

Source

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 call
  • pool_id - Pool identifier
  • validators - 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.

Source

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 Destroying if pool fails ok_to_be_open conditions
§Arguments
  • origin - Origin of the call
  • pool_id - Pool identifier
  • state - 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.

Source

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 call
  • pool_id - Pool identifier
  • metadata - New metadata to set
§Errors
  • [Error::PoolNotFound] - Pool does not exist
  • [Error::MetadataExceedsMaxLen] - Metadata length exceeds maximum allowed
  • [Error::DoesNotHavePermission] - Caller lacks required permissions
Source

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 call
  • min_join_bond - Config operation for minimum bond to join a pool
  • min_create_bond - Config operation for minimum bond to create a pool
  • max_pools - Config operation for maximum number of pools
  • global_max_commission - Config operation for maximum global commission
§Errors
Source

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 call
  • pool_id - Pool identifier
  • new_root - New root role configuration
  • new_nominator - New nominator role configuration
  • new_bouncer - New bouncer role configuration
§Errors
  • [Error::PoolNotFound] - Pool does not exist
  • [Error::DoesNotHavePermission] - Origin does not have permission
Source

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 call
  • pool_id - Pool identifier
§Errors
  • [Error::PoolNotFound] - Pool does not exist
  • [Error::NotNominator] - Origin lacks nomination permission
Source

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 PermissionlessAll or PermissionlessCompound claim permissions
§Arguments
  • origin - The origin of the call
  • member - Pool member account to bond for
  • pool_id - Pool identifier
  • extra - 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
Source

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 call
  • pool_id - The pool identifier
  • new_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
Source

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 call
  • pool_id - The pool identifier
  • max_commission - The new maximum commission rate
§Errors
  • [Error::PoolNotFound] - The pool_id does not exist
  • [Error::DoesNotHavePermission] - Caller lacks commission management permission
Source

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.
Source

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.
Source

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.
Source

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.
Source

pub fn set_last_pool_id(&self, pool_id: PoolId) -> StaticPayload<SetLastPoolId>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Conv for T

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> FmtForward for T

Source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
Source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
Source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
Source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
Source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
Source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
Source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pipe for T
where T: ?Sized,

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
Source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows 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
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows 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
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
Source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .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
where Self: BorrowMut<B>, B: ?Sized,

Calls .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
where Self: AsRef<R>, R: ?Sized,

Calls .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
where Self: AsMut<R>, R: ?Sized,

Calls .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
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> JsonSchemaMaybe for T

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSendSync for T