API Reference

SUI API Overview

Endpoints

  • /stake: generates the staking transaction in hex.
  • /broadcast: broadcasts a signed transaction
  • /stakes: returns the list of SUI stake objects (with their staked_sui_id).
  • /withdraw: returns the withdraw transaction (using the staked_sui_id as one of the inputs), in hex

Flow

sequenceDiagram
    participant Staker
    participant Figment
  
Staker->>Figment: Calls /stake
Figment->>Staker: Returns an unsigned staking tx
Staker->>Staker: Signs the staking tx
Staker->>Figment: Calls /broadcast with the unsigned and signed staking txs
Figment->>Figment: Brodcasts the signed staking tx
Figment->>Staker: Returns the tx hash
Staker->>Figment: Calls /stakes
Figment->>Staker: Returns the list of stakes with SUI stake ids
Staker->>Figment: Calls /withdraw with a stake id
Figment->>Staker: Returns an unsigned withdraw tx
Staker->>Staker: Signs the withdraw tx
Staker->>Figment: Calls /broadcast with the unsigned and signed withdraw txs
Figment->>Figment: Brodcasts the signed withdraw tx
Figment->>Staker: Returns the tx hash