@stacks/blockchain-api-client 8.0.0-beta.1 → 8.0.0-beta.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stacks/blockchain-api-client",
3
- "version": "8.0.0-beta.1",
3
+ "version": "8.0.0-beta.3",
4
4
  "access": "public",
5
5
  "description": "Client for the Stacks Blockchain API",
6
6
  "homepage": "https://github.com/hirosystems/stacks-blockchain-api/tree/master/client#readme",
@@ -1812,7 +1812,7 @@ export interface operations {
1812
1812
  offset?: number;
1813
1813
  /** @description Results per page */
1814
1814
  limit?: number;
1815
- type?: (("coinbase" | "token_transfer" | "smart_contract" | "contract_call" | "poison_microblock" | "tenure_change") | string)[];
1815
+ type?: ("coinbase" | "token_transfer" | "smart_contract" | "contract_call" | "poison_microblock" | "tenure_change")[];
1816
1816
  /**
1817
1817
  * @description Include data from unanchored (i.e. unconfirmed) microblocks
1818
1818
  * @example true
@@ -3177,7 +3177,7 @@ export interface operations {
3177
3177
  get_tx_list_details: {
3178
3178
  parameters: {
3179
3179
  query: {
3180
- tx_id: (string)[];
3180
+ tx_id: string[];
3181
3181
  /** @description Results per page */
3182
3182
  event_limit?: number;
3183
3183
  /** @description Result offset */
@@ -6496,7 +6496,7 @@ export interface operations {
6496
6496
  */
6497
6497
  tx_id?: string;
6498
6498
  address?: string;
6499
- type?: (("smart_contract_log" | "stx_lock" | "stx_asset" | "fungible_token_asset" | "non_fungible_token_asset") | string)[];
6499
+ type?: ("smart_contract_log" | "stx_lock" | "stx_asset" | "fungible_token_asset" | "non_fungible_token_asset")[];
6500
6500
  /** @description Result offset */
6501
6501
  offset?: number;
6502
6502
  /** @description Results per page */
@@ -27255,7 +27255,7 @@ export interface operations {
27255
27255
  query?: never;
27256
27256
  header?: never;
27257
27257
  path: {
27258
- height_or_hash: "latest" | string;
27258
+ height_or_hash: "latest" | string | number;
27259
27259
  };
27260
27260
  cookie?: never;
27261
27261
  };
@@ -27321,7 +27321,7 @@ export interface operations {
27321
27321
  };
27322
27322
  header?: never;
27323
27323
  path: {
27324
- height_or_hash: "latest" | string;
27324
+ height_or_hash: "latest" | string | number;
27325
27325
  };
27326
27326
  cookie?: never;
27327
27327
  };
@@ -28697,7 +28697,7 @@ export interface operations {
28697
28697
  query?: never;
28698
28698
  header?: never;
28699
28699
  path: {
28700
- height_or_hash: "latest" | string;
28700
+ height_or_hash: "latest" | string | number;
28701
28701
  };
28702
28702
  cookie?: never;
28703
28703
  };
@@ -28739,7 +28739,7 @@ export interface operations {
28739
28739
  };
28740
28740
  header?: never;
28741
28741
  path: {
28742
- height_or_hash: "latest" | string;
28742
+ height_or_hash: "latest" | string | number;
28743
28743
  };
28744
28744
  cookie?: never;
28745
28745
  };
package/src/index.ts CHANGED
@@ -10,3 +10,4 @@ export * from './common';
10
10
  export * from './socket-io';
11
11
  export * from './ws';
12
12
  export type * from './types';
13
+ export * from 'openapi-fetch';
package/src/types.d.ts CHANGED
@@ -1,14 +1,25 @@
1
- import type { operations } from "./generated/schema";
1
+ import type { operations, paths } from './generated/schema';
2
+
3
+ type Extract200Response<T> = T extends { 200: infer R } ? R : never;
4
+ type ExtractOperationResponse<T extends keyof operations> = Extract200Response<operations[T]['responses']> extends { content: { 'application/json': infer U } } ? U : never;
5
+ type PathResponse<T extends keyof paths> = paths[T]['get'] extends { responses: infer R } ? Extract200Response<R> extends { content: { 'application/json': infer U } } ? U : never : never;
6
+
7
+ export type OperationResponse = {
8
+ [K in keyof operations]: ExtractOperationResponse<K>;
9
+ } & {
10
+ [P in keyof paths]: PathResponse<P>;
11
+ };
12
+
13
+ export type Transaction = OperationResponse['get_transaction_list']['results'][number];
14
+ export type MempoolTransaction = OperationResponse['get_mempool_transaction_list']['results'][number];
15
+ export type Block = OperationResponse['get_block_by_height'];
16
+ export type Microblock = OperationResponse['get_microblock_by_hash'];
17
+ export type NakamotoBlock = OperationResponse['get_block'];
18
+ export type BurnBlock = OperationResponse['get_burn_blocks']['results'][number];
19
+ export type SmartContract = OperationResponse['get_contract_by_id'];
20
+ export type AddressTransactionWithTransfers = OperationResponse['get_account_transactions_with_transfers']['results'][number];
21
+ export type AddressStxBalanceResponse = OperationResponse['get_account_stx_balance'];
2
22
 
3
- export type Transaction = operations['get_transaction_list']['responses']['200']['content']['application/json']['results'][number];
4
- export type MempoolTransaction = operations['get_mempool_transaction_list']['responses']['200']['content']['application/json']['results'][number];
5
- export type Block = operations['get_block_by_height']['responses']['200']['content']['application/json'];
6
- export type Microblock = operations['get_microblock_by_hash']['responses']['200']['content']['application/json'];
7
- export type NakamotoBlock = operations['get_block']['responses']['200']['content']['application/json'];
8
- export type BurnBlock = operations['get_burn_blocks']['responses']['200']['content']['application/json']['results'][number];
9
- export type SmartContract = operations['get_contract_by_id']['responses']['200']['content']['application/json'];
10
- export type AddressTransactionWithTransfers = operations['get_account_transactions_with_transfers']['responses']['200']['content']['application/json']['results'][number];
11
- export type AddressStxBalanceResponse = operations['get_account_stx_balance']['responses']['200']['content']['application/json'];
12
23
  export type RpcAddressTxNotificationParams = AddressTransactionWithTransfers & {
13
24
  address: string;
14
25
  tx_id: string;