algosdk 1.11.1 → 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.
Files changed (148) hide show
  1. package/README.md +17 -6
  2. package/dist/browser/algosdk.min.js +1 -1
  3. package/dist/browser/algosdk.min.js.map +1 -1
  4. package/dist/cjs/src/abi/abi_type.js +693 -0
  5. package/dist/cjs/src/abi/abi_type.js.map +1 -0
  6. package/dist/cjs/src/abi/contract.js +27 -0
  7. package/dist/cjs/src/abi/contract.js.map +1 -0
  8. package/dist/cjs/src/abi/index.js +19 -0
  9. package/dist/cjs/src/abi/index.js.map +1 -0
  10. package/dist/cjs/src/abi/interface.js +23 -0
  11. package/dist/cjs/src/abi/interface.js.map +1 -0
  12. package/dist/cjs/src/abi/method.js +114 -0
  13. package/dist/cjs/src/abi/method.js.map +1 -0
  14. package/dist/cjs/src/abi/reference.js +25 -0
  15. package/dist/cjs/src/abi/reference.js.map +1 -0
  16. package/dist/cjs/src/abi/transaction.js +52 -0
  17. package/dist/cjs/src/abi/transaction.js.map +1 -0
  18. package/dist/cjs/src/client/baseHTTPClient.js +3 -0
  19. package/dist/cjs/src/client/baseHTTPClient.js.map +1 -0
  20. package/dist/cjs/src/client/client.js +165 -104
  21. package/dist/cjs/src/client/client.js.map +1 -1
  22. package/dist/cjs/src/client/urlTokenBaseHTTPClient.js +138 -0
  23. package/dist/cjs/src/client/urlTokenBaseHTTPClient.js.map +1 -0
  24. package/dist/cjs/src/client/v2/algod/algod.js +262 -9
  25. package/dist/cjs/src/client/v2/algod/algod.js.map +1 -1
  26. package/dist/cjs/src/client/v2/algod/models/types.js +13 -33
  27. package/dist/cjs/src/client/v2/algod/models/types.js.map +1 -1
  28. package/dist/cjs/src/client/v2/indexer/indexer.js +168 -3
  29. package/dist/cjs/src/client/v2/indexer/indexer.js.map +1 -1
  30. package/dist/cjs/src/client/v2/indexer/lookupApplicationLogs.js +48 -0
  31. package/dist/cjs/src/client/v2/indexer/lookupApplicationLogs.js.map +1 -0
  32. package/dist/cjs/src/client/v2/indexer/lookupAssetBalances.js +98 -6
  33. package/dist/cjs/src/client/v2/indexer/lookupAssetBalances.js.map +1 -1
  34. package/dist/cjs/src/client/v2/serviceClient.js +17 -8
  35. package/dist/cjs/src/client/v2/serviceClient.js.map +1 -1
  36. package/dist/cjs/src/composer.js +439 -0
  37. package/dist/cjs/src/composer.js.map +1 -0
  38. package/dist/cjs/src/dryrun.js +103 -0
  39. package/dist/cjs/src/dryrun.js.map +1 -0
  40. package/dist/cjs/src/encoding/address.js +14 -1
  41. package/dist/cjs/src/encoding/address.js.map +1 -1
  42. package/dist/cjs/src/encoding/bigint.js +38 -0
  43. package/dist/cjs/src/encoding/bigint.js.map +1 -0
  44. package/dist/cjs/src/logic/langspec.json +392 -77
  45. package/dist/cjs/src/logicsig.js +2 -2
  46. package/dist/cjs/src/logicsig.js.map +1 -1
  47. package/dist/cjs/src/main.js +18 -91
  48. package/dist/cjs/src/main.js.map +1 -1
  49. package/dist/cjs/src/makeTxn.js +29 -1
  50. package/dist/cjs/src/makeTxn.js.map +1 -1
  51. package/dist/cjs/src/multisig.js +77 -2
  52. package/dist/cjs/src/multisig.js.map +1 -1
  53. package/dist/cjs/src/signer.js +66 -0
  54. package/dist/cjs/src/signer.js.map +1 -0
  55. package/dist/cjs/src/transaction.js +50 -10
  56. package/dist/cjs/src/transaction.js.map +1 -1
  57. package/dist/cjs/src/types/intDecoding.js +0 -2
  58. package/dist/cjs/src/types/intDecoding.js.map +1 -1
  59. package/dist/cjs/src/types/transactions/base.js +0 -1
  60. package/dist/cjs/src/types/transactions/base.js.map +1 -1
  61. package/dist/cjs/src/wait.js +53 -0
  62. package/dist/cjs/src/wait.js.map +1 -0
  63. package/dist/esm/src/abi/abi_type.js +680 -0
  64. package/dist/esm/src/abi/abi_type.js.map +1 -0
  65. package/dist/esm/src/abi/contract.js +23 -0
  66. package/dist/esm/src/abi/contract.js.map +1 -0
  67. package/dist/esm/src/abi/index.js +7 -0
  68. package/dist/esm/src/abi/index.js.map +1 -0
  69. package/dist/esm/src/abi/interface.js +19 -0
  70. package/dist/esm/src/abi/interface.js.map +1 -0
  71. package/dist/esm/src/abi/method.js +110 -0
  72. package/dist/esm/src/abi/method.js.map +1 -0
  73. package/dist/esm/src/abi/reference.js +21 -0
  74. package/dist/esm/src/abi/reference.js.map +1 -0
  75. package/dist/esm/src/abi/transaction.js +47 -0
  76. package/dist/esm/src/abi/transaction.js.map +1 -0
  77. package/dist/esm/src/client/baseHTTPClient.js +2 -0
  78. package/dist/esm/src/client/baseHTTPClient.js.map +1 -0
  79. package/dist/esm/src/client/client.js +165 -101
  80. package/dist/esm/src/client/client.js.map +1 -1
  81. package/dist/esm/src/client/urlTokenBaseHTTPClient.js +112 -0
  82. package/dist/esm/src/client/urlTokenBaseHTTPClient.js.map +1 -0
  83. package/dist/esm/src/client/v2/algod/algod.js +262 -9
  84. package/dist/esm/src/client/v2/algod/algod.js.map +1 -1
  85. package/dist/esm/src/client/v2/algod/models/types.js +12 -31
  86. package/dist/esm/src/client/v2/algod/models/types.js.map +1 -1
  87. package/dist/esm/src/client/v2/indexer/indexer.js +168 -3
  88. package/dist/esm/src/client/v2/indexer/indexer.js.map +1 -1
  89. package/dist/esm/src/client/v2/indexer/lookupApplicationLogs.js +42 -0
  90. package/dist/esm/src/client/v2/indexer/lookupApplicationLogs.js.map +1 -0
  91. package/dist/esm/src/client/v2/indexer/lookupAssetBalances.js +98 -6
  92. package/dist/esm/src/client/v2/indexer/lookupAssetBalances.js.map +1 -1
  93. package/dist/esm/src/client/v2/serviceClient.js +17 -8
  94. package/dist/esm/src/client/v2/serviceClient.js.map +1 -1
  95. package/dist/esm/src/composer.js +435 -0
  96. package/dist/esm/src/composer.js.map +1 -0
  97. package/dist/esm/src/dryrun.js +99 -0
  98. package/dist/esm/src/dryrun.js.map +1 -0
  99. package/dist/esm/src/encoding/address.js +12 -0
  100. package/dist/esm/src/encoding/address.js.map +1 -1
  101. package/dist/esm/src/encoding/bigint.js +33 -0
  102. package/dist/esm/src/encoding/bigint.js.map +1 -0
  103. package/dist/esm/src/logic/langspec.json +392 -77
  104. package/dist/esm/src/logicsig.js +2 -2
  105. package/dist/esm/src/logicsig.js.map +1 -1
  106. package/dist/esm/src/main.js +8 -85
  107. package/dist/esm/src/main.js.map +1 -1
  108. package/dist/esm/src/makeTxn.js +27 -0
  109. package/dist/esm/src/makeTxn.js.map +1 -1
  110. package/dist/esm/src/multisig.js +73 -1
  111. package/dist/esm/src/multisig.js.map +1 -1
  112. package/dist/esm/src/signer.js +59 -0
  113. package/dist/esm/src/signer.js.map +1 -0
  114. package/dist/esm/src/transaction.js +50 -10
  115. package/dist/esm/src/transaction.js.map +1 -1
  116. package/dist/esm/src/types/intDecoding.js +0 -2
  117. package/dist/esm/src/types/intDecoding.js.map +1 -1
  118. package/dist/esm/src/types/transactions/base.js +0 -1
  119. package/dist/esm/src/types/transactions/base.js.map +1 -1
  120. package/dist/esm/src/wait.js +49 -0
  121. package/dist/esm/src/wait.js.map +1 -0
  122. package/dist/types/src/abi/abi_type.d.ts +102 -0
  123. package/dist/types/src/abi/contract.d.ts +21 -0
  124. package/dist/types/src/abi/index.d.ts +6 -0
  125. package/dist/types/src/abi/interface.d.ts +13 -0
  126. package/dist/types/src/abi/method.d.ts +39 -0
  127. package/dist/types/src/abi/reference.d.ts +15 -0
  128. package/dist/types/src/abi/transaction.d.ts +33 -0
  129. package/dist/types/src/client/baseHTTPClient.d.ts +41 -0
  130. package/dist/types/src/client/client.d.ts +67 -31
  131. package/dist/types/src/client/kmd.d.ts +1 -1
  132. package/dist/types/src/client/urlTokenBaseHTTPClient.d.ts +44 -0
  133. package/dist/types/src/client/v2/algod/algod.d.ts +263 -9
  134. package/dist/types/src/client/v2/algod/models/types.d.ts +24 -37
  135. package/dist/types/src/client/v2/indexer/indexer.d.ts +167 -3
  136. package/dist/types/src/client/v2/indexer/lookupApplicationLogs.d.ts +20 -0
  137. package/dist/types/src/client/v2/indexer/lookupAssetBalances.d.ts +98 -0
  138. package/dist/types/src/client/v2/serviceClient.d.ts +6 -2
  139. package/dist/types/src/composer.d.ts +160 -0
  140. package/dist/types/src/dryrun.d.ts +20 -0
  141. package/dist/types/src/encoding/address.d.ts +6 -0
  142. package/dist/types/src/encoding/bigint.d.ts +14 -0
  143. package/dist/types/src/main.d.ts +9 -48
  144. package/dist/types/src/makeTxn.d.ts +18 -1
  145. package/dist/types/src/multisig.d.ts +39 -1
  146. package/dist/types/src/signer.d.ts +40 -0
  147. package/dist/types/src/wait.d.ts +11 -0
  148. 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
- constructor(token: string | AlgodTokenHeader | CustomTokenHeader, baseServer?: string, port?: string | number, headers?: {});
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 information.
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 transactions that are pending in the pool.
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 transactions that are pending in the pool sent by a specific sender.
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
- * Gets the supply details for the specified node's ledger.
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, it returns application information including creator, approval
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
- * Get the proof for a given transaction in a round.
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
- * [\lsch) global schema
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 - [\lsch) global schema
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, }: {
@@ -746,6 +746,10 @@ export declare class DryrunTxnResult extends BaseModel {
746
746
  disassembly: string[];
747
747
  appCallMessages?: string[];
748
748
  appCallTrace?: DryrunState[];
749
+ /**
750
+ * Execution cost of app call transaction
751
+ */
752
+ cost?: number | bigint;
749
753
  /**
750
754
  * Application state delta.
751
755
  */
@@ -753,27 +757,29 @@ export declare class DryrunTxnResult extends BaseModel {
753
757
  localDeltas?: AccountStateDelta[];
754
758
  logicSigMessages?: string[];
755
759
  logicSigTrace?: DryrunState[];
756
- logs?: LogItem[];
760
+ logs?: Uint8Array[];
757
761
  /**
758
762
  * Creates a new `DryrunTxnResult` object.
759
763
  * @param disassembly - Disassembled program line by line.
760
764
  * @param appCallMessages -
761
765
  * @param appCallTrace -
766
+ * @param cost - Execution cost of app call transaction
762
767
  * @param globalDelta - Application state delta.
763
768
  * @param localDeltas -
764
769
  * @param logicSigMessages -
765
770
  * @param logicSigTrace -
766
771
  * @param logs -
767
772
  */
768
- constructor({ disassembly, appCallMessages, appCallTrace, globalDelta, localDeltas, logicSigMessages, logicSigTrace, logs, }: {
773
+ constructor({ disassembly, appCallMessages, appCallTrace, cost, globalDelta, localDeltas, logicSigMessages, logicSigTrace, logs, }: {
769
774
  disassembly: string[];
770
775
  appCallMessages?: string[];
771
776
  appCallTrace?: DryrunState[];
777
+ cost?: number | bigint;
772
778
  globalDelta?: EvalDeltaKeyValue[];
773
779
  localDeltas?: AccountStateDelta[];
774
780
  logicSigMessages?: string[];
775
781
  logicSigTrace?: DryrunState[];
776
- logs?: LogItem[];
782
+ logs?: Uint8Array[];
777
783
  });
778
784
  }
779
785
  /**
@@ -829,25 +835,6 @@ export declare class EvalDeltaKeyValue extends BaseModel {
829
835
  */
830
836
  constructor(key: string, value: EvalDelta);
831
837
  }
832
- /**
833
- * Application Log
834
- */
835
- export declare class LogItem extends BaseModel {
836
- /**
837
- * unique application identifier
838
- */
839
- id: number | bigint;
840
- /**
841
- * base64 encoded log message
842
- */
843
- value: string;
844
- /**
845
- * Creates a new `LogItem` object.
846
- * @param id - unique application identifier
847
- * @param value - base64 encoded log message
848
- */
849
- constructor(id: number | bigint, value: string);
850
- }
851
838
  /**
852
839
  *
853
840
  */
@@ -961,14 +948,8 @@ export declare class NodeStatusResponse extends BaseModel {
961
948
  });
962
949
  }
963
950
  /**
964
- * Given a transaction id of a recently submitted transaction, it returns
965
- * information about it. There are several cases when this might succeed:
966
- * - transaction committed (committed round > 0)
967
- * - transaction still in the pool (committed round = 0, pool error = "")
968
- * - transaction removed from pool due to error (committed round = 0, pool error !=
969
- * "")
970
- * Or the transaction may have happened sufficiently long ago that the node no
971
- * longer remembers it, and this will return an error.
951
+ * Details about a pending transaction. If the transaction was recently confirmed,
952
+ * includes confirmation details like the round and reward details.
972
953
  */
973
954
  export declare class PendingTransactionResponse extends BaseModel {
974
955
  /**
@@ -1011,6 +992,10 @@ export declare class PendingTransactionResponse extends BaseModel {
1011
992
  * transaction.
1012
993
  */
1013
994
  globalStateDelta?: EvalDeltaKeyValue[];
995
+ /**
996
+ * Inner transactions produced by application execution.
997
+ */
998
+ innerTxns?: PendingTransactionResponse[];
1014
999
  /**
1015
1000
  * (ld) Local state key/value changes for the application being executed by this
1016
1001
  * transaction.
@@ -1019,7 +1004,7 @@ export declare class PendingTransactionResponse extends BaseModel {
1019
1004
  /**
1020
1005
  * (lg) Logs for the application being executed by this transaction.
1021
1006
  */
1022
- logs?: LogItem[];
1007
+ logs?: Uint8Array[];
1023
1008
  /**
1024
1009
  * Rewards in microalgos applied to the receiver account.
1025
1010
  */
@@ -1043,13 +1028,14 @@ export declare class PendingTransactionResponse extends BaseModel {
1043
1028
  * @param confirmedRound - The round where this transaction was confirmed, if present.
1044
1029
  * @param globalStateDelta - (gd) Global state key/value changes for the application being executed by this
1045
1030
  * transaction.
1031
+ * @param innerTxns - Inner transactions produced by application execution.
1046
1032
  * @param localStateDelta - (ld) Local state key/value changes for the application being executed by this
1047
1033
  * transaction.
1048
1034
  * @param logs - (lg) Logs for the application being executed by this transaction.
1049
1035
  * @param receiverRewards - Rewards in microalgos applied to the receiver account.
1050
1036
  * @param senderRewards - Rewards in microalgos applied to the sender account.
1051
1037
  */
1052
- constructor({ poolError, txn, applicationIndex, assetClosingAmount, assetIndex, closeRewards, closingAmount, confirmedRound, globalStateDelta, localStateDelta, logs, receiverRewards, senderRewards, }: {
1038
+ constructor({ poolError, txn, applicationIndex, assetClosingAmount, assetIndex, closeRewards, closingAmount, confirmedRound, globalStateDelta, innerTxns, localStateDelta, logs, receiverRewards, senderRewards, }: {
1053
1039
  poolError: string;
1054
1040
  txn: EncodedSignedTransaction;
1055
1041
  applicationIndex?: number | bigint;
@@ -1059,8 +1045,9 @@ export declare class PendingTransactionResponse extends BaseModel {
1059
1045
  closingAmount?: number | bigint;
1060
1046
  confirmedRound?: number | bigint;
1061
1047
  globalStateDelta?: EvalDeltaKeyValue[];
1048
+ innerTxns?: PendingTransactionResponse[];
1062
1049
  localStateDelta?: AccountStateDelta[];
1063
- logs?: LogItem[];
1050
+ logs?: Uint8Array[];
1064
1051
  receiverRewards?: number | bigint;
1065
1052
  senderRewards?: number | bigint;
1066
1053
  });
@@ -1169,7 +1156,7 @@ export declare class TealKeyValue extends BaseModel {
1169
1156
  */
1170
1157
  export declare class TealValue extends BaseModel {
1171
1158
  /**
1172
- * (tt) value type.
1159
+ * (tt) value type. Value `1` refers to **bytes**, value `2` refers to **uint**
1173
1160
  */
1174
1161
  type: number | bigint;
1175
1162
  /**
@@ -1182,7 +1169,7 @@ export declare class TealValue extends BaseModel {
1182
1169
  uint: number | bigint;
1183
1170
  /**
1184
1171
  * Creates a new `TealValue` object.
1185
- * @param type - (tt) value type.
1172
+ * @param type - (tt) value type. Value `1` refers to **bytes**, value `2` refers to **uint**
1186
1173
  * @param bytes - (tb) bytes value.
1187
1174
  * @param uint - (ui) uint value.
1188
1175
  */