algosdk 1.15.0 → 1.16.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/src/client/kmd.js +1 -1
- package/dist/cjs/src/client/kmd.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/indexer.js +8 -8
- package/dist/cjs/src/client/v2/indexer/lookupAccountAppLocalStates.js +29 -4
- package/dist/cjs/src/client/v2/indexer/lookupAccountAppLocalStates.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/lookupAccountAssets.js +29 -3
- package/dist/cjs/src/client/v2/indexer/lookupAccountAssets.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/lookupAccountByID.js +76 -3
- package/dist/cjs/src/client/v2/indexer/lookupAccountByID.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/lookupAccountCreatedApplications.js +30 -4
- package/dist/cjs/src/client/v2/indexer/lookupAccountCreatedApplications.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/lookupAccountCreatedAssets.js +30 -3
- package/dist/cjs/src/client/v2/indexer/lookupAccountCreatedAssets.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/lookupAccountTransactions.js +30 -25
- package/dist/cjs/src/client/v2/indexer/lookupAccountTransactions.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/lookupApplicationLogs.js +112 -6
- package/dist/cjs/src/client/v2/indexer/lookupApplicationLogs.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/lookupApplications.js +40 -1
- package/dist/cjs/src/client/v2/indexer/lookupApplications.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/lookupAssetBalances.js +29 -6
- package/dist/cjs/src/client/v2/indexer/lookupAssetBalances.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/lookupAssetByID.js +2 -0
- package/dist/cjs/src/client/v2/indexer/lookupAssetByID.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/lookupAssetTransactions.js +298 -18
- package/dist/cjs/src/client/v2/indexer/lookupAssetTransactions.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/lookupBlock.js +16 -0
- package/dist/cjs/src/client/v2/indexer/lookupBlock.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/lookupTransactionByID.js +16 -0
- package/dist/cjs/src/client/v2/indexer/lookupTransactionByID.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/makeHealthCheck.js +15 -0
- package/dist/cjs/src/client/v2/indexer/makeHealthCheck.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/searchAccounts.js +210 -10
- package/dist/cjs/src/client/v2/indexer/searchAccounts.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/searchForApplications.js +101 -5
- package/dist/cjs/src/client/v2/indexer/searchForApplications.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/searchForAssets.js +132 -7
- package/dist/cjs/src/client/v2/indexer/searchForAssets.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/searchForTransactions.js +328 -19
- package/dist/cjs/src/client/v2/indexer/searchForTransactions.js.map +1 -1
- package/dist/cjs/src/dryrun.js +199 -2
- package/dist/cjs/src/dryrun.js.map +1 -1
- package/dist/esm/src/client/kmd.js +1 -1
- package/dist/esm/src/client/kmd.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/indexer.js +8 -8
- package/dist/esm/src/client/v2/indexer/lookupAccountAppLocalStates.js +29 -4
- package/dist/esm/src/client/v2/indexer/lookupAccountAppLocalStates.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/lookupAccountAssets.js +29 -3
- package/dist/esm/src/client/v2/indexer/lookupAccountAssets.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/lookupAccountByID.js +76 -3
- package/dist/esm/src/client/v2/indexer/lookupAccountByID.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/lookupAccountCreatedApplications.js +30 -4
- package/dist/esm/src/client/v2/indexer/lookupAccountCreatedApplications.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/lookupAccountCreatedAssets.js +30 -3
- package/dist/esm/src/client/v2/indexer/lookupAccountCreatedAssets.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/lookupAccountTransactions.js +30 -25
- package/dist/esm/src/client/v2/indexer/lookupAccountTransactions.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/lookupApplicationLogs.js +112 -6
- package/dist/esm/src/client/v2/indexer/lookupApplicationLogs.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/lookupApplications.js +40 -1
- package/dist/esm/src/client/v2/indexer/lookupApplications.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/lookupAssetBalances.js +29 -6
- package/dist/esm/src/client/v2/indexer/lookupAssetBalances.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/lookupAssetByID.js +2 -0
- package/dist/esm/src/client/v2/indexer/lookupAssetByID.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/lookupAssetTransactions.js +298 -18
- package/dist/esm/src/client/v2/indexer/lookupAssetTransactions.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/lookupBlock.js +16 -0
- package/dist/esm/src/client/v2/indexer/lookupBlock.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/lookupTransactionByID.js +16 -0
- package/dist/esm/src/client/v2/indexer/lookupTransactionByID.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/makeHealthCheck.js +15 -0
- package/dist/esm/src/client/v2/indexer/makeHealthCheck.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/searchAccounts.js +210 -10
- package/dist/esm/src/client/v2/indexer/searchAccounts.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/searchForApplications.js +101 -5
- package/dist/esm/src/client/v2/indexer/searchForApplications.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/searchForAssets.js +132 -7
- package/dist/esm/src/client/v2/indexer/searchForAssets.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/searchForTransactions.js +328 -19
- package/dist/esm/src/client/v2/indexer/searchForTransactions.js.map +1 -1
- package/dist/esm/src/dryrun.js +197 -1
- package/dist/esm/src/dryrun.js.map +1 -1
- package/dist/types/src/client/kmd.d.ts +2 -2
- package/dist/types/src/client/v2/indexer/indexer.d.ts +8 -8
- package/dist/types/src/client/v2/indexer/lookupAccountAppLocalStates.d.ts +29 -4
- package/dist/types/src/client/v2/indexer/lookupAccountAssets.d.ts +29 -3
- package/dist/types/src/client/v2/indexer/lookupAccountByID.d.ts +76 -0
- package/dist/types/src/client/v2/indexer/lookupAccountCreatedApplications.d.ts +30 -4
- package/dist/types/src/client/v2/indexer/lookupAccountCreatedAssets.d.ts +30 -3
- package/dist/types/src/client/v2/indexer/lookupAccountTransactions.d.ts +30 -25
- package/dist/types/src/client/v2/indexer/lookupApplicationLogs.d.ts +112 -6
- package/dist/types/src/client/v2/indexer/lookupApplications.d.ts +40 -0
- package/dist/types/src/client/v2/indexer/lookupAssetBalances.d.ts +29 -6
- package/dist/types/src/client/v2/indexer/lookupAssetByID.d.ts +2 -0
- package/dist/types/src/client/v2/indexer/lookupAssetTransactions.d.ts +298 -1
- package/dist/types/src/client/v2/indexer/lookupBlock.d.ts +16 -0
- package/dist/types/src/client/v2/indexer/lookupTransactionByID.d.ts +16 -0
- package/dist/types/src/client/v2/indexer/makeHealthCheck.d.ts +15 -0
- package/dist/types/src/client/v2/indexer/searchAccounts.d.ts +210 -0
- package/dist/types/src/client/v2/indexer/searchForApplications.d.ts +101 -0
- package/dist/types/src/client/v2/indexer/searchForAssets.d.ts +132 -0
- package/dist/types/src/client/v2/indexer/searchForTransactions.d.ts +328 -1
- package/dist/types/src/dryrun.d.ts +81 -1
- package/package.json +4 -3
|
@@ -5,105 +5,414 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const jsonrequest_1 = __importDefault(require("../jsonrequest"));
|
|
7
7
|
const lookupAccountTransactions_1 = require("./lookupAccountTransactions");
|
|
8
|
+
/**
|
|
9
|
+
* Returns information about indexed transactions.
|
|
10
|
+
*
|
|
11
|
+
* #### Example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const txns = await indexerClient.searchForTransactions().do();
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2transactions)
|
|
17
|
+
* @category GET
|
|
18
|
+
*/
|
|
8
19
|
class SearchForTransactions extends jsonrequest_1.default {
|
|
20
|
+
/**
|
|
21
|
+
* @returns `/v2/transactions`
|
|
22
|
+
*/
|
|
9
23
|
// eslint-disable-next-line class-methods-use-this
|
|
10
24
|
path() {
|
|
11
25
|
return '/v2/transactions';
|
|
12
26
|
}
|
|
13
27
|
/**
|
|
14
|
-
*
|
|
28
|
+
* Specifies a prefix which must be contained in the note field.
|
|
29
|
+
*
|
|
30
|
+
* #### Example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const notePrefixBase64Encoded = "Y3JlYXRl";
|
|
33
|
+
* const txns = await indexerClient
|
|
34
|
+
* .searchForTransactions()
|
|
35
|
+
* .notePrefix(notePrefixBase64Encoded)
|
|
36
|
+
* .do();
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
15
39
|
* @param prefix - base64 string or uint8array
|
|
40
|
+
* @category query
|
|
16
41
|
*/
|
|
17
42
|
notePrefix(prefix) {
|
|
18
43
|
this.query['note-prefix'] = lookupAccountTransactions_1.base64StringFunnel(prefix);
|
|
19
44
|
return this;
|
|
20
45
|
}
|
|
21
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Type of transaction to filter with.
|
|
48
|
+
*
|
|
49
|
+
* #### Example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const txns = await indexerClient
|
|
52
|
+
* .searchForTransactions()
|
|
53
|
+
* .txType("keyreg")
|
|
54
|
+
* .do();
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @param type - one of `pay`, `keyreg`, `acfg`, `axfer`, `afrz`, `appl`
|
|
58
|
+
* @category query
|
|
59
|
+
*/
|
|
22
60
|
txType(type) {
|
|
23
61
|
this.query['tx-type'] = type;
|
|
24
62
|
return this;
|
|
25
63
|
}
|
|
26
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Type of signature to filter with.
|
|
66
|
+
* - sig: Standard
|
|
67
|
+
* - msig: MultiSig
|
|
68
|
+
* - lsig: LogicSig
|
|
69
|
+
*
|
|
70
|
+
* #### Example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const txns = await indexerClient
|
|
73
|
+
* .searchForTransactions()
|
|
74
|
+
* .sigType("sig")
|
|
75
|
+
* .do();
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @param type - one of `sig`, `msig`, `lsig`
|
|
79
|
+
* @category query
|
|
80
|
+
*/
|
|
27
81
|
sigType(type) {
|
|
28
82
|
this.query['sig-type'] = type;
|
|
29
83
|
return this;
|
|
30
84
|
}
|
|
31
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Lookup the specific transaction by ID.
|
|
87
|
+
*
|
|
88
|
+
* #### Example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* const txId = "MEUOC4RQJB23CQZRFRKYEI6WBO73VTTPST5A7B3S5OKBUY6LFUDA";
|
|
91
|
+
* const txns = await indexerClient
|
|
92
|
+
* .searchForTransactions()
|
|
93
|
+
* .txid(txId)
|
|
94
|
+
* .do();
|
|
95
|
+
* ```
|
|
96
|
+
* @remarks Alternatively, use `indexerClient.lookupTransactionByID(txnId).do()`
|
|
97
|
+
* @param txid
|
|
98
|
+
* @category query
|
|
99
|
+
*/
|
|
32
100
|
txid(txid) {
|
|
33
101
|
this.query.txid = txid;
|
|
34
102
|
return this;
|
|
35
103
|
}
|
|
36
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Include results for the specified round.
|
|
106
|
+
*
|
|
107
|
+
* #### Example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const targetBlock = 18309917;
|
|
110
|
+
* const txns = await indexerClient
|
|
111
|
+
* .searchForTransactions()
|
|
112
|
+
* .round(targetBlock)
|
|
113
|
+
* .do();
|
|
114
|
+
* ```
|
|
115
|
+
* @remarks Alternatively, use `indexerClient.lookupBlock(targetBlock).do()`
|
|
116
|
+
* @param round
|
|
117
|
+
* @category query
|
|
118
|
+
*/
|
|
37
119
|
round(round) {
|
|
38
120
|
this.query.round = round;
|
|
39
121
|
return this;
|
|
40
122
|
}
|
|
41
|
-
|
|
123
|
+
/**
|
|
124
|
+
* Include results at or after the specified min-round.
|
|
125
|
+
*
|
|
126
|
+
* #### Example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* const minRound = 18309917;
|
|
129
|
+
* const txns = await indexerClient
|
|
130
|
+
* .searchForTransactions()
|
|
131
|
+
* .minRound(minRound)
|
|
132
|
+
* .do();
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @param round
|
|
136
|
+
* @category query
|
|
137
|
+
*/
|
|
42
138
|
minRound(round) {
|
|
43
139
|
this.query['min-round'] = round;
|
|
44
140
|
return this;
|
|
45
141
|
}
|
|
46
|
-
|
|
142
|
+
/**
|
|
143
|
+
* Include results at or before the specified max-round.
|
|
144
|
+
*
|
|
145
|
+
* #### Example
|
|
146
|
+
* ```typescript
|
|
147
|
+
* const maxRound = 18309917;
|
|
148
|
+
* const txns = await indexerClient
|
|
149
|
+
* .searchForTransactions()
|
|
150
|
+
* .maxRound(maxRound)
|
|
151
|
+
* .do();
|
|
152
|
+
* ```
|
|
153
|
+
*
|
|
154
|
+
* @param round
|
|
155
|
+
* @category query
|
|
156
|
+
*/
|
|
47
157
|
maxRound(round) {
|
|
48
158
|
this.query['max-round'] = round;
|
|
49
159
|
return this;
|
|
50
160
|
}
|
|
51
|
-
|
|
161
|
+
/**
|
|
162
|
+
* Asset ID to filter with.
|
|
163
|
+
*
|
|
164
|
+
* #### Example
|
|
165
|
+
* ```typescript
|
|
166
|
+
* const assetID = 163650;
|
|
167
|
+
* const txns = await indexerClient
|
|
168
|
+
* .searchForTransactions()
|
|
169
|
+
* .assetID(assetID)
|
|
170
|
+
* .do();
|
|
171
|
+
* ```
|
|
172
|
+
* @remarks Alternatively, use `indexerClient.lookupAssetTransactions(assetId).do()`
|
|
173
|
+
* @param id
|
|
174
|
+
* @category query
|
|
175
|
+
*/
|
|
52
176
|
assetID(id) {
|
|
53
177
|
this.query['asset-id'] = id;
|
|
54
178
|
return this;
|
|
55
179
|
}
|
|
56
|
-
|
|
180
|
+
/**
|
|
181
|
+
* Maximum number of results to return.
|
|
182
|
+
*
|
|
183
|
+
* #### Example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* const maxResults = 25;
|
|
186
|
+
* const txns = await indexerClient
|
|
187
|
+
* .searchForTransactions()
|
|
188
|
+
* .limit(maxResults)
|
|
189
|
+
* .do();
|
|
190
|
+
* ```
|
|
191
|
+
*
|
|
192
|
+
* @param limit
|
|
193
|
+
* @category query
|
|
194
|
+
*/
|
|
57
195
|
limit(limit) {
|
|
58
196
|
this.query.limit = limit;
|
|
59
197
|
return this;
|
|
60
198
|
}
|
|
61
|
-
|
|
199
|
+
/**
|
|
200
|
+
* Include results before the given time.
|
|
201
|
+
*
|
|
202
|
+
* #### Example
|
|
203
|
+
* ```typescript
|
|
204
|
+
* const beforeTime = "2022-02-02T20:20:22.02Z";
|
|
205
|
+
* const txns = await indexerClient
|
|
206
|
+
* .searchForTransactions()
|
|
207
|
+
* .beforeTime(beforeTime)
|
|
208
|
+
* .do();
|
|
209
|
+
* ```
|
|
210
|
+
*
|
|
211
|
+
* @param before - rfc3339 string
|
|
212
|
+
* @category query
|
|
213
|
+
*/
|
|
62
214
|
beforeTime(before) {
|
|
63
215
|
this.query['before-time'] = before;
|
|
64
216
|
return this;
|
|
65
217
|
}
|
|
66
|
-
|
|
218
|
+
/**
|
|
219
|
+
* Include results after the given time.
|
|
220
|
+
*
|
|
221
|
+
* #### Example
|
|
222
|
+
* ```typescript
|
|
223
|
+
* const afterTime = "2022-10-21T00:00:11.55Z";
|
|
224
|
+
* const txns = await indexerClient
|
|
225
|
+
* .searchForTransactions()
|
|
226
|
+
* .afterTime(afterTime)
|
|
227
|
+
* .do();
|
|
228
|
+
* ```
|
|
229
|
+
*
|
|
230
|
+
* @param after - rfc3339 string
|
|
231
|
+
* @category query
|
|
232
|
+
*/
|
|
67
233
|
afterTime(after) {
|
|
68
234
|
this.query['after-time'] = after;
|
|
69
235
|
return this;
|
|
70
236
|
}
|
|
71
|
-
|
|
237
|
+
/**
|
|
238
|
+
* Filtered results should have an amount greater than this value, as int, representing microAlgos, unless an asset-id is provided, in which case units are in the asset's units.
|
|
239
|
+
*
|
|
240
|
+
* #### Example 1
|
|
241
|
+
* ```typescript
|
|
242
|
+
* const minBalance = 300000;
|
|
243
|
+
* const txns = await indexerClient
|
|
244
|
+
* .searchForTransactions()
|
|
245
|
+
* .currencyGreaterThan(minBalance - 1)
|
|
246
|
+
* .do();
|
|
247
|
+
* ```
|
|
248
|
+
*
|
|
249
|
+
* #### Example 2
|
|
250
|
+
* ```typescript
|
|
251
|
+
* const assetID = 163650;
|
|
252
|
+
* const minBalance = 300000;
|
|
253
|
+
* const txns = await indexerClient
|
|
254
|
+
* .searchForTransactions()
|
|
255
|
+
* .assetID(assetID)
|
|
256
|
+
* .currencyGreaterThan(minBalance - 1)
|
|
257
|
+
* .do();
|
|
258
|
+
* ```
|
|
259
|
+
* @remarks
|
|
260
|
+
* If you are looking for transactions with the currency amount greater than 0, simply construct the query without `currencyGreaterThan` because it doesn't accept `-1`, and passing the `0` `currency-greater-than` value would exclude transactions with a 0 amount.
|
|
261
|
+
*
|
|
262
|
+
* @param greater
|
|
263
|
+
* @category query
|
|
264
|
+
*/
|
|
72
265
|
currencyGreaterThan(greater) {
|
|
73
266
|
this.query['currency-greater-than'] = greater;
|
|
74
267
|
return this;
|
|
75
268
|
}
|
|
76
|
-
|
|
269
|
+
/**
|
|
270
|
+
* Filtered results should have an amount less than this value, as int, representing microAlgos, unless an asset-id is provided, in which case units are in the asset's units.
|
|
271
|
+
*
|
|
272
|
+
* #### Example 1
|
|
273
|
+
* ```typescript
|
|
274
|
+
* const maxBalance = 500000;
|
|
275
|
+
* const txns = await indexerClient
|
|
276
|
+
* .searchForTransactions()
|
|
277
|
+
* .currencyLessThan(maxBalance + 1)
|
|
278
|
+
* .do();
|
|
279
|
+
* ```
|
|
280
|
+
*
|
|
281
|
+
* #### Example 2
|
|
282
|
+
* ```typescript
|
|
283
|
+
* const assetID = 163650;
|
|
284
|
+
* const maxBalance = 500000;
|
|
285
|
+
* const txns = await indexerClient
|
|
286
|
+
* .searchForTransactions()
|
|
287
|
+
* .assetID(assetID)
|
|
288
|
+
* .currencyLessThan(maxBalance + 1)
|
|
289
|
+
* .do();
|
|
290
|
+
* ```
|
|
291
|
+
*
|
|
292
|
+
* @param lesser
|
|
293
|
+
* @category query
|
|
294
|
+
*/
|
|
77
295
|
currencyLessThan(lesser) {
|
|
78
296
|
this.query['currency-less-than'] = lesser;
|
|
79
297
|
return this;
|
|
80
298
|
}
|
|
81
|
-
|
|
299
|
+
/**
|
|
300
|
+
* Combined with address, defines what address to filter on, as string.
|
|
301
|
+
*
|
|
302
|
+
* #### Example
|
|
303
|
+
* ```typescript
|
|
304
|
+
* const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
305
|
+
* const role = "freeze-target";
|
|
306
|
+
* const txns = await indexerClient
|
|
307
|
+
* .searchForTransactions()
|
|
308
|
+
* .address(address)
|
|
309
|
+
* .addressRole(role)
|
|
310
|
+
* .do();
|
|
311
|
+
* ```
|
|
312
|
+
*
|
|
313
|
+
* @param role - one of `sender`, `receiver`, `freeze-target`
|
|
314
|
+
* @category query
|
|
315
|
+
*/
|
|
82
316
|
addressRole(role) {
|
|
83
317
|
this.query['address-role'] = role;
|
|
84
318
|
return this;
|
|
85
319
|
}
|
|
86
|
-
|
|
320
|
+
/**
|
|
321
|
+
* Only include transactions with this address in one of the transaction fields.
|
|
322
|
+
*
|
|
323
|
+
* #### Example
|
|
324
|
+
* ```typescript
|
|
325
|
+
* const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
326
|
+
* const txns = await indexerClient
|
|
327
|
+
* .searchForTransactions()
|
|
328
|
+
* .address(address)
|
|
329
|
+
* .do();
|
|
330
|
+
* ```
|
|
331
|
+
* @remarks Alternatively, use `indexerClient.lookupAccountTransactions(address).do()`
|
|
332
|
+
* @param address
|
|
333
|
+
* @category query
|
|
334
|
+
*/
|
|
87
335
|
address(address) {
|
|
88
336
|
this.query.address = address;
|
|
89
337
|
return this;
|
|
90
338
|
}
|
|
91
|
-
|
|
339
|
+
/**
|
|
340
|
+
* Whether or not to consider the `close-to` field as a receiver when filtering transactions, as bool. Set to `true` to ignore `close-to`.
|
|
341
|
+
*
|
|
342
|
+
* #### Example
|
|
343
|
+
* ```typescript
|
|
344
|
+
* const txns = await indexerClient
|
|
345
|
+
* .searchForTransactions()
|
|
346
|
+
* .excludeCloseTo(true)
|
|
347
|
+
* .do();
|
|
348
|
+
* ```
|
|
349
|
+
*
|
|
350
|
+
* @param exclude
|
|
351
|
+
* @category query
|
|
352
|
+
*/
|
|
92
353
|
excludeCloseTo(exclude) {
|
|
93
354
|
this.query['exclude-close-to'] = exclude;
|
|
94
355
|
return this;
|
|
95
356
|
}
|
|
96
|
-
|
|
357
|
+
/**
|
|
358
|
+
* The next page of results.
|
|
359
|
+
*
|
|
360
|
+
* #### Example
|
|
361
|
+
* ```typescript
|
|
362
|
+
* const maxResults = 25;
|
|
363
|
+
*
|
|
364
|
+
* const txnsPage1 = await indexerClient
|
|
365
|
+
* .searchForTransactions()
|
|
366
|
+
* .limit(maxResults)
|
|
367
|
+
* .do();
|
|
368
|
+
*
|
|
369
|
+
* const txnsPage2 = await indexerClient
|
|
370
|
+
* .searchForTransactions()
|
|
371
|
+
* .limit(maxResults)
|
|
372
|
+
* .nextToken(txnsPage1["next-token"])
|
|
373
|
+
* .do();
|
|
374
|
+
* ```
|
|
375
|
+
*
|
|
376
|
+
* @param nextToken - provided by the previous results
|
|
377
|
+
* @category query
|
|
378
|
+
*/
|
|
97
379
|
nextToken(nextToken) {
|
|
98
380
|
this.query.next = nextToken;
|
|
99
381
|
return this;
|
|
100
382
|
}
|
|
101
|
-
|
|
383
|
+
/**
|
|
384
|
+
* Whether or not to include rekeying transactions.
|
|
385
|
+
*
|
|
386
|
+
* #### Example
|
|
387
|
+
* ```typescript
|
|
388
|
+
* const txns = await indexerClient
|
|
389
|
+
* .searchForTransactions()
|
|
390
|
+
* .rekeyTo(false)
|
|
391
|
+
* .do();
|
|
392
|
+
* ```
|
|
393
|
+
*
|
|
394
|
+
* @param rekeyTo
|
|
395
|
+
* @category query
|
|
396
|
+
*/
|
|
102
397
|
rekeyTo(rekeyTo) {
|
|
103
398
|
this.query['rekey-to'] = rekeyTo;
|
|
104
399
|
return this;
|
|
105
400
|
}
|
|
106
|
-
|
|
401
|
+
/**
|
|
402
|
+
* Filter for this application.
|
|
403
|
+
*
|
|
404
|
+
* #### Example
|
|
405
|
+
* ```typescript
|
|
406
|
+
* const appId = 60553466;
|
|
407
|
+
* const txns = await indexerClient
|
|
408
|
+
* .searchForTransactions()
|
|
409
|
+
* .applicationID(appId)
|
|
410
|
+
* .do();
|
|
411
|
+
* ```
|
|
412
|
+
*
|
|
413
|
+
* @param applicationID
|
|
414
|
+
* @category query
|
|
415
|
+
*/
|
|
107
416
|
applicationID(applicationID) {
|
|
108
417
|
this.query['application-id'] = applicationID;
|
|
109
418
|
return this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchForTransactions.js","sourceRoot":"","sources":["../../../../../../src/client/v2/indexer/searchForTransactions.ts"],"names":[],"mappings":";;;;;AAAA,iEAAyC;AACzC,2EAAiE;AAEjE,MAAqB,qBAAsB,SAAQ,qBAAW;IAC5D,kDAAkD;IAClD,IAAI;QACF,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"searchForTransactions.js","sourceRoot":"","sources":["../../../../../../src/client/v2/indexer/searchForTransactions.ts"],"names":[],"mappings":"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"}
|
package/dist/cjs/src/dryrun.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createDryrun = void 0;
|
|
3
|
+
exports.DryrunResult = exports.createDryrun = void 0;
|
|
4
4
|
const types_1 = require("./client/v2/algod/models/types");
|
|
5
5
|
const transactions_1 = require("./types/transactions");
|
|
6
6
|
const address_1 = require("./encoding/address");
|
|
7
7
|
const defaultAppId = 1380011588;
|
|
8
|
+
const defaultMaxWidth = 30;
|
|
8
9
|
function decodePrograms(ap) {
|
|
9
10
|
// eslint-disable-next-line no-param-reassign
|
|
10
11
|
ap.params['approval-program'] = Buffer.from(ap.params['approval-program'].toString(), 'base64');
|
|
@@ -32,8 +33,10 @@ async function createDryrun({ client, txns, protocolVersion, latestTimestamp, ro
|
|
|
32
33
|
accts.push(address_1.encodeAddress(t.txn.from.publicKey));
|
|
33
34
|
if (t.txn.appAccounts)
|
|
34
35
|
accts.push(...t.txn.appAccounts.map((a) => address_1.encodeAddress(a.publicKey)));
|
|
35
|
-
if (t.txn.appForeignApps)
|
|
36
|
+
if (t.txn.appForeignApps) {
|
|
36
37
|
apps.push(...t.txn.appForeignApps);
|
|
38
|
+
accts.push(...t.txn.appForeignApps.map((aidx) => address_1.getApplicationAddress(aidx)));
|
|
39
|
+
}
|
|
37
40
|
if (t.txn.appForeignAssets)
|
|
38
41
|
assets.push(...t.txn.appForeignAssets);
|
|
39
42
|
// Create application,
|
|
@@ -102,4 +105,198 @@ async function createDryrun({ client, txns, protocolVersion, latestTimestamp, ro
|
|
|
102
105
|
});
|
|
103
106
|
}
|
|
104
107
|
exports.createDryrun = createDryrun;
|
|
108
|
+
class DryrunStackValue {
|
|
109
|
+
constructor(sv) {
|
|
110
|
+
this.type = 0;
|
|
111
|
+
this.bytes = '';
|
|
112
|
+
this.uint = 0;
|
|
113
|
+
this.type = sv.type;
|
|
114
|
+
this.bytes = sv.bytes;
|
|
115
|
+
this.uint = sv.uint;
|
|
116
|
+
}
|
|
117
|
+
toString() {
|
|
118
|
+
if (this.type === 1) {
|
|
119
|
+
return `0x${Buffer.from(this.bytes, 'base64').toString('hex')}`;
|
|
120
|
+
}
|
|
121
|
+
return this.uint.toString();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
class DryrunTraceLine {
|
|
125
|
+
constructor(line) {
|
|
126
|
+
this.error = '';
|
|
127
|
+
this.line = 0;
|
|
128
|
+
this.pc = 0;
|
|
129
|
+
this.scratch = [];
|
|
130
|
+
this.stack = [];
|
|
131
|
+
this.error = line.error === undefined ? '' : line.error;
|
|
132
|
+
this.line = line.line;
|
|
133
|
+
this.pc = line.pc;
|
|
134
|
+
this.scratch = line.scratch;
|
|
135
|
+
this.stack = line.stack.map((sv) => new DryrunStackValue(sv));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
class DryrunTrace {
|
|
139
|
+
constructor(t) {
|
|
140
|
+
this.trace = [];
|
|
141
|
+
if (t === undefined)
|
|
142
|
+
return;
|
|
143
|
+
this.trace = t.map((line) => new DryrunTraceLine(line));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function truncate(str, maxValueWidth) {
|
|
147
|
+
if (str.length > maxValueWidth && maxValueWidth > 0) {
|
|
148
|
+
return `${str.slice(0, maxValueWidth)}...`;
|
|
149
|
+
}
|
|
150
|
+
return str;
|
|
151
|
+
}
|
|
152
|
+
function scratchToString(prevScratch, currScratch) {
|
|
153
|
+
if (currScratch.length === 0)
|
|
154
|
+
return '';
|
|
155
|
+
let newScratchIdx = null;
|
|
156
|
+
for (let idx = 0; idx < currScratch.length; idx++) {
|
|
157
|
+
if (idx > prevScratch.length) {
|
|
158
|
+
newScratchIdx = idx;
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
if (JSON.stringify(prevScratch[idx]) !== JSON.stringify(currScratch[idx])) {
|
|
162
|
+
newScratchIdx = idx;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (newScratchIdx == null)
|
|
166
|
+
return '';
|
|
167
|
+
const newScratch = currScratch[newScratchIdx];
|
|
168
|
+
if (newScratch.bytes.length > 0) {
|
|
169
|
+
return `${newScratchIdx} = 0x${Buffer.from(newScratch.bytes, 'base64').toString('hex')}`;
|
|
170
|
+
}
|
|
171
|
+
return `${newScratchIdx} = ${newScratch.uint.toString()}`;
|
|
172
|
+
}
|
|
173
|
+
function stackToString(stack, reverse) {
|
|
174
|
+
const svs = reverse ? stack.reverse() : stack;
|
|
175
|
+
return `[${svs
|
|
176
|
+
.map((sv) => {
|
|
177
|
+
switch (sv.type) {
|
|
178
|
+
case 1:
|
|
179
|
+
return `0x${Buffer.from(sv.bytes, 'base64').toString('hex')}`;
|
|
180
|
+
case 2:
|
|
181
|
+
return `${sv.uint.toString()}`;
|
|
182
|
+
default:
|
|
183
|
+
return '';
|
|
184
|
+
}
|
|
185
|
+
})
|
|
186
|
+
.join(', ')}]`;
|
|
187
|
+
}
|
|
188
|
+
class DryrunTransactionResult {
|
|
189
|
+
constructor(dtr) {
|
|
190
|
+
this.disassembly = [];
|
|
191
|
+
this.appCallMessages = [];
|
|
192
|
+
this.localDeltas = [];
|
|
193
|
+
this.globalDelta = [];
|
|
194
|
+
this.cost = 0;
|
|
195
|
+
this.logicSigMessages = [];
|
|
196
|
+
this.logicSigDisassembly = [];
|
|
197
|
+
this.logs = [];
|
|
198
|
+
this.appCallTrace = undefined;
|
|
199
|
+
this.logicSigTrace = undefined;
|
|
200
|
+
this.required = ['disassembly'];
|
|
201
|
+
this.optionals = [
|
|
202
|
+
'app-call-messages',
|
|
203
|
+
'local-deltas',
|
|
204
|
+
'global-delta',
|
|
205
|
+
'cost',
|
|
206
|
+
'logic-sig-messages',
|
|
207
|
+
'logic-sig-disassembly',
|
|
208
|
+
'logs',
|
|
209
|
+
];
|
|
210
|
+
this.traces = ['app-call-trace', 'logic-sig-trace'];
|
|
211
|
+
this.disassembly = dtr.disassembly;
|
|
212
|
+
this.appCallMessages = dtr['app-call-messages'];
|
|
213
|
+
this.localDeltas = dtr['local-deltas'];
|
|
214
|
+
this.globalDelta = dtr['global-delta'];
|
|
215
|
+
this.cost = dtr.cost;
|
|
216
|
+
this.logicSigMessages = dtr['logic-sig-messages'];
|
|
217
|
+
this.logicSigDisassembly = dtr['logic-sig-disassembly'];
|
|
218
|
+
this.logs = dtr.logs;
|
|
219
|
+
this.appCallTrace = new DryrunTrace(dtr['app-call-trace']);
|
|
220
|
+
this.logicSigTrace = new DryrunTrace(dtr['logic-sig-trace']);
|
|
221
|
+
}
|
|
222
|
+
appCallRejected() {
|
|
223
|
+
return (this.appCallMessages !== undefined &&
|
|
224
|
+
this.appCallMessages.includes('REJECT'));
|
|
225
|
+
}
|
|
226
|
+
logicSigRejected() {
|
|
227
|
+
return (this.logicSigMessages !== undefined &&
|
|
228
|
+
this.logicSigMessages.includes('REJECT'));
|
|
229
|
+
}
|
|
230
|
+
static trace(drt, disassembly, spc) {
|
|
231
|
+
let maxWidth = defaultMaxWidth;
|
|
232
|
+
if (spc.maxValueWidth === undefined)
|
|
233
|
+
maxWidth = spc.maxValueWidth;
|
|
234
|
+
// Create the array of arrays, each sub array contains N columns
|
|
235
|
+
const lines = [['pc#', 'ln#', 'source', 'scratch', 'stack']];
|
|
236
|
+
for (let idx = 0; idx < drt.trace.length; idx++) {
|
|
237
|
+
const { line, error, pc, scratch, stack } = drt.trace[idx];
|
|
238
|
+
const currScratch = scratch !== undefined ? scratch : [];
|
|
239
|
+
const prevScratch = idx > 0 && drt.trace[idx - 1].scratch !== undefined
|
|
240
|
+
? drt.trace[idx - 1].scratch
|
|
241
|
+
: [];
|
|
242
|
+
const src = error === '' ? disassembly[line] : `!! ${error} !!`;
|
|
243
|
+
lines.push([
|
|
244
|
+
pc.toString().padEnd(3, ' '),
|
|
245
|
+
line.toString().padEnd(3, ' '),
|
|
246
|
+
truncate(src, maxWidth),
|
|
247
|
+
truncate(scratchToString(prevScratch, currScratch), maxWidth),
|
|
248
|
+
truncate(stackToString(stack, spc.topOfStackFirst), maxWidth),
|
|
249
|
+
]);
|
|
250
|
+
}
|
|
251
|
+
// Get the max length for each column
|
|
252
|
+
const maxLengths = lines.reduce((prev, curr) => {
|
|
253
|
+
const newVal = new Array(lines[0].length).fill(0);
|
|
254
|
+
for (let idx = 0; idx < prev.length; idx++) {
|
|
255
|
+
newVal[idx] =
|
|
256
|
+
curr[idx].length > prev[idx] ? curr[idx].length : prev[idx];
|
|
257
|
+
}
|
|
258
|
+
return newVal;
|
|
259
|
+
}, new Array(lines[0].length).fill(0));
|
|
260
|
+
return `${lines
|
|
261
|
+
.map((line) => line
|
|
262
|
+
.map((v, idx) => v.padEnd(maxLengths[idx] + 1, ' '))
|
|
263
|
+
.join('|')
|
|
264
|
+
.trim())
|
|
265
|
+
.join('\n')}\n`;
|
|
266
|
+
}
|
|
267
|
+
appTrace(spc) {
|
|
268
|
+
if (this.appCallTrace === undefined || !this.disassembly)
|
|
269
|
+
return '';
|
|
270
|
+
let conf = spc;
|
|
271
|
+
if (spc === undefined)
|
|
272
|
+
conf = {
|
|
273
|
+
maxValueWidth: defaultMaxWidth,
|
|
274
|
+
topOfStackFirst: false,
|
|
275
|
+
};
|
|
276
|
+
return DryrunTransactionResult.trace(this.appCallTrace, this.disassembly, conf);
|
|
277
|
+
}
|
|
278
|
+
lsigTrace(spc) {
|
|
279
|
+
if (this.logicSigTrace === undefined ||
|
|
280
|
+
this.logicSigDisassembly === undefined)
|
|
281
|
+
return '';
|
|
282
|
+
let conf = spc;
|
|
283
|
+
if (spc === undefined)
|
|
284
|
+
conf = {
|
|
285
|
+
maxValueWidth: defaultMaxWidth,
|
|
286
|
+
topOfStackFirst: true,
|
|
287
|
+
};
|
|
288
|
+
return DryrunTransactionResult.trace(this.logicSigTrace, this.logicSigDisassembly, conf);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
class DryrunResult {
|
|
292
|
+
constructor(drrResp) {
|
|
293
|
+
this.error = '';
|
|
294
|
+
this.protocolVersion = '';
|
|
295
|
+
this.txns = [];
|
|
296
|
+
this.error = drrResp.error;
|
|
297
|
+
this.protocolVersion = drrResp['protocol-version'];
|
|
298
|
+
this.txns = drrResp.txns.map((txn) => new DryrunTransactionResult(txn));
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
exports.DryrunResult = DryrunResult;
|
|
105
302
|
//# sourceMappingURL=dryrun.js.map
|