algosdk 3.5.2 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/browser/algosdk.min.js +1 -1
- package/dist/browser/algosdk.min.js.map +1 -1
- package/dist/cjs/appAccess.js +8 -5
- package/dist/cjs/appAccess.js.map +1 -1
- package/dist/cjs/client/v2/algod/accountApplicationsInformation.js +38 -0
- package/dist/cjs/client/v2/algod/accountApplicationsInformation.js.map +1 -0
- package/dist/cjs/client/v2/algod/accountAssetsInformation.js +31 -0
- package/dist/cjs/client/v2/algod/accountAssetsInformation.js.map +1 -0
- package/dist/cjs/client/v2/algod/algod.js +23 -1
- package/dist/cjs/client/v2/algod/algod.js.map +1 -1
- package/dist/cjs/client/v2/algod/getApplicationBoxes.js +116 -5
- package/dist/cjs/client/v2/algod/getApplicationBoxes.js.map +1 -1
- package/dist/cjs/client/v2/algod/models/types.js +243 -20
- package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
- package/dist/cjs/dryrun.js.map +1 -1
- package/dist/esm/appAccess.js +8 -5
- package/dist/esm/appAccess.js.map +1 -1
- package/dist/esm/client/v2/algod/accountApplicationsInformation.js +32 -0
- package/dist/esm/client/v2/algod/accountApplicationsInformation.js.map +1 -0
- package/dist/esm/client/v2/algod/accountAssetsInformation.js +25 -0
- package/dist/esm/client/v2/algod/accountAssetsInformation.js.map +1 -0
- package/dist/esm/client/v2/algod/algod.js +23 -1
- package/dist/esm/client/v2/algod/algod.js.map +1 -1
- package/dist/esm/client/v2/algod/getApplicationBoxes.js +116 -5
- package/dist/esm/client/v2/algod/getApplicationBoxes.js.map +1 -1
- package/dist/esm/client/v2/algod/models/types.js +239 -18
- package/dist/esm/client/v2/algod/models/types.js.map +1 -1
- package/dist/esm/dryrun.js.map +1 -1
- package/dist/types/client/v2/algod/accountApplicationsInformation.d.ts +16 -0
- package/dist/types/client/v2/algod/accountAssetsInformation.d.ts +12 -0
- package/dist/types/client/v2/algod/algod.d.ts +19 -1
- package/dist/types/client/v2/algod/getApplicationBoxes.d.ts +100 -5
- package/dist/types/client/v2/algod/models/types.d.ts +146 -15
- package/package.json +1 -1
- package/src/appAccess.ts +10 -5
- package/src/client/v2/algod/accountApplicationsInformation.ts +46 -0
- package/src/client/v2/algod/accountAssetsInformation.ts +33 -0
- package/src/client/v2/algod/algod.ts +25 -1
- package/src/client/v2/algod/getApplicationBoxes.ts +123 -5
- package/src/client/v2/algod/models/types.ts +409 -32
- package/src/dryrun.ts +2 -2
|
@@ -2,6 +2,8 @@ import ServiceClient from '../serviceClient.js';
|
|
|
2
2
|
import * as modelsv2 from './models/types.js';
|
|
3
3
|
import AccountInformation from './accountInformation.js';
|
|
4
4
|
import AccountAssetInformation from './accountAssetInformation.js';
|
|
5
|
+
import AccountAssetsInformation from './accountAssetsInformation.js';
|
|
6
|
+
import AccountApplicationsInformation from './accountApplicationsInformation.js';
|
|
5
7
|
import AccountApplicationInformation from './accountApplicationInformation.js';
|
|
6
8
|
import Block from './block.js';
|
|
7
9
|
import Compile from './compile.js';
|
|
@@ -177,6 +179,26 @@ export class AlgodClient extends ServiceClient {
|
|
|
177
179
|
return new AccountAssetInformation(this.c, account, index);
|
|
178
180
|
}
|
|
179
181
|
|
|
182
|
+
/**
|
|
183
|
+
* Returns the given account's asset holdings, paginated.
|
|
184
|
+
*
|
|
185
|
+
* @param account - The address of the account to look up.
|
|
186
|
+
* @category GET
|
|
187
|
+
*/
|
|
188
|
+
accountAssetsInformation(account: string | Address) {
|
|
189
|
+
return new AccountAssetsInformation(this.c, account);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Returns the given account's application holdings, paginated.
|
|
194
|
+
*
|
|
195
|
+
* @param account - The address of the account to look up.
|
|
196
|
+
* @category GET
|
|
197
|
+
*/
|
|
198
|
+
accountApplicationsInformation(account: string | Address) {
|
|
199
|
+
return new AccountApplicationsInformation(this.c, account);
|
|
200
|
+
}
|
|
201
|
+
|
|
180
202
|
/**
|
|
181
203
|
* Returns the given account's application information for a specific application.
|
|
182
204
|
*
|
|
@@ -512,7 +534,7 @@ export class AlgodClient extends ServiceClient {
|
|
|
512
534
|
}
|
|
513
535
|
|
|
514
536
|
/**
|
|
515
|
-
* Given an application ID, return all the
|
|
537
|
+
* Given an application ID, return all the boxes associated with the app.
|
|
516
538
|
*
|
|
517
539
|
* #### Example
|
|
518
540
|
* ```typescript
|
|
@@ -520,6 +542,8 @@ export class AlgodClient extends ServiceClient {
|
|
|
520
542
|
* const boxesResponse = await algodClient.getApplicationBoxes(index).max(3).do();
|
|
521
543
|
* const boxNames = boxesResponse.boxes.map(box => box.name);
|
|
522
544
|
* ```
|
|
545
|
+
* With the `.include("values")` parameter, returns values in addition to names. Pagination is supported with `limit`. If using pagination,
|
|
546
|
+
* it is recommended to use the `.round()` parameter to ensure each page is for the same round.
|
|
523
547
|
*
|
|
524
548
|
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2applicationsapplication-idboxes)
|
|
525
549
|
* @param index - The application ID to look up.
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import JSONRequest from '../jsonrequest.js';
|
|
2
2
|
import { HTTPClient, HTTPClientResponse } from '../../client.js';
|
|
3
3
|
import { decodeJSON } from '../../../encoding/encoding.js';
|
|
4
|
+
import { bytesToBase64 } from '../../../encoding/binarydata.js';
|
|
5
|
+
import { ensureSafeInteger } from '../../../utils/utils.js';
|
|
4
6
|
import { BoxesResponse } from './models/types.js';
|
|
5
7
|
|
|
8
|
+
export type BoxInclude = 'values';
|
|
9
|
+
|
|
6
10
|
/**
|
|
7
|
-
* Given an application ID, return all the
|
|
11
|
+
* Given an application ID, return all the boxes associated with the app.
|
|
8
12
|
*
|
|
9
13
|
* #### Example
|
|
10
14
|
* ```typescript
|
|
@@ -13,6 +17,9 @@ import { BoxesResponse } from './models/types.js';
|
|
|
13
17
|
* const boxNames = boxesResponse.boxes.map(box => box.name);
|
|
14
18
|
* ```
|
|
15
19
|
*
|
|
20
|
+
* With the `.include("values")` parameter, returns values in addition to names. Pagination is supported with `limit`. If using pagination,
|
|
21
|
+
* it is recommended to use the `.round()` parameter to ensure each page is for the same round.
|
|
22
|
+
*
|
|
16
23
|
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2applicationsapplication-idboxes)
|
|
17
24
|
* @param index - The application ID to look up.
|
|
18
25
|
* @category GET
|
|
@@ -34,18 +41,20 @@ export default class GetApplicationBoxes extends JSONRequest<BoxesResponse> {
|
|
|
34
41
|
}
|
|
35
42
|
|
|
36
43
|
/**
|
|
37
|
-
*
|
|
44
|
+
* @deprecated - Use `limit` instead for proper pagination with a limit.
|
|
45
|
+
*
|
|
46
|
+
* Set the max amount of boxes to return. Returns HTTP 400 if max is exceeded.
|
|
38
47
|
*
|
|
39
48
|
* #### Example
|
|
40
49
|
* ```typescript
|
|
41
50
|
* const maxResults = 20;
|
|
42
51
|
* const boxesResult = await algodClient
|
|
43
|
-
* .
|
|
44
|
-
* .
|
|
52
|
+
* .getApplicationBoxes(1234)
|
|
53
|
+
* .max(maxResults)
|
|
45
54
|
* .do();
|
|
46
55
|
* ```
|
|
47
56
|
*
|
|
48
|
-
* @param
|
|
57
|
+
* @param max - maximum number of results to return.
|
|
49
58
|
* @category query
|
|
50
59
|
*/
|
|
51
60
|
max(max: number) {
|
|
@@ -53,6 +62,115 @@ export default class GetApplicationBoxes extends JSONRequest<BoxesResponse> {
|
|
|
53
62
|
return this;
|
|
54
63
|
}
|
|
55
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Pagination token returned by the previous call.
|
|
67
|
+
*
|
|
68
|
+
* This is the value returned by a previous call to this endpoint in the
|
|
69
|
+
* `next-token` response field. Provide this token to get the next page of
|
|
70
|
+
* results. The token is the box name to use as the pagination cursor,
|
|
71
|
+
* encoded in the goal app call arg form.
|
|
72
|
+
*
|
|
73
|
+
* #### Example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const boxesResponse = await algodClient
|
|
76
|
+
* .getApplicationBoxes(1234)
|
|
77
|
+
* .limit(20)
|
|
78
|
+
* .next("b64:AAECAw==")
|
|
79
|
+
* .do();
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @param nextToken - The next token to use for pagination.
|
|
83
|
+
* @category query
|
|
84
|
+
*/
|
|
85
|
+
next(nextToken: string | undefined) {
|
|
86
|
+
this.query.next = nextToken;
|
|
87
|
+
return this;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Filter box names by a prefix.
|
|
92
|
+
*
|
|
93
|
+
* #### Example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const boxesResponse = await algodClient
|
|
96
|
+
* .getApplicationBoxes(1234)
|
|
97
|
+
* .prefix(myAddr.publicKey)
|
|
98
|
+
* .do();
|
|
99
|
+
* ```
|
|
100
|
+
*
|
|
101
|
+
* @param prefix - The prefix to filter box names by
|
|
102
|
+
* @category query
|
|
103
|
+
*/
|
|
104
|
+
prefix(prefix: Uint8Array) {
|
|
105
|
+
this.query.prefix = `b64:${bytesToBase64(prefix)}`;
|
|
106
|
+
return this;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Include additional items in the response.
|
|
111
|
+
*
|
|
112
|
+
* Use `values` to include box values.
|
|
113
|
+
*
|
|
114
|
+
* #### Example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const boxesResponse = await algodClient
|
|
117
|
+
* .getApplicationBoxes(1234)
|
|
118
|
+
* .prefix(myAddr.publicKey)
|
|
119
|
+
* .include("values")
|
|
120
|
+
* .do();
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* @param include - The additional items to include in the response.
|
|
124
|
+
* @category query
|
|
125
|
+
*/
|
|
126
|
+
include(...include: BoxInclude[]) {
|
|
127
|
+
this.query.include = include.join(',');
|
|
128
|
+
return this;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Limits results per page when using pagination.
|
|
133
|
+
*
|
|
134
|
+
* #### Example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* const maxResults = 20;
|
|
137
|
+
* const boxesResult = await algodClient
|
|
138
|
+
* .getApplicationBoxes(1234)
|
|
139
|
+
* .limit(maxResults)
|
|
140
|
+
* .do();
|
|
141
|
+
* const { nextToken } = boxesResult
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* @param limit - maximum number of results to return per page.
|
|
145
|
+
* @category query
|
|
146
|
+
*/
|
|
147
|
+
limit(limit: number) {
|
|
148
|
+
this.query.limit = limit;
|
|
149
|
+
return this;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Return results for the specified round.
|
|
154
|
+
*
|
|
155
|
+
* If not provided, results will be from the latest round. This parameter
|
|
156
|
+
* can be used to pin all pages of a paginated query to a consistent round.
|
|
157
|
+
*
|
|
158
|
+
* #### Example
|
|
159
|
+
* ```typescript
|
|
160
|
+
* const boxesResponse = await algodClient
|
|
161
|
+
* .getApplicationBoxes(1234)
|
|
162
|
+
* .round(12345678)
|
|
163
|
+
* .do();
|
|
164
|
+
* ```
|
|
165
|
+
*
|
|
166
|
+
* @param roundNumber - The round to query.
|
|
167
|
+
* @category query
|
|
168
|
+
*/
|
|
169
|
+
round(roundNumber: number | bigint) {
|
|
170
|
+
this.query.round = ensureSafeInteger(roundNumber);
|
|
171
|
+
return this;
|
|
172
|
+
}
|
|
173
|
+
|
|
56
174
|
// eslint-disable-next-line class-methods-use-this
|
|
57
175
|
prepare(response: HTTPClientResponse): BoxesResponse {
|
|
58
176
|
return decodeJSON(response.getJSONText(), BoxesResponse);
|