algosdk 1.13.0-beta.2 → 1.13.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/v2/algod/algod.js +255 -7
- package/dist/cjs/src/client/v2/algod/algod.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/indexer.js +153 -1
- package/dist/cjs/src/client/v2/indexer/indexer.js.map +1 -1
- package/dist/cjs/src/client/v2/indexer/lookupAssetBalances.js +98 -6
- package/dist/cjs/src/client/v2/indexer/lookupAssetBalances.js.map +1 -1
- package/dist/cjs/src/client/v2/serviceClient.js.map +1 -1
- package/dist/cjs/src/dryrun.js +103 -0
- package/dist/cjs/src/dryrun.js.map +1 -0
- package/dist/cjs/src/main.js +1 -0
- package/dist/cjs/src/main.js.map +1 -1
- package/dist/esm/src/client/v2/algod/algod.js +255 -7
- package/dist/esm/src/client/v2/algod/algod.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/indexer.js +153 -1
- package/dist/esm/src/client/v2/indexer/indexer.js.map +1 -1
- package/dist/esm/src/client/v2/indexer/lookupAssetBalances.js +98 -6
- package/dist/esm/src/client/v2/indexer/lookupAssetBalances.js.map +1 -1
- package/dist/esm/src/client/v2/serviceClient.js.map +1 -1
- package/dist/esm/src/dryrun.js +99 -0
- package/dist/esm/src/dryrun.js.map +1 -0
- package/dist/esm/src/main.js +1 -0
- package/dist/esm/src/main.js.map +1 -1
- package/dist/types/src/client/v2/algod/algod.d.ts +255 -7
- package/dist/types/src/client/v2/indexer/indexer.d.ts +153 -1
- package/dist/types/src/client/v2/indexer/lookupAssetBalances.d.ts +98 -0
- package/dist/types/src/client/v2/serviceClient.d.ts +2 -0
- package/dist/types/src/dryrun.d.ts +20 -0
- package/dist/types/src/main.d.ts +1 -0
- package/package.json +2 -2
|
@@ -20,79 +20,327 @@ import Genesis from './genesis';
|
|
|
20
20
|
import Proof from './proof';
|
|
21
21
|
import { BaseHTTPClient } from '../../baseHTTPClient';
|
|
22
22
|
import { AlgodTokenHeader, CustomTokenHeader } from '../../urlTokenBaseHTTPClient';
|
|
23
|
+
/**
|
|
24
|
+
* Algod client connects an application to the Algorand blockchain. The algod client requires a valid algod REST endpoint IP address and algod token from an Algorand node that is connected to the network you plan to interact with.
|
|
25
|
+
*
|
|
26
|
+
* Algod is the main Algorand process for handling the blockchain. Messages between nodes are processed, the protocol steps are executed, and the blocks are written to disk. The algod process also exposes a REST API server that developers can use to communicate with the node and the network. Algod uses the data directory for storage and configuration information.
|
|
27
|
+
*
|
|
28
|
+
* #### Relevant Information
|
|
29
|
+
* [How do I obtain an algod address and token?](https://developer.algorand.org/docs/archive/build-apps/setup/?from_query=algod#how-do-i-obtain-an-algod-address-and-token)
|
|
30
|
+
*
|
|
31
|
+
* [Run Algod in Postman OAS3](https://developer.algorand.org/docs/rest-apis/restendpoints/?from_query=algod#algod-indexer-and-kmd-rest-endpoints)
|
|
32
|
+
*/
|
|
23
33
|
export default class AlgodClient extends ServiceClient {
|
|
24
34
|
/**
|
|
25
35
|
* Create an AlgodClient from
|
|
26
36
|
* * either a token, baseServer, port, and optional headers
|
|
27
37
|
* * or a base client server for interoperability with external dApp wallets
|
|
38
|
+
*
|
|
39
|
+
* #### Example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const token = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
|
|
42
|
+
* const server = "http://localhost";
|
|
43
|
+
* const port = 4001;
|
|
44
|
+
* const algodClient = new algosdk.Algodv2(token, server, port);
|
|
45
|
+
* ```
|
|
46
|
+
* @remarks
|
|
47
|
+
* The above configuration is for a sandbox private network.
|
|
48
|
+
* For applications on production, you are encouraged to run your own node, or use an Algorand REST API provider with a dedicated API key.
|
|
49
|
+
*
|
|
50
|
+
* @param tokenOrBaseClient - The algod token from the Algorand node you are interacting with
|
|
51
|
+
* @param baseServer - REST endpoint
|
|
52
|
+
* @param port - Port number if specifically configured by the server
|
|
53
|
+
* @param headers - Optional headers
|
|
28
54
|
*/
|
|
29
55
|
constructor(tokenOrBaseClient: string | AlgodTokenHeader | CustomTokenHeader | BaseHTTPClient, baseServer?: string, port?: string | number, headers?: Record<string, string>);
|
|
56
|
+
/**
|
|
57
|
+
* Returns OK if healthy.
|
|
58
|
+
*
|
|
59
|
+
* #### Example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* const health = await algodClient.healthCheck().do();
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-health)
|
|
65
|
+
* @category GET
|
|
66
|
+
*/
|
|
30
67
|
healthCheck(): HealthCheck;
|
|
68
|
+
/**
|
|
69
|
+
* Retrieves the supported API versions, binary build versions, and genesis information.
|
|
70
|
+
*
|
|
71
|
+
* #### Example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const versionsDetails = await algodClient.versionsCheck().do();
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-versions)
|
|
77
|
+
* @category GET
|
|
78
|
+
*/
|
|
31
79
|
versionsCheck(): Versions;
|
|
80
|
+
/**
|
|
81
|
+
* Broadcasts a raw transaction to the network.
|
|
82
|
+
*
|
|
83
|
+
* #### Example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* const { txId } = await algodClient.sendRawTransaction(signedTxns).do();
|
|
86
|
+
* const result = await waitForConfirmation(algodClient, txid, 3);
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#post-v2transactions)
|
|
90
|
+
*
|
|
91
|
+
* @remarks
|
|
92
|
+
* Often used with {@linkcode waitForConfirmation}
|
|
93
|
+
* @param stxOrStxs - Signed transactions
|
|
94
|
+
* @category POST
|
|
95
|
+
*/
|
|
32
96
|
sendRawTransaction(stxOrStxs: Uint8Array | Uint8Array[]): SendRawTransaction;
|
|
33
97
|
/**
|
|
34
|
-
* Returns the given account's
|
|
98
|
+
* Returns the given account's status, balance and spendable amounts.
|
|
99
|
+
*
|
|
100
|
+
* #### Example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
103
|
+
* const accountInfo = await algodClient.accountInformation(address).do();
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2accountsaddress)
|
|
35
107
|
* @param account - The address of the account to look up.
|
|
108
|
+
* @category GET
|
|
36
109
|
*/
|
|
37
110
|
accountInformation(account: string): AccountInformation;
|
|
38
111
|
/**
|
|
39
112
|
* Gets the block info for the given round.
|
|
113
|
+
*
|
|
114
|
+
* #### Example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const roundNumber = 18038133;
|
|
117
|
+
* const block = await algodClient.block(roundNumber).do();
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2blocksround)
|
|
40
121
|
* @param roundNumber - The round number of the block to get.
|
|
122
|
+
* @category GET
|
|
41
123
|
*/
|
|
42
124
|
block(roundNumber: number): Block;
|
|
43
125
|
/**
|
|
44
126
|
* Returns the transaction information for a specific pending transaction.
|
|
127
|
+
*
|
|
128
|
+
* #### Example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* const txId = "DRJS6R745A7GFVMXEXWP4TGVDGKW7VILFTA7HC2BR2GRLHNY5CTA";
|
|
131
|
+
* const pending = await algodClient.pendingTransactionInformation(txId).do();
|
|
132
|
+
* ```
|
|
133
|
+
*
|
|
134
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2transactionspendingtxid)
|
|
135
|
+
*
|
|
136
|
+
* @remarks
|
|
137
|
+
* <br><br>
|
|
138
|
+
* There are several cases when this might succeed:
|
|
139
|
+
* - transaction committed (committed round > 0)
|
|
140
|
+
* - transaction still in the pool (committed round = 0, pool error = "")
|
|
141
|
+
* - transaction removed from pool due to error (committed round = 0, pool error != "")
|
|
142
|
+
*
|
|
143
|
+
* Or the transaction may have happened sufficiently long ago that the node no longer remembers it, and this will return an error.
|
|
144
|
+
*
|
|
45
145
|
* @param txid - The TxID string of the pending transaction to look up.
|
|
146
|
+
* @category GET
|
|
46
147
|
*/
|
|
47
148
|
pendingTransactionInformation(txid: string): PendingTransactionInformation;
|
|
48
149
|
/**
|
|
49
|
-
* Returns
|
|
150
|
+
* Returns the list of pending transactions in the pool, sorted by priority, in decreasing order, truncated at the end at MAX.
|
|
151
|
+
* If MAX = 0, returns all pending transactions.
|
|
152
|
+
*
|
|
153
|
+
* #### Example 1
|
|
154
|
+
* ```typescript
|
|
155
|
+
* const pendingTxns = await algodClient.pendingTransactionsInformation().do();
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* #### Example 2
|
|
159
|
+
* ```typescript
|
|
160
|
+
* const maxTxns = 5;
|
|
161
|
+
* const pendingTxns = await algodClient
|
|
162
|
+
* .pendingTransactionsInformation()
|
|
163
|
+
* .max(maxTxns)
|
|
164
|
+
* .do();
|
|
165
|
+
* ```
|
|
166
|
+
*
|
|
167
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2transactionspending)
|
|
168
|
+
* @category GET
|
|
50
169
|
*/
|
|
51
170
|
pendingTransactionsInformation(): PendingTransactions;
|
|
52
171
|
/**
|
|
53
|
-
* Returns
|
|
172
|
+
* Returns the list of pending transactions sent by the address, sorted by priority, in decreasing order, truncated at the end at MAX.
|
|
173
|
+
* If MAX = 0, returns all pending transactions.
|
|
174
|
+
*
|
|
175
|
+
* #### Example 1
|
|
176
|
+
* ```typescript
|
|
177
|
+
* const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
178
|
+
* const pendingTxnsByAddr = await algodClient.pendingTransactionByAddress(address).do();
|
|
179
|
+
* ```
|
|
180
|
+
*
|
|
181
|
+
* #### Example 2
|
|
182
|
+
* ```typescript
|
|
183
|
+
* const maxTxns = 5;
|
|
184
|
+
* const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
185
|
+
* const pendingTxns = await algodClient
|
|
186
|
+
* .pendingTransactionByAddress(address)
|
|
187
|
+
* .max(maxTxns)
|
|
188
|
+
* .do();
|
|
189
|
+
* ```
|
|
190
|
+
*
|
|
191
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2accountsaddresstransactionspending)
|
|
54
192
|
* @param address - The address of the sender.
|
|
193
|
+
* @category GET
|
|
55
194
|
*/
|
|
56
195
|
pendingTransactionByAddress(address: string): PendingTransactionsByAddress;
|
|
57
196
|
/**
|
|
58
197
|
* Retrieves the StatusResponse from the running node.
|
|
198
|
+
*
|
|
199
|
+
* #### Example
|
|
200
|
+
* ```typescript
|
|
201
|
+
* const status = await algodClient.status().do();
|
|
202
|
+
* ```
|
|
203
|
+
*
|
|
204
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2status)
|
|
205
|
+
* @category GET
|
|
59
206
|
*/
|
|
60
207
|
status(): Status;
|
|
61
208
|
/**
|
|
62
|
-
* Waits for a specific round to occur then returns the StatusResponse for that round.
|
|
209
|
+
* Waits for a specific round to occur then returns the `StatusResponse` for that round.
|
|
210
|
+
*
|
|
211
|
+
* #### Example
|
|
212
|
+
* ```typescript
|
|
213
|
+
* const round = 18038133;
|
|
214
|
+
* const statusAfterBlock = await algodClient.statusAfterBlock(round).do();
|
|
215
|
+
* ```
|
|
216
|
+
*
|
|
217
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2statuswait-for-block-afterround)
|
|
63
218
|
* @param round - The number of the round to wait for.
|
|
219
|
+
* @category GET
|
|
64
220
|
*/
|
|
65
221
|
statusAfterBlock(round: number): StatusAfterBlock;
|
|
66
222
|
/**
|
|
67
223
|
* Returns the common needed parameters for a new transaction.
|
|
224
|
+
*
|
|
225
|
+
* #### Example
|
|
226
|
+
* ```typescript
|
|
227
|
+
* const suggestedParams = await algodClient.getTransactionParams().do();
|
|
228
|
+
* const amountInMicroAlgos = algosdk.algosToMicroalgos(2); // 2 Algos
|
|
229
|
+
* const unsignedTxn = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
|
|
230
|
+
* from: senderAddress,
|
|
231
|
+
* to: receiverAddress,
|
|
232
|
+
* amount: amountInMicroAlgos,
|
|
233
|
+
* suggestedParams: suggestedParams,
|
|
234
|
+
* });
|
|
235
|
+
* ```
|
|
236
|
+
*
|
|
237
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2transactionsparams)
|
|
238
|
+
*
|
|
239
|
+
* @remarks
|
|
240
|
+
* Often used with
|
|
241
|
+
* {@linkcode makePaymentTxnWithSuggestedParamsFromObject}, {@linkcode algosToMicroalgos}
|
|
242
|
+
* @category GET
|
|
68
243
|
*/
|
|
69
244
|
getTransactionParams(): SuggestedParams;
|
|
70
245
|
/**
|
|
71
|
-
*
|
|
246
|
+
* Returns the supply details for the specified node's ledger.
|
|
247
|
+
*
|
|
248
|
+
* #### Example
|
|
249
|
+
* ```typescript
|
|
250
|
+
* const supplyDetails = await algodClient.supply().do();
|
|
251
|
+
* ```
|
|
252
|
+
*
|
|
253
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2ledgersupply)
|
|
254
|
+
* @category GET
|
|
72
255
|
*/
|
|
73
256
|
supply(): Supply;
|
|
257
|
+
/**
|
|
258
|
+
* Compiles TEAL source code to binary, returns base64 encoded program bytes and base32 SHA512_256 hash of program bytes (Address style).
|
|
259
|
+
*
|
|
260
|
+
* #### Example
|
|
261
|
+
* ```typescript
|
|
262
|
+
* const source = "TEAL SOURCE CODE";
|
|
263
|
+
* const compiledSmartContract = await algodClient.compile(source).do();
|
|
264
|
+
* ```
|
|
265
|
+
*
|
|
266
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#post-v2tealcompile)
|
|
267
|
+
* @remarks
|
|
268
|
+
* This endpoint is only enabled when a node's configuration file sets `EnableDeveloperAPI` to true.
|
|
269
|
+
* @param source
|
|
270
|
+
* @category POST
|
|
271
|
+
*/
|
|
74
272
|
compile(source: string | Uint8Array): Compile;
|
|
273
|
+
/**
|
|
274
|
+
* Provides debugging information for a transaction (or group).
|
|
275
|
+
*
|
|
276
|
+
* Executes TEAL program(s) in context and returns debugging information about the execution. This endpoint is only enabled when a node's configureation file sets `EnableDeveloperAPI` to true.
|
|
277
|
+
*
|
|
278
|
+
* #### Example
|
|
279
|
+
* ```typescript
|
|
280
|
+
* const dryRunResult = await algodClient.dryrun(dr).do();
|
|
281
|
+
* ```
|
|
282
|
+
*
|
|
283
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#post-v2tealdryrun)
|
|
284
|
+
* @param dr
|
|
285
|
+
* @category POST
|
|
286
|
+
*/
|
|
75
287
|
dryrun(dr: modelsv2.DryrunRequest): Dryrun;
|
|
76
288
|
/**
|
|
77
289
|
* Given an asset ID, return asset information including creator, name, total supply and
|
|
78
290
|
* special addresses.
|
|
291
|
+
*
|
|
292
|
+
* #### Example
|
|
293
|
+
* ```typescript
|
|
294
|
+
* const asset_id = 163650;
|
|
295
|
+
* const asset = await algodClient.getAssetByID(asset_id).do();
|
|
296
|
+
* ```
|
|
297
|
+
*
|
|
298
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2assetsasset-id)
|
|
79
299
|
* @param index - The asset ID to look up.
|
|
300
|
+
* @category GET
|
|
80
301
|
*/
|
|
81
302
|
getAssetByID(index: number): GetAssetByID;
|
|
82
303
|
/**
|
|
83
|
-
* Given an application ID,
|
|
304
|
+
* Given an application ID, return the application information including creator, approval
|
|
84
305
|
* and clear programs, global and local schemas, and global state.
|
|
306
|
+
*
|
|
307
|
+
* #### Example
|
|
308
|
+
* ```typescript
|
|
309
|
+
* const index = 60553466;
|
|
310
|
+
* const app = await algodClient.getApplicationByID(index).do();
|
|
311
|
+
* ```
|
|
312
|
+
*
|
|
313
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2applicationsapplication-id)
|
|
85
314
|
* @param index - The application ID to look up.
|
|
315
|
+
* @category GET
|
|
86
316
|
*/
|
|
87
317
|
getApplicationByID(index: number): GetApplicationByID;
|
|
88
318
|
/**
|
|
89
319
|
* Returns the entire genesis file.
|
|
320
|
+
*
|
|
321
|
+
* #### Example
|
|
322
|
+
* ```typescript
|
|
323
|
+
* const genesis = await algodClient.genesis().do();
|
|
324
|
+
* ```
|
|
325
|
+
*
|
|
326
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-genesis)
|
|
327
|
+
* @category GET
|
|
90
328
|
*/
|
|
91
329
|
genesis(): Genesis;
|
|
92
330
|
/**
|
|
93
|
-
*
|
|
331
|
+
* Returns a Merkle proof for a given transaction in a block.
|
|
332
|
+
*
|
|
333
|
+
* #### Example
|
|
334
|
+
* ```typescript
|
|
335
|
+
* const round = 18038133;
|
|
336
|
+
* const txId = "MEUOC4RQJB23CQZRFRKYEI6WBO73VTTPST5A7B3S5OKBUY6LFUDA";
|
|
337
|
+
* const proof = await algodClient.getProof(round, txId).do();
|
|
338
|
+
* ```
|
|
339
|
+
*
|
|
340
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2blocksroundtransactionstxidproof)
|
|
94
341
|
* @param round - The round in which the transaction appears.
|
|
95
342
|
* @param txID - The transaction ID for which to generate a proof.
|
|
343
|
+
* @category GET
|
|
96
344
|
*/
|
|
97
345
|
getProof(round: number, txID: string): Proof;
|
|
98
346
|
}
|
|
@@ -15,76 +15,228 @@ import SearchForAssets from './searchForAssets';
|
|
|
15
15
|
import SearchForApplications from './searchForApplications';
|
|
16
16
|
import { BaseHTTPClient } from '../../baseHTTPClient';
|
|
17
17
|
import { CustomTokenHeader, IndexerTokenHeader } from '../../urlTokenBaseHTTPClient';
|
|
18
|
+
/**
|
|
19
|
+
* The Indexer provides a REST API interface of API calls to support searching the Algorand Blockchain.
|
|
20
|
+
*
|
|
21
|
+
* The Indexer REST APIs retrieve the blockchain data from a PostgreSQL compatible database that must be populated.
|
|
22
|
+
*
|
|
23
|
+
* This database is populated using the same indexer instance or a separate instance of the indexer which must connect to the algod process of a running Algorand node to read block data.
|
|
24
|
+
*
|
|
25
|
+
* This node must also be an Archival node to make searching the entire blockchain possible.
|
|
26
|
+
*
|
|
27
|
+
* #### Relevant Information
|
|
28
|
+
* [Learn more about Indexer](https://developer.algorand.org/docs/get-details/indexer/)
|
|
29
|
+
*
|
|
30
|
+
* [Run Indexer in Postman OAS3](https://developer.algorand.org/docs/rest-apis/restendpoints/#algod-indexer-and-kmd-rest-endpoints)
|
|
31
|
+
*/
|
|
18
32
|
export default class IndexerClient extends ServiceClient {
|
|
19
33
|
/**
|
|
20
34
|
* Create an IndexerClient from
|
|
21
35
|
* * either a token, baseServer, port, and optional headers
|
|
22
36
|
* * or a base client server for interoperability with external dApp wallets
|
|
37
|
+
*
|
|
38
|
+
* #### Example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const token = "";
|
|
41
|
+
* const server = "http://localhost";
|
|
42
|
+
* const port = 8980;
|
|
43
|
+
* const indexerClient = new algosdk.Indexer(token, server, port);
|
|
44
|
+
* ```
|
|
45
|
+
* @remarks
|
|
46
|
+
* The above configuration is for a sandbox private network.
|
|
47
|
+
* For applications on production, you are encouraged to run your own node with indexer, or use an Algorand REST API provider with a dedicated API key.
|
|
48
|
+
*
|
|
49
|
+
* @param tokenOrBaseClient - The API token for the Indexer API
|
|
50
|
+
* @param baseServer - REST endpoint
|
|
51
|
+
* @param port - Port number if specifically configured by the server
|
|
52
|
+
* @param headers - Optional headers
|
|
23
53
|
*/
|
|
24
54
|
constructor(tokenOrBaseClient: string | IndexerTokenHeader | CustomTokenHeader | BaseHTTPClient, baseServer?: string, port?: string | number, headers?: Record<string, string>);
|
|
25
55
|
/**
|
|
26
56
|
* Returns the health object for the service.
|
|
57
|
+
* Returns 200 if healthy.
|
|
58
|
+
*
|
|
59
|
+
* #### Example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* const health = await indexerClient.makeHealthCheck().do();
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-health)
|
|
65
|
+
* @category GET
|
|
27
66
|
*/
|
|
28
67
|
makeHealthCheck(): MakeHealthCheck;
|
|
29
68
|
/**
|
|
30
|
-
* Returns
|
|
69
|
+
* Returns the list of accounts who hold the given asset and their balance.
|
|
70
|
+
*
|
|
71
|
+
* #### Example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const assetId = 163650;
|
|
74
|
+
* const assetBalances = await indexerClient.lookupAssetBalances(assetId).do();
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2assetsasset-idbalances)
|
|
31
78
|
* @param index - The asset ID to look up.
|
|
79
|
+
* @category GET
|
|
32
80
|
*/
|
|
33
81
|
lookupAssetBalances(index: number): LookupAssetBalances;
|
|
34
82
|
/**
|
|
35
83
|
* Returns transactions relating to the given asset.
|
|
84
|
+
*
|
|
85
|
+
* #### Example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const assetId = 163650;
|
|
88
|
+
* const assetTxns = await indexerClient.lookupAssetTransactions(assetId).do();
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2assetsasset-idtransactions)
|
|
36
92
|
* @param index - The asset ID to look up.
|
|
93
|
+
* @category GET
|
|
37
94
|
*/
|
|
38
95
|
lookupAssetTransactions(index: number): LookupAssetTransactions;
|
|
39
96
|
/**
|
|
40
97
|
* Returns transactions relating to the given account.
|
|
98
|
+
*
|
|
99
|
+
* #### Example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
102
|
+
* const accountTxns = await indexerClient.lookupAccountTransactions(address).do();
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-idtransactions)
|
|
41
106
|
* @param account - The address of the account.
|
|
107
|
+
* @category GET
|
|
42
108
|
*/
|
|
43
109
|
lookupAccountTransactions(account: string): LookupAccountTransactions;
|
|
44
110
|
/**
|
|
45
111
|
* Returns the block for the passed round.
|
|
112
|
+
*
|
|
113
|
+
* #### Example
|
|
114
|
+
* ```typescript
|
|
115
|
+
* const targetBlock = 18309917;
|
|
116
|
+
* const blockInfo = await indexerClient.lookupBlock(targetBlock).do();
|
|
117
|
+
* ```
|
|
118
|
+
*
|
|
119
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2blocksround-number)
|
|
46
120
|
* @param round - The number of the round to look up.
|
|
121
|
+
* @category GET
|
|
47
122
|
*/
|
|
48
123
|
lookupBlock(round: number): LookupBlock;
|
|
49
124
|
/**
|
|
50
125
|
* Returns information about the given transaction.
|
|
126
|
+
*
|
|
127
|
+
* #### Example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* const txnId = "MEUOC4RQJB23CQZRFRKYEI6WBO73VTTPST5A7B3S5OKBUY6LFUDA";
|
|
130
|
+
* const txnInfo = await indexerClient.lookupTransactionByID(txnId).do();
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2transactionstxid)
|
|
51
134
|
* @param txID - The ID of the transaction to look up.
|
|
135
|
+
* @category GET
|
|
52
136
|
*/
|
|
53
137
|
lookupTransactionByID(txID: string): LookupTransactionByID;
|
|
54
138
|
/**
|
|
55
139
|
* Returns information about the given account.
|
|
140
|
+
*
|
|
141
|
+
* #### Example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
144
|
+
* const accountInfo = await indexerClient.lookupAccountByID(address).do();
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-id)
|
|
56
148
|
* @param account - The address of the account to look up.
|
|
149
|
+
* @category GET
|
|
57
150
|
*/
|
|
58
151
|
lookupAccountByID(account: string): LookupAccountByID;
|
|
59
152
|
/**
|
|
60
153
|
* Returns information about the passed asset.
|
|
154
|
+
*
|
|
155
|
+
* #### Example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* const assetId = 163650;
|
|
158
|
+
* const assetInfo = await indexerClient.lookupAssetByID(assetId).do();
|
|
159
|
+
* ```
|
|
160
|
+
*
|
|
161
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2assetsasset-id)
|
|
61
162
|
* @param index - The ID of the asset ot look up.
|
|
163
|
+
* @category GET
|
|
62
164
|
*/
|
|
63
165
|
lookupAssetByID(index: number): LookupAssetByID;
|
|
64
166
|
/**
|
|
65
167
|
* Returns information about the passed application.
|
|
168
|
+
*
|
|
169
|
+
* #### Example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* const appId = 60553466;
|
|
172
|
+
* const appInfo = await indexerClient.lookupApplications(appId).do();
|
|
173
|
+
* ```
|
|
174
|
+
*
|
|
175
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2applicationsapplication-id)
|
|
66
176
|
* @param index - The ID of the application to look up.
|
|
177
|
+
* @category GET
|
|
67
178
|
*/
|
|
68
179
|
lookupApplications(index: number): LookupApplications;
|
|
69
180
|
/**
|
|
70
181
|
* Returns log messages generated by the passed in application.
|
|
182
|
+
*
|
|
183
|
+
* #### Example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* const appId = 60553466;
|
|
186
|
+
* const appLogs = await indexerClient.lookupApplicationLogs(appId).do();
|
|
187
|
+
* ```
|
|
188
|
+
*
|
|
189
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2applicationsapplication-idlogs)
|
|
71
190
|
* @param appID - The ID of the application which generated the logs.
|
|
191
|
+
* @category GET
|
|
72
192
|
*/
|
|
73
193
|
lookupApplicationLogs(appID: number): LookupApplicationLogs;
|
|
74
194
|
/**
|
|
75
195
|
* Returns information about indexed accounts.
|
|
196
|
+
*
|
|
197
|
+
* #### Example
|
|
198
|
+
* ```typescript
|
|
199
|
+
* const accounts = await indexerClient.searchAccounts().do();
|
|
200
|
+
* ```
|
|
201
|
+
*
|
|
202
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accounts)
|
|
203
|
+
* @category GET
|
|
76
204
|
*/
|
|
77
205
|
searchAccounts(): SearchAccounts;
|
|
78
206
|
/**
|
|
79
207
|
* Returns information about indexed transactions.
|
|
208
|
+
*
|
|
209
|
+
* #### Example
|
|
210
|
+
* ```typescript
|
|
211
|
+
* const txns = await indexerClient.searchForTransactions().do();
|
|
212
|
+
* ```
|
|
213
|
+
*
|
|
214
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2transactions)
|
|
215
|
+
* @category GET
|
|
80
216
|
*/
|
|
81
217
|
searchForTransactions(): SearchForTransactions;
|
|
82
218
|
/**
|
|
83
219
|
* Returns information about indexed assets.
|
|
220
|
+
*
|
|
221
|
+
* #### Example
|
|
222
|
+
* ```typescript
|
|
223
|
+
* const assets = await indexerClient.searchForAssets().do();
|
|
224
|
+
* ```
|
|
225
|
+
*
|
|
226
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2assets)
|
|
227
|
+
* @category GET
|
|
84
228
|
*/
|
|
85
229
|
searchForAssets(): SearchForAssets;
|
|
86
230
|
/**
|
|
87
231
|
* Returns information about indexed applications.
|
|
232
|
+
*
|
|
233
|
+
* #### Example
|
|
234
|
+
* ```typescript
|
|
235
|
+
* const apps = await indexerClient.searchForApplications().do();
|
|
236
|
+
* ```
|
|
237
|
+
*
|
|
238
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2applications)
|
|
239
|
+
* @category GET
|
|
88
240
|
*/
|
|
89
241
|
searchForApplications(): SearchForApplications;
|
|
90
242
|
}
|
|
@@ -3,12 +3,110 @@ import HTTPClient from '../../client';
|
|
|
3
3
|
import IntDecoding from '../../../types/intDecoding';
|
|
4
4
|
export default class LookupAssetBalances extends JSONRequest {
|
|
5
5
|
private index;
|
|
6
|
+
/**
|
|
7
|
+
* Returns the list of accounts which hold the given asset and their balance.
|
|
8
|
+
*
|
|
9
|
+
* #### Example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const assetId = 163650;
|
|
12
|
+
* const assetBalances = await indexerClient.lookupAssetBalances(assetId).do();
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2assetsasset-idbalances)
|
|
16
|
+
* @param index - The asset ID to look up.
|
|
17
|
+
*/
|
|
6
18
|
constructor(c: HTTPClient, intDecoding: IntDecoding, index: number);
|
|
7
19
|
path(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Add a limit for filter.
|
|
22
|
+
*
|
|
23
|
+
* #### Example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const assetId = 163650;
|
|
26
|
+
* const maxResults = 20;
|
|
27
|
+
* const assetBalances = await indexerClient
|
|
28
|
+
* .lookupAssetBalances(assetId)
|
|
29
|
+
* .limit(maxResults)
|
|
30
|
+
* .do();
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @param limit - maximum number of results to return.
|
|
34
|
+
*/
|
|
8
35
|
limit(limit: number): this;
|
|
36
|
+
/**
|
|
37
|
+
* Specify round to filter with.
|
|
38
|
+
*
|
|
39
|
+
* #### Example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const assetId = 163650;
|
|
42
|
+
* const targetBlock = 18309917;
|
|
43
|
+
* const assetBalances = await indexerClient
|
|
44
|
+
* .lookupAssetBalances(assetId)
|
|
45
|
+
* .round(targetBlock)
|
|
46
|
+
* .do();
|
|
47
|
+
* ```
|
|
48
|
+
* @param round
|
|
49
|
+
*/
|
|
9
50
|
round(round: number): this;
|
|
51
|
+
/**
|
|
52
|
+
* Filtered results should have an asset balance greater than this value.
|
|
53
|
+
*
|
|
54
|
+
* #### Example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* const assetId = 163650;
|
|
57
|
+
* const minBalance = 1000000;
|
|
58
|
+
* const assetBalances = await indexerClient
|
|
59
|
+
* .lookupAssetBalances(assetId)
|
|
60
|
+
* .currencyGreaterThan(minBalance)
|
|
61
|
+
* .do();
|
|
62
|
+
* ```
|
|
63
|
+
* @param greater
|
|
64
|
+
*/
|
|
10
65
|
currencyGreaterThan(greater: number): this;
|
|
66
|
+
/**
|
|
67
|
+
* Filtered results should have an asset balance less than this value.
|
|
68
|
+
*
|
|
69
|
+
* #### Example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const assetId = 163650;
|
|
72
|
+
* const maxBalance = 2000000;
|
|
73
|
+
* const assetBalances = await indexerClient
|
|
74
|
+
* .lookupAssetBalances(assetId)
|
|
75
|
+
* .currencyLessThan(maxBalance)
|
|
76
|
+
* .do();
|
|
77
|
+
* ```
|
|
78
|
+
* @param lesser
|
|
79
|
+
*/
|
|
11
80
|
currencyLessThan(lesser: number): this;
|
|
81
|
+
/**
|
|
82
|
+
* Specify the next page of results.
|
|
83
|
+
*
|
|
84
|
+
* #### Example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* const assetId = 163650;
|
|
87
|
+
* const maxResults = 20;
|
|
88
|
+
* const nextToken = "APA6C7C3NCANRPIBUWQOF7WSKLJMK6RPQUVFLLDV4U5WCQE4DEF26D4E3E";
|
|
89
|
+
* const assetBalances = await indexerClient
|
|
90
|
+
* .lookupAssetBalances(assetId)
|
|
91
|
+
* .limit(maxResults)
|
|
92
|
+
* .next(nextToken)
|
|
93
|
+
* .do();
|
|
94
|
+
* ```
|
|
95
|
+
* @param nextToken - provided by the previous results.
|
|
96
|
+
*/
|
|
12
97
|
nextToken(nextToken: string): this;
|
|
98
|
+
/**
|
|
99
|
+
* Include all items including closed accounts, deleted applications, destroyed assets, opted-out asset holdings, and closed-out application localstates
|
|
100
|
+
*
|
|
101
|
+
* #### Example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* const assetId = 163650;
|
|
104
|
+
* const assetBalances = await indexerClient
|
|
105
|
+
* .lookupAssetBalances(assetId)
|
|
106
|
+
* .includeAll(false)
|
|
107
|
+
* .do();
|
|
108
|
+
* ```
|
|
109
|
+
* @param value
|
|
110
|
+
*/
|
|
13
111
|
includeAll(value?: boolean): this;
|
|
14
112
|
}
|
|
@@ -7,7 +7,9 @@ export declare type TokenHeaderIdentifier = 'X-Indexer-API-Token' | 'X-KMD-API-T
|
|
|
7
7
|
* Abstract service client to encapsulate shared AlgodClient and IndexerClient logic
|
|
8
8
|
*/
|
|
9
9
|
export default abstract class ServiceClient {
|
|
10
|
+
/** @ignore */
|
|
10
11
|
c: HTTPClient;
|
|
12
|
+
/** @ignore */
|
|
11
13
|
intDecoding: IntDecoding;
|
|
12
14
|
constructor(tokenHeaderIdentifier: TokenHeaderIdentifier, tokenHeaderOrStrOrBaseClient: string | TokenHeader | BaseHTTPClient, baseServer: string, port?: string | number, defaultHeaders?: Record<string, any>);
|
|
13
15
|
/**
|