@secondlayer/sdk 15.3.1 → 15.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -353,10 +353,9 @@ type ArchiveVerifyResult = {
353
353
  }>;
354
354
  reason?: string;
355
355
  };
356
+ import { ArchiveDataset } from "@secondlayer/shared/archive/datasets";
356
357
  import { RangeDigest } from "@secondlayer/shared/archive/range-digest";
357
358
  import { ArchiveStatus } from "@secondlayer/shared/archive/status";
358
- /** The three archive datasets: blocks, transactions, and events. */
359
- type ArchiveDataset = "blocks" | "transactions" | "events";
360
359
  /** Whether an archive purchase is a bootstrap or a repair. */
361
360
  type ArchiveFlow = "bootstrap" | "repair";
362
361
  /** One archive file: dataset, block range, path, rows, bytes. */
@@ -451,7 +450,7 @@ type ArchiveClient = {
451
450
  /**
452
451
  * List a loaded archive's partitions, optionally filtered.
453
452
  *
454
- * Runs locally on the manifest you already loaded and makes no request. Filter by `dataset` (`blocks`, `transactions`, or `events`) and a block range.
453
+ * Runs locally on the manifest you already loaded and makes no request. Filter by `dataset` (`blocks`, `transactions`, `events`, or `state_writes` when the archive publishes it) and a block range.
455
454
  */
456
455
  partitions(ref: LoadedArchive, filter?: {
457
456
  dataset?: ArchiveDataset;
@@ -3126,6 +3125,46 @@ type RuneBalancesListParams = ({
3126
3125
  cursor?: string | null;
3127
3126
  limit?: number;
3128
3127
  };
3128
+ /** A Bitcoin output that no transaction spends yet. */
3129
+ type BitcoinOutputUnspent = {
3130
+ txid: string;
3131
+ vout: number;
3132
+ spent: false;
3133
+ };
3134
+ /** A Bitcoin output that some transaction spends. The spend may
3135
+ * still be in the mempool (`mempool: true`) or in a block. */
3136
+ type BitcoinOutputSpent = {
3137
+ txid: string;
3138
+ vout: number;
3139
+ spent: true;
3140
+ /** Null for a confirmed spend deeper than the blocks a lookup reads
3141
+ * (144 below the tip); `note` says so. Still spent. */
3142
+ spending_txid: string | null;
3143
+ /** The spending input's index in `spending_txid`. */
3144
+ spending_vin: number | null;
3145
+ /** In a block of the active chain. */
3146
+ confirmed: boolean;
3147
+ /** Only in the mempool so far. */
3148
+ mempool: boolean;
3149
+ /** Null in the mempool. */
3150
+ block_height: number | null;
3151
+ block_hash: string | null;
3152
+ /** Why the spender is not named, when it isn't. */
3153
+ note?: string;
3154
+ };
3155
+ /** `GET /v1/bitcoin/outspend/{txid}/{vout}`. Narrow on `spent`. */
3156
+ type BitcoinOutspend = BitcoinOutputUnspent | BitcoinOutputSpent;
3157
+ /** `index.bitcoin`: reads answered live from the instance's Bitcoin node. */
3158
+ interface BitcoinResource {
3159
+ /**
3160
+ * Whether a Bitcoin output is spent, and by which transaction.
3161
+ *
3162
+ * A mempool spend shows on the next read (`mempool: true`); a confirmed
3163
+ * one names its block. Resolves to `null` on 404: no such transaction,
3164
+ * no output at `vout`, or an OP_RETURN output.
3165
+ */
3166
+ outspend(txid: string, vout: number): Promise<BitcoinOutspend | null>;
3167
+ }
3129
3168
  /** `index.runes` — the rune catalog, activity log, and balances. Runes is
3130
3169
  * more data on the existing Index plane, not a new product. Not configured
3131
3170
  * on hosted yet; every feed's `notes` says so when it isn't. Self-host with
@@ -3473,6 +3512,8 @@ declare class Index extends BaseClient {
3473
3512
  /** Rune catalog, activity and balances. Separate clock/reorg source from
3474
3513
  * the Stacks feeds above — see {@link RunesResource}. */
3475
3514
  readonly runes: RunesResource;
3515
+ /** Spend status of Bitcoin outputs. See {@link BitcoinResource}. */
3516
+ readonly bitcoin: BitcoinResource;
3476
3517
  private listFtTransfers;
3477
3518
  private listNftTransfers;
3478
3519
  /** Shared keyset-pagination loop for every `walk*` feed: seed the cursor from
@@ -3526,6 +3567,7 @@ declare class Index extends BaseClient {
3526
3567
  private walkPoxCycles;
3527
3568
  private getPoxCycle;
3528
3569
  private listRunes;
3570
+ private getBitcoinOutspend;
3529
3571
  private getRune;
3530
3572
  private listRuneActivity;
3531
3573
  private walkRuneActivity;
@@ -1818,6 +1818,9 @@ class Index extends BaseClient {
1818
1818
  walk: (params = {}) => this.walkRuneActivity(params)
1819
1819
  }
1820
1820
  };
1821
+ bitcoin = {
1822
+ outspend: (txid, vout) => this.getBitcoinOutspend(txid, vout)
1823
+ };
1821
1824
  async listFtTransfers(params = {}) {
1822
1825
  return this.request("GET", `/v1/index/ft-transfers${buildQuery({
1823
1826
  ...indexPageQuery(params),
@@ -2073,6 +2076,9 @@ class Index extends BaseClient {
2073
2076
  limit: params.limit
2074
2077
  })}`, undefined, { signal: params.signal });
2075
2078
  }
2079
+ async getBitcoinOutspend(txid, vout) {
2080
+ return this.requestOrNull("GET", `/v1/bitcoin/outspend/${encodeURIComponent(txid)}/${vout}`);
2081
+ }
2076
2082
  async getRune(rune) {
2077
2083
  return this.requestOrNull("GET", `/v1/index/runes/${encodeURIComponent(rune)}`);
2078
2084
  }
@@ -2836,5 +2842,5 @@ export {
2836
2842
  getSubgraph
2837
2843
  };
2838
2844
 
2839
- //# debugId=2B2B0CE3958DF43464756E2164756E21
2845
+ //# debugId=B52CC2088456848264756E2164756E21
2840
2846
  //# sourceMappingURL=index.js.map