Skip to content

[Stacks 2.1] Support PoX-2 for account STX balance locked state #1277

@zone117x

Description

@zone117x

The API currently uses the Stacks 2.0 stx_lock_event event to store and retrieve "locked" and "unlock_height" data when responding to account balance requests. This was implemented in #324 -- the account balance response is currently:

interface StxBalance {
  balance: string;
  total_sent: string;
  total_received: string;
  total_fees_sent: string;
  total_miner_rewards_received: string;
  /* [PoX] The transaction where the lock event occurred. Empty if no tokens are locked. */
  lock_tx_id: string;
  /* [PoX] The amount of locked STX, as string quoted micro-STX. Zero if no tokens are locked. */
  locked: string;
  /* [PoX] The STX chain block height of when the lock event occurred. Zero if no tokens are locked. */
  lock_height: number;
  /* [PoX] The burnchain block height of when the lock event occurred. Zero if no tokens are locked. */
  burnchain_lock_height: number;
  /* [PoX] The burnchain block height of when the tokens unlock. Zero if no tokens are locked. */
  burnchain_unlock_height: number;
}

PoX v2 introduces several new features, some already merged:

Some WIP:

It doesn't look like there are any new events (similar to stx_lock_event) for these new PoX operations -- can/will the various new operations just emit another stx_lock_event event. If so, does it make sense for the API use the same event to query for the latest locked state when returning stx balance data?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions