A representation of a staking operation (stake, unstake, claim stake, etc.). It may have multiple steps with some being transactions to sign, and others to wait.

Constructors

Properties

transactions: Transaction[]

Methods

  • Get signed voluntary exit messages for native eth unstaking

    Returns string[]

    The signed voluntary exit messages for a native eth unstaking operation.

  • Returns whether the Staking operation is in a complete state.

    Returns boolean

    Whether the Staking operation is in a complete state.

  • Returns whether the Staking operation is in a failed state.

    Returns boolean

    Whether the Staking operation is in a failed state.

  • Returns whether the Staking operation is in a terminal State.

    Returns boolean

    Whether the Staking operation is in a terminal State

  • loadTransactionsFromModel loads new unsigned transactions from the model into the transactions array. Note: For External Address model since tx signing and broadcast status happens by the end user and not our backend we need to be careful to not overwrite the transactions array with the response from the API. Ex: End user could have used stakingOperation.sign() method to sign the transactions, and we should not overwrite them with the response from the API. This however is ok to do so for the Wallet Address model since the transactions states are maintained by our backend. This method attempts to be safe for both address models, and only adds newly created unsigned transactions that are not already in the transactions array.

    Returns void

  • Reloads the StakingOperation model with the latest data from the server. If the StakingOperation object was created by an ExternalAddress then it will not have a wallet ID.

    Returns Promise<void>

    Throws

    if the API request to get the StakingOperation fails.

    Throws

    if this function is called on a StakingOperation without a wallet ID.

  • Sign the transactions in the StakingOperation object.

    Parameters

    • key: Wallet

      The key used to sign the transactions.

    Returns Promise<void>

  • Return a human-readable string representation of the StakingOperation object.

    Returns string

    The string representation of the StakingOperation object.

  • Waits until the Staking Operation is completed or failed by polling its status at the given interval.

    Parameters

    • options: {
          intervalSeconds: undefined | number;
          timeoutSeconds: undefined | number;
      } = {}

      The options to configure the wait function.

      • intervalSeconds: undefined | number

        The interval at which to poll, in seconds

      • timeoutSeconds: undefined | number

        The maximum amount of time to wait for the StakingOperation to complete, in seconds

    Returns Promise<StakingOperation>

    The completed StakingOperation object.

    Throws

    If the StakingOperation takes longer than the given timeout.

  • Get the staking operation for the given ID.

    Parameters

    • networkId: string

      The network ID.

    • addressId: string

      The address ID.

    • id: string

      The staking operation ID.

    • Optional walletId: string

      The wallet ID of the staking operation.

    Returns Promise<StakingOperation>

    The staking operation object.

    Throws

    If the wallet id is defined but empty.