Skip to content

[Agent: cross-repo-impact] Handle sweep_tx event in GetTransactionsStream + add sweptVtxos to TxNotification #375

@arkanaai

Description

@arkanaai

Context

arkd PR #988 (merged 2026-03-23) added two API changes that ts-sdk needs to implement:

1. New sweep_tx field in GetTransactionsStreamResponse (service.proto field 4)

message GetTransactionsStreamResponse {
  oneof data {
    TxNotification commitment_tx = 1;
    TxNotification ark_tx = 2;
    Heartbeat heartbeat = 3;
    TxNotification sweep_tx = 4;  // NEW
  }
}

2. New swept_vtxos field in TxNotification (types.proto field 6)

message TxNotification {
  // ... existing fields ...
  repeated Outpoint swept_vtxos = 6;  // NEW
}

Current state (verified 2026-05-22)

sweptVtxos is already handled in the subscription stream (getSubscription) in both:

  • providers/indexer.ts lines 508–510
  • providers/expoIndexer.ts lines 106–108

These cover the subscription stream, NOT the transactions stream.

Remaining work in src/providers/ark.ts

  1. TxNotification interface (line 175) — add sweptVtxos?: Outpoint[]
  2. getTransactionsStream return type (line 247–250) — add sweepTx?: TxNotification
  3. parseTransactionNotification() (lines 855–890) — add handler for data.sweepTx before the console.warn fallthrough

Required changes in src/providers/ark.ts

TxNotification interface

Add: sweptVtxos?: Outpoint[]

getTransactionsStream return type

getTransactionsStream(signal: AbortSignal): AsyncIterableIterator<{
    commitmentTx?: TxNotification;
    arkTx?: TxNotification;
    sweepTx?: TxNotification;  // ADD
}>;

parseTransactionNotification()

if (data.sweepTx) {
    return {
        sweepTx: {
            txid: data.sweepTx.txid,
            tx: data.sweepTx.tx,
            spentVtxos: data.sweepTx.spentVtxos.map(mapVtxo),
            spendableVtxos: data.sweepTx.spendableVtxos.map(mapVtxo),
            checkpointTxs: data.sweepTx.checkpointTxs,
            sweptVtxos: data.sweepTx.sweptVtxos || [],
        },
    };
}

Why it matters

Clients using getTransactionsStream will silently miss sweep events (dropped at console.warn). Swept VTXO outpoints are needed for wallet sync to mark outputs as swept.

Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions