@secondlayer/sdk 15.3.0 → 15.4.0

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.
@@ -3126,6 +3126,46 @@ type RuneBalancesListParams = ({
3126
3126
  cursor?: string | null;
3127
3127
  limit?: number;
3128
3128
  };
3129
+ /** A Bitcoin output that no transaction spends yet. */
3130
+ type BitcoinOutputUnspent = {
3131
+ txid: string;
3132
+ vout: number;
3133
+ spent: false;
3134
+ };
3135
+ /** A Bitcoin output that some transaction spends. The spend may
3136
+ * still be in the mempool (`mempool: true`) or in a block. */
3137
+ type BitcoinOutputSpent = {
3138
+ txid: string;
3139
+ vout: number;
3140
+ spent: true;
3141
+ /** Null for a confirmed spend deeper than the blocks a lookup reads
3142
+ * (144 below the tip); `note` says so. Still spent. */
3143
+ spending_txid: string | null;
3144
+ /** The spending input's index in `spending_txid`. */
3145
+ spending_vin: number | null;
3146
+ /** In a block of the active chain. */
3147
+ confirmed: boolean;
3148
+ /** Only in the mempool so far. */
3149
+ mempool: boolean;
3150
+ /** Null in the mempool. */
3151
+ block_height: number | null;
3152
+ block_hash: string | null;
3153
+ /** Why the spender is not named, when it isn't. */
3154
+ note?: string;
3155
+ };
3156
+ /** `GET /v1/bitcoin/outspend/{txid}/{vout}`. Narrow on `spent`. */
3157
+ type BitcoinOutspend = BitcoinOutputUnspent | BitcoinOutputSpent;
3158
+ /** `index.bitcoin`: reads answered live from the instance's Bitcoin node. */
3159
+ interface BitcoinResource {
3160
+ /**
3161
+ * Whether a Bitcoin output is spent, and by which transaction.
3162
+ *
3163
+ * A mempool spend shows on the next read (`mempool: true`); a confirmed
3164
+ * one names its block. Resolves to `null` on 404: no such transaction,
3165
+ * no output at `vout`, or an OP_RETURN output.
3166
+ */
3167
+ outspend(txid: string, vout: number): Promise<BitcoinOutspend | null>;
3168
+ }
3129
3169
  /** `index.runes` — the rune catalog, activity log, and balances. Runes is
3130
3170
  * more data on the existing Index plane, not a new product. Not configured
3131
3171
  * on hosted yet; every feed's `notes` says so when it isn't. Self-host with
@@ -3473,6 +3513,8 @@ declare class Index extends BaseClient {
3473
3513
  /** Rune catalog, activity and balances. Separate clock/reorg source from
3474
3514
  * the Stacks feeds above — see {@link RunesResource}. */
3475
3515
  readonly runes: RunesResource;
3516
+ /** Spend status of Bitcoin outputs. See {@link BitcoinResource}. */
3517
+ readonly bitcoin: BitcoinResource;
3476
3518
  private listFtTransfers;
3477
3519
  private listNftTransfers;
3478
3520
  /** Shared keyset-pagination loop for every `walk*` feed: seed the cursor from
@@ -3526,6 +3568,7 @@ declare class Index extends BaseClient {
3526
3568
  private walkPoxCycles;
3527
3569
  private getPoxCycle;
3528
3570
  private listRunes;
3571
+ private getBitcoinOutspend;
3529
3572
  private getRune;
3530
3573
  private listRuneActivity;
3531
3574
  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