@stacks/blockchain-api-client 7.12.0-beta.1 → 7.13.0-beta.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stacks/blockchain-api-client",
3
- "version": "7.12.0-beta.1",
3
+ "version": "7.13.0-beta.1",
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",
@@ -4,6 +4,7 @@ apis/BlocksApi.ts
4
4
  apis/BurnBlocksApi.ts
5
5
  apis/FaucetsApi.ts
6
6
  apis/FeesApi.ts
7
+ apis/FungibleTokensApi.ts
7
8
  apis/InfoApi.ts
8
9
  apis/MempoolApi.ts
9
10
  apis/MicroblocksApi.ts
@@ -61,6 +62,8 @@ models/CoreNodeInfoResponse.ts
61
62
  models/CoreNodePoxResponse.ts
62
63
  models/FeeRate.ts
63
64
  models/FeeRateRequest.ts
65
+ models/FtHolderEntry.ts
66
+ models/FungibleTokenHolderList.ts
64
67
  models/GetRawTransactionResult.ts
65
68
  models/GetStxSupplyLegacyFormatResponse.ts
66
69
  models/GetStxSupplyResponse.ts
@@ -0,0 +1,89 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Stacks Blockchain API
5
+ * Welcome to the API reference overview for the [Stacks Blockchain API](https://docs.hiro.so/stacks-blockchain-api). [Download Postman collection](https://hirosystems.github.io/stacks-blockchain-api/collection.json)
6
+ *
7
+ * The version of the OpenAPI document: STACKS_API_VERSION
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import * as runtime from '../runtime';
17
+ import {
18
+ FungibleTokenHolderList,
19
+ FungibleTokenHolderListFromJSON,
20
+ FungibleTokenHolderListToJSON,
21
+ } from '../models';
22
+
23
+ export interface GetFtHoldersRequest {
24
+ token: string;
25
+ }
26
+
27
+ /**
28
+ * FungibleTokensApi - interface
29
+ *
30
+ * @export
31
+ * @interface FungibleTokensApiInterface
32
+ */
33
+ export interface FungibleTokensApiInterface {
34
+ /**
35
+ * Retrieves the list of Fungible Token holders for a given token ID. Specify `stx` for the `token` parameter to get the list of STX holders.
36
+ * @summary Fungible token holders
37
+ * @param {string} token fungible token identifier
38
+ * @param {*} [options] Override http request option.
39
+ * @throws {RequiredError}
40
+ * @memberof FungibleTokensApiInterface
41
+ */
42
+ getFtHoldersRaw(requestParameters: GetFtHoldersRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<FungibleTokenHolderList>>;
43
+
44
+ /**
45
+ * Retrieves the list of Fungible Token holders for a given token ID. Specify `stx` for the `token` parameter to get the list of STX holders.
46
+ * Fungible token holders
47
+ */
48
+ getFtHolders(requestParameters: GetFtHoldersRequest, initOverrides?: RequestInit): Promise<FungibleTokenHolderList>;
49
+
50
+ }
51
+
52
+ /**
53
+ *
54
+ */
55
+ export class FungibleTokensApi extends runtime.BaseAPI implements FungibleTokensApiInterface {
56
+
57
+ /**
58
+ * Retrieves the list of Fungible Token holders for a given token ID. Specify `stx` for the `token` parameter to get the list of STX holders.
59
+ * Fungible token holders
60
+ */
61
+ async getFtHoldersRaw(requestParameters: GetFtHoldersRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<FungibleTokenHolderList>> {
62
+ if (requestParameters.token === null || requestParameters.token === undefined) {
63
+ throw new runtime.RequiredError('token','Required parameter requestParameters.token was null or undefined when calling getFtHolders.');
64
+ }
65
+
66
+ const queryParameters: any = {};
67
+
68
+ const headerParameters: runtime.HTTPHeaders = {};
69
+
70
+ const response = await this.request({
71
+ path: `/extended/v1/tokens/ft/{token}/holders`.replace(`{${"token"}}`, encodeURIComponent(String(requestParameters.token))),
72
+ method: 'GET',
73
+ headers: headerParameters,
74
+ query: queryParameters,
75
+ }, initOverrides);
76
+
77
+ return new runtime.JSONApiResponse(response, (jsonValue) => FungibleTokenHolderListFromJSON(jsonValue));
78
+ }
79
+
80
+ /**
81
+ * Retrieves the list of Fungible Token holders for a given token ID. Specify `stx` for the `token` parameter to get the list of STX holders.
82
+ * Fungible token holders
83
+ */
84
+ async getFtHolders(requestParameters: GetFtHoldersRequest, initOverrides?: RequestInit): Promise<FungibleTokenHolderList> {
85
+ const response = await this.getFtHoldersRaw(requestParameters, initOverrides);
86
+ return await response.value();
87
+ }
88
+
89
+ }
@@ -100,7 +100,14 @@ export interface GetTransactionListRequest {
100
100
  limit?: number;
101
101
  offset?: number;
102
102
  type?: Array<GetTransactionListTypeEnum>;
103
+ fromAddress?: string;
104
+ toAddress?: string;
103
105
  sortBy?: GetTransactionListSortByEnum;
106
+ startTime?: number;
107
+ endTime?: number;
108
+ contractId?: string;
109
+ functionName?: string;
110
+ nonce?: number;
104
111
  order?: GetTransactionListOrderEnum;
105
112
  unanchored?: boolean;
106
113
  }
@@ -312,7 +319,14 @@ export interface TransactionsApiInterface {
312
319
  * @param {number} [limit] max number of transactions to fetch
313
320
  * @param {number} [offset] index of first transaction to fetch
314
321
  * @param {Array<'coinbase' | 'token_transfer' | 'smart_contract' | 'contract_call' | 'poison_microblock' | 'tenure_change'>} [type] Filter by transaction type
322
+ * @param {string} [fromAddress] Option to filter results by sender address
323
+ * @param {string} [toAddress] Option to filter results by recipient address
315
324
  * @param {'block_height' | 'burn_block_time' | 'fee'} [sortBy] Option to sort results by block height, timestamp, or fee
325
+ * @param {number} [startTime] Filter by transactions after this timestamp (unix timestamp in seconds)
326
+ * @param {number} [endTime] Filter by transactions before this timestamp (unix timestamp in seconds)
327
+ * @param {string} [contractId] Filter by contract call transactions involving this contract ID
328
+ * @param {string} [functionName] Filter by contract call transactions involving this function name
329
+ * @param {number} [nonce] Filter by transactions with this nonce
316
330
  * @param {'asc' | 'desc'} [order] Option to sort results in ascending or descending order
317
331
  * @param {boolean} [unanchored] Include transaction data from unanchored (i.e. unconfirmed) microblocks
318
332
  * @param {*} [options] Override http request option.
@@ -817,10 +831,38 @@ export class TransactionsApi extends runtime.BaseAPI implements TransactionsApiI
817
831
  queryParameters['type'] = requestParameters.type;
818
832
  }
819
833
 
834
+ if (requestParameters.fromAddress !== undefined) {
835
+ queryParameters['from_address'] = requestParameters.fromAddress;
836
+ }
837
+
838
+ if (requestParameters.toAddress !== undefined) {
839
+ queryParameters['to_address'] = requestParameters.toAddress;
840
+ }
841
+
820
842
  if (requestParameters.sortBy !== undefined) {
821
843
  queryParameters['sort_by'] = requestParameters.sortBy;
822
844
  }
823
845
 
846
+ if (requestParameters.startTime !== undefined) {
847
+ queryParameters['start_time'] = requestParameters.startTime;
848
+ }
849
+
850
+ if (requestParameters.endTime !== undefined) {
851
+ queryParameters['end_time'] = requestParameters.endTime;
852
+ }
853
+
854
+ if (requestParameters.contractId !== undefined) {
855
+ queryParameters['contract_id'] = requestParameters.contractId;
856
+ }
857
+
858
+ if (requestParameters.functionName !== undefined) {
859
+ queryParameters['function_name'] = requestParameters.functionName;
860
+ }
861
+
862
+ if (requestParameters.nonce !== undefined) {
863
+ queryParameters['nonce'] = requestParameters.nonce;
864
+ }
865
+
824
866
  if (requestParameters.order !== undefined) {
825
867
  queryParameters['order'] = requestParameters.order;
826
868
  }
@@ -5,6 +5,7 @@ export * from './BlocksApi';
5
5
  export * from './BurnBlocksApi';
6
6
  export * from './FaucetsApi';
7
7
  export * from './FeesApi';
8
+ export * from './FungibleTokensApi';
8
9
  export * from './InfoApi';
9
10
  export * from './MempoolApi';
10
11
  export * from './MicroblocksApi';
@@ -0,0 +1,64 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Stacks Blockchain API
5
+ * Welcome to the API reference overview for the [Stacks Blockchain API](https://docs.hiro.so/stacks-blockchain-api). [Download Postman collection](https://hirosystems.github.io/stacks-blockchain-api/collection.json)
6
+ *
7
+ * The version of the OpenAPI document: STACKS_API_VERSION
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { exists, mapValues } from '../runtime';
16
+ /**
17
+ *
18
+ * @export
19
+ * @interface FtHolderEntry
20
+ */
21
+ export interface FtHolderEntry {
22
+ /**
23
+ *
24
+ * @type {string}
25
+ * @memberof FtHolderEntry
26
+ */
27
+ address: string;
28
+ /**
29
+ *
30
+ * @type {string}
31
+ * @memberof FtHolderEntry
32
+ */
33
+ balance: string;
34
+ }
35
+
36
+ export function FtHolderEntryFromJSON(json: any): FtHolderEntry {
37
+ return FtHolderEntryFromJSONTyped(json, false);
38
+ }
39
+
40
+ export function FtHolderEntryFromJSONTyped(json: any, ignoreDiscriminator: boolean): FtHolderEntry {
41
+ if ((json === undefined) || (json === null)) {
42
+ return json;
43
+ }
44
+ return {
45
+
46
+ 'address': json['address'],
47
+ 'balance': json['balance'],
48
+ };
49
+ }
50
+
51
+ export function FtHolderEntryToJSON(value?: FtHolderEntry | null): any {
52
+ if (value === undefined) {
53
+ return undefined;
54
+ }
55
+ if (value === null) {
56
+ return null;
57
+ }
58
+ return {
59
+
60
+ 'address': value.address,
61
+ 'balance': value.balance,
62
+ };
63
+ }
64
+
@@ -0,0 +1,95 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Stacks Blockchain API
5
+ * Welcome to the API reference overview for the [Stacks Blockchain API](https://docs.hiro.so/stacks-blockchain-api). [Download Postman collection](https://hirosystems.github.io/stacks-blockchain-api/collection.json)
6
+ *
7
+ * The version of the OpenAPI document: STACKS_API_VERSION
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { exists, mapValues } from '../runtime';
16
+ import {
17
+ FtHolderEntry,
18
+ FtHolderEntryFromJSON,
19
+ FtHolderEntryFromJSONTyped,
20
+ FtHolderEntryToJSON,
21
+ } from './';
22
+
23
+ /**
24
+ * List of Fungible Token holders
25
+ * @export
26
+ * @interface FungibleTokenHolderList
27
+ */
28
+ export interface FungibleTokenHolderList {
29
+ /**
30
+ * The number of holders to return
31
+ * @type {number}
32
+ * @memberof FungibleTokenHolderList
33
+ */
34
+ limit: number;
35
+ /**
36
+ * The number to holders to skip (starting at `0`)
37
+ * @type {number}
38
+ * @memberof FungibleTokenHolderList
39
+ */
40
+ offset: number;
41
+ /**
42
+ * The number of holders available
43
+ * @type {number}
44
+ * @memberof FungibleTokenHolderList
45
+ */
46
+ total: number;
47
+ /**
48
+ * The total supply of the token (the sum of all balances)
49
+ * @type {string}
50
+ * @memberof FungibleTokenHolderList
51
+ */
52
+ total_supply: string;
53
+ /**
54
+ *
55
+ * @type {Array<FtHolderEntry>}
56
+ * @memberof FungibleTokenHolderList
57
+ */
58
+ results: Array<FtHolderEntry>;
59
+ }
60
+
61
+ export function FungibleTokenHolderListFromJSON(json: any): FungibleTokenHolderList {
62
+ return FungibleTokenHolderListFromJSONTyped(json, false);
63
+ }
64
+
65
+ export function FungibleTokenHolderListFromJSONTyped(json: any, ignoreDiscriminator: boolean): FungibleTokenHolderList {
66
+ if ((json === undefined) || (json === null)) {
67
+ return json;
68
+ }
69
+ return {
70
+
71
+ 'limit': json['limit'],
72
+ 'offset': json['offset'],
73
+ 'total': json['total'],
74
+ 'total_supply': json['total_supply'],
75
+ 'results': ((json['results'] as Array<any>).map(FtHolderEntryFromJSON)),
76
+ };
77
+ }
78
+
79
+ export function FungibleTokenHolderListToJSON(value?: FungibleTokenHolderList | null): any {
80
+ if (value === undefined) {
81
+ return undefined;
82
+ }
83
+ if (value === null) {
84
+ return null;
85
+ }
86
+ return {
87
+
88
+ 'limit': value.limit,
89
+ 'offset': value.offset,
90
+ 'total': value.total,
91
+ 'total_supply': value.total_supply,
92
+ 'results': ((value.results as Array<any>).map(FtHolderEntryToJSON)),
93
+ };
94
+ }
95
+
@@ -43,6 +43,8 @@ export * from './CoreNodeInfoResponse';
43
43
  export * from './CoreNodePoxResponse';
44
44
  export * from './FeeRate';
45
45
  export * from './FeeRateRequest';
46
+ export * from './FtHolderEntry';
47
+ export * from './FungibleTokenHolderList';
46
48
  export * from './GetRawTransactionResult';
47
49
  export * from './GetStxSupplyLegacyFormatResponse';
48
50
  export * from './GetStxSupplyResponse';