@stacks/blockchain-api-client 6.0.0-beta.9 → 6.0.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": "6.0.0-beta.9",
3
+ "version": "6.0.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",
@@ -18,6 +18,8 @@ index.ts
18
18
  models/AccountDataResponse.ts
19
19
  models/AddressAssetsListResponse.ts
20
20
  models/AddressBalanceResponse.ts
21
+ models/AddressNftListResponse.ts
22
+ models/AddressNftListResponseValue.ts
21
23
  models/AddressNonces.ts
22
24
  models/AddressStxInboundListResponse.ts
23
25
  models/AddressTokenOfferingLocked.ts
@@ -71,6 +73,7 @@ models/MicroblockListResponse.ts
71
73
  models/NetworkBlockTimeResponse.ts
72
74
  models/NetworkBlockTimesResponse.ts
73
75
  models/NetworkIdentifier.ts
76
+ models/NftEvent.ts
74
77
  models/NonFungibleTokenHistoryEventList.ts
75
78
  models/NonFungibleTokenHoldingsList.ts
76
79
  models/NonFungibleTokenMetadata.ts
@@ -24,6 +24,9 @@ import {
24
24
  AddressBalanceResponse,
25
25
  AddressBalanceResponseFromJSON,
26
26
  AddressBalanceResponseToJSON,
27
+ AddressNftListResponse,
28
+ AddressNftListResponseFromJSON,
29
+ AddressNftListResponseToJSON,
27
30
  AddressNonces,
28
31
  AddressNoncesFromJSON,
29
32
  AddressNoncesToJSON,
@@ -70,6 +73,14 @@ export interface GetAccountInfoRequest {
70
73
  tip?: string;
71
74
  }
72
75
 
76
+ export interface GetAccountNftRequest {
77
+ principal: string;
78
+ limit?: number;
79
+ offset?: number;
80
+ unanchored?: boolean;
81
+ untilBlock?: string;
82
+ }
83
+
73
84
  export interface GetAccountNoncesRequest {
74
85
  principal: string;
75
86
  blockHeight?: number;
@@ -189,6 +200,26 @@ export interface AccountsApiInterface {
189
200
  */
190
201
  getAccountInfo(requestParameters: GetAccountInfoRequest, initOverrides?: RequestInit): Promise<AccountDataResponse>;
191
202
 
203
+ /**
204
+ * **NOTE:** This endpoint is deprecated in favor of [Non-Fungible Token holdings](#operation/get_nft_holdings). Retrieves a list of all nfts owned by an address, contains the clarity value of the identifier of the nft.
205
+ * @summary Get nft events
206
+ * @param {string} principal Stacks address or a Contract identifier
207
+ * @param {number} [limit] number of items to return
208
+ * @param {number} [offset] number of items to skip
209
+ * @param {boolean} [unanchored] Include transaction data from unanchored (i.e. unconfirmed) microblocks
210
+ * @param {string} [untilBlock] returned data representing the state up until that point in time, rather than the current block. Note - Use either of the query parameters but not both at a time.
211
+ * @param {*} [options] Override http request option.
212
+ * @throws {RequiredError}
213
+ * @memberof AccountsApiInterface
214
+ */
215
+ getAccountNftRaw(requestParameters: GetAccountNftRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<AddressNftListResponse>>;
216
+
217
+ /**
218
+ * **NOTE:** This endpoint is deprecated in favor of [Non-Fungible Token holdings](#operation/get_nft_holdings). Retrieves a list of all nfts owned by an address, contains the clarity value of the identifier of the nft.
219
+ * Get nft events
220
+ */
221
+ getAccountNft(requestParameters: GetAccountNftRequest, initOverrides?: RequestInit): Promise<AddressNftListResponse>;
222
+
192
223
  /**
193
224
  * Retrieves the latest nonce values used by an account by inspecting the mempool, microblock transactions, and anchored transactions.
194
225
  * @summary Get the latest nonce used by an account
@@ -471,6 +502,54 @@ export class AccountsApi extends runtime.BaseAPI implements AccountsApiInterface
471
502
  return await response.value();
472
503
  }
473
504
 
505
+ /**
506
+ * **NOTE:** This endpoint is deprecated in favor of [Non-Fungible Token holdings](#operation/get_nft_holdings). Retrieves a list of all nfts owned by an address, contains the clarity value of the identifier of the nft.
507
+ * Get nft events
508
+ */
509
+ async getAccountNftRaw(requestParameters: GetAccountNftRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<AddressNftListResponse>> {
510
+ if (requestParameters.principal === null || requestParameters.principal === undefined) {
511
+ throw new runtime.RequiredError('principal','Required parameter requestParameters.principal was null or undefined when calling getAccountNft.');
512
+ }
513
+
514
+ const queryParameters: any = {};
515
+
516
+ if (requestParameters.limit !== undefined) {
517
+ queryParameters['limit'] = requestParameters.limit;
518
+ }
519
+
520
+ if (requestParameters.offset !== undefined) {
521
+ queryParameters['offset'] = requestParameters.offset;
522
+ }
523
+
524
+ if (requestParameters.unanchored !== undefined) {
525
+ queryParameters['unanchored'] = requestParameters.unanchored;
526
+ }
527
+
528
+ if (requestParameters.untilBlock !== undefined) {
529
+ queryParameters['until_block'] = requestParameters.untilBlock;
530
+ }
531
+
532
+ const headerParameters: runtime.HTTPHeaders = {};
533
+
534
+ const response = await this.request({
535
+ path: `/extended/v1/address/{principal}/nft_events`.replace(`{${"principal"}}`, encodeURIComponent(String(requestParameters.principal))),
536
+ method: 'GET',
537
+ headers: headerParameters,
538
+ query: queryParameters,
539
+ }, initOverrides);
540
+
541
+ return new runtime.JSONApiResponse(response, (jsonValue) => AddressNftListResponseFromJSON(jsonValue));
542
+ }
543
+
544
+ /**
545
+ * **NOTE:** This endpoint is deprecated in favor of [Non-Fungible Token holdings](#operation/get_nft_holdings). Retrieves a list of all nfts owned by an address, contains the clarity value of the identifier of the nft.
546
+ * Get nft events
547
+ */
548
+ async getAccountNft(requestParameters: GetAccountNftRequest, initOverrides?: RequestInit): Promise<AddressNftListResponse> {
549
+ const response = await this.getAccountNftRaw(requestParameters, initOverrides);
550
+ return await response.value();
551
+ }
552
+
474
553
  /**
475
554
  * Retrieves the latest nonce values used by an account by inspecting the mempool, microblock transactions, and anchored transactions.
476
555
  * Get the latest nonce used by an account
@@ -0,0 +1,87 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Stacks Blockchain API
5
+ * Welcome to the API reference overview for the <a href=\"https://docs.hiro.so/get-started/stacks-blockchain-api\">Stacks Blockchain API</a>. <a href=\"https://hirosystems.github.io/stacks-blockchain-api/collection.json\" download=\"stacks-api-collection.json\">Download Postman collection</a>
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
+ NftEvent,
18
+ NftEventFromJSON,
19
+ NftEventFromJSONTyped,
20
+ NftEventToJSON,
21
+ } from './';
22
+
23
+ /**
24
+ *
25
+ * @export
26
+ * @interface AddressNftListResponse
27
+ */
28
+ export interface AddressNftListResponse {
29
+ /**
30
+ *
31
+ * @type {number}
32
+ * @memberof AddressNftListResponse
33
+ */
34
+ limit: number;
35
+ /**
36
+ *
37
+ * @type {number}
38
+ * @memberof AddressNftListResponse
39
+ */
40
+ offset: number;
41
+ /**
42
+ *
43
+ * @type {number}
44
+ * @memberof AddressNftListResponse
45
+ */
46
+ total: number;
47
+ /**
48
+ *
49
+ * @type {Array<NftEvent>}
50
+ * @memberof AddressNftListResponse
51
+ */
52
+ nft_events: Array<NftEvent>;
53
+ }
54
+
55
+ export function AddressNftListResponseFromJSON(json: any): AddressNftListResponse {
56
+ return AddressNftListResponseFromJSONTyped(json, false);
57
+ }
58
+
59
+ export function AddressNftListResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): AddressNftListResponse {
60
+ if ((json === undefined) || (json === null)) {
61
+ return json;
62
+ }
63
+ return {
64
+
65
+ 'limit': json['limit'],
66
+ 'offset': json['offset'],
67
+ 'total': json['total'],
68
+ 'nft_events': ((json['nft_events'] as Array<any>).map(NftEventFromJSON)),
69
+ };
70
+ }
71
+
72
+ export function AddressNftListResponseToJSON(value?: AddressNftListResponse | null): any {
73
+ if (value === undefined) {
74
+ return undefined;
75
+ }
76
+ if (value === null) {
77
+ return null;
78
+ }
79
+ return {
80
+
81
+ 'limit': value.limit,
82
+ 'offset': value.offset,
83
+ 'total': value.total,
84
+ 'nft_events': ((value.nft_events as Array<any>).map(NftEventToJSON)),
85
+ };
86
+ }
87
+
@@ -0,0 +1,64 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Stacks Blockchain API
5
+ * Welcome to the API reference overview for the <a href=\"https://docs.hiro.so/get-started/stacks-blockchain-api\">Stacks Blockchain API</a>. <a href=\"https://hirosystems.github.io/stacks-blockchain-api/collection.json\" download=\"stacks-api-collection.json\">Download Postman collection</a>
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
+ * Identifier of the NFT
18
+ * @export
19
+ * @interface AddressNftListResponseValue
20
+ */
21
+ export interface AddressNftListResponseValue {
22
+ /**
23
+ * Hex string representing the identifier of the NFT
24
+ * @type {string}
25
+ * @memberof AddressNftListResponseValue
26
+ */
27
+ hex: string;
28
+ /**
29
+ * Readable string of the NFT identifier
30
+ * @type {string}
31
+ * @memberof AddressNftListResponseValue
32
+ */
33
+ repr: string;
34
+ }
35
+
36
+ export function AddressNftListResponseValueFromJSON(json: any): AddressNftListResponseValue {
37
+ return AddressNftListResponseValueFromJSONTyped(json, false);
38
+ }
39
+
40
+ export function AddressNftListResponseValueFromJSONTyped(json: any, ignoreDiscriminator: boolean): AddressNftListResponseValue {
41
+ if ((json === undefined) || (json === null)) {
42
+ return json;
43
+ }
44
+ return {
45
+
46
+ 'hex': json['hex'],
47
+ 'repr': json['repr'],
48
+ };
49
+ }
50
+
51
+ export function AddressNftListResponseValueToJSON(value?: AddressNftListResponseValue | null): any {
52
+ if (value === undefined) {
53
+ return undefined;
54
+ }
55
+ if (value === null) {
56
+ return null;
57
+ }
58
+ return {
59
+
60
+ 'hex': value.hex,
61
+ 'repr': value.repr,
62
+ };
63
+ }
64
+
@@ -0,0 +1,127 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Stacks Blockchain API
5
+ * Welcome to the API reference overview for the <a href=\"https://docs.hiro.so/get-started/stacks-blockchain-api\">Stacks Blockchain API</a>. <a href=\"https://hirosystems.github.io/stacks-blockchain-api/collection.json\" download=\"stacks-api-collection.json\">Download Postman collection</a>
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
+ AddressNftListResponseValue,
18
+ AddressNftListResponseValueFromJSON,
19
+ AddressNftListResponseValueFromJSONTyped,
20
+ AddressNftListResponseValueToJSON,
21
+ } from './';
22
+
23
+ /**
24
+ *
25
+ * @export
26
+ * @interface NftEvent
27
+ */
28
+ export interface NftEvent {
29
+ /**
30
+ *
31
+ * @type {string}
32
+ * @memberof NftEvent
33
+ */
34
+ sender?: string;
35
+ /**
36
+ *
37
+ * @type {string}
38
+ * @memberof NftEvent
39
+ */
40
+ recipient?: string;
41
+ /**
42
+ *
43
+ * @type {string}
44
+ * @memberof NftEvent
45
+ */
46
+ asset_identifier: string;
47
+ /**
48
+ *
49
+ * @type {string}
50
+ * @memberof NftEvent
51
+ */
52
+ asset_event_type: string;
53
+ /**
54
+ *
55
+ * @type {AddressNftListResponseValue}
56
+ * @memberof NftEvent
57
+ */
58
+ value: AddressNftListResponseValue;
59
+ /**
60
+ *
61
+ * @type {string}
62
+ * @memberof NftEvent
63
+ */
64
+ tx_id: string;
65
+ /**
66
+ *
67
+ * @type {number}
68
+ * @memberof NftEvent
69
+ */
70
+ tx_index: number;
71
+ /**
72
+ *
73
+ * @type {number}
74
+ * @memberof NftEvent
75
+ */
76
+ block_height: number;
77
+ /**
78
+ *
79
+ * @type {number}
80
+ * @memberof NftEvent
81
+ */
82
+ event_index: number;
83
+ }
84
+
85
+ export function NftEventFromJSON(json: any): NftEvent {
86
+ return NftEventFromJSONTyped(json, false);
87
+ }
88
+
89
+ export function NftEventFromJSONTyped(json: any, ignoreDiscriminator: boolean): NftEvent {
90
+ if ((json === undefined) || (json === null)) {
91
+ return json;
92
+ }
93
+ return {
94
+
95
+ 'sender': !exists(json, 'sender') ? undefined : json['sender'],
96
+ 'recipient': !exists(json, 'recipient') ? undefined : json['recipient'],
97
+ 'asset_identifier': json['asset_identifier'],
98
+ 'asset_event_type': json['asset_event_type'],
99
+ 'value': AddressNftListResponseValueFromJSON(json['value']),
100
+ 'tx_id': json['tx_id'],
101
+ 'tx_index': json['tx_index'],
102
+ 'block_height': json['block_height'],
103
+ 'event_index': json['event_index'],
104
+ };
105
+ }
106
+
107
+ export function NftEventToJSON(value?: NftEvent | null): any {
108
+ if (value === undefined) {
109
+ return undefined;
110
+ }
111
+ if (value === null) {
112
+ return null;
113
+ }
114
+ return {
115
+
116
+ 'sender': value.sender,
117
+ 'recipient': value.recipient,
118
+ 'asset_identifier': value.asset_identifier,
119
+ 'asset_event_type': value.asset_event_type,
120
+ 'value': AddressNftListResponseValueToJSON(value.value),
121
+ 'tx_id': value.tx_id,
122
+ 'tx_index': value.tx_index,
123
+ 'block_height': value.block_height,
124
+ 'event_index': value.event_index,
125
+ };
126
+ }
127
+
@@ -3,6 +3,8 @@
3
3
  export * from './AccountDataResponse';
4
4
  export * from './AddressAssetsListResponse';
5
5
  export * from './AddressBalanceResponse';
6
+ export * from './AddressNftListResponse';
7
+ export * from './AddressNftListResponseValue';
6
8
  export * from './AddressNonces';
7
9
  export * from './AddressStxInboundListResponse';
8
10
  export * from './AddressTokenOfferingLocked';
@@ -56,6 +58,7 @@ export * from './MicroblockListResponse';
56
58
  export * from './NetworkBlockTimeResponse';
57
59
  export * from './NetworkBlockTimesResponse';
58
60
  export * from './NetworkIdentifier';
61
+ export * from './NftEvent';
59
62
  export * from './NonFungibleTokenHistoryEventList';
60
63
  export * from './NonFungibleTokenHoldingsList';
61
64
  export * from './NonFungibleTokenMetadata';