algosdk 1.12.0 → 1.13.1
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/abi/abi_type.js +693 -0
- package/dist/cjs/src/abi/abi_type.js.map +1 -0
- package/dist/cjs/src/abi/contract.js +27 -0
- package/dist/cjs/src/abi/contract.js.map +1 -0
- package/dist/cjs/src/abi/index.js +19 -0
- package/dist/cjs/src/abi/index.js.map +1 -0
- package/dist/cjs/src/abi/interface.js +23 -0
- package/dist/cjs/src/abi/interface.js.map +1 -0
- package/dist/cjs/src/abi/method.js +114 -0
- package/dist/cjs/src/abi/method.js.map +1 -0
- package/dist/cjs/src/abi/reference.js +25 -0
- package/dist/cjs/src/abi/reference.js.map +1 -0
- package/dist/cjs/src/abi/transaction.js +52 -0
- package/dist/cjs/src/abi/transaction.js.map +1 -0
- package/dist/cjs/src/client/baseHTTPClient.js +3 -0
- package/dist/cjs/src/client/baseHTTPClient.js.map +1 -0
- package/dist/cjs/src/client/client.js +164 -104
- package/dist/cjs/src/client/client.js.map +1 -1
- package/dist/cjs/src/client/urlTokenBaseHTTPClient.js +138 -0
- package/dist/cjs/src/client/urlTokenBaseHTTPClient.js.map +1 -0
- package/dist/cjs/src/client/v2/algod/algod.js +262 -9
- package/dist/cjs/src/client/v2/algod/algod.js.map +1 -1
- package/dist/cjs/src/client/v2/algod/models/types.js +2 -2
- package/dist/cjs/src/client/v2/indexer/indexer.js +160 -3
- 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 +17 -8
- package/dist/cjs/src/client/v2/serviceClient.js.map +1 -1
- package/dist/cjs/src/composer.js +439 -0
- package/dist/cjs/src/composer.js.map +1 -0
- package/dist/cjs/src/dryrun.js +105 -0
- package/dist/cjs/src/dryrun.js.map +1 -0
- package/dist/cjs/src/encoding/bigint.js +38 -0
- package/dist/cjs/src/encoding/bigint.js.map +1 -0
- package/dist/cjs/src/logicsig.js +2 -2
- package/dist/cjs/src/logicsig.js.map +1 -1
- package/dist/cjs/src/main.js +12 -87
- package/dist/cjs/src/main.js.map +1 -1
- package/dist/cjs/src/makeTxn.js +29 -1
- package/dist/cjs/src/makeTxn.js.map +1 -1
- package/dist/cjs/src/multisig.js +77 -2
- package/dist/cjs/src/multisig.js.map +1 -1
- package/dist/cjs/src/signer.js +66 -0
- package/dist/cjs/src/signer.js.map +1 -0
- package/dist/cjs/src/transaction.js +8 -4
- package/dist/cjs/src/transaction.js.map +1 -1
- package/dist/cjs/src/types/intDecoding.js +0 -2
- package/dist/cjs/src/types/intDecoding.js.map +1 -1
- package/dist/cjs/src/types/transactions/base.js +0 -1
- package/dist/cjs/src/types/transactions/base.js.map +1 -1
- package/dist/cjs/src/wait.js +53 -0
- package/dist/cjs/src/wait.js.map +1 -0
- package/dist/esm/src/abi/abi_type.js +680 -0
- package/dist/esm/src/abi/abi_type.js.map +1 -0
- package/dist/esm/src/abi/contract.js +23 -0
- package/dist/esm/src/abi/contract.js.map +1 -0
- package/dist/esm/src/abi/index.js +7 -0
- package/dist/esm/src/abi/index.js.map +1 -0
- package/dist/esm/src/abi/interface.js +19 -0
- package/dist/esm/src/abi/interface.js.map +1 -0
- package/dist/esm/src/abi/method.js +110 -0
- package/dist/esm/src/abi/method.js.map +1 -0
- package/dist/esm/src/abi/reference.js +21 -0
- package/dist/esm/src/abi/reference.js.map +1 -0
- package/dist/esm/src/abi/transaction.js +47 -0
- package/dist/esm/src/abi/transaction.js.map +1 -0
- package/dist/esm/src/client/baseHTTPClient.js +2 -0
- package/dist/esm/src/client/baseHTTPClient.js.map +1 -0
- package/dist/esm/src/client/client.js +164 -101
- package/dist/esm/src/client/client.js.map +1 -1
- package/dist/esm/src/client/urlTokenBaseHTTPClient.js +112 -0
- package/dist/esm/src/client/urlTokenBaseHTTPClient.js.map +1 -0
- package/dist/esm/src/client/v2/algod/algod.js +262 -9
- package/dist/esm/src/client/v2/algod/algod.js.map +1 -1
- package/dist/esm/src/client/v2/algod/models/types.js +2 -2
- package/dist/esm/src/client/v2/indexer/indexer.js +160 -3
- 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 +17 -8
- package/dist/esm/src/client/v2/serviceClient.js.map +1 -1
- package/dist/esm/src/composer.js +435 -0
- package/dist/esm/src/composer.js.map +1 -0
- package/dist/esm/src/dryrun.js +101 -0
- package/dist/esm/src/dryrun.js.map +1 -0
- package/dist/esm/src/encoding/bigint.js +33 -0
- package/dist/esm/src/encoding/bigint.js.map +1 -0
- package/dist/esm/src/logicsig.js +2 -2
- package/dist/esm/src/logicsig.js.map +1 -1
- package/dist/esm/src/main.js +6 -82
- package/dist/esm/src/main.js.map +1 -1
- package/dist/esm/src/makeTxn.js +27 -0
- package/dist/esm/src/makeTxn.js.map +1 -1
- package/dist/esm/src/multisig.js +73 -1
- package/dist/esm/src/multisig.js.map +1 -1
- package/dist/esm/src/signer.js +59 -0
- package/dist/esm/src/signer.js.map +1 -0
- package/dist/esm/src/transaction.js +8 -4
- package/dist/esm/src/transaction.js.map +1 -1
- package/dist/esm/src/types/intDecoding.js +0 -2
- package/dist/esm/src/types/intDecoding.js.map +1 -1
- package/dist/esm/src/types/transactions/base.js +0 -1
- package/dist/esm/src/types/transactions/base.js.map +1 -1
- package/dist/esm/src/wait.js +49 -0
- package/dist/esm/src/wait.js.map +1 -0
- package/dist/types/src/abi/abi_type.d.ts +102 -0
- package/dist/types/src/abi/contract.d.ts +21 -0
- package/dist/types/src/abi/index.d.ts +6 -0
- package/dist/types/src/abi/interface.d.ts +13 -0
- package/dist/types/src/abi/method.d.ts +39 -0
- package/dist/types/src/abi/reference.d.ts +15 -0
- package/dist/types/src/abi/transaction.d.ts +33 -0
- package/dist/types/src/client/baseHTTPClient.d.ts +41 -0
- package/dist/types/src/client/client.d.ts +66 -31
- package/dist/types/src/client/kmd.d.ts +1 -1
- package/dist/types/src/client/urlTokenBaseHTTPClient.d.ts +44 -0
- package/dist/types/src/client/v2/algod/algod.d.ts +263 -9
- package/dist/types/src/client/v2/algod/models/types.d.ts +4 -4
- package/dist/types/src/client/v2/indexer/indexer.d.ts +161 -3
- package/dist/types/src/client/v2/indexer/lookupAssetBalances.d.ts +98 -0
- package/dist/types/src/client/v2/serviceClient.d.ts +6 -2
- package/dist/types/src/composer.d.ts +160 -0
- package/dist/types/src/dryrun.d.ts +20 -0
- package/dist/types/src/encoding/bigint.d.ts +14 -0
- package/dist/types/src/main.d.ts +7 -45
- package/dist/types/src/makeTxn.d.ts +18 -1
- package/dist/types/src/multisig.d.ts +39 -1
- package/dist/types/src/signer.d.ts +40 -0
- package/dist/types/src/wait.d.ts +11 -0
- package/package.json +6 -4
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BaseHTTPClient, BaseHTTPClientResponse, Query } from './baseHTTPClient';
|
|
2
|
+
export interface AlgodTokenHeader {
|
|
3
|
+
'X-Algo-API-Token': string;
|
|
4
|
+
}
|
|
5
|
+
export interface IndexerTokenHeader {
|
|
6
|
+
'X-Indexer-API-Token': string;
|
|
7
|
+
}
|
|
8
|
+
export interface KMDTokenHeader {
|
|
9
|
+
'X-KMD-API-Token': string;
|
|
10
|
+
}
|
|
11
|
+
export interface CustomTokenHeader {
|
|
12
|
+
[headerName: string]: string;
|
|
13
|
+
}
|
|
14
|
+
export declare type TokenHeader = AlgodTokenHeader | IndexerTokenHeader | KMDTokenHeader | CustomTokenHeader;
|
|
15
|
+
/**
|
|
16
|
+
* Implementation of BaseHTTPClient that uses a URL and a token
|
|
17
|
+
* and make the REST queries using superagent.
|
|
18
|
+
* This is the default implementation of BaseHTTPClient.
|
|
19
|
+
*/
|
|
20
|
+
export declare class URLTokenBaseHTTPClient implements BaseHTTPClient {
|
|
21
|
+
private defaultHeaders;
|
|
22
|
+
private readonly baseURL;
|
|
23
|
+
private readonly tokenHeader;
|
|
24
|
+
constructor(tokenHeader: TokenHeader, baseServer: string, port?: string | number, defaultHeaders?: Record<string, any>);
|
|
25
|
+
/**
|
|
26
|
+
* Compute the URL for a path relative to the instance's address
|
|
27
|
+
* @param relativePath - A path string
|
|
28
|
+
* @returns A URL string
|
|
29
|
+
*/
|
|
30
|
+
private addressWithPath;
|
|
31
|
+
/**
|
|
32
|
+
* Convert a superagent response to a valid BaseHTTPClientResponse
|
|
33
|
+
* Modify the superagent response
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
36
|
+
private static superagentToHTTPClientResponse;
|
|
37
|
+
/**
|
|
38
|
+
* Make a superagent error more readable. For more info, see https://github.com/visionmedia/superagent/issues/1074
|
|
39
|
+
*/
|
|
40
|
+
private static formatSuperagentError;
|
|
41
|
+
get(relativePath: string, query?: Query<string>, requestHeaders?: Record<string, string>): Promise<BaseHTTPClientResponse>;
|
|
42
|
+
post(relativePath: string, data: Uint8Array, query?: Query<string>, requestHeaders?: Record<string, string>): Promise<BaseHTTPClientResponse>;
|
|
43
|
+
delete(relativePath: string, data: Uint8Array, query?: Query<string>, requestHeaders?: Record<string, string>): Promise<BaseHTTPClientResponse>;
|
|
44
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import ServiceClient from '../serviceClient';
|
|
2
|
-
import { AlgodTokenHeader, CustomTokenHeader } from '../../client';
|
|
3
2
|
import * as modelsv2 from './models/types';
|
|
4
3
|
import AccountInformation from './accountInformation';
|
|
5
4
|
import Block from './block';
|
|
@@ -19,74 +18,329 @@ import Supply from './supply';
|
|
|
19
18
|
import Versions from './versions';
|
|
20
19
|
import Genesis from './genesis';
|
|
21
20
|
import Proof from './proof';
|
|
21
|
+
import { BaseHTTPClient } from '../../baseHTTPClient';
|
|
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
|
+
*/
|
|
22
33
|
export default class AlgodClient extends ServiceClient {
|
|
23
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Create an AlgodClient from
|
|
36
|
+
* * either a token, baseServer, port, and optional headers
|
|
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
|
|
54
|
+
*/
|
|
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
|
+
*/
|
|
24
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
|
+
*/
|
|
25
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
|
+
*/
|
|
26
96
|
sendRawTransaction(stxOrStxs: Uint8Array | Uint8Array[]): SendRawTransaction;
|
|
27
97
|
/**
|
|
28
|
-
* 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)
|
|
29
107
|
* @param account - The address of the account to look up.
|
|
108
|
+
* @category GET
|
|
30
109
|
*/
|
|
31
110
|
accountInformation(account: string): AccountInformation;
|
|
32
111
|
/**
|
|
33
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)
|
|
34
121
|
* @param roundNumber - The round number of the block to get.
|
|
122
|
+
* @category GET
|
|
35
123
|
*/
|
|
36
124
|
block(roundNumber: number): Block;
|
|
37
125
|
/**
|
|
38
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
|
+
*
|
|
39
145
|
* @param txid - The TxID string of the pending transaction to look up.
|
|
146
|
+
* @category GET
|
|
40
147
|
*/
|
|
41
148
|
pendingTransactionInformation(txid: string): PendingTransactionInformation;
|
|
42
149
|
/**
|
|
43
|
-
* 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
|
|
44
169
|
*/
|
|
45
170
|
pendingTransactionsInformation(): PendingTransactions;
|
|
46
171
|
/**
|
|
47
|
-
* 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)
|
|
48
192
|
* @param address - The address of the sender.
|
|
193
|
+
* @category GET
|
|
49
194
|
*/
|
|
50
195
|
pendingTransactionByAddress(address: string): PendingTransactionsByAddress;
|
|
51
196
|
/**
|
|
52
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
|
|
53
206
|
*/
|
|
54
207
|
status(): Status;
|
|
55
208
|
/**
|
|
56
|
-
* 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)
|
|
57
218
|
* @param round - The number of the round to wait for.
|
|
219
|
+
* @category GET
|
|
58
220
|
*/
|
|
59
221
|
statusAfterBlock(round: number): StatusAfterBlock;
|
|
60
222
|
/**
|
|
61
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
|
|
62
243
|
*/
|
|
63
244
|
getTransactionParams(): SuggestedParams;
|
|
64
245
|
/**
|
|
65
|
-
*
|
|
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
|
|
66
255
|
*/
|
|
67
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
|
+
*/
|
|
68
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
|
+
*/
|
|
69
287
|
dryrun(dr: modelsv2.DryrunRequest): Dryrun;
|
|
70
288
|
/**
|
|
71
289
|
* Given an asset ID, return asset information including creator, name, total supply and
|
|
72
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)
|
|
73
299
|
* @param index - The asset ID to look up.
|
|
300
|
+
* @category GET
|
|
74
301
|
*/
|
|
75
302
|
getAssetByID(index: number): GetAssetByID;
|
|
76
303
|
/**
|
|
77
|
-
* Given an application ID,
|
|
304
|
+
* Given an application ID, return the application information including creator, approval
|
|
78
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)
|
|
79
314
|
* @param index - The application ID to look up.
|
|
315
|
+
* @category GET
|
|
80
316
|
*/
|
|
81
317
|
getApplicationByID(index: number): GetApplicationByID;
|
|
82
318
|
/**
|
|
83
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
|
|
84
328
|
*/
|
|
85
329
|
genesis(): Genesis;
|
|
86
330
|
/**
|
|
87
|
-
*
|
|
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)
|
|
88
341
|
* @param round - The round in which the transaction appears.
|
|
89
342
|
* @param txID - The transaction ID for which to generate a proof.
|
|
343
|
+
* @category GET
|
|
90
344
|
*/
|
|
91
345
|
getProof(round: number, txID: string): Proof;
|
|
92
346
|
}
|
|
@@ -286,7 +286,7 @@ export declare class ApplicationParams extends BaseModel {
|
|
|
286
286
|
*/
|
|
287
287
|
globalState?: TealKeyValue[];
|
|
288
288
|
/**
|
|
289
|
-
* [\
|
|
289
|
+
* [\gsch) global schema
|
|
290
290
|
*/
|
|
291
291
|
globalStateSchema?: ApplicationStateSchema;
|
|
292
292
|
/**
|
|
@@ -301,7 +301,7 @@ export declare class ApplicationParams extends BaseModel {
|
|
|
301
301
|
* parameters and global state for this application can be found.
|
|
302
302
|
* @param extraProgramPages - (epp) the amount of extra program pages available to this app.
|
|
303
303
|
* @param globalState - [\gs) global schema
|
|
304
|
-
* @param globalStateSchema - [\
|
|
304
|
+
* @param globalStateSchema - [\gsch) global schema
|
|
305
305
|
* @param localStateSchema - [\lsch) local schema
|
|
306
306
|
*/
|
|
307
307
|
constructor({ approvalProgram, clearStateProgram, creator, extraProgramPages, globalState, globalStateSchema, localStateSchema, }: {
|
|
@@ -1156,7 +1156,7 @@ export declare class TealKeyValue extends BaseModel {
|
|
|
1156
1156
|
*/
|
|
1157
1157
|
export declare class TealValue extends BaseModel {
|
|
1158
1158
|
/**
|
|
1159
|
-
* (tt) value type.
|
|
1159
|
+
* (tt) value type. Value `1` refers to **bytes**, value `2` refers to **uint**
|
|
1160
1160
|
*/
|
|
1161
1161
|
type: number | bigint;
|
|
1162
1162
|
/**
|
|
@@ -1169,7 +1169,7 @@ export declare class TealValue extends BaseModel {
|
|
|
1169
1169
|
uint: number | bigint;
|
|
1170
1170
|
/**
|
|
1171
1171
|
* Creates a new `TealValue` object.
|
|
1172
|
-
* @param type - (tt) value type.
|
|
1172
|
+
* @param type - (tt) value type. Value `1` refers to **bytes**, value `2` refers to **uint**
|
|
1173
1173
|
* @param bytes - (tb) bytes value.
|
|
1174
1174
|
* @param uint - (ui) uint value.
|
|
1175
1175
|
*/
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import ServiceClient from '../serviceClient';
|
|
2
|
-
import { CustomTokenHeader, IndexerTokenHeader } from '../../client';
|
|
3
2
|
import MakeHealthCheck from './makeHealthCheck';
|
|
4
3
|
import LookupAssetBalances from './lookupAssetBalances';
|
|
5
4
|
import LookupAssetTransactions from './lookupAssetTransactions';
|
|
@@ -14,71 +13,230 @@ import SearchAccounts from './searchAccounts';
|
|
|
14
13
|
import SearchForTransactions from './searchForTransactions';
|
|
15
14
|
import SearchForAssets from './searchForAssets';
|
|
16
15
|
import SearchForApplications from './searchForApplications';
|
|
16
|
+
import { BaseHTTPClient } from '../../baseHTTPClient';
|
|
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
|
+
*/
|
|
17
32
|
export default class IndexerClient extends ServiceClient {
|
|
18
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Create an IndexerClient from
|
|
35
|
+
* * either a token, baseServer, port, and optional headers
|
|
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
|
|
53
|
+
*/
|
|
54
|
+
constructor(tokenOrBaseClient: string | IndexerTokenHeader | CustomTokenHeader | BaseHTTPClient, baseServer?: string, port?: string | number, headers?: Record<string, string>);
|
|
19
55
|
/**
|
|
20
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
|
|
21
66
|
*/
|
|
22
67
|
makeHealthCheck(): MakeHealthCheck;
|
|
23
68
|
/**
|
|
24
|
-
* 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)
|
|
25
78
|
* @param index - The asset ID to look up.
|
|
79
|
+
* @category GET
|
|
26
80
|
*/
|
|
27
81
|
lookupAssetBalances(index: number): LookupAssetBalances;
|
|
28
82
|
/**
|
|
29
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)
|
|
30
92
|
* @param index - The asset ID to look up.
|
|
93
|
+
* @category GET
|
|
31
94
|
*/
|
|
32
95
|
lookupAssetTransactions(index: number): LookupAssetTransactions;
|
|
33
96
|
/**
|
|
34
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)
|
|
35
106
|
* @param account - The address of the account.
|
|
107
|
+
* @category GET
|
|
36
108
|
*/
|
|
37
109
|
lookupAccountTransactions(account: string): LookupAccountTransactions;
|
|
38
110
|
/**
|
|
39
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)
|
|
40
120
|
* @param round - The number of the round to look up.
|
|
121
|
+
* @category GET
|
|
41
122
|
*/
|
|
42
123
|
lookupBlock(round: number): LookupBlock;
|
|
43
124
|
/**
|
|
44
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)
|
|
45
134
|
* @param txID - The ID of the transaction to look up.
|
|
135
|
+
* @category GET
|
|
46
136
|
*/
|
|
47
137
|
lookupTransactionByID(txID: string): LookupTransactionByID;
|
|
48
138
|
/**
|
|
49
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)
|
|
50
148
|
* @param account - The address of the account to look up.
|
|
149
|
+
* @category GET
|
|
51
150
|
*/
|
|
52
151
|
lookupAccountByID(account: string): LookupAccountByID;
|
|
53
152
|
/**
|
|
54
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)
|
|
55
162
|
* @param index - The ID of the asset ot look up.
|
|
163
|
+
* @category GET
|
|
56
164
|
*/
|
|
57
165
|
lookupAssetByID(index: number): LookupAssetByID;
|
|
58
166
|
/**
|
|
59
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)
|
|
60
176
|
* @param index - The ID of the application to look up.
|
|
177
|
+
* @category GET
|
|
61
178
|
*/
|
|
62
179
|
lookupApplications(index: number): LookupApplications;
|
|
63
180
|
/**
|
|
64
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)
|
|
65
190
|
* @param appID - The ID of the application which generated the logs.
|
|
191
|
+
* @category GET
|
|
66
192
|
*/
|
|
67
193
|
lookupApplicationLogs(appID: number): LookupApplicationLogs;
|
|
68
194
|
/**
|
|
69
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
|
|
70
204
|
*/
|
|
71
205
|
searchAccounts(): SearchAccounts;
|
|
72
206
|
/**
|
|
73
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
|
|
74
216
|
*/
|
|
75
217
|
searchForTransactions(): SearchForTransactions;
|
|
76
218
|
/**
|
|
77
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
|
|
78
228
|
*/
|
|
79
229
|
searchForAssets(): SearchForAssets;
|
|
80
230
|
/**
|
|
81
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
|
|
82
240
|
*/
|
|
83
241
|
searchForApplications(): SearchForApplications;
|
|
84
242
|
}
|