@secretkeylabs/stacks-tools 0.7.0-3be878c → 0.7.0-6184ecb

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.
package/dist/index.cjs CHANGED
@@ -223,28 +223,6 @@ var baseListResponseSchema = v2.object({
223
223
  });
224
224
 
225
225
  // src/stacks-api/blocks/get-block.ts
226
- var v3 = __toESM(require("valibot"), 1);
227
- var responseSchema2 = v3.object({
228
- canonical: v3.boolean(),
229
- height: v3.number(),
230
- hash: v3.string(),
231
- block_time: v3.number(),
232
- block_time_iso: v3.string(),
233
- index_block_hash: v3.string(),
234
- parent_block_hash: v3.string(),
235
- parent_index_block_hash: v3.string(),
236
- burn_block_time: v3.number(),
237
- burn_block_time_iso: v3.string(),
238
- burn_block_hash: v3.string(),
239
- burn_block_height: v3.number(),
240
- miner_txid: v3.string(),
241
- tx_count: v3.number(),
242
- execution_cost_read_count: v3.number(),
243
- execution_cost_read_length: v3.number(),
244
- execution_cost_runtime: v3.number(),
245
- execution_cost_write_count: v3.number(),
246
- execution_cost_write_length: v3.number()
247
- });
248
226
  async function getBlock(opts) {
249
227
  const init = {};
250
228
  if (opts.apiKeyConfig) {
@@ -252,10 +230,8 @@ async function getBlock(opts) {
252
230
  [opts.apiKeyConfig.header]: opts.apiKeyConfig.key
253
231
  };
254
232
  }
255
- const res = await fetch(
256
- `${opts.baseUrl}/extended/v2/blocks/${opts.heightOrHash}`,
257
- init
258
- );
233
+ const endpoint = `${opts.baseUrl}/extended/v2/blocks/${opts.heightOrHash}`;
234
+ const res = await fetch(endpoint, init);
259
235
  if (!res.ok) {
260
236
  return error({
261
237
  name: "FetchBlockError",
@@ -275,15 +251,7 @@ async function getBlock(opts) {
275
251
  data: jsonError
276
252
  });
277
253
  }
278
- const validationResult = v3.safeParse(responseSchema2, data);
279
- if (!validationResult.success) {
280
- return error({
281
- name: "ValidateDataError",
282
- message: "Failed to validate data.",
283
- data: validationResult
284
- });
285
- }
286
- return success(validationResult.output);
254
+ return success(data);
287
255
  }
288
256
 
289
257
  // src/stacks-api/blocks/index.ts
@@ -291,6 +259,44 @@ var blocks = {
291
259
  getBlock
292
260
  };
293
261
 
262
+ // src/stacks-api/burn-blocks/get-burn-block.ts
263
+ async function getBurnBlock(args) {
264
+ const init = {};
265
+ if (args.apiKeyConfig) {
266
+ init.headers = {
267
+ [args.apiKeyConfig.header]: args.apiKeyConfig.key
268
+ };
269
+ }
270
+ const endpoint = `${args.baseUrl}/extended/v2/burn-blocks/${args.heightOrHash}`;
271
+ const res = await fetch(endpoint, init);
272
+ if (!res.ok) {
273
+ return error({
274
+ name: "BurnBlockGetError",
275
+ message: "Failed to get burn block.",
276
+ data: {
277
+ heightOrHash: args.heightOrHash,
278
+ status: res.status,
279
+ statusText: res.statusText,
280
+ body: await safeExtractResponseBody(res)
281
+ }
282
+ });
283
+ }
284
+ const [jsonParseError, data] = await safePromise(res.json());
285
+ if (jsonParseError) {
286
+ return error({
287
+ name: "ParseBodyError",
288
+ message: "Failed to parse response body as JSON.",
289
+ data: jsonParseError
290
+ });
291
+ }
292
+ return success(data);
293
+ }
294
+
295
+ // src/stacks-api/burn-blocks/index.ts
296
+ var burnBlocks = {
297
+ getBurnBlock
298
+ };
299
+
294
300
  // src/stacks-api/faucets/stx.ts
295
301
  async function stx(opts) {
296
302
  const search = new URLSearchParams();
@@ -333,22 +339,22 @@ var faucets = {
333
339
  };
334
340
 
335
341
  // src/stacks-api/info/core-api.ts
336
- var v4 = __toESM(require("valibot"), 1);
337
- var CoreApiResponseSchema = v4.object({
338
- peer_version: v4.number(),
339
- pox_consensus: v4.string(),
340
- burn_block_height: v4.number(),
341
- stable_pox_consensus: v4.string(),
342
- stable_burn_block_height: v4.number(),
343
- server_version: v4.string(),
344
- network_id: v4.number(),
345
- parent_network_id: v4.number(),
346
- stacks_tip_height: v4.number(),
347
- stacks_tip: v4.string(),
348
- stacks_tip_consensus_hash: v4.string(),
349
- unanchored_tip: v4.nullable(v4.string()),
350
- unanchored_seq: v4.nullable(v4.string()),
351
- exit_at_block_height: v4.nullable(v4.number())
342
+ var v3 = __toESM(require("valibot"), 1);
343
+ var CoreApiResponseSchema = v3.object({
344
+ peer_version: v3.number(),
345
+ pox_consensus: v3.string(),
346
+ burn_block_height: v3.number(),
347
+ stable_pox_consensus: v3.string(),
348
+ stable_burn_block_height: v3.number(),
349
+ server_version: v3.string(),
350
+ network_id: v3.number(),
351
+ parent_network_id: v3.number(),
352
+ stacks_tip_height: v3.number(),
353
+ stacks_tip: v3.string(),
354
+ stacks_tip_consensus_hash: v3.string(),
355
+ unanchored_tip: v3.nullable(v3.string()),
356
+ unanchored_seq: v3.nullable(v3.string()),
357
+ exit_at_block_height: v3.nullable(v3.number())
352
358
  });
353
359
  async function coreApi(apiOpts) {
354
360
  const init = {};
@@ -377,7 +383,7 @@ async function coreApi(apiOpts) {
377
383
  data: parseBodyError
378
384
  });
379
385
  }
380
- const validationResult = v4.safeParse(CoreApiResponseSchema, data);
386
+ const validationResult = v3.safeParse(CoreApiResponseSchema, data);
381
387
  if (!validationResult.success) {
382
388
  return error({
383
389
  name: "ValidateDataError",
@@ -394,14 +400,14 @@ var info = {
394
400
  };
395
401
 
396
402
  // src/stacks-api/proof-of-transfer/cycle.ts
397
- var v5 = __toESM(require("valibot"), 1);
398
- var responseSchema3 = v5.object({
399
- block_height: v5.number(),
400
- index_block_hash: v5.string(),
401
- cycle_number: v5.number(),
402
- total_weight: v5.number(),
403
- total_stacked_amount: v5.string(),
404
- total_signers: v5.number()
403
+ var v4 = __toESM(require("valibot"), 1);
404
+ var responseSchema2 = v4.object({
405
+ block_height: v4.number(),
406
+ index_block_hash: v4.string(),
407
+ cycle_number: v4.number(),
408
+ total_weight: v4.number(),
409
+ total_stacked_amount: v4.string(),
410
+ total_signers: v4.number()
405
411
  });
406
412
  async function cycle(opts) {
407
413
  const init = {};
@@ -432,7 +438,7 @@ async function cycle(opts) {
432
438
  data: jsonError
433
439
  });
434
440
  }
435
- const validationResult = v5.safeParse(responseSchema3, data);
441
+ const validationResult = v4.safeParse(responseSchema2, data);
436
442
  if (!validationResult.success) {
437
443
  return error({
438
444
  name: "ValidateDataError",
@@ -444,17 +450,17 @@ async function cycle(opts) {
444
450
  }
445
451
 
446
452
  // src/stacks-api/proof-of-transfer/cycles.ts
447
- var v6 = __toESM(require("valibot"), 1);
448
- var cycleInfoSchema = v6.object({
449
- block_height: v6.number(),
450
- index_block_hash: v6.string(),
451
- cycle_number: v6.number(),
452
- total_weight: v6.number(),
453
- total_stacked_amount: v6.string(),
454
- total_signers: v6.number()
453
+ var v5 = __toESM(require("valibot"), 1);
454
+ var cycleInfoSchema = v5.object({
455
+ block_height: v5.number(),
456
+ index_block_hash: v5.string(),
457
+ cycle_number: v5.number(),
458
+ total_weight: v5.number(),
459
+ total_stacked_amount: v5.string(),
460
+ total_signers: v5.number()
455
461
  });
456
- var resultsSchema = v6.array(cycleInfoSchema);
457
- var cyclesResponseSchema = v6.object({
462
+ var resultsSchema = v5.array(cycleInfoSchema);
463
+ var cyclesResponseSchema = v5.object({
458
464
  ...baseListResponseSchema.entries,
459
465
  results: resultsSchema
460
466
  });
@@ -490,7 +496,7 @@ async function cycles(args) {
490
496
  data: jsonError
491
497
  });
492
498
  }
493
- const validationResult = v6.safeParse(cyclesResponseSchema, data);
499
+ const validationResult = v5.safeParse(cyclesResponseSchema, data);
494
500
  if (!validationResult.success) {
495
501
  return error({
496
502
  name: "ValidateDataError",
@@ -502,16 +508,16 @@ async function cycles(args) {
502
508
  }
503
509
 
504
510
  // src/stacks-api/proof-of-transfer/signer-in-cycle.ts
505
- var v7 = __toESM(require("valibot"), 1);
506
- var signerInCycleResponseSchema = v7.object({
507
- signing_key: v7.string(),
508
- signer_address: v7.string(),
509
- weight: v7.number(),
510
- stacked_amount: v7.string(),
511
- weight_percent: v7.number(),
512
- stacked_amount_percent: v7.number(),
513
- solo_stacker_count: v7.number(),
514
- pooled_stacker_count: v7.number()
511
+ var v6 = __toESM(require("valibot"), 1);
512
+ var signerInCycleResponseSchema = v6.object({
513
+ signing_key: v6.string(),
514
+ signer_address: v6.string(),
515
+ weight: v6.number(),
516
+ stacked_amount: v6.string(),
517
+ weight_percent: v6.number(),
518
+ stacked_amount_percent: v6.number(),
519
+ solo_stacker_count: v6.number(),
520
+ pooled_stacker_count: v6.number()
515
521
  });
516
522
  async function signerInCycle(args) {
517
523
  const init = {};
@@ -547,7 +553,7 @@ async function signerInCycle(args) {
547
553
  }
548
554
  });
549
555
  }
550
- const validationResult = v7.safeParse(signerInCycleResponseSchema, data);
556
+ const validationResult = v6.safeParse(signerInCycleResponseSchema, data);
551
557
  if (!validationResult.success) {
552
558
  return error({
553
559
  name: "ValidateDataError",
@@ -559,19 +565,19 @@ async function signerInCycle(args) {
559
565
  }
560
566
 
561
567
  // src/stacks-api/proof-of-transfer/signers-in-cycle.ts
562
- var v8 = __toESM(require("valibot"), 1);
563
- var signerSchema = v8.object({
564
- signing_key: v8.string(),
565
- signer_address: v8.string(),
566
- weight: v8.number(),
567
- stacked_amount: v8.string(),
568
- weight_percent: v8.number(),
569
- stacked_amount_percent: v8.number(),
570
- pooled_stacker_count: v8.number(),
571
- solo_stacker_count: v8.number()
568
+ var v7 = __toESM(require("valibot"), 1);
569
+ var signerSchema = v7.object({
570
+ signing_key: v7.string(),
571
+ signer_address: v7.string(),
572
+ weight: v7.number(),
573
+ stacked_amount: v7.string(),
574
+ weight_percent: v7.number(),
575
+ stacked_amount_percent: v7.number(),
576
+ pooled_stacker_count: v7.number(),
577
+ solo_stacker_count: v7.number()
572
578
  });
573
- var resultsSchema2 = v8.array(signerSchema);
574
- var signersResponseSchema = v8.object({
579
+ var resultsSchema2 = v7.array(signerSchema);
580
+ var signersResponseSchema = v7.object({
575
581
  ...baseListResponseSchema.entries,
576
582
  results: resultsSchema2
577
583
  });
@@ -610,7 +616,7 @@ async function signersInCycle(args) {
610
616
  }
611
617
  });
612
618
  }
613
- const validationResult = v8.safeParse(signersResponseSchema, data);
619
+ const validationResult = v7.safeParse(signersResponseSchema, data);
614
620
  if (!validationResult.success) {
615
621
  return error({
616
622
  name: "ValidateDataError",
@@ -942,6 +948,7 @@ var mempool = {
942
948
  var stacksApi = {
943
949
  accounts,
944
950
  blocks,
951
+ burnBlocks,
945
952
  faucets,
946
953
  info,
947
954
  mempool,
@@ -951,16 +958,16 @@ var stacksApi = {
951
958
  };
952
959
 
953
960
  // src/stacks-rpc-api/smart-contracts/map-entry.ts
954
- var v9 = __toESM(require("valibot"), 1);
955
- var mapEntryResponseSchema = v9.object({
961
+ var v8 = __toESM(require("valibot"), 1);
962
+ var mapEntryResponseSchema = v8.object({
956
963
  /**
957
964
  * Hex-encoded string of clarity value. It is always an optional tuple.
958
965
  */
959
- data: v9.string(),
966
+ data: v8.string(),
960
967
  /**
961
968
  * Hex-encoded string of the MARF proof for the data
962
969
  */
963
- proof: v9.optional(v9.string())
970
+ proof: v8.optional(v8.string())
964
971
  });
965
972
  async function mapEntry(args) {
966
973
  const search = new URLSearchParams();
@@ -1000,7 +1007,7 @@ async function mapEntry(args) {
1000
1007
  data: jsonError
1001
1008
  });
1002
1009
  }
1003
- const validationResult = v9.safeParse(mapEntryResponseSchema, data);
1010
+ const validationResult = v8.safeParse(mapEntryResponseSchema, data);
1004
1011
  if (!validationResult.success) {
1005
1012
  return error({
1006
1013
  name: "ValidateDataError",
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { OperationResponse, MempoolTransaction } from '@stacks/blockchain-api-client';
1
+ import { OperationResponse } from '@stacks/blockchain-api-client';
2
2
  import * as v from 'valibot';
3
3
  import { ClarityAbi, OptionalCV, TupleCV, BufferCV, UIntCV, PrincipalCV, ListCV } from '@stacks/transactions';
4
4
 
@@ -31,12 +31,6 @@ type ApiPaginationOptions = {
31
31
  limit?: number;
32
32
  offset?: number;
33
33
  };
34
- type ListResponse<T = unknown> = {
35
- limit: number;
36
- offset: number;
37
- total: number;
38
- results: T[];
39
- };
40
34
 
41
35
  type SafeError<TName extends string = string, TData = unknown> = {
42
36
  readonly name: TName;
@@ -61,18 +55,18 @@ declare function flatResults<T>(results: Array<Result$1<T>>): Result$1<Array<T>>
61
55
  */
62
56
  declare function safeExtractResponseBody(response: Response): Promise<unknown>;
63
57
 
64
- type Args$m = {
58
+ type Args$n = {
65
59
  transactionId: string;
66
60
  } & ApiRequestOptions;
67
- type Response$8 = OperationResponse["get_raw_transaction_by_id"];
68
- declare function getRawTransaction(args: Args$m): Promise<Result$1<Response$8>>;
61
+ type Response$9 = OperationResponse["get_raw_transaction_by_id"];
62
+ declare function getRawTransaction(args: Args$n): Promise<Result$1<Response$9>>;
69
63
 
70
64
  declare const getRawTransaction$1_getRawTransaction: typeof getRawTransaction;
71
65
  declare namespace getRawTransaction$1 {
72
- export { type Args$m as Args, type Response$8 as Response, getRawTransaction$1_getRawTransaction as getRawTransaction };
66
+ export { type Args$n as Args, type Response$9 as Response, getRawTransaction$1_getRawTransaction as getRawTransaction };
73
67
  }
74
68
 
75
- type Args$l = {
69
+ type Args$m = {
76
70
  /**
77
71
  * Filter to only return transactions with this sender address.
78
72
  */
@@ -96,8 +90,8 @@ type Args$l = {
96
90
  */
97
91
  order?: "asc" | "desc";
98
92
  } & ApiRequestOptions & ApiPaginationOptions;
99
- type MempoolTransactionsResponse = ListResponse<MempoolTransaction>;
100
- declare function mempoolTransactions(args: Args$l): Promise<Result$1<MempoolTransactionsResponse, SafeError<"FetchMempoolTransactionsError" | "ParseBodyError" | "ValidateDataError">>>;
93
+ type MempoolTransactionsResponse = OperationResponse["/extended/v1/tx/mempool"];
94
+ declare function mempoolTransactions(args: Args$m): Promise<Result$1<MempoolTransactionsResponse, SafeError<"FetchMempoolTransactionsError" | "ParseBodyError" | "ValidateDataError">>>;
101
95
 
102
96
  type mempoolTransactions$1_MempoolTransactionsResponse = MempoolTransactionsResponse;
103
97
  declare const mempoolTransactions$1_mempoolTransactions: typeof mempoolTransactions;
@@ -105,34 +99,34 @@ declare namespace mempoolTransactions$1 {
105
99
  export { type mempoolTransactions$1_MempoolTransactionsResponse as MempoolTransactionsResponse, mempoolTransactions$1_mempoolTransactions as mempoolTransactions };
106
100
  }
107
101
 
108
- type Args$k = {
102
+ type Args$l = {
109
103
  transactionId: string;
110
104
  } & ApiRequestOptions;
111
- type Response$7 = OperationResponse["get_transaction_by_id"];
112
- declare function getTransaction(args: Args$k): Promise<Result$1<Response$7>>;
105
+ type Response$8 = OperationResponse["get_transaction_by_id"];
106
+ declare function getTransaction(args: Args$l): Promise<Result$1<Response$8>>;
113
107
 
114
108
  declare const getTransaction$1_getTransaction: typeof getTransaction;
115
109
  declare namespace getTransaction$1 {
116
110
  export { getTransaction$1_getTransaction as getTransaction };
117
111
  }
118
112
 
119
- type Args$j = {
113
+ type Args$k = {
120
114
  address: string;
121
115
  transactionId: string;
122
116
  } & ApiRequestOptions & ApiPaginationOptions;
123
- type Response$6 = OperationResponse["/extended/v2/addresses/{address}/transactions/{tx_id}/events"];
124
- declare function eventsForAnAddressTransaction(args: Args$j): Promise<Result$1<Response$6>>;
117
+ type Response$7 = OperationResponse["/extended/v2/addresses/{address}/transactions/{tx_id}/events"];
118
+ declare function eventsForAnAddressTransaction(args: Args$k): Promise<Result$1<Response$7>>;
125
119
 
126
120
  declare const eventsForAnAddressTransaction$1_eventsForAnAddressTransaction: typeof eventsForAnAddressTransaction;
127
121
  declare namespace eventsForAnAddressTransaction$1 {
128
122
  export { eventsForAnAddressTransaction$1_eventsForAnAddressTransaction as eventsForAnAddressTransaction };
129
123
  }
130
124
 
131
- type Args$i = {
125
+ type Args$j = {
132
126
  address: string;
133
127
  } & ApiRequestOptions & ApiPaginationOptions;
134
128
  type Result = OperationResponse["/extended/v2/addresses/{address}/transactions"];
135
- declare function addressTransactions(args: Args$i): Promise<Result$1<Result, SafeError<"FetchAddressTransactionsError" | "ParseBodyError" | "ValidateDataError">>>;
129
+ declare function addressTransactions(args: Args$j): Promise<Result$1<Result, SafeError<"FetchAddressTransactionsError" | "ParseBodyError" | "ValidateDataError">>>;
136
130
 
137
131
  type addressTransactions$1_Result = Result;
138
132
  declare const addressTransactions$1_addressTransactions: typeof addressTransactions;
@@ -140,34 +134,34 @@ declare namespace addressTransactions$1 {
140
134
  export { type addressTransactions$1_Result as Result, addressTransactions$1_addressTransactions as addressTransactions };
141
135
  }
142
136
 
143
- type Args$h = {
137
+ type Args$i = {
144
138
  poolPrincipal: string;
145
139
  afterBlock?: string | number | bigint;
146
140
  unanchored?: boolean;
147
141
  limit?: number;
148
142
  offset?: number;
149
143
  } & ApiRequestOptions & ApiPaginationOptions;
150
- type Response$5 = OperationResponse["get_pool_delegations"];
151
- declare function members(args: Args$h): Promise<Result$1<Response$5>>;
144
+ type Response$6 = OperationResponse["get_pool_delegations"];
145
+ declare function members(args: Args$i): Promise<Result$1<Response$6>>;
152
146
 
153
147
  declare const members$1_members: typeof members;
154
148
  declare namespace members$1 {
155
- export { type Args$h as Args, type Response$5 as Response, members$1_members as members };
149
+ export { type Args$i as Args, type Response$6 as Response, members$1_members as members };
156
150
  }
157
151
 
158
- type Args$g = {
152
+ type Args$h = {
159
153
  cycleNumber: string | number | bigint;
160
154
  signerPublicKey: string;
161
155
  } & ApiRequestOptions & ApiPaginationOptions;
162
- type Response$4 = OperationResponse["get_pox_cycle_signer_stackers"];
163
- declare function stackersForSignerInCycle(opts: Args$g): Promise<Result$1<Response$4, SafeError<"FetchStackersForSignerInCycleError" | "ParseBodyError">>>;
156
+ type Response$5 = OperationResponse["get_pox_cycle_signer_stackers"];
157
+ declare function stackersForSignerInCycle(opts: Args$h): Promise<Result$1<Response$5, SafeError<"FetchStackersForSignerInCycleError" | "ParseBodyError">>>;
164
158
 
165
159
  declare const stackersForSignerInCycle$1_stackersForSignerInCycle: typeof stackersForSignerInCycle;
166
160
  declare namespace stackersForSignerInCycle$1 {
167
- export { type Args$g as Args, type Response$4 as Response, stackersForSignerInCycle$1_stackersForSignerInCycle as stackersForSignerInCycle };
161
+ export { type Args$h as Args, type Response$5 as Response, stackersForSignerInCycle$1_stackersForSignerInCycle as stackersForSignerInCycle };
168
162
  }
169
163
 
170
- type Args$f = {
164
+ type Args$g = {
171
165
  cycleNumber: number;
172
166
  } & ApiRequestOptions & ApiPaginationOptions;
173
167
  declare const signerSchema: v.ObjectSchema<{
@@ -208,7 +202,7 @@ declare const signersResponseSchema: v.ObjectSchema<{
208
202
  readonly total: v.NumberSchema<undefined>;
209
203
  }, undefined>;
210
204
  type SignersResponse = v.InferOutput<typeof signersResponseSchema>;
211
- declare function signersInCycle(args: Args$f): Promise<Result$1<SignersResponse, SafeError<"FetchSignersError" | "ParseBodyError" | "ValidateDataError">>>;
205
+ declare function signersInCycle(args: Args$g): Promise<Result$1<SignersResponse, SafeError<"FetchSignersError" | "ParseBodyError" | "ValidateDataError">>>;
212
206
 
213
207
  type signersInCycle$1_Signer = Signer;
214
208
  type signersInCycle$1_SignersResponse = SignersResponse;
@@ -216,10 +210,10 @@ declare const signersInCycle$1_signerSchema: typeof signerSchema;
216
210
  declare const signersInCycle$1_signersInCycle: typeof signersInCycle;
217
211
  declare const signersInCycle$1_signersResponseSchema: typeof signersResponseSchema;
218
212
  declare namespace signersInCycle$1 {
219
- export { type Args$f as Args, type Results$1 as Results, type signersInCycle$1_Signer as Signer, type signersInCycle$1_SignersResponse as SignersResponse, resultsSchema$1 as resultsSchema, signersInCycle$1_signerSchema as signerSchema, signersInCycle$1_signersInCycle as signersInCycle, signersInCycle$1_signersResponseSchema as signersResponseSchema };
213
+ export { type Args$g as Args, type Results$1 as Results, type signersInCycle$1_Signer as Signer, type signersInCycle$1_SignersResponse as SignersResponse, resultsSchema$1 as resultsSchema, signersInCycle$1_signerSchema as signerSchema, signersInCycle$1_signersInCycle as signersInCycle, signersInCycle$1_signersResponseSchema as signersResponseSchema };
220
214
  }
221
215
 
222
- type Args$e = {
216
+ type Args$f = {
223
217
  /**
224
218
  * The signers public key as a hex string, with or without a '0x' prefix.
225
219
  */
@@ -237,16 +231,16 @@ declare const signerInCycleResponseSchema: v.ObjectSchema<{
237
231
  readonly pooled_stacker_count: v.NumberSchema<undefined>;
238
232
  }, undefined>;
239
233
  type SignerInCycleResponse = v.InferOutput<typeof signerInCycleResponseSchema>;
240
- declare function signerInCycle(args: Args$e): Promise<Result$1<SignerInCycleResponse>>;
234
+ declare function signerInCycle(args: Args$f): Promise<Result$1<SignerInCycleResponse>>;
241
235
 
242
236
  type signerInCycle$1_SignerInCycleResponse = SignerInCycleResponse;
243
237
  declare const signerInCycle$1_signerInCycle: typeof signerInCycle;
244
238
  declare const signerInCycle$1_signerInCycleResponseSchema: typeof signerInCycleResponseSchema;
245
239
  declare namespace signerInCycle$1 {
246
- export { type Args$e as Args, type signerInCycle$1_SignerInCycleResponse as SignerInCycleResponse, signerInCycle$1_signerInCycle as signerInCycle, signerInCycle$1_signerInCycleResponseSchema as signerInCycleResponseSchema };
240
+ export { type Args$f as Args, type signerInCycle$1_SignerInCycleResponse as SignerInCycleResponse, signerInCycle$1_signerInCycle as signerInCycle, signerInCycle$1_signerInCycleResponseSchema as signerInCycleResponseSchema };
247
241
  }
248
242
 
249
- type Args$d = ApiRequestOptions & ApiPaginationOptions;
243
+ type Args$e = ApiRequestOptions & ApiPaginationOptions;
250
244
  declare const cycleInfoSchema: v.ObjectSchema<{
251
245
  readonly block_height: v.NumberSchema<undefined>;
252
246
  readonly index_block_hash: v.StringSchema<undefined>;
@@ -279,7 +273,7 @@ declare const cyclesResponseSchema: v.ObjectSchema<{
279
273
  readonly total: v.NumberSchema<undefined>;
280
274
  }, undefined>;
281
275
  type CyclesResponse = v.InferOutput<typeof cyclesResponseSchema>;
282
- declare function cycles(args: Args$d): Promise<Result$1<CyclesResponse>>;
276
+ declare function cycles(args: Args$e): Promise<Result$1<CyclesResponse>>;
283
277
 
284
278
  type cycles$1_CycleInfo = CycleInfo;
285
279
  type cycles$1_CyclesResponse = CyclesResponse;
@@ -289,13 +283,13 @@ declare const cycles$1_cycles: typeof cycles;
289
283
  declare const cycles$1_cyclesResponseSchema: typeof cyclesResponseSchema;
290
284
  declare const cycles$1_resultsSchema: typeof resultsSchema;
291
285
  declare namespace cycles$1 {
292
- export { type Args$d as Args, type cycles$1_CycleInfo as CycleInfo, type cycles$1_CyclesResponse as CyclesResponse, type cycles$1_Results as Results, cycles$1_cycleInfoSchema as cycleInfoSchema, cycles$1_cycles as cycles, cycles$1_cyclesResponseSchema as cyclesResponseSchema, cycles$1_resultsSchema as resultsSchema };
286
+ export { type Args$e as Args, type cycles$1_CycleInfo as CycleInfo, type cycles$1_CyclesResponse as CyclesResponse, type cycles$1_Results as Results, cycles$1_cycleInfoSchema as cycleInfoSchema, cycles$1_cycles as cycles, cycles$1_cyclesResponseSchema as cyclesResponseSchema, cycles$1_resultsSchema as resultsSchema };
293
287
  }
294
288
 
295
- type Args$c = {
289
+ type Args$d = {
296
290
  cycleNumber: number;
297
291
  } & ApiRequestOptions;
298
- declare const responseSchema$2: v.ObjectSchema<{
292
+ declare const responseSchema$1: v.ObjectSchema<{
299
293
  readonly block_height: v.NumberSchema<undefined>;
300
294
  readonly index_block_hash: v.StringSchema<undefined>;
301
295
  readonly cycle_number: v.NumberSchema<undefined>;
@@ -303,12 +297,12 @@ declare const responseSchema$2: v.ObjectSchema<{
303
297
  readonly total_stacked_amount: v.StringSchema<undefined>;
304
298
  readonly total_signers: v.NumberSchema<undefined>;
305
299
  }, undefined>;
306
- type Response$3 = v.InferOutput<typeof responseSchema$2>;
307
- declare function cycle(opts: Args$c): Promise<Result$1<Response$3, SafeError<"FetchCycleError" | "ParseBodyError" | "ValidateDataError">>>;
300
+ type Response$4 = v.InferOutput<typeof responseSchema$1>;
301
+ declare function cycle(opts: Args$d): Promise<Result$1<Response$4, SafeError<"FetchCycleError" | "ParseBodyError" | "ValidateDataError">>>;
308
302
 
309
303
  declare const cycle$1_cycle: typeof cycle;
310
304
  declare namespace cycle$1 {
311
- export { type Args$c as Args, type Response$3 as Response, cycle$1_cycle as cycle, responseSchema$2 as responseSchema };
305
+ export { type Args$d as Args, type Response$4 as Response, cycle$1_cycle as cycle, responseSchema$1 as responseSchema };
312
306
  }
313
307
 
314
308
  type FeePrioritiesResponse = {
@@ -370,47 +364,37 @@ declare namespace coreApi$1 {
370
364
  export { type coreApi$1_CoreApiResponse as CoreApiResponse, coreApi$1_coreApi as coreApi };
371
365
  }
372
366
 
373
- type Args$b = {
367
+ type Args$c = {
374
368
  address: string;
375
369
  stacking?: boolean;
376
370
  } & ApiRequestOptions;
377
- declare function stx(opts: Args$b): Promise<Result$1<any>>;
371
+ declare function stx(opts: Args$c): Promise<Result$1<any>>;
378
372
 
379
373
  declare const stx$1_stx: typeof stx;
380
374
  declare namespace stx$1 {
381
- export { type Args$b as Args, stx$1_stx as stx };
375
+ export { type Args$c as Args, stx$1_stx as stx };
376
+ }
377
+
378
+ type Args$b = {
379
+ heightOrHash: string | number | bigint;
380
+ } & ApiRequestOptions;
381
+ type Response$3 = OperationResponse["get_burn_block"];
382
+ declare function getBurnBlock(args: Args$b): Promise<Result$1<Response$3>>;
383
+
384
+ declare const getBurnBlock$1_getBurnBlock: typeof getBurnBlock;
385
+ declare namespace getBurnBlock$1 {
386
+ export { type Args$b as Args, type Response$3 as Response, getBurnBlock$1_getBurnBlock as getBurnBlock };
382
387
  }
383
388
 
384
389
  type Args$a = {
385
390
  heightOrHash: string | number;
386
391
  } & ApiRequestOptions;
387
- declare const responseSchema$1: v.ObjectSchema<{
388
- readonly canonical: v.BooleanSchema<undefined>;
389
- readonly height: v.NumberSchema<undefined>;
390
- readonly hash: v.StringSchema<undefined>;
391
- readonly block_time: v.NumberSchema<undefined>;
392
- readonly block_time_iso: v.StringSchema<undefined>;
393
- readonly index_block_hash: v.StringSchema<undefined>;
394
- readonly parent_block_hash: v.StringSchema<undefined>;
395
- readonly parent_index_block_hash: v.StringSchema<undefined>;
396
- readonly burn_block_time: v.NumberSchema<undefined>;
397
- readonly burn_block_time_iso: v.StringSchema<undefined>;
398
- readonly burn_block_hash: v.StringSchema<undefined>;
399
- readonly burn_block_height: v.NumberSchema<undefined>;
400
- readonly miner_txid: v.StringSchema<undefined>;
401
- readonly tx_count: v.NumberSchema<undefined>;
402
- readonly execution_cost_read_count: v.NumberSchema<undefined>;
403
- readonly execution_cost_read_length: v.NumberSchema<undefined>;
404
- readonly execution_cost_runtime: v.NumberSchema<undefined>;
405
- readonly execution_cost_write_count: v.NumberSchema<undefined>;
406
- readonly execution_cost_write_length: v.NumberSchema<undefined>;
407
- }, undefined>;
408
- type Response$2 = v.InferOutput<typeof responseSchema$1>;
409
- declare function getBlock(opts: Args$a): Promise<Result$1<Response$2, SafeError<"FetchBlockError" | "ParseBodyError" | "ValidateDataError">>>;
392
+ type Response$2 = OperationResponse["get_block"];
393
+ declare function getBlock(opts: Args$a): Promise<Result$1<Response$2>>;
410
394
 
411
395
  declare const getBlock$1_getBlock: typeof getBlock;
412
396
  declare namespace getBlock$1 {
413
- export { type Args$a as Args, type Response$2 as Response, getBlock$1_getBlock as getBlock, responseSchema$1 as responseSchema };
397
+ export { type Args$a as Args, type Response$2 as Response, getBlock$1_getBlock as getBlock };
414
398
  }
415
399
 
416
400
  type Args$9 = {
@@ -449,18 +433,27 @@ declare const accounts: {
449
433
  latestNonce: typeof latestNonce;
450
434
  };
451
435
 
452
- declare const index$e_accounts: typeof accounts;
453
- declare namespace index$e {
454
- export { balances$1 as Balances, latestNonce$1 as LatestNonce, index$e_accounts as accounts };
436
+ declare const index$f_accounts: typeof accounts;
437
+ declare namespace index$f {
438
+ export { balances$1 as Balances, latestNonce$1 as LatestNonce, index$f_accounts as accounts };
455
439
  }
456
440
 
457
441
  declare const blocks: {
458
442
  getBlock: typeof getBlock;
459
443
  };
460
444
 
461
- declare const index$d_blocks: typeof blocks;
445
+ declare const index$e_blocks: typeof blocks;
446
+ declare namespace index$e {
447
+ export { getBlock$1 as GetBlock, index$e_blocks as blocks };
448
+ }
449
+
450
+ declare const burnBlocks: {
451
+ getBurnBlock: typeof getBurnBlock;
452
+ };
453
+
454
+ declare const index$d_burnBlocks: typeof burnBlocks;
462
455
  declare namespace index$d {
463
- export { getBlock$1 as GetBlock, index$d_blocks as blocks };
456
+ export { getBurnBlock$1 as GetBurnBlock, index$d_burnBlocks as burnBlocks };
464
457
  }
465
458
 
466
459
  declare const faucets: {
@@ -533,6 +526,9 @@ declare const stacksApi: {
533
526
  blocks: {
534
527
  getBlock: typeof getBlock;
535
528
  };
529
+ burnBlocks: {
530
+ getBurnBlock: typeof getBurnBlock;
531
+ };
536
532
  faucets: {
537
533
  stx: typeof stx;
538
534
  };
@@ -563,7 +559,7 @@ declare const stacksApi: {
563
559
 
564
560
  declare const index$6_stacksApi: typeof stacksApi;
565
561
  declare namespace index$6 {
566
- export { index$e as Accounts, index$d as Blocks, index$c as Faucets, index$b as Info, index$7 as Mempool, index$a as ProofOfTransfer, index$9 as StackingPool, index$8 as Transactions, index$6_stacksApi as stacksApi };
562
+ export { index$f as Accounts, index$e as Blocks, index$d as BurnBlocks, index$c as Faucets, index$b as Info, index$7 as Mempool, index$a as ProofOfTransfer, index$9 as StackingPool, index$8 as Transactions, index$6_stacksApi as stacksApi };
567
563
  }
568
564
 
569
565
  type Args$7 = {
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { OperationResponse, MempoolTransaction } from '@stacks/blockchain-api-client';
1
+ import { OperationResponse } from '@stacks/blockchain-api-client';
2
2
  import * as v from 'valibot';
3
3
  import { ClarityAbi, OptionalCV, TupleCV, BufferCV, UIntCV, PrincipalCV, ListCV } from '@stacks/transactions';
4
4
 
@@ -31,12 +31,6 @@ type ApiPaginationOptions = {
31
31
  limit?: number;
32
32
  offset?: number;
33
33
  };
34
- type ListResponse<T = unknown> = {
35
- limit: number;
36
- offset: number;
37
- total: number;
38
- results: T[];
39
- };
40
34
 
41
35
  type SafeError<TName extends string = string, TData = unknown> = {
42
36
  readonly name: TName;
@@ -61,18 +55,18 @@ declare function flatResults<T>(results: Array<Result$1<T>>): Result$1<Array<T>>
61
55
  */
62
56
  declare function safeExtractResponseBody(response: Response): Promise<unknown>;
63
57
 
64
- type Args$m = {
58
+ type Args$n = {
65
59
  transactionId: string;
66
60
  } & ApiRequestOptions;
67
- type Response$8 = OperationResponse["get_raw_transaction_by_id"];
68
- declare function getRawTransaction(args: Args$m): Promise<Result$1<Response$8>>;
61
+ type Response$9 = OperationResponse["get_raw_transaction_by_id"];
62
+ declare function getRawTransaction(args: Args$n): Promise<Result$1<Response$9>>;
69
63
 
70
64
  declare const getRawTransaction$1_getRawTransaction: typeof getRawTransaction;
71
65
  declare namespace getRawTransaction$1 {
72
- export { type Args$m as Args, type Response$8 as Response, getRawTransaction$1_getRawTransaction as getRawTransaction };
66
+ export { type Args$n as Args, type Response$9 as Response, getRawTransaction$1_getRawTransaction as getRawTransaction };
73
67
  }
74
68
 
75
- type Args$l = {
69
+ type Args$m = {
76
70
  /**
77
71
  * Filter to only return transactions with this sender address.
78
72
  */
@@ -96,8 +90,8 @@ type Args$l = {
96
90
  */
97
91
  order?: "asc" | "desc";
98
92
  } & ApiRequestOptions & ApiPaginationOptions;
99
- type MempoolTransactionsResponse = ListResponse<MempoolTransaction>;
100
- declare function mempoolTransactions(args: Args$l): Promise<Result$1<MempoolTransactionsResponse, SafeError<"FetchMempoolTransactionsError" | "ParseBodyError" | "ValidateDataError">>>;
93
+ type MempoolTransactionsResponse = OperationResponse["/extended/v1/tx/mempool"];
94
+ declare function mempoolTransactions(args: Args$m): Promise<Result$1<MempoolTransactionsResponse, SafeError<"FetchMempoolTransactionsError" | "ParseBodyError" | "ValidateDataError">>>;
101
95
 
102
96
  type mempoolTransactions$1_MempoolTransactionsResponse = MempoolTransactionsResponse;
103
97
  declare const mempoolTransactions$1_mempoolTransactions: typeof mempoolTransactions;
@@ -105,34 +99,34 @@ declare namespace mempoolTransactions$1 {
105
99
  export { type mempoolTransactions$1_MempoolTransactionsResponse as MempoolTransactionsResponse, mempoolTransactions$1_mempoolTransactions as mempoolTransactions };
106
100
  }
107
101
 
108
- type Args$k = {
102
+ type Args$l = {
109
103
  transactionId: string;
110
104
  } & ApiRequestOptions;
111
- type Response$7 = OperationResponse["get_transaction_by_id"];
112
- declare function getTransaction(args: Args$k): Promise<Result$1<Response$7>>;
105
+ type Response$8 = OperationResponse["get_transaction_by_id"];
106
+ declare function getTransaction(args: Args$l): Promise<Result$1<Response$8>>;
113
107
 
114
108
  declare const getTransaction$1_getTransaction: typeof getTransaction;
115
109
  declare namespace getTransaction$1 {
116
110
  export { getTransaction$1_getTransaction as getTransaction };
117
111
  }
118
112
 
119
- type Args$j = {
113
+ type Args$k = {
120
114
  address: string;
121
115
  transactionId: string;
122
116
  } & ApiRequestOptions & ApiPaginationOptions;
123
- type Response$6 = OperationResponse["/extended/v2/addresses/{address}/transactions/{tx_id}/events"];
124
- declare function eventsForAnAddressTransaction(args: Args$j): Promise<Result$1<Response$6>>;
117
+ type Response$7 = OperationResponse["/extended/v2/addresses/{address}/transactions/{tx_id}/events"];
118
+ declare function eventsForAnAddressTransaction(args: Args$k): Promise<Result$1<Response$7>>;
125
119
 
126
120
  declare const eventsForAnAddressTransaction$1_eventsForAnAddressTransaction: typeof eventsForAnAddressTransaction;
127
121
  declare namespace eventsForAnAddressTransaction$1 {
128
122
  export { eventsForAnAddressTransaction$1_eventsForAnAddressTransaction as eventsForAnAddressTransaction };
129
123
  }
130
124
 
131
- type Args$i = {
125
+ type Args$j = {
132
126
  address: string;
133
127
  } & ApiRequestOptions & ApiPaginationOptions;
134
128
  type Result = OperationResponse["/extended/v2/addresses/{address}/transactions"];
135
- declare function addressTransactions(args: Args$i): Promise<Result$1<Result, SafeError<"FetchAddressTransactionsError" | "ParseBodyError" | "ValidateDataError">>>;
129
+ declare function addressTransactions(args: Args$j): Promise<Result$1<Result, SafeError<"FetchAddressTransactionsError" | "ParseBodyError" | "ValidateDataError">>>;
136
130
 
137
131
  type addressTransactions$1_Result = Result;
138
132
  declare const addressTransactions$1_addressTransactions: typeof addressTransactions;
@@ -140,34 +134,34 @@ declare namespace addressTransactions$1 {
140
134
  export { type addressTransactions$1_Result as Result, addressTransactions$1_addressTransactions as addressTransactions };
141
135
  }
142
136
 
143
- type Args$h = {
137
+ type Args$i = {
144
138
  poolPrincipal: string;
145
139
  afterBlock?: string | number | bigint;
146
140
  unanchored?: boolean;
147
141
  limit?: number;
148
142
  offset?: number;
149
143
  } & ApiRequestOptions & ApiPaginationOptions;
150
- type Response$5 = OperationResponse["get_pool_delegations"];
151
- declare function members(args: Args$h): Promise<Result$1<Response$5>>;
144
+ type Response$6 = OperationResponse["get_pool_delegations"];
145
+ declare function members(args: Args$i): Promise<Result$1<Response$6>>;
152
146
 
153
147
  declare const members$1_members: typeof members;
154
148
  declare namespace members$1 {
155
- export { type Args$h as Args, type Response$5 as Response, members$1_members as members };
149
+ export { type Args$i as Args, type Response$6 as Response, members$1_members as members };
156
150
  }
157
151
 
158
- type Args$g = {
152
+ type Args$h = {
159
153
  cycleNumber: string | number | bigint;
160
154
  signerPublicKey: string;
161
155
  } & ApiRequestOptions & ApiPaginationOptions;
162
- type Response$4 = OperationResponse["get_pox_cycle_signer_stackers"];
163
- declare function stackersForSignerInCycle(opts: Args$g): Promise<Result$1<Response$4, SafeError<"FetchStackersForSignerInCycleError" | "ParseBodyError">>>;
156
+ type Response$5 = OperationResponse["get_pox_cycle_signer_stackers"];
157
+ declare function stackersForSignerInCycle(opts: Args$h): Promise<Result$1<Response$5, SafeError<"FetchStackersForSignerInCycleError" | "ParseBodyError">>>;
164
158
 
165
159
  declare const stackersForSignerInCycle$1_stackersForSignerInCycle: typeof stackersForSignerInCycle;
166
160
  declare namespace stackersForSignerInCycle$1 {
167
- export { type Args$g as Args, type Response$4 as Response, stackersForSignerInCycle$1_stackersForSignerInCycle as stackersForSignerInCycle };
161
+ export { type Args$h as Args, type Response$5 as Response, stackersForSignerInCycle$1_stackersForSignerInCycle as stackersForSignerInCycle };
168
162
  }
169
163
 
170
- type Args$f = {
164
+ type Args$g = {
171
165
  cycleNumber: number;
172
166
  } & ApiRequestOptions & ApiPaginationOptions;
173
167
  declare const signerSchema: v.ObjectSchema<{
@@ -208,7 +202,7 @@ declare const signersResponseSchema: v.ObjectSchema<{
208
202
  readonly total: v.NumberSchema<undefined>;
209
203
  }, undefined>;
210
204
  type SignersResponse = v.InferOutput<typeof signersResponseSchema>;
211
- declare function signersInCycle(args: Args$f): Promise<Result$1<SignersResponse, SafeError<"FetchSignersError" | "ParseBodyError" | "ValidateDataError">>>;
205
+ declare function signersInCycle(args: Args$g): Promise<Result$1<SignersResponse, SafeError<"FetchSignersError" | "ParseBodyError" | "ValidateDataError">>>;
212
206
 
213
207
  type signersInCycle$1_Signer = Signer;
214
208
  type signersInCycle$1_SignersResponse = SignersResponse;
@@ -216,10 +210,10 @@ declare const signersInCycle$1_signerSchema: typeof signerSchema;
216
210
  declare const signersInCycle$1_signersInCycle: typeof signersInCycle;
217
211
  declare const signersInCycle$1_signersResponseSchema: typeof signersResponseSchema;
218
212
  declare namespace signersInCycle$1 {
219
- export { type Args$f as Args, type Results$1 as Results, type signersInCycle$1_Signer as Signer, type signersInCycle$1_SignersResponse as SignersResponse, resultsSchema$1 as resultsSchema, signersInCycle$1_signerSchema as signerSchema, signersInCycle$1_signersInCycle as signersInCycle, signersInCycle$1_signersResponseSchema as signersResponseSchema };
213
+ export { type Args$g as Args, type Results$1 as Results, type signersInCycle$1_Signer as Signer, type signersInCycle$1_SignersResponse as SignersResponse, resultsSchema$1 as resultsSchema, signersInCycle$1_signerSchema as signerSchema, signersInCycle$1_signersInCycle as signersInCycle, signersInCycle$1_signersResponseSchema as signersResponseSchema };
220
214
  }
221
215
 
222
- type Args$e = {
216
+ type Args$f = {
223
217
  /**
224
218
  * The signers public key as a hex string, with or without a '0x' prefix.
225
219
  */
@@ -237,16 +231,16 @@ declare const signerInCycleResponseSchema: v.ObjectSchema<{
237
231
  readonly pooled_stacker_count: v.NumberSchema<undefined>;
238
232
  }, undefined>;
239
233
  type SignerInCycleResponse = v.InferOutput<typeof signerInCycleResponseSchema>;
240
- declare function signerInCycle(args: Args$e): Promise<Result$1<SignerInCycleResponse>>;
234
+ declare function signerInCycle(args: Args$f): Promise<Result$1<SignerInCycleResponse>>;
241
235
 
242
236
  type signerInCycle$1_SignerInCycleResponse = SignerInCycleResponse;
243
237
  declare const signerInCycle$1_signerInCycle: typeof signerInCycle;
244
238
  declare const signerInCycle$1_signerInCycleResponseSchema: typeof signerInCycleResponseSchema;
245
239
  declare namespace signerInCycle$1 {
246
- export { type Args$e as Args, type signerInCycle$1_SignerInCycleResponse as SignerInCycleResponse, signerInCycle$1_signerInCycle as signerInCycle, signerInCycle$1_signerInCycleResponseSchema as signerInCycleResponseSchema };
240
+ export { type Args$f as Args, type signerInCycle$1_SignerInCycleResponse as SignerInCycleResponse, signerInCycle$1_signerInCycle as signerInCycle, signerInCycle$1_signerInCycleResponseSchema as signerInCycleResponseSchema };
247
241
  }
248
242
 
249
- type Args$d = ApiRequestOptions & ApiPaginationOptions;
243
+ type Args$e = ApiRequestOptions & ApiPaginationOptions;
250
244
  declare const cycleInfoSchema: v.ObjectSchema<{
251
245
  readonly block_height: v.NumberSchema<undefined>;
252
246
  readonly index_block_hash: v.StringSchema<undefined>;
@@ -279,7 +273,7 @@ declare const cyclesResponseSchema: v.ObjectSchema<{
279
273
  readonly total: v.NumberSchema<undefined>;
280
274
  }, undefined>;
281
275
  type CyclesResponse = v.InferOutput<typeof cyclesResponseSchema>;
282
- declare function cycles(args: Args$d): Promise<Result$1<CyclesResponse>>;
276
+ declare function cycles(args: Args$e): Promise<Result$1<CyclesResponse>>;
283
277
 
284
278
  type cycles$1_CycleInfo = CycleInfo;
285
279
  type cycles$1_CyclesResponse = CyclesResponse;
@@ -289,13 +283,13 @@ declare const cycles$1_cycles: typeof cycles;
289
283
  declare const cycles$1_cyclesResponseSchema: typeof cyclesResponseSchema;
290
284
  declare const cycles$1_resultsSchema: typeof resultsSchema;
291
285
  declare namespace cycles$1 {
292
- export { type Args$d as Args, type cycles$1_CycleInfo as CycleInfo, type cycles$1_CyclesResponse as CyclesResponse, type cycles$1_Results as Results, cycles$1_cycleInfoSchema as cycleInfoSchema, cycles$1_cycles as cycles, cycles$1_cyclesResponseSchema as cyclesResponseSchema, cycles$1_resultsSchema as resultsSchema };
286
+ export { type Args$e as Args, type cycles$1_CycleInfo as CycleInfo, type cycles$1_CyclesResponse as CyclesResponse, type cycles$1_Results as Results, cycles$1_cycleInfoSchema as cycleInfoSchema, cycles$1_cycles as cycles, cycles$1_cyclesResponseSchema as cyclesResponseSchema, cycles$1_resultsSchema as resultsSchema };
293
287
  }
294
288
 
295
- type Args$c = {
289
+ type Args$d = {
296
290
  cycleNumber: number;
297
291
  } & ApiRequestOptions;
298
- declare const responseSchema$2: v.ObjectSchema<{
292
+ declare const responseSchema$1: v.ObjectSchema<{
299
293
  readonly block_height: v.NumberSchema<undefined>;
300
294
  readonly index_block_hash: v.StringSchema<undefined>;
301
295
  readonly cycle_number: v.NumberSchema<undefined>;
@@ -303,12 +297,12 @@ declare const responseSchema$2: v.ObjectSchema<{
303
297
  readonly total_stacked_amount: v.StringSchema<undefined>;
304
298
  readonly total_signers: v.NumberSchema<undefined>;
305
299
  }, undefined>;
306
- type Response$3 = v.InferOutput<typeof responseSchema$2>;
307
- declare function cycle(opts: Args$c): Promise<Result$1<Response$3, SafeError<"FetchCycleError" | "ParseBodyError" | "ValidateDataError">>>;
300
+ type Response$4 = v.InferOutput<typeof responseSchema$1>;
301
+ declare function cycle(opts: Args$d): Promise<Result$1<Response$4, SafeError<"FetchCycleError" | "ParseBodyError" | "ValidateDataError">>>;
308
302
 
309
303
  declare const cycle$1_cycle: typeof cycle;
310
304
  declare namespace cycle$1 {
311
- export { type Args$c as Args, type Response$3 as Response, cycle$1_cycle as cycle, responseSchema$2 as responseSchema };
305
+ export { type Args$d as Args, type Response$4 as Response, cycle$1_cycle as cycle, responseSchema$1 as responseSchema };
312
306
  }
313
307
 
314
308
  type FeePrioritiesResponse = {
@@ -370,47 +364,37 @@ declare namespace coreApi$1 {
370
364
  export { type coreApi$1_CoreApiResponse as CoreApiResponse, coreApi$1_coreApi as coreApi };
371
365
  }
372
366
 
373
- type Args$b = {
367
+ type Args$c = {
374
368
  address: string;
375
369
  stacking?: boolean;
376
370
  } & ApiRequestOptions;
377
- declare function stx(opts: Args$b): Promise<Result$1<any>>;
371
+ declare function stx(opts: Args$c): Promise<Result$1<any>>;
378
372
 
379
373
  declare const stx$1_stx: typeof stx;
380
374
  declare namespace stx$1 {
381
- export { type Args$b as Args, stx$1_stx as stx };
375
+ export { type Args$c as Args, stx$1_stx as stx };
376
+ }
377
+
378
+ type Args$b = {
379
+ heightOrHash: string | number | bigint;
380
+ } & ApiRequestOptions;
381
+ type Response$3 = OperationResponse["get_burn_block"];
382
+ declare function getBurnBlock(args: Args$b): Promise<Result$1<Response$3>>;
383
+
384
+ declare const getBurnBlock$1_getBurnBlock: typeof getBurnBlock;
385
+ declare namespace getBurnBlock$1 {
386
+ export { type Args$b as Args, type Response$3 as Response, getBurnBlock$1_getBurnBlock as getBurnBlock };
382
387
  }
383
388
 
384
389
  type Args$a = {
385
390
  heightOrHash: string | number;
386
391
  } & ApiRequestOptions;
387
- declare const responseSchema$1: v.ObjectSchema<{
388
- readonly canonical: v.BooleanSchema<undefined>;
389
- readonly height: v.NumberSchema<undefined>;
390
- readonly hash: v.StringSchema<undefined>;
391
- readonly block_time: v.NumberSchema<undefined>;
392
- readonly block_time_iso: v.StringSchema<undefined>;
393
- readonly index_block_hash: v.StringSchema<undefined>;
394
- readonly parent_block_hash: v.StringSchema<undefined>;
395
- readonly parent_index_block_hash: v.StringSchema<undefined>;
396
- readonly burn_block_time: v.NumberSchema<undefined>;
397
- readonly burn_block_time_iso: v.StringSchema<undefined>;
398
- readonly burn_block_hash: v.StringSchema<undefined>;
399
- readonly burn_block_height: v.NumberSchema<undefined>;
400
- readonly miner_txid: v.StringSchema<undefined>;
401
- readonly tx_count: v.NumberSchema<undefined>;
402
- readonly execution_cost_read_count: v.NumberSchema<undefined>;
403
- readonly execution_cost_read_length: v.NumberSchema<undefined>;
404
- readonly execution_cost_runtime: v.NumberSchema<undefined>;
405
- readonly execution_cost_write_count: v.NumberSchema<undefined>;
406
- readonly execution_cost_write_length: v.NumberSchema<undefined>;
407
- }, undefined>;
408
- type Response$2 = v.InferOutput<typeof responseSchema$1>;
409
- declare function getBlock(opts: Args$a): Promise<Result$1<Response$2, SafeError<"FetchBlockError" | "ParseBodyError" | "ValidateDataError">>>;
392
+ type Response$2 = OperationResponse["get_block"];
393
+ declare function getBlock(opts: Args$a): Promise<Result$1<Response$2>>;
410
394
 
411
395
  declare const getBlock$1_getBlock: typeof getBlock;
412
396
  declare namespace getBlock$1 {
413
- export { type Args$a as Args, type Response$2 as Response, getBlock$1_getBlock as getBlock, responseSchema$1 as responseSchema };
397
+ export { type Args$a as Args, type Response$2 as Response, getBlock$1_getBlock as getBlock };
414
398
  }
415
399
 
416
400
  type Args$9 = {
@@ -449,18 +433,27 @@ declare const accounts: {
449
433
  latestNonce: typeof latestNonce;
450
434
  };
451
435
 
452
- declare const index$e_accounts: typeof accounts;
453
- declare namespace index$e {
454
- export { balances$1 as Balances, latestNonce$1 as LatestNonce, index$e_accounts as accounts };
436
+ declare const index$f_accounts: typeof accounts;
437
+ declare namespace index$f {
438
+ export { balances$1 as Balances, latestNonce$1 as LatestNonce, index$f_accounts as accounts };
455
439
  }
456
440
 
457
441
  declare const blocks: {
458
442
  getBlock: typeof getBlock;
459
443
  };
460
444
 
461
- declare const index$d_blocks: typeof blocks;
445
+ declare const index$e_blocks: typeof blocks;
446
+ declare namespace index$e {
447
+ export { getBlock$1 as GetBlock, index$e_blocks as blocks };
448
+ }
449
+
450
+ declare const burnBlocks: {
451
+ getBurnBlock: typeof getBurnBlock;
452
+ };
453
+
454
+ declare const index$d_burnBlocks: typeof burnBlocks;
462
455
  declare namespace index$d {
463
- export { getBlock$1 as GetBlock, index$d_blocks as blocks };
456
+ export { getBurnBlock$1 as GetBurnBlock, index$d_burnBlocks as burnBlocks };
464
457
  }
465
458
 
466
459
  declare const faucets: {
@@ -533,6 +526,9 @@ declare const stacksApi: {
533
526
  blocks: {
534
527
  getBlock: typeof getBlock;
535
528
  };
529
+ burnBlocks: {
530
+ getBurnBlock: typeof getBurnBlock;
531
+ };
536
532
  faucets: {
537
533
  stx: typeof stx;
538
534
  };
@@ -563,7 +559,7 @@ declare const stacksApi: {
563
559
 
564
560
  declare const index$6_stacksApi: typeof stacksApi;
565
561
  declare namespace index$6 {
566
- export { index$e as Accounts, index$d as Blocks, index$c as Faucets, index$b as Info, index$7 as Mempool, index$a as ProofOfTransfer, index$9 as StackingPool, index$8 as Transactions, index$6_stacksApi as stacksApi };
562
+ export { index$f as Accounts, index$e as Blocks, index$d as BurnBlocks, index$c as Faucets, index$b as Info, index$7 as Mempool, index$a as ProofOfTransfer, index$9 as StackingPool, index$8 as Transactions, index$6_stacksApi as stacksApi };
567
563
  }
568
564
 
569
565
  type Args$7 = {
package/dist/index.js CHANGED
@@ -175,28 +175,6 @@ var baseListResponseSchema = v2.object({
175
175
  });
176
176
 
177
177
  // src/stacks-api/blocks/get-block.ts
178
- import * as v3 from "valibot";
179
- var responseSchema2 = v3.object({
180
- canonical: v3.boolean(),
181
- height: v3.number(),
182
- hash: v3.string(),
183
- block_time: v3.number(),
184
- block_time_iso: v3.string(),
185
- index_block_hash: v3.string(),
186
- parent_block_hash: v3.string(),
187
- parent_index_block_hash: v3.string(),
188
- burn_block_time: v3.number(),
189
- burn_block_time_iso: v3.string(),
190
- burn_block_hash: v3.string(),
191
- burn_block_height: v3.number(),
192
- miner_txid: v3.string(),
193
- tx_count: v3.number(),
194
- execution_cost_read_count: v3.number(),
195
- execution_cost_read_length: v3.number(),
196
- execution_cost_runtime: v3.number(),
197
- execution_cost_write_count: v3.number(),
198
- execution_cost_write_length: v3.number()
199
- });
200
178
  async function getBlock(opts) {
201
179
  const init = {};
202
180
  if (opts.apiKeyConfig) {
@@ -204,10 +182,8 @@ async function getBlock(opts) {
204
182
  [opts.apiKeyConfig.header]: opts.apiKeyConfig.key
205
183
  };
206
184
  }
207
- const res = await fetch(
208
- `${opts.baseUrl}/extended/v2/blocks/${opts.heightOrHash}`,
209
- init
210
- );
185
+ const endpoint = `${opts.baseUrl}/extended/v2/blocks/${opts.heightOrHash}`;
186
+ const res = await fetch(endpoint, init);
211
187
  if (!res.ok) {
212
188
  return error({
213
189
  name: "FetchBlockError",
@@ -227,15 +203,7 @@ async function getBlock(opts) {
227
203
  data: jsonError
228
204
  });
229
205
  }
230
- const validationResult = v3.safeParse(responseSchema2, data);
231
- if (!validationResult.success) {
232
- return error({
233
- name: "ValidateDataError",
234
- message: "Failed to validate data.",
235
- data: validationResult
236
- });
237
- }
238
- return success(validationResult.output);
206
+ return success(data);
239
207
  }
240
208
 
241
209
  // src/stacks-api/blocks/index.ts
@@ -243,6 +211,44 @@ var blocks = {
243
211
  getBlock
244
212
  };
245
213
 
214
+ // src/stacks-api/burn-blocks/get-burn-block.ts
215
+ async function getBurnBlock(args) {
216
+ const init = {};
217
+ if (args.apiKeyConfig) {
218
+ init.headers = {
219
+ [args.apiKeyConfig.header]: args.apiKeyConfig.key
220
+ };
221
+ }
222
+ const endpoint = `${args.baseUrl}/extended/v2/burn-blocks/${args.heightOrHash}`;
223
+ const res = await fetch(endpoint, init);
224
+ if (!res.ok) {
225
+ return error({
226
+ name: "BurnBlockGetError",
227
+ message: "Failed to get burn block.",
228
+ data: {
229
+ heightOrHash: args.heightOrHash,
230
+ status: res.status,
231
+ statusText: res.statusText,
232
+ body: await safeExtractResponseBody(res)
233
+ }
234
+ });
235
+ }
236
+ const [jsonParseError, data] = await safePromise(res.json());
237
+ if (jsonParseError) {
238
+ return error({
239
+ name: "ParseBodyError",
240
+ message: "Failed to parse response body as JSON.",
241
+ data: jsonParseError
242
+ });
243
+ }
244
+ return success(data);
245
+ }
246
+
247
+ // src/stacks-api/burn-blocks/index.ts
248
+ var burnBlocks = {
249
+ getBurnBlock
250
+ };
251
+
246
252
  // src/stacks-api/faucets/stx.ts
247
253
  async function stx(opts) {
248
254
  const search = new URLSearchParams();
@@ -285,22 +291,22 @@ var faucets = {
285
291
  };
286
292
 
287
293
  // src/stacks-api/info/core-api.ts
288
- import * as v4 from "valibot";
289
- var CoreApiResponseSchema = v4.object({
290
- peer_version: v4.number(),
291
- pox_consensus: v4.string(),
292
- burn_block_height: v4.number(),
293
- stable_pox_consensus: v4.string(),
294
- stable_burn_block_height: v4.number(),
295
- server_version: v4.string(),
296
- network_id: v4.number(),
297
- parent_network_id: v4.number(),
298
- stacks_tip_height: v4.number(),
299
- stacks_tip: v4.string(),
300
- stacks_tip_consensus_hash: v4.string(),
301
- unanchored_tip: v4.nullable(v4.string()),
302
- unanchored_seq: v4.nullable(v4.string()),
303
- exit_at_block_height: v4.nullable(v4.number())
294
+ import * as v3 from "valibot";
295
+ var CoreApiResponseSchema = v3.object({
296
+ peer_version: v3.number(),
297
+ pox_consensus: v3.string(),
298
+ burn_block_height: v3.number(),
299
+ stable_pox_consensus: v3.string(),
300
+ stable_burn_block_height: v3.number(),
301
+ server_version: v3.string(),
302
+ network_id: v3.number(),
303
+ parent_network_id: v3.number(),
304
+ stacks_tip_height: v3.number(),
305
+ stacks_tip: v3.string(),
306
+ stacks_tip_consensus_hash: v3.string(),
307
+ unanchored_tip: v3.nullable(v3.string()),
308
+ unanchored_seq: v3.nullable(v3.string()),
309
+ exit_at_block_height: v3.nullable(v3.number())
304
310
  });
305
311
  async function coreApi(apiOpts) {
306
312
  const init = {};
@@ -329,7 +335,7 @@ async function coreApi(apiOpts) {
329
335
  data: parseBodyError
330
336
  });
331
337
  }
332
- const validationResult = v4.safeParse(CoreApiResponseSchema, data);
338
+ const validationResult = v3.safeParse(CoreApiResponseSchema, data);
333
339
  if (!validationResult.success) {
334
340
  return error({
335
341
  name: "ValidateDataError",
@@ -346,14 +352,14 @@ var info = {
346
352
  };
347
353
 
348
354
  // src/stacks-api/proof-of-transfer/cycle.ts
349
- import * as v5 from "valibot";
350
- var responseSchema3 = v5.object({
351
- block_height: v5.number(),
352
- index_block_hash: v5.string(),
353
- cycle_number: v5.number(),
354
- total_weight: v5.number(),
355
- total_stacked_amount: v5.string(),
356
- total_signers: v5.number()
355
+ import * as v4 from "valibot";
356
+ var responseSchema2 = v4.object({
357
+ block_height: v4.number(),
358
+ index_block_hash: v4.string(),
359
+ cycle_number: v4.number(),
360
+ total_weight: v4.number(),
361
+ total_stacked_amount: v4.string(),
362
+ total_signers: v4.number()
357
363
  });
358
364
  async function cycle(opts) {
359
365
  const init = {};
@@ -384,7 +390,7 @@ async function cycle(opts) {
384
390
  data: jsonError
385
391
  });
386
392
  }
387
- const validationResult = v5.safeParse(responseSchema3, data);
393
+ const validationResult = v4.safeParse(responseSchema2, data);
388
394
  if (!validationResult.success) {
389
395
  return error({
390
396
  name: "ValidateDataError",
@@ -396,17 +402,17 @@ async function cycle(opts) {
396
402
  }
397
403
 
398
404
  // src/stacks-api/proof-of-transfer/cycles.ts
399
- import * as v6 from "valibot";
400
- var cycleInfoSchema = v6.object({
401
- block_height: v6.number(),
402
- index_block_hash: v6.string(),
403
- cycle_number: v6.number(),
404
- total_weight: v6.number(),
405
- total_stacked_amount: v6.string(),
406
- total_signers: v6.number()
405
+ import * as v5 from "valibot";
406
+ var cycleInfoSchema = v5.object({
407
+ block_height: v5.number(),
408
+ index_block_hash: v5.string(),
409
+ cycle_number: v5.number(),
410
+ total_weight: v5.number(),
411
+ total_stacked_amount: v5.string(),
412
+ total_signers: v5.number()
407
413
  });
408
- var resultsSchema = v6.array(cycleInfoSchema);
409
- var cyclesResponseSchema = v6.object({
414
+ var resultsSchema = v5.array(cycleInfoSchema);
415
+ var cyclesResponseSchema = v5.object({
410
416
  ...baseListResponseSchema.entries,
411
417
  results: resultsSchema
412
418
  });
@@ -442,7 +448,7 @@ async function cycles(args) {
442
448
  data: jsonError
443
449
  });
444
450
  }
445
- const validationResult = v6.safeParse(cyclesResponseSchema, data);
451
+ const validationResult = v5.safeParse(cyclesResponseSchema, data);
446
452
  if (!validationResult.success) {
447
453
  return error({
448
454
  name: "ValidateDataError",
@@ -454,16 +460,16 @@ async function cycles(args) {
454
460
  }
455
461
 
456
462
  // src/stacks-api/proof-of-transfer/signer-in-cycle.ts
457
- import * as v7 from "valibot";
458
- var signerInCycleResponseSchema = v7.object({
459
- signing_key: v7.string(),
460
- signer_address: v7.string(),
461
- weight: v7.number(),
462
- stacked_amount: v7.string(),
463
- weight_percent: v7.number(),
464
- stacked_amount_percent: v7.number(),
465
- solo_stacker_count: v7.number(),
466
- pooled_stacker_count: v7.number()
463
+ import * as v6 from "valibot";
464
+ var signerInCycleResponseSchema = v6.object({
465
+ signing_key: v6.string(),
466
+ signer_address: v6.string(),
467
+ weight: v6.number(),
468
+ stacked_amount: v6.string(),
469
+ weight_percent: v6.number(),
470
+ stacked_amount_percent: v6.number(),
471
+ solo_stacker_count: v6.number(),
472
+ pooled_stacker_count: v6.number()
467
473
  });
468
474
  async function signerInCycle(args) {
469
475
  const init = {};
@@ -499,7 +505,7 @@ async function signerInCycle(args) {
499
505
  }
500
506
  });
501
507
  }
502
- const validationResult = v7.safeParse(signerInCycleResponseSchema, data);
508
+ const validationResult = v6.safeParse(signerInCycleResponseSchema, data);
503
509
  if (!validationResult.success) {
504
510
  return error({
505
511
  name: "ValidateDataError",
@@ -511,19 +517,19 @@ async function signerInCycle(args) {
511
517
  }
512
518
 
513
519
  // src/stacks-api/proof-of-transfer/signers-in-cycle.ts
514
- import * as v8 from "valibot";
515
- var signerSchema = v8.object({
516
- signing_key: v8.string(),
517
- signer_address: v8.string(),
518
- weight: v8.number(),
519
- stacked_amount: v8.string(),
520
- weight_percent: v8.number(),
521
- stacked_amount_percent: v8.number(),
522
- pooled_stacker_count: v8.number(),
523
- solo_stacker_count: v8.number()
520
+ import * as v7 from "valibot";
521
+ var signerSchema = v7.object({
522
+ signing_key: v7.string(),
523
+ signer_address: v7.string(),
524
+ weight: v7.number(),
525
+ stacked_amount: v7.string(),
526
+ weight_percent: v7.number(),
527
+ stacked_amount_percent: v7.number(),
528
+ pooled_stacker_count: v7.number(),
529
+ solo_stacker_count: v7.number()
524
530
  });
525
- var resultsSchema2 = v8.array(signerSchema);
526
- var signersResponseSchema = v8.object({
531
+ var resultsSchema2 = v7.array(signerSchema);
532
+ var signersResponseSchema = v7.object({
527
533
  ...baseListResponseSchema.entries,
528
534
  results: resultsSchema2
529
535
  });
@@ -562,7 +568,7 @@ async function signersInCycle(args) {
562
568
  }
563
569
  });
564
570
  }
565
- const validationResult = v8.safeParse(signersResponseSchema, data);
571
+ const validationResult = v7.safeParse(signersResponseSchema, data);
566
572
  if (!validationResult.success) {
567
573
  return error({
568
574
  name: "ValidateDataError",
@@ -894,6 +900,7 @@ var mempool = {
894
900
  var stacksApi = {
895
901
  accounts,
896
902
  blocks,
903
+ burnBlocks,
897
904
  faucets,
898
905
  info,
899
906
  mempool,
@@ -903,16 +910,16 @@ var stacksApi = {
903
910
  };
904
911
 
905
912
  // src/stacks-rpc-api/smart-contracts/map-entry.ts
906
- import * as v9 from "valibot";
907
- var mapEntryResponseSchema = v9.object({
913
+ import * as v8 from "valibot";
914
+ var mapEntryResponseSchema = v8.object({
908
915
  /**
909
916
  * Hex-encoded string of clarity value. It is always an optional tuple.
910
917
  */
911
- data: v9.string(),
918
+ data: v8.string(),
912
919
  /**
913
920
  * Hex-encoded string of the MARF proof for the data
914
921
  */
915
- proof: v9.optional(v9.string())
922
+ proof: v8.optional(v8.string())
916
923
  });
917
924
  async function mapEntry(args) {
918
925
  const search = new URLSearchParams();
@@ -952,7 +959,7 @@ async function mapEntry(args) {
952
959
  data: jsonError
953
960
  });
954
961
  }
955
- const validationResult = v9.safeParse(mapEntryResponseSchema, data);
962
+ const validationResult = v8.safeParse(mapEntryResponseSchema, data);
956
963
  if (!validationResult.success) {
957
964
  return error({
958
965
  name: "ValidateDataError",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secretkeylabs/stacks-tools",
3
- "version": "0.7.0-3be878c",
3
+ "version": "0.7.0-6184ecb",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"