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
@@ -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';
@@ -9,70 +8,235 @@ import LookupTransactionByID from './lookupTransactionByID';
9
8
  import LookupAccountByID from './lookupAccountByID';
10
9
  import LookupAssetByID from './lookupAssetByID';
11
10
  import LookupApplications from './lookupApplications';
11
+ import LookupApplicationLogs from './lookupApplicationLogs';
12
12
  import SearchAccounts from './searchAccounts';
13
13
  import SearchForTransactions from './searchForTransactions';
14
14
  import SearchForAssets from './searchForAssets';
15
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
+ */
16
32
  export default class IndexerClient extends ServiceClient {
17
- constructor(token: string | IndexerTokenHeader | CustomTokenHeader, baseServer?: string, port?: string | number, headers?: {});
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>);
18
55
  /**
19
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
20
66
  */
21
67
  makeHealthCheck(): MakeHealthCheck;
22
68
  /**
23
- * Returns holder balances for the given asset.
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)
24
78
  * @param index - The asset ID to look up.
79
+ * @category GET
25
80
  */
26
81
  lookupAssetBalances(index: number): LookupAssetBalances;
27
82
  /**
28
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)
29
92
  * @param index - The asset ID to look up.
93
+ * @category GET
30
94
  */
31
95
  lookupAssetTransactions(index: number): LookupAssetTransactions;
32
96
  /**
33
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)
34
106
  * @param account - The address of the account.
107
+ * @category GET
35
108
  */
36
109
  lookupAccountTransactions(account: string): LookupAccountTransactions;
37
110
  /**
38
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)
39
120
  * @param round - The number of the round to look up.
121
+ * @category GET
40
122
  */
41
123
  lookupBlock(round: number): LookupBlock;
42
124
  /**
43
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)
44
134
  * @param txID - The ID of the transaction to look up.
135
+ * @category GET
45
136
  */
46
137
  lookupTransactionByID(txID: string): LookupTransactionByID;
47
138
  /**
48
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)
49
148
  * @param account - The address of the account to look up.
149
+ * @category GET
50
150
  */
51
151
  lookupAccountByID(account: string): LookupAccountByID;
52
152
  /**
53
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)
54
162
  * @param index - The ID of the asset ot look up.
163
+ * @category GET
55
164
  */
56
165
  lookupAssetByID(index: number): LookupAssetByID;
57
166
  /**
58
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)
59
176
  * @param index - The ID of the application to look up.
177
+ * @category GET
60
178
  */
61
179
  lookupApplications(index: number): LookupApplications;
180
+ /**
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)
190
+ * @param appID - The ID of the application which generated the logs.
191
+ * @category GET
192
+ */
193
+ lookupApplicationLogs(appID: number): LookupApplicationLogs;
62
194
  /**
63
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
64
204
  */
65
205
  searchAccounts(): SearchAccounts;
66
206
  /**
67
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
68
216
  */
69
217
  searchForTransactions(): SearchForTransactions;
70
218
  /**
71
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
72
228
  */
73
229
  searchForAssets(): SearchForAssets;
74
230
  /**
75
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
76
240
  */
77
241
  searchForApplications(): SearchForApplications;
78
242
  }
@@ -0,0 +1,20 @@
1
+ import JSONRequest from '../jsonrequest';
2
+ import HTTPClient from '../../client';
3
+ import IntDecoding from '../../../types/intDecoding';
4
+ export default class LookupApplicationLogs extends JSONRequest {
5
+ private appID;
6
+ constructor(c: HTTPClient, intDecoding: IntDecoding, appID: number);
7
+ path(): string;
8
+ /** limit for filter, as int */
9
+ limit(limit: number): this;
10
+ /** min round to filter with, as int */
11
+ minRound(round: number): this;
12
+ /** max round to filter with, as int */
13
+ maxRound(round: number): this;
14
+ /** used for pagination */
15
+ nextToken(nextToken: string): this;
16
+ /** only include transactions with this sender address */
17
+ sender(senderAddress: string): this;
18
+ /** txid to filter with, as string */
19
+ txid(txid: string): this;
20
+ }
@@ -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
  }
@@ -1,13 +1,17 @@
1
- import HTTPClient, { TokenHeader } from '../client';
1
+ import HTTPClient from '../client';
2
2
  import IntDecoding from '../../types/intDecoding';
3
+ import { BaseHTTPClient } from '../baseHTTPClient';
4
+ import { TokenHeader } from '../urlTokenBaseHTTPClient';
3
5
  export declare type TokenHeaderIdentifier = 'X-Indexer-API-Token' | 'X-KMD-API-Token' | 'X-Algo-API-Token' | string;
4
6
  /**
5
7
  * Abstract service client to encapsulate shared AlgodClient and IndexerClient logic
6
8
  */
7
9
  export default abstract class ServiceClient {
10
+ /** @ignore */
8
11
  c: HTTPClient;
12
+ /** @ignore */
9
13
  intDecoding: IntDecoding;
10
- constructor(tokenHeaderIdentifier: TokenHeaderIdentifier, tokenHeaderOrStr: string | TokenHeader, baseServer: string, port?: string | number, defaultHeaders?: Record<string, any>);
14
+ constructor(tokenHeaderIdentifier: TokenHeaderIdentifier, tokenHeaderOrStrOrBaseClient: string | TokenHeader | BaseHTTPClient, baseServer: string, port?: string | number, defaultHeaders?: Record<string, any>);
11
15
  /**
12
16
  * Set the default int decoding method for all JSON requests this client creates.
13
17
  * @param method - \{"default" | "safe" | "mixed" | "bigint"\} method The method to use when parsing the
@@ -0,0 +1,160 @@
1
+ import { ABIValue, ABIMethod } from './abi';
2
+ import Algodv2 from './client/v2/algod/algod';
3
+ import { TransactionSigner, TransactionWithSigner } from './signer';
4
+ import { OnApplicationComplete, SuggestedParams } from './types/transactions/base';
5
+ export declare type ABIArgument = ABIValue | TransactionWithSigner;
6
+ /** Represents the output from a successful ABI method call. */
7
+ export interface ABIResult {
8
+ /** The TxID of the transaction that invoked the ABI method call. */
9
+ txID: string;
10
+ /**
11
+ * The raw bytes of the return value from the ABI method call. This will be empty if the method
12
+ * does not return a value (return type "void").
13
+ */
14
+ rawReturnValue: Uint8Array;
15
+ /**
16
+ * The return value from the ABI method call. This will be undefined if the method does not return
17
+ * a value (return type "void"), or if the SDK was unable to decode the returned value.
18
+ */
19
+ returnValue?: ABIValue;
20
+ /** If the SDK was unable to decode a return value, the error will be here. */
21
+ decodeError?: Error;
22
+ }
23
+ export declare enum AtomicTransactionComposerStatus {
24
+ /** The atomic group is still under construction. */
25
+ BUILDING = 0,
26
+ /** The atomic group has been finalized, but not yet signed. */
27
+ BUILT = 1,
28
+ /** The atomic group has been finalized and signed, but not yet submitted to the network. */
29
+ SIGNED = 2,
30
+ /** The atomic group has been finalized, signed, and submitted to the network. */
31
+ SUBMITTED = 3,
32
+ /** The atomic group has been finalized, signed, submitted, and successfully committed to a block. */
33
+ COMMITTED = 4
34
+ }
35
+ /** A class used to construct and execute atomic transaction groups */
36
+ export declare class AtomicTransactionComposer {
37
+ /** The maximum size of an atomic transaction group. */
38
+ static MAX_GROUP_SIZE: number;
39
+ private status;
40
+ private transactions;
41
+ private methodCalls;
42
+ private signedTxns;
43
+ private txIDs;
44
+ /**
45
+ * Get the status of this composer's transaction group.
46
+ */
47
+ getStatus(): AtomicTransactionComposerStatus;
48
+ /**
49
+ * Get the number of transactions currently in this atomic group.
50
+ */
51
+ count(): number;
52
+ /**
53
+ * Create a new composer with the same underlying transactions. The new composer's status will be
54
+ * BUILDING, so additional transactions may be added to it.
55
+ */
56
+ clone(): AtomicTransactionComposer;
57
+ /**
58
+ * Add a transaction to this atomic group.
59
+ *
60
+ * An error will be thrown if the transaction has a nonzero group ID, the composer's status is
61
+ * not BUILDING, or if adding this transaction causes the current group to exceed MAX_GROUP_SIZE.
62
+ */
63
+ addTransaction(txnAndSigner: TransactionWithSigner): void;
64
+ /**
65
+ * Add a smart contract method call to this atomic group.
66
+ *
67
+ * An error will be thrown if the composer's status is not BUILDING, if adding this transaction
68
+ * causes the current group to exceed MAX_GROUP_SIZE, or if the provided arguments are invalid
69
+ * for the given method.
70
+ */
71
+ addMethodCall({ appID, method, methodArgs, sender, suggestedParams, onComplete, approvalProgram, clearProgram, numGlobalInts, numGlobalByteSlices, numLocalInts, numLocalByteSlices, extraPages, note, lease, rekeyTo, signer, }: {
72
+ /** The ID of the smart contract to call. Set this to 0 to indicate an application creation call. */
73
+ appID: number;
74
+ /** The method to call on the smart contract */
75
+ method: ABIMethod;
76
+ /** The arguments to include in the method call. If omitted, no arguments will be passed to the method. */
77
+ methodArgs?: ABIArgument[];
78
+ /** The address of the sender of this application call */
79
+ sender: string;
80
+ /** Transactions params to use for this application call */
81
+ suggestedParams: SuggestedParams;
82
+ /** The OnComplete action to take for this application call. If omitted, OnApplicationComplete.NoOpOC will be used. */
83
+ onComplete?: OnApplicationComplete;
84
+ /** The approval program for this application call. Only set this if this is an application creation call, or if onComplete is OnApplicationComplete.UpdateApplicationOC */
85
+ approvalProgram?: Uint8Array;
86
+ /** The clear program for this application call. Only set this if this is an application creation call, or if onComplete is OnApplicationComplete.UpdateApplicationOC */
87
+ clearProgram?: Uint8Array;
88
+ /** The global integer schema size. Only set this if this is an application creation call. */
89
+ numGlobalInts?: number;
90
+ /** The global byte slice schema size. Only set this if this is an application creation call. */
91
+ numGlobalByteSlices?: number;
92
+ /** The local integer schema size. Only set this if this is an application creation call. */
93
+ numLocalInts?: number;
94
+ /** The local byte slice schema size. Only set this if this is an application creation call. */
95
+ numLocalByteSlices?: number;
96
+ /** The number of extra pages to allocate for the application's programs. Only set this if this is an application creation call. If omitted, defaults to 0. */
97
+ extraPages?: number;
98
+ /** The note value for this application call */
99
+ note?: Uint8Array;
100
+ /** The lease value for this application call */
101
+ lease?: Uint8Array;
102
+ /** If provided, the address that the sender will be rekeyed to at the conclusion of this application call */
103
+ rekeyTo?: string;
104
+ /** A transaction signer that can authorize this application call from sender */
105
+ signer: TransactionSigner;
106
+ }): void;
107
+ /**
108
+ * Finalize the transaction group and returned the finalized transactions.
109
+ *
110
+ * The composer's status will be at least BUILT after executing this method.
111
+ */
112
+ buildGroup(): TransactionWithSigner[];
113
+ /**
114
+ * Obtain signatures for each transaction in this group. If signatures have already been obtained,
115
+ * this method will return cached versions of the signatures.
116
+ *
117
+ * The composer's status will be at least SIGNED after executing this method.
118
+ *
119
+ * An error will be thrown if signing any of the transactions fails.
120
+ *
121
+ * @returns A promise that resolves to an array of signed transactions.
122
+ */
123
+ gatherSignatures(): Promise<Uint8Array[]>;
124
+ /**
125
+ * Send the transaction group to the network, but don't wait for it to be committed to a block. An
126
+ * error will be thrown if submission fails.
127
+ *
128
+ * The composer's status must be SUBMITTED or lower before calling this method. If submission is
129
+ * successful, this composer's status will update to SUBMITTED.
130
+ *
131
+ * Note: a group can only be submitted again if it fails.
132
+ *
133
+ * @param client - An Algodv2 client
134
+ *
135
+ * @returns A promise that, upon success, resolves to a list of TxIDs of the submitted transactions.
136
+ */
137
+ submit(client: Algodv2): Promise<string[]>;
138
+ /**
139
+ * Send the transaction group to the network and wait until it's committed to a block. An error
140
+ * will be thrown if submission or execution fails.
141
+ *
142
+ * The composer's status must be SUBMITTED or lower before calling this method, since execution is
143
+ * only allowed once. If submission is successful, this composer's status will update to SUBMITTED.
144
+ * If the execution is also successful, this composer's status will update to COMMITTED.
145
+ *
146
+ * Note: a group can only be submitted again if it fails.
147
+ *
148
+ * @param client - An Algodv2 client
149
+ * @param waitRounds - The maximum number of rounds to wait for transaction confirmation
150
+ *
151
+ * @returns A promise that, upon success, resolves to an object containing the confirmed round for
152
+ * this transaction, the txIDs of the submitted transactions, and an array of results containing
153
+ * one element for each method call transaction in this group.
154
+ */
155
+ execute(client: Algodv2, waitRounds: number): Promise<{
156
+ confirmedRound: number;
157
+ txIDs: string[];
158
+ methodResults: ABIResult[];
159
+ }>;
160
+ }
@@ -0,0 +1,20 @@
1
+ import AlgodClient from './client/v2/algod/algod';
2
+ import { DryrunRequest, DryrunSource } from './client/v2/algod/models/types';
3
+ import { SignedTransaction } from './transaction';
4
+ /**
5
+ * createDryrun takes an Algod Client (from algod.AlgodV2Client) and an array of Signed Transactions
6
+ * from (transaction.SignedTransaction) and creates a DryrunRequest object with relevant balances
7
+ * @param client - the AlgodClient to make requests against
8
+ * @param txns - the array of SignedTransaction to use for generating the DryrunRequest object
9
+ * @param protocolVersion - the string representing the protocol version to use
10
+ * @param latestTimestamp - the timestamp
11
+ * @returns the DryrunRequest object constructed from the SignedTransactions passed
12
+ */
13
+ export declare function createDryrun({ client, txns, protocolVersion, latestTimestamp, round, sources, }: {
14
+ client: AlgodClient;
15
+ txns: SignedTransaction[];
16
+ protocolVersion?: string;
17
+ latestTimestamp?: number | bigint;
18
+ round?: number | bigint;
19
+ sources?: DryrunSource[];
20
+ }): Promise<DryrunRequest>;
@@ -49,3 +49,9 @@ export declare function fromMultisigPreImgAddrs({ version, threshold, addrs, }:
49
49
  threshold: number;
50
50
  addrs: string[];
51
51
  }): string;
52
+ /**
53
+ * Get the escrow address of an application.
54
+ * @param appID - The ID of the application.
55
+ * @returns The address corresponding to that application's escrow account.
56
+ */
57
+ export declare function getApplicationAddress(appID: number | bigint): string;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * bigIntToBytes converts a BigInt to a big-endian Uint8Array for encoding.
3
+ * @param bi - The bigint to convert.
4
+ * @param size - The size of the resulting byte array.
5
+ * @returns A byte array containing the big-endian encoding of the input bigint
6
+ */
7
+ export declare function bigIntToBytes(bi: bigint | number, size: number): Uint8Array;
8
+ /**
9
+ * bytesToBigInt produces a bigint from a binary representation.
10
+ *
11
+ * @param bytes - The Uint8Array to convert.
12
+ * @returns The bigint that was encoded in the input data.
13
+ */
14
+ export declare function bytesToBigInt(bytes: Uint8Array): bigint;