algosdk 3.5.2 → 3.7.0-beta.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.
Files changed (133) hide show
  1. package/README.md +4 -4
  2. package/dist/browser/algosdk.min.js +1 -1
  3. package/dist/browser/algosdk.min.js.map +1 -1
  4. package/dist/cjs/appAccess.js +8 -5
  5. package/dist/cjs/appAccess.js.map +1 -1
  6. package/dist/cjs/client/v2/algod/accountApplicationsInformation.js +38 -0
  7. package/dist/cjs/client/v2/algod/accountApplicationsInformation.js.map +1 -0
  8. package/dist/cjs/client/v2/algod/accountAssetsInformation.js +31 -0
  9. package/dist/cjs/client/v2/algod/accountAssetsInformation.js.map +1 -0
  10. package/dist/cjs/client/v2/algod/algod.js +23 -19
  11. package/dist/cjs/client/v2/algod/algod.js.map +1 -1
  12. package/dist/cjs/client/v2/algod/getApplicationBoxes.js +116 -5
  13. package/dist/cjs/client/v2/algod/getApplicationBoxes.js.map +1 -1
  14. package/dist/cjs/client/v2/algod/models/types.js +243 -452
  15. package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
  16. package/dist/cjs/ed25519-signer.js +76 -0
  17. package/dist/cjs/ed25519-signer.js.map +1 -0
  18. package/dist/cjs/encoding/address.js +61 -1
  19. package/dist/cjs/encoding/address.js.map +1 -1
  20. package/dist/cjs/falcon-signer.js +17 -0
  21. package/dist/cjs/falcon-signer.js.map +1 -0
  22. package/dist/cjs/logicsig.js +201 -16
  23. package/dist/cjs/logicsig.js.map +1 -1
  24. package/dist/cjs/main.js +32 -63
  25. package/dist/cjs/main.js.map +1 -1
  26. package/dist/cjs/mnemonic/mnemonic.js +26 -1
  27. package/dist/cjs/mnemonic/mnemonic.js.map +1 -1
  28. package/dist/cjs/multisigSigning.js +78 -1
  29. package/dist/cjs/multisigSigning.js.map +1 -1
  30. package/dist/cjs/pq-signer.js +54 -0
  31. package/dist/cjs/pq-signer.js.map +1 -0
  32. package/dist/cjs/signedTransaction.js +15 -1
  33. package/dist/cjs/signedTransaction.js.map +1 -1
  34. package/dist/cjs/signer.js.map +1 -1
  35. package/dist/cjs/signing.js +94 -7
  36. package/dist/cjs/signing.js.map +1 -1
  37. package/dist/cjs/transaction.js +9 -1
  38. package/dist/cjs/transaction.js.map +1 -1
  39. package/dist/cjs/types/transactions/encoded.js +51 -1
  40. package/dist/cjs/types/transactions/encoded.js.map +1 -1
  41. package/dist/cjs/utils/ed25519-check.js +69 -0
  42. package/dist/cjs/utils/ed25519-check.js.map +1 -0
  43. package/dist/esm/appAccess.js +8 -5
  44. package/dist/esm/appAccess.js.map +1 -1
  45. package/dist/esm/client/v2/algod/accountApplicationsInformation.js +32 -0
  46. package/dist/esm/client/v2/algod/accountApplicationsInformation.js.map +1 -0
  47. package/dist/esm/client/v2/algod/accountAssetsInformation.js +25 -0
  48. package/dist/esm/client/v2/algod/accountAssetsInformation.js.map +1 -0
  49. package/dist/esm/client/v2/algod/algod.js +23 -19
  50. package/dist/esm/client/v2/algod/algod.js.map +1 -1
  51. package/dist/esm/client/v2/algod/getApplicationBoxes.js +116 -5
  52. package/dist/esm/client/v2/algod/getApplicationBoxes.js.map +1 -1
  53. package/dist/esm/client/v2/algod/models/types.js +239 -445
  54. package/dist/esm/client/v2/algod/models/types.js.map +1 -1
  55. package/dist/esm/ed25519-signer.js +72 -0
  56. package/dist/esm/ed25519-signer.js.map +1 -0
  57. package/dist/esm/encoding/address.js +58 -0
  58. package/dist/esm/encoding/address.js.map +1 -1
  59. package/dist/esm/falcon-signer.js +13 -0
  60. package/dist/esm/falcon-signer.js.map +1 -0
  61. package/dist/esm/logicsig.js +200 -15
  62. package/dist/esm/logicsig.js.map +1 -1
  63. package/dist/esm/main.js +8 -56
  64. package/dist/esm/main.js.map +1 -1
  65. package/dist/esm/mnemonic/mnemonic.js +25 -1
  66. package/dist/esm/mnemonic/mnemonic.js.map +1 -1
  67. package/dist/esm/multisigSigning.js +75 -0
  68. package/dist/esm/multisigSigning.js.map +1 -1
  69. package/dist/esm/pq-signer.js +50 -0
  70. package/dist/esm/pq-signer.js.map +1 -0
  71. package/dist/esm/signedTransaction.js +16 -2
  72. package/dist/esm/signedTransaction.js.map +1 -1
  73. package/dist/esm/signer.js.map +1 -1
  74. package/dist/esm/signing.js +91 -8
  75. package/dist/esm/signing.js.map +1 -1
  76. package/dist/esm/transaction.js +9 -1
  77. package/dist/esm/transaction.js.map +1 -1
  78. package/dist/esm/types/transactions/encoded.js +49 -1
  79. package/dist/esm/types/transactions/encoded.js.map +1 -1
  80. package/dist/esm/utils/ed25519-check.js +65 -0
  81. package/dist/esm/utils/ed25519-check.js.map +1 -0
  82. package/dist/types/client/v2/algod/accountApplicationsInformation.d.ts +16 -0
  83. package/dist/types/client/v2/algod/accountAssetsInformation.d.ts +12 -0
  84. package/dist/types/client/v2/algod/algod.d.ts +19 -17
  85. package/dist/types/client/v2/algod/getApplicationBoxes.d.ts +100 -5
  86. package/dist/types/client/v2/algod/models/types.d.ts +146 -232
  87. package/dist/types/ed25519-signer.d.ts +7 -0
  88. package/dist/types/encoding/address.d.ts +37 -0
  89. package/dist/types/falcon-signer.d.ts +11 -0
  90. package/dist/types/logicsig.d.ts +72 -1
  91. package/dist/types/main.d.ts +8 -44
  92. package/dist/types/mnemonic/mnemonic.d.ts +13 -0
  93. package/dist/types/multisigSigning.d.ts +49 -0
  94. package/dist/types/pq-signer.d.ts +8 -0
  95. package/dist/types/signedTransaction.d.ts +7 -2
  96. package/dist/types/signer.d.ts +38 -0
  97. package/dist/types/signing.d.ts +45 -0
  98. package/dist/types/transaction.d.ts +9 -0
  99. package/dist/types/types/transactions/encoded.d.ts +27 -0
  100. package/dist/types/utils/ed25519-check.d.ts +10 -0
  101. package/package.json +2 -1
  102. package/src/appAccess.ts +10 -5
  103. package/src/client/v2/algod/accountApplicationsInformation.ts +46 -0
  104. package/src/client/v2/algod/accountAssetsInformation.ts +33 -0
  105. package/src/client/v2/algod/algod.ts +25 -20
  106. package/src/client/v2/algod/getApplicationBoxes.ts +123 -5
  107. package/src/client/v2/algod/models/types.ts +523 -846
  108. package/src/ed25519-signer.ts +125 -0
  109. package/src/encoding/address.ts +80 -0
  110. package/src/falcon-signer.ts +30 -0
  111. package/src/logicsig.ts +258 -16
  112. package/src/main.ts +30 -60
  113. package/src/mnemonic/mnemonic.ts +34 -1
  114. package/src/multisigSigning.ts +111 -0
  115. package/src/pq-signer.ts +90 -0
  116. package/src/signedTransaction.ts +24 -0
  117. package/src/signer.ts +53 -0
  118. package/src/signing.ts +109 -8
  119. package/src/transaction.ts +9 -1
  120. package/src/types/transactions/encoded.ts +88 -0
  121. package/src/utils/ed25519-check.ts +67 -0
  122. package/dist/cjs/client/v2/algod/dryrun.js +0 -34
  123. package/dist/cjs/client/v2/algod/dryrun.js.map +0 -1
  124. package/dist/cjs/dryrun.js +0 -214
  125. package/dist/cjs/dryrun.js.map +0 -1
  126. package/dist/esm/client/v2/algod/dryrun.js +0 -28
  127. package/dist/esm/client/v2/algod/dryrun.js.map +0 -1
  128. package/dist/esm/dryrun.js +0 -208
  129. package/dist/esm/dryrun.js.map +0 -1
  130. package/dist/types/client/v2/algod/dryrun.d.ts +0 -11
  131. package/dist/types/dryrun.d.ts +0 -28
  132. package/src/client/v2/algod/dryrun.ts +0 -38
  133. package/src/dryrun.ts +0 -292
@@ -0,0 +1,33 @@
1
+ import JSONRequest from '../jsonrequest.js';
2
+ import { HTTPClient, HTTPClientResponse } from '../../client.js';
3
+ import { decodeJSON } from '../../../encoding/encoding.js';
4
+ import { AccountAssetsInformationResponse } from './models/types.js';
5
+ import { Address } from '../../../encoding/address.js';
6
+
7
+ export default class AccountAssetsInformation extends JSONRequest<AccountAssetsInformationResponse> {
8
+ private account: string;
9
+
10
+ constructor(c: HTTPClient, account: string | Address) {
11
+ super(c);
12
+ this.account = account.toString();
13
+ }
14
+
15
+ path() {
16
+ return `/v2/accounts/${this.account}/assets`;
17
+ }
18
+
19
+ limit(limit: number) {
20
+ this.query.limit = limit;
21
+ return this;
22
+ }
23
+
24
+ next(next: string) {
25
+ this.query.next = next;
26
+ return this;
27
+ }
28
+
29
+ // eslint-disable-next-line class-methods-use-this
30
+ prepare(response: HTTPClientResponse): AccountAssetsInformationResponse {
31
+ return decodeJSON(response.getJSONText(), AccountAssetsInformationResponse);
32
+ }
33
+ }
@@ -2,10 +2,11 @@ import ServiceClient from '../serviceClient.js';
2
2
  import * as modelsv2 from './models/types.js';
3
3
  import AccountInformation from './accountInformation.js';
4
4
  import AccountAssetInformation from './accountAssetInformation.js';
5
+ import AccountAssetsInformation from './accountAssetsInformation.js';
6
+ import AccountApplicationsInformation from './accountApplicationsInformation.js';
5
7
  import AccountApplicationInformation from './accountApplicationInformation.js';
6
8
  import Block from './block.js';
7
9
  import Compile from './compile.js';
8
- import Dryrun from './dryrun.js';
9
10
  import Genesis from './genesis.js';
10
11
  import GetAssetByID from './getAssetByID.js';
11
12
  import GetApplicationByID from './getApplicationByID.js';
@@ -177,6 +178,26 @@ export class AlgodClient extends ServiceClient {
177
178
  return new AccountAssetInformation(this.c, account, index);
178
179
  }
179
180
 
181
+ /**
182
+ * Returns the given account's asset holdings, paginated.
183
+ *
184
+ * @param account - The address of the account to look up.
185
+ * @category GET
186
+ */
187
+ accountAssetsInformation(account: string | Address) {
188
+ return new AccountAssetsInformation(this.c, account);
189
+ }
190
+
191
+ /**
192
+ * Returns the given account's application holdings, paginated.
193
+ *
194
+ * @param account - The address of the account to look up.
195
+ * @category GET
196
+ */
197
+ accountApplicationsInformation(account: string | Address) {
198
+ return new AccountApplicationsInformation(this.c, account);
199
+ }
200
+
180
201
  /**
181
202
  * Returns the given account's application information for a specific application.
182
203
  *
@@ -438,24 +459,6 @@ export class AlgodClient extends ServiceClient {
438
459
  return new Disassemble(this.c, source);
439
460
  }
440
461
 
441
- /**
442
- * Provides debugging information for a transaction (or group).
443
- *
444
- * 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.
445
- *
446
- * #### Example
447
- * ```typescript
448
- * const dryRunResult = await algodClient.dryrun(dr).do();
449
- * ```
450
- *
451
- * [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2tealdryrun)
452
- * @param dr
453
- * @category POST
454
- */
455
- dryrun(dr: modelsv2.DryrunRequest) {
456
- return new Dryrun(this.c, dr);
457
- }
458
-
459
462
  /**
460
463
  * Given an asset ID, return asset information including creator, name, total supply and
461
464
  * special addresses.
@@ -512,7 +515,7 @@ export class AlgodClient extends ServiceClient {
512
515
  }
513
516
 
514
517
  /**
515
- * Given an application ID, return all the box names associated with the app.
518
+ * Given an application ID, return all the boxes associated with the app.
516
519
  *
517
520
  * #### Example
518
521
  * ```typescript
@@ -520,6 +523,8 @@ export class AlgodClient extends ServiceClient {
520
523
  * const boxesResponse = await algodClient.getApplicationBoxes(index).max(3).do();
521
524
  * const boxNames = boxesResponse.boxes.map(box => box.name);
522
525
  * ```
526
+ * With the `.include("values")` parameter, returns values in addition to names. Pagination is supported with `limit`. If using pagination,
527
+ * it is recommended to use the `.round()` parameter to ensure each page is for the same round.
523
528
  *
524
529
  * [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2applicationsapplication-idboxes)
525
530
  * @param index - The application ID to look up.
@@ -1,10 +1,14 @@
1
1
  import JSONRequest from '../jsonrequest.js';
2
2
  import { HTTPClient, HTTPClientResponse } from '../../client.js';
3
3
  import { decodeJSON } from '../../../encoding/encoding.js';
4
+ import { bytesToBase64 } from '../../../encoding/binarydata.js';
5
+ import { ensureSafeInteger } from '../../../utils/utils.js';
4
6
  import { BoxesResponse } from './models/types.js';
5
7
 
8
+ export type BoxInclude = 'values';
9
+
6
10
  /**
7
- * Given an application ID, return all the box names associated with the app.
11
+ * Given an application ID, return all the boxes associated with the app.
8
12
  *
9
13
  * #### Example
10
14
  * ```typescript
@@ -13,6 +17,9 @@ import { BoxesResponse } from './models/types.js';
13
17
  * const boxNames = boxesResponse.boxes.map(box => box.name);
14
18
  * ```
15
19
  *
20
+ * With the `.include("values")` parameter, returns values in addition to names. Pagination is supported with `limit`. If using pagination,
21
+ * it is recommended to use the `.round()` parameter to ensure each page is for the same round.
22
+ *
16
23
  * [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2applicationsapplication-idboxes)
17
24
  * @param index - The application ID to look up.
18
25
  * @category GET
@@ -34,18 +41,20 @@ export default class GetApplicationBoxes extends JSONRequest<BoxesResponse> {
34
41
  }
35
42
 
36
43
  /**
37
- * Limit results for pagination.
44
+ * @deprecated - Use `limit` instead for proper pagination with a limit.
45
+ *
46
+ * Set the max amount of boxes to return. Returns HTTP 400 if max is exceeded.
38
47
  *
39
48
  * #### Example
40
49
  * ```typescript
41
50
  * const maxResults = 20;
42
51
  * const boxesResult = await algodClient
43
- * .GetApplicationBoxes(1234)
44
- * .limit(maxResults)
52
+ * .getApplicationBoxes(1234)
53
+ * .max(maxResults)
45
54
  * .do();
46
55
  * ```
47
56
  *
48
- * @param limit - maximum number of results to return.
57
+ * @param max - maximum number of results to return.
49
58
  * @category query
50
59
  */
51
60
  max(max: number) {
@@ -53,6 +62,115 @@ export default class GetApplicationBoxes extends JSONRequest<BoxesResponse> {
53
62
  return this;
54
63
  }
55
64
 
65
+ /**
66
+ * Pagination token returned by the previous call.
67
+ *
68
+ * This is the value returned by a previous call to this endpoint in the
69
+ * `next-token` response field. Provide this token to get the next page of
70
+ * results. The token is the box name to use as the pagination cursor,
71
+ * encoded in the goal app call arg form.
72
+ *
73
+ * #### Example
74
+ * ```typescript
75
+ * const boxesResponse = await algodClient
76
+ * .getApplicationBoxes(1234)
77
+ * .limit(20)
78
+ * .next("b64:AAECAw==")
79
+ * .do();
80
+ * ```
81
+ *
82
+ * @param nextToken - The next token to use for pagination.
83
+ * @category query
84
+ */
85
+ next(nextToken: string | undefined) {
86
+ this.query.next = nextToken;
87
+ return this;
88
+ }
89
+
90
+ /**
91
+ * Filter box names by a prefix.
92
+ *
93
+ * #### Example
94
+ * ```typescript
95
+ * const boxesResponse = await algodClient
96
+ * .getApplicationBoxes(1234)
97
+ * .prefix(myAddr.publicKey)
98
+ * .do();
99
+ * ```
100
+ *
101
+ * @param prefix - The prefix to filter box names by
102
+ * @category query
103
+ */
104
+ prefix(prefix: Uint8Array) {
105
+ this.query.prefix = `b64:${bytesToBase64(prefix)}`;
106
+ return this;
107
+ }
108
+
109
+ /**
110
+ * Include additional items in the response.
111
+ *
112
+ * Use `values` to include box values.
113
+ *
114
+ * #### Example
115
+ * ```typescript
116
+ * const boxesResponse = await algodClient
117
+ * .getApplicationBoxes(1234)
118
+ * .prefix(myAddr.publicKey)
119
+ * .include("values")
120
+ * .do();
121
+ * ```
122
+ *
123
+ * @param include - The additional items to include in the response.
124
+ * @category query
125
+ */
126
+ include(...include: BoxInclude[]) {
127
+ this.query.include = include.join(',');
128
+ return this;
129
+ }
130
+
131
+ /**
132
+ * Limits results per page when using pagination.
133
+ *
134
+ * #### Example
135
+ * ```typescript
136
+ * const maxResults = 20;
137
+ * const boxesResult = await algodClient
138
+ * .getApplicationBoxes(1234)
139
+ * .limit(maxResults)
140
+ * .do();
141
+ * const { nextToken } = boxesResult
142
+ * ```
143
+ *
144
+ * @param limit - maximum number of results to return per page.
145
+ * @category query
146
+ */
147
+ limit(limit: number) {
148
+ this.query.limit = limit;
149
+ return this;
150
+ }
151
+
152
+ /**
153
+ * Return results for the specified round.
154
+ *
155
+ * If not provided, results will be from the latest round. This parameter
156
+ * can be used to pin all pages of a paginated query to a consistent round.
157
+ *
158
+ * #### Example
159
+ * ```typescript
160
+ * const boxesResponse = await algodClient
161
+ * .getApplicationBoxes(1234)
162
+ * .round(12345678)
163
+ * .do();
164
+ * ```
165
+ *
166
+ * @param roundNumber - The round to query.
167
+ * @category query
168
+ */
169
+ round(roundNumber: number | bigint) {
170
+ this.query.round = ensureSafeInteger(roundNumber);
171
+ return this;
172
+ }
173
+
56
174
  // eslint-disable-next-line class-methods-use-this
57
175
  prepare(response: HTTPClientResponse): BoxesResponse {
58
176
  return decodeJSON(response.getJSONText(), BoxesResponse);