algosdk 3.1.0 → 3.2.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/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/models/types.js +2 -43
- 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/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/models/types.js +0 -40
- 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/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/models/types.d.ts +0 -21
- package/dist/types/client/v2/indexer/indexer.d.ts +13 -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/models/types.ts +0 -52
- package/src/client/v2/indexer/indexer.ts +16 -0
- package/src/client/v2/indexer/searchForBlockHeaders.ts +223 -0
|
@@ -2904,58 +2904,6 @@ export class BlockHashResponse implements Encodable {
|
|
|
2904
2904
|
}
|
|
2905
2905
|
}
|
|
2906
2906
|
|
|
2907
|
-
/**
|
|
2908
|
-
* Block header.
|
|
2909
|
-
*/
|
|
2910
|
-
export class BlockHeaderResponse implements Encodable {
|
|
2911
|
-
private static encodingSchemaValue: Schema | undefined;
|
|
2912
|
-
|
|
2913
|
-
static get encodingSchema(): Schema {
|
|
2914
|
-
if (!this.encodingSchemaValue) {
|
|
2915
|
-
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
2916
|
-
(this.encodingSchemaValue as NamedMapSchema).pushEntries({
|
|
2917
|
-
key: 'blockHeader',
|
|
2918
|
-
valueSchema: Block.encodingSchema,
|
|
2919
|
-
omitEmpty: true,
|
|
2920
|
-
});
|
|
2921
|
-
}
|
|
2922
|
-
return this.encodingSchemaValue;
|
|
2923
|
-
}
|
|
2924
|
-
|
|
2925
|
-
/**
|
|
2926
|
-
* Block header data.
|
|
2927
|
-
*/
|
|
2928
|
-
public blockheader: Block;
|
|
2929
|
-
|
|
2930
|
-
/**
|
|
2931
|
-
* Creates a new `BlockHeaderResponse` object.
|
|
2932
|
-
* @param blockheader - Block header data.
|
|
2933
|
-
*/
|
|
2934
|
-
constructor({ blockheader }: { blockheader: Block }) {
|
|
2935
|
-
this.blockheader = blockheader;
|
|
2936
|
-
}
|
|
2937
|
-
|
|
2938
|
-
// eslint-disable-next-line class-methods-use-this
|
|
2939
|
-
getEncodingSchema(): Schema {
|
|
2940
|
-
return BlockHeaderResponse.encodingSchema;
|
|
2941
|
-
}
|
|
2942
|
-
|
|
2943
|
-
toEncodingData(): Map<string, unknown> {
|
|
2944
|
-
return new Map<string, unknown>([
|
|
2945
|
-
['blockHeader', this.blockheader.toEncodingData()],
|
|
2946
|
-
]);
|
|
2947
|
-
}
|
|
2948
|
-
|
|
2949
|
-
static fromEncodingData(data: unknown): BlockHeaderResponse {
|
|
2950
|
-
if (!(data instanceof Map)) {
|
|
2951
|
-
throw new Error(`Invalid decoded BlockHeaderResponse: ${data}`);
|
|
2952
|
-
}
|
|
2953
|
-
return new BlockHeaderResponse({
|
|
2954
|
-
blockheader: Block.fromEncodingData(data.get('blockHeader') ?? new Map()),
|
|
2955
|
-
});
|
|
2956
|
-
}
|
|
2957
|
-
}
|
|
2958
|
-
|
|
2959
2907
|
/**
|
|
2960
2908
|
* All logs emitted in the given round. Each app call, whether top-level or inner,
|
|
2961
2909
|
* that contains logs results in a separate AppCallLogs object. Therefore there may
|
|
@@ -15,6 +15,7 @@ import LookupApplications from './lookupApplications.js';
|
|
|
15
15
|
import LookupApplicationLogs from './lookupApplicationLogs.js';
|
|
16
16
|
import LookupApplicationBoxByIDandName from './lookupApplicationBoxByIDandName.js';
|
|
17
17
|
import SearchAccounts from './searchAccounts.js';
|
|
18
|
+
import SearchForBlockHeaders from './searchForBlockHeaders.js';
|
|
18
19
|
import SearchForTransactions from './searchForTransactions.js';
|
|
19
20
|
import SearchForAssets from './searchForAssets.js';
|
|
20
21
|
import SearchForApplications from './searchForApplications.js';
|
|
@@ -327,6 +328,21 @@ export class IndexerClient extends ServiceClient {
|
|
|
327
328
|
return new SearchAccounts(this.c);
|
|
328
329
|
}
|
|
329
330
|
|
|
331
|
+
/**
|
|
332
|
+
* Returns information about indexed block headers.
|
|
333
|
+
*
|
|
334
|
+
* #### Example
|
|
335
|
+
* ```typescript
|
|
336
|
+
* const bhs = await indexerClient.searchForBlockHeaders().do();
|
|
337
|
+
* ```
|
|
338
|
+
*
|
|
339
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2block-headers)
|
|
340
|
+
* @category GET
|
|
341
|
+
*/
|
|
342
|
+
searchForBlockHeaders() {
|
|
343
|
+
return new SearchForBlockHeaders(this.c);
|
|
344
|
+
}
|
|
345
|
+
|
|
330
346
|
/**
|
|
331
347
|
* Returns information about indexed transactions.
|
|
332
348
|
*
|
|
@@ -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
|
+
}
|