algosdk 3.1.0 → 3.3.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 +5 -5
- package/dist/browser/algosdk.min.js +1 -1
- package/dist/browser/algosdk.min.js.map +1 -1
- package/dist/cjs/abi/abi_type.js +9 -7
- package/dist/cjs/abi/abi_type.js.map +1 -1
- package/dist/cjs/client/v2/algod/block.js +21 -0
- package/dist/cjs/client/v2/algod/block.js.map +1 -1
- package/dist/cjs/client/v2/algod/getApplicationBoxes.js +58 -1
- package/dist/cjs/client/v2/algod/getApplicationBoxes.js.map +1 -1
- package/dist/cjs/client/v2/algod/models/types.js +165 -141
- package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
- package/dist/cjs/client/v2/indexer/indexer.js +15 -0
- package/dist/cjs/client/v2/indexer/indexer.js.map +1 -1
- package/dist/cjs/client/v2/indexer/models/types.js +10 -1
- package/dist/cjs/client/v2/indexer/models/types.js.map +1 -1
- package/dist/cjs/client/v2/indexer/searchAccounts.js +19 -0
- package/dist/cjs/client/v2/indexer/searchAccounts.js.map +1 -1
- package/dist/cjs/client/v2/indexer/searchForBlockHeaders.js +217 -0
- package/dist/cjs/client/v2/indexer/searchForBlockHeaders.js.map +1 -0
- package/dist/esm/abi/abi_type.js +10 -8
- package/dist/esm/abi/abi_type.js.map +1 -1
- package/dist/esm/client/v2/algod/block.js +21 -0
- package/dist/esm/client/v2/algod/block.js.map +1 -1
- package/dist/esm/client/v2/algod/getApplicationBoxes.js +58 -1
- package/dist/esm/client/v2/algod/getApplicationBoxes.js.map +1 -1
- package/dist/esm/client/v2/algod/models/types.js +161 -136
- package/dist/esm/client/v2/algod/models/types.js.map +1 -1
- package/dist/esm/client/v2/indexer/indexer.js +15 -0
- package/dist/esm/client/v2/indexer/indexer.js.map +1 -1
- package/dist/esm/client/v2/indexer/models/types.js +10 -1
- package/dist/esm/client/v2/indexer/models/types.js.map +1 -1
- package/dist/esm/client/v2/indexer/searchAccounts.js +19 -0
- package/dist/esm/client/v2/indexer/searchAccounts.js.map +1 -1
- package/dist/esm/client/v2/indexer/searchForBlockHeaders.js +211 -0
- package/dist/esm/client/v2/indexer/searchForBlockHeaders.js.map +1 -0
- package/dist/types/abi/abi_type.d.ts +13 -1
- package/dist/types/client/v2/algod/block.d.ts +18 -0
- package/dist/types/client/v2/algod/getApplicationBoxes.d.ts +49 -1
- package/dist/types/client/v2/algod/models/types.d.ts +93 -83
- package/dist/types/client/v2/indexer/indexer.d.ts +13 -0
- package/dist/types/client/v2/indexer/models/types.d.ts +7 -1
- package/dist/types/client/v2/indexer/searchAccounts.d.ts +16 -0
- package/dist/types/client/v2/indexer/searchForBlockHeaders.d.ts +176 -0
- package/package.json +2 -2
- package/src/abi/abi_type.ts +16 -9
- package/src/client/v2/algod/block.ts +22 -0
- package/src/client/v2/algod/getApplicationBoxes.ts +61 -1
- package/src/client/v2/algod/models/types.ts +285 -197
- package/src/client/v2/indexer/indexer.ts +16 -0
- package/src/client/v2/indexer/models/types.ts +17 -0
- package/src/client/v2/indexer/searchAccounts.ts +20 -0
- package/src/client/v2/indexer/searchForBlockHeaders.ts +223 -0
|
@@ -1659,6 +1659,11 @@ export class ApplicationParams implements Encodable {
|
|
|
1659
1659
|
ApplicationStateSchema.encodingSchema
|
|
1660
1660
|
),
|
|
1661
1661
|
omitEmpty: true,
|
|
1662
|
+
},
|
|
1663
|
+
{
|
|
1664
|
+
key: 'version',
|
|
1665
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
1666
|
+
omitEmpty: true,
|
|
1662
1667
|
}
|
|
1663
1668
|
);
|
|
1664
1669
|
}
|
|
@@ -1701,6 +1706,11 @@ export class ApplicationParams implements Encodable {
|
|
|
1701
1706
|
*/
|
|
1702
1707
|
public localStateSchema?: ApplicationStateSchema;
|
|
1703
1708
|
|
|
1709
|
+
/**
|
|
1710
|
+
* the number of updates to the application programs
|
|
1711
|
+
*/
|
|
1712
|
+
public version?: number;
|
|
1713
|
+
|
|
1704
1714
|
/**
|
|
1705
1715
|
* Creates a new `ApplicationParams` object.
|
|
1706
1716
|
* @param approvalProgram - approval program.
|
|
@@ -1711,6 +1721,7 @@ export class ApplicationParams implements Encodable {
|
|
|
1711
1721
|
* @param globalState - global state
|
|
1712
1722
|
* @param globalStateSchema - global schema
|
|
1713
1723
|
* @param localStateSchema - local schema
|
|
1724
|
+
* @param version - the number of updates to the application programs
|
|
1714
1725
|
*/
|
|
1715
1726
|
constructor({
|
|
1716
1727
|
approvalProgram,
|
|
@@ -1720,6 +1731,7 @@ export class ApplicationParams implements Encodable {
|
|
|
1720
1731
|
globalState,
|
|
1721
1732
|
globalStateSchema,
|
|
1722
1733
|
localStateSchema,
|
|
1734
|
+
version,
|
|
1723
1735
|
}: {
|
|
1724
1736
|
approvalProgram: string | Uint8Array;
|
|
1725
1737
|
clearStateProgram: string | Uint8Array;
|
|
@@ -1728,6 +1740,7 @@ export class ApplicationParams implements Encodable {
|
|
|
1728
1740
|
globalState?: TealKeyValue[];
|
|
1729
1741
|
globalStateSchema?: ApplicationStateSchema;
|
|
1730
1742
|
localStateSchema?: ApplicationStateSchema;
|
|
1743
|
+
version?: number | bigint;
|
|
1731
1744
|
}) {
|
|
1732
1745
|
this.approvalProgram =
|
|
1733
1746
|
typeof approvalProgram === 'string'
|
|
@@ -1746,6 +1759,8 @@ export class ApplicationParams implements Encodable {
|
|
|
1746
1759
|
this.globalState = globalState;
|
|
1747
1760
|
this.globalStateSchema = globalStateSchema;
|
|
1748
1761
|
this.localStateSchema = localStateSchema;
|
|
1762
|
+
this.version =
|
|
1763
|
+
typeof version === 'undefined' ? undefined : ensureSafeInteger(version);
|
|
1749
1764
|
}
|
|
1750
1765
|
|
|
1751
1766
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -1782,6 +1797,7 @@ export class ApplicationParams implements Encodable {
|
|
|
1782
1797
|
? this.localStateSchema.toEncodingData()
|
|
1783
1798
|
: undefined,
|
|
1784
1799
|
],
|
|
1800
|
+
['version', this.version],
|
|
1785
1801
|
]);
|
|
1786
1802
|
}
|
|
1787
1803
|
|
|
@@ -1812,6 +1828,7 @@ export class ApplicationParams implements Encodable {
|
|
|
1812
1828
|
data.get('local-state-schema')
|
|
1813
1829
|
)
|
|
1814
1830
|
: undefined,
|
|
1831
|
+
version: data.get('version'),
|
|
1815
1832
|
});
|
|
1816
1833
|
}
|
|
1817
1834
|
}
|
|
@@ -271,6 +271,26 @@ export default class SearchAccounts extends JSONRequest<AccountsResponse> {
|
|
|
271
271
|
return this;
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
+
/**
|
|
275
|
+
* If true, only online accounts will be returned in the response.
|
|
276
|
+
*
|
|
277
|
+
* #### Example
|
|
278
|
+
* ```typescript
|
|
279
|
+
* const onlineOnly = true;
|
|
280
|
+
* const accounts = await indexerClient
|
|
281
|
+
* .searchAccounts
|
|
282
|
+
* .onlineOnly(onlineOnly)
|
|
283
|
+
* .do();
|
|
284
|
+
* ```
|
|
285
|
+
*
|
|
286
|
+
* @param onlineOnly - if true, only online accounts will be returned in the response
|
|
287
|
+
* @category query
|
|
288
|
+
*/
|
|
289
|
+
onlineOnly(onlineOnly: boolean) {
|
|
290
|
+
this.query['online-only'] = onlineOnly;
|
|
291
|
+
return this;
|
|
292
|
+
}
|
|
293
|
+
|
|
274
294
|
// eslint-disable-next-line class-methods-use-this
|
|
275
295
|
prepare(response: HTTPClientResponse): AccountsResponse {
|
|
276
296
|
return decodeJSON(response.getJSONText(), AccountsResponse);
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import JSONRequest from '../jsonrequest.js';
|
|
2
|
+
import { HTTPClientResponse } from '../../client.js';
|
|
3
|
+
import { decodeJSON } from '../../../encoding/encoding.js';
|
|
4
|
+
import { Address } from '../../../encoding/address.js';
|
|
5
|
+
import { BlockHeadersResponse } from './models/types.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Returns information about indexed block headers.
|
|
9
|
+
*
|
|
10
|
+
* #### Example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const bhs = await indexerClient.searchForBlockHeaders().do();
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2block-headers)
|
|
16
|
+
* @category GET
|
|
17
|
+
*/
|
|
18
|
+
export default class SearchForBlockHeaders extends JSONRequest<BlockHeadersResponse> {
|
|
19
|
+
/**
|
|
20
|
+
* @returns `/v2/block-headers`
|
|
21
|
+
*/
|
|
22
|
+
// eslint-disable-next-line class-methods-use-this
|
|
23
|
+
path() {
|
|
24
|
+
return '/v2/block-headers';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Accounts marked as absent in the block header's participation updates.
|
|
29
|
+
*
|
|
30
|
+
* #### Example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const address1 = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
33
|
+
* const address2 = "4H5UNRBJ2Q6JENAXQ6HNTGKLKINP4J4VTQBEPK5F3I6RDICMZBPGNH6KD4";
|
|
34
|
+
* const bhs = await indexerClient
|
|
35
|
+
* .searchForBlockHeaders()
|
|
36
|
+
* .absent([address1,address2])
|
|
37
|
+
* .do();
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @param absent - a comma separated list of addresses
|
|
41
|
+
* @category query
|
|
42
|
+
*/
|
|
43
|
+
absent(absent: (string | Address)[]) {
|
|
44
|
+
this.query.absent = absent;
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Include results after the given time.
|
|
50
|
+
*
|
|
51
|
+
* #### Example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const afterTime = "2022-10-21T00:00:11.55Z";
|
|
54
|
+
* const bhs = await indexerClient
|
|
55
|
+
* .searchForBlockHeaders()
|
|
56
|
+
* .afterTime(afterTime)
|
|
57
|
+
* .do();
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @param after - rfc3339 string or Date object
|
|
61
|
+
* @category query
|
|
62
|
+
*/
|
|
63
|
+
afterTime(after: string | Date) {
|
|
64
|
+
this.query['after-time'] =
|
|
65
|
+
after instanceof Date ? after.toISOString() : after;
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Include results before the given time.
|
|
71
|
+
*
|
|
72
|
+
* #### Example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const beforeTime = "2022-02-02T20:20:22.02Z";
|
|
75
|
+
* const bhs = await indexerClient
|
|
76
|
+
* .searchForBlockHeaders()
|
|
77
|
+
* .beforeTime(beforeTime)
|
|
78
|
+
* .do();
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @param before - rfc3339 string or Date object
|
|
82
|
+
* @category query
|
|
83
|
+
*/
|
|
84
|
+
beforeTime(before: string | Date) {
|
|
85
|
+
this.query['before-time'] =
|
|
86
|
+
before instanceof Date ? before.toISOString() : before;
|
|
87
|
+
return this;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Accounts marked as expired in the block header's participation updates.
|
|
92
|
+
*
|
|
93
|
+
* #### Example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const address1 = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
96
|
+
* const address2 = "4H5UNRBJ2Q6JENAXQ6HNTGKLKINP4J4VTQBEPK5F3I6RDICMZBPGNH6KD4";
|
|
97
|
+
* const bhs = await indexerClient
|
|
98
|
+
* .searchForBlockHeaders()
|
|
99
|
+
* .expired([address1,address2])
|
|
100
|
+
* .do();
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* @param expired - - a comma separated list of addresses
|
|
104
|
+
* @category query
|
|
105
|
+
*/
|
|
106
|
+
expired(expired: (string | Address)[]) {
|
|
107
|
+
this.query.expired = expired;
|
|
108
|
+
return this;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Maximum number of results to return.
|
|
113
|
+
*
|
|
114
|
+
* #### Example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const maxResults = 25;
|
|
117
|
+
* const bhs = await indexerClient
|
|
118
|
+
* .searchForBlockHeaders()
|
|
119
|
+
* .limit(maxResults)
|
|
120
|
+
* .do();
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* @param limit
|
|
124
|
+
* @category query
|
|
125
|
+
*/
|
|
126
|
+
limit(limit: number) {
|
|
127
|
+
this.query.limit = limit;
|
|
128
|
+
return this;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Include results at or before the specified max-round.
|
|
133
|
+
*
|
|
134
|
+
* #### Example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* const maxRound = 18309917;
|
|
137
|
+
* const bhs = await indexerClient
|
|
138
|
+
* .searchForBlockHeaders()
|
|
139
|
+
* .maxRound(maxRound)
|
|
140
|
+
* .do();
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* @param round
|
|
144
|
+
* @category query
|
|
145
|
+
*/
|
|
146
|
+
maxRound(round: number | bigint) {
|
|
147
|
+
this.query['max-round'] = round;
|
|
148
|
+
return this;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Include results at or after the specified min-round.
|
|
153
|
+
*
|
|
154
|
+
* #### Example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* const minRound = 18309917;
|
|
157
|
+
* const bhs = await indexerClient
|
|
158
|
+
* .searchForBlockHeaders()
|
|
159
|
+
* .minRound(minRound)
|
|
160
|
+
* .do();
|
|
161
|
+
* ```
|
|
162
|
+
*
|
|
163
|
+
* @param round
|
|
164
|
+
* @category query
|
|
165
|
+
*/
|
|
166
|
+
minRound(round: number | bigint) {
|
|
167
|
+
this.query['min-round'] = round;
|
|
168
|
+
return this;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* The next page of results.
|
|
173
|
+
*
|
|
174
|
+
* #### Example
|
|
175
|
+
* ```typescript
|
|
176
|
+
* const maxResults = 25;
|
|
177
|
+
*
|
|
178
|
+
* const bh1 = await indexerClient
|
|
179
|
+
* .searchForBlockHeaders()
|
|
180
|
+
* .limit(maxResults)
|
|
181
|
+
* .do();
|
|
182
|
+
*
|
|
183
|
+
* const bh2 = await indexerClient
|
|
184
|
+
* .searchForBlockHeaders()
|
|
185
|
+
* .limit(maxResults)
|
|
186
|
+
* .nextToken(bh1["next-token"])
|
|
187
|
+
* .do();
|
|
188
|
+
* ```
|
|
189
|
+
*
|
|
190
|
+
* @param nextToken - provided by the previous results
|
|
191
|
+
* @category query
|
|
192
|
+
*/
|
|
193
|
+
nextToken(nextToken: string) {
|
|
194
|
+
this.query.next = nextToken;
|
|
195
|
+
return this;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Accounts marked as proposer in the block header's participation updates.
|
|
200
|
+
*
|
|
201
|
+
* #### Example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* const address1 = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
204
|
+
* const address2 = "4H5UNRBJ2Q6JENAXQ6HNTGKLKINP4J4VTQBEPK5F3I6RDICMZBPGNH6KD4";
|
|
205
|
+
* const bhs = await indexerClient
|
|
206
|
+
* .searchForBlockHeaders()
|
|
207
|
+
* .proposers([address1,address2])
|
|
208
|
+
* .do();
|
|
209
|
+
* ```
|
|
210
|
+
*
|
|
211
|
+
* @param proposers - a comma separated list of addresses
|
|
212
|
+
* @category query
|
|
213
|
+
*/
|
|
214
|
+
proposers(proposers: (string | Address)[]) {
|
|
215
|
+
this.query.proposers = proposers;
|
|
216
|
+
return this;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// eslint-disable-next-line class-methods-use-this
|
|
220
|
+
prepare(response: HTTPClientResponse): BlockHeadersResponse {
|
|
221
|
+
return decodeJSON(response.getJSONText(), BlockHeadersResponse);
|
|
222
|
+
}
|
|
223
|
+
}
|