Skip to content

Trustline Management, Clawback Execution & Authorization Flag Inspector #81

Description

@grantfox-oss

Overview

Stellar's asset control features — AUTHORIZATION_REQUIRED, AUTHORIZATION_REVOCABLE, AUTHORIZATION_CLAWBACK_ENABLED, AUTHORIZATION_IMMUTABLE — and the associated operations (AllowTrust, SetTrustlineFlags, Clawback, ClawbackClaimableBalance) are among the least-understood parts of the protocol. Regulated asset issuers, stablecoin operators, and compliance teams all need these, but the operations are complex and easy to misconfigure. SaviTools should expose a full Asset Control workstation that lets an issuer inspect all trustlines for their asset, set authorization flags, execute clawbacks, and preview the exact operations before submitting.

What needs to be built

apps/api/src/modules/wallet/assetcontrol.service.ts

  • GET /wallet/asset/:code/:issuer/trustlines — fetches all accounts that hold a trustline to the specified asset; returns { trustlines: [{ account, balance, limit, authorized, authorizedToMaintainLiabilities, clawbackEnabled }] }

  • POST /wallet/asset/:code/:issuer/set-flags — accepts { account, flags: { authorized?, authorizedToMaintainLiabilities? } }: builds a SetTrustlineFlags operation; returns assembled XDR for the issuer to sign — never signs on behalf of the issuer

  • POST /wallet/asset/:code/:issuer/clawback — accepts { account, amount }:

    • Validates that the asset has AUTHORIZATION_CLAWBACK_ENABLED set on the issuer account — rejects with CLAWBACK_NOT_ENABLED if not
    • Builds a Clawback operation; returns assembled XDR
  • GET /wallet/asset/:code/:issuer/flags — fetches the issuer account from Horizon; returns parsed asset control flags: { authorizationRequired, authorizationRevocable, authorizationClawbackEnabled, authorizationImmutable }
    apps/web/src/app/sandbox/assetcontrol/

  • Asset selector: code + issuer public key input; "Load Asset" fetches flags and trustlines

  • Asset flags panel: four flag badges (colour-coded enabled/disabled); "Edit Flags" opens a form to set issuer account flags via SetOptions

  • Trustline table: all accounts holding this asset, with balance, limit, authorization status per row; per-row actions: "Authorize" / "Deauthorize" (builds SetTrustlineFlags XDR), "Clawback" (opens amount input, builds Clawback XDR)

  • XDR preview modal — shows the assembled operation(s) for review before the user copies to submit via the Transaction Composer

  • Search/filter on the trustline table: filter by authorization status, balance range, account address

Acceptance criteria

  • Trustline list correctly paginates and returns all holders for an asset with more than 200 trustline holders
  • Clawback operation is rejected with CLAWBACK_NOT_ENABLED when the issuer account does not have the clawback flag set — confirmed without any Horizon submission
  • SetTrustlineFlags XDR produced for deauthorization is a valid Stellar transaction — accepted by Horizon testnet when signed by the issuer
  • Asset flags panel correctly reads and displays all four flags from the issuer account — including AUTHORIZATION_IMMUTABLE which blocks further flag changes
  • Trustline table filter by authorized=false returns only unauthorised trustlines — correct even when the full list spans multiple Horizon pages
  • All XDR outputs open correctly in the Transaction Composer via a "Open in Composer" button

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions