@algorandfoundation/algokit-utils 8.2.0-beta.2 → 8.2.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 (71) hide show
  1. package/package.json +3 -2
  2. package/types/account-manager.d.ts +33 -18
  3. package/types/account-manager.js +33 -18
  4. package/types/account-manager.js.map +1 -1
  5. package/types/account-manager.mjs +33 -18
  6. package/types/account-manager.mjs.map +1 -1
  7. package/types/account.d.ts +5 -0
  8. package/types/account.js +5 -0
  9. package/types/account.js.map +1 -1
  10. package/types/account.mjs +5 -0
  11. package/types/account.mjs.map +1 -1
  12. package/types/algorand-client-transaction-creator.d.ts +103 -70
  13. package/types/algorand-client-transaction-creator.js +103 -70
  14. package/types/algorand-client-transaction-creator.js.map +1 -1
  15. package/types/algorand-client-transaction-creator.mjs +103 -70
  16. package/types/algorand-client-transaction-creator.mjs.map +1 -1
  17. package/types/algorand-client-transaction-sender.d.ts +107 -20
  18. package/types/algorand-client-transaction-sender.js +107 -21
  19. package/types/algorand-client-transaction-sender.js.map +1 -1
  20. package/types/algorand-client-transaction-sender.mjs +107 -21
  21. package/types/algorand-client-transaction-sender.mjs.map +1 -1
  22. package/types/algorand-client.d.ts +108 -24
  23. package/types/algorand-client.js +107 -23
  24. package/types/algorand-client.js.map +1 -1
  25. package/types/algorand-client.mjs +107 -23
  26. package/types/algorand-client.mjs.map +1 -1
  27. package/types/amount.d.ts +10 -0
  28. package/types/amount.js +10 -0
  29. package/types/amount.js.map +1 -1
  30. package/types/amount.mjs +10 -0
  31. package/types/amount.mjs.map +1 -1
  32. package/types/app-client.d.ts +128 -8
  33. package/types/app-client.js +128 -8
  34. package/types/app-client.js.map +1 -1
  35. package/types/app-client.mjs +128 -8
  36. package/types/app-client.mjs.map +1 -1
  37. package/types/app-deployer.d.ts +33 -1
  38. package/types/app-deployer.js +33 -1
  39. package/types/app-deployer.js.map +1 -1
  40. package/types/app-deployer.mjs +33 -1
  41. package/types/app-deployer.mjs.map +1 -1
  42. package/types/app-factory.d.ts +74 -4
  43. package/types/app-factory.js +74 -4
  44. package/types/app-factory.js.map +1 -1
  45. package/types/app-factory.mjs +74 -4
  46. package/types/app-factory.mjs.map +1 -1
  47. package/types/app-manager.d.ts +64 -0
  48. package/types/app-manager.js +64 -0
  49. package/types/app-manager.js.map +1 -1
  50. package/types/app-manager.mjs +64 -0
  51. package/types/app-manager.mjs.map +1 -1
  52. package/types/app-spec.d.ts +9 -0
  53. package/types/app-spec.js +9 -0
  54. package/types/app-spec.js.map +1 -1
  55. package/types/app-spec.mjs +9 -0
  56. package/types/app-spec.mjs.map +1 -1
  57. package/types/asset-manager.d.ts +5 -5
  58. package/types/asset-manager.js +5 -5
  59. package/types/asset-manager.js.map +1 -1
  60. package/types/asset-manager.mjs +5 -5
  61. package/types/asset-manager.mjs.map +1 -1
  62. package/types/client-manager.d.ts +79 -18
  63. package/types/client-manager.js +79 -18
  64. package/types/client-manager.js.map +1 -1
  65. package/types/client-manager.mjs +79 -18
  66. package/types/client-manager.mjs.map +1 -1
  67. package/types/composer.d.ts +599 -1
  68. package/types/composer.js +575 -1
  69. package/types/composer.js.map +1 -1
  70. package/types/composer.mjs +575 -1
  71. package/types/composer.mjs.map +1 -1
@@ -18,6 +18,7 @@ class TransactionComposer {
18
18
  /**
19
19
  * Create a `TransactionComposer`.
20
20
  * @param params The configuration for this composer
21
+ * @returns The `TransactionComposer` instance
21
22
  */
22
23
  constructor(params) {
23
24
  /** The ATC used to compose the group */
@@ -45,6 +46,10 @@ class TransactionComposer {
45
46
  * @param transaction The pre-built transaction
46
47
  * @param signer Optional signer override for the transaction
47
48
  * @returns The composer so you can chain method calls
49
+ * @example
50
+ * ```typescript
51
+ * composer.addTransaction(txn)
52
+ * ```
48
53
  */
49
54
  addTransaction(transaction, signer) {
50
55
  this.txns.push({
@@ -58,6 +63,34 @@ class TransactionComposer {
58
63
  * Add a payment transaction to the transaction group.
59
64
  * @param params The payment transaction parameters
60
65
  * @returns The composer so you can chain method calls
66
+ * @example Basic example
67
+ * ```typescript
68
+ * composer.addPayment({
69
+ * sender: 'SENDERADDRESS',
70
+ * receiver: 'RECEIVERADDRESS',
71
+ * amount: (4).algo(),
72
+ * })
73
+ * ```
74
+ * @example Advanced example
75
+ * ```typescript
76
+ * composer.addPayment({
77
+ * amount: (4).algo(),
78
+ * receiver: 'RECEIVERADDRESS',
79
+ * sender: 'SENDERADDRESS',
80
+ * closeRemainderTo: 'CLOSEREMAINDERTOADDRESS',
81
+ * lease: 'lease',
82
+ * note: 'note',
83
+ * // Use this with caution, it's generally better to use algorand.account.rekeyAccount
84
+ * rekeyTo: 'REKEYTOADDRESS',
85
+ * // You wouldn't normally set this field
86
+ * firstValidRound: 1000n,
87
+ * validityWindow: 10,
88
+ * extraFee: (1000).microAlgo(),
89
+ * staticFee: (1000).microAlgo(),
90
+ * // Max fee doesn't make sense with extraFee AND staticFee
91
+ * // already specified, but here for completeness
92
+ * maxFee: (3000).microAlgo(),
93
+ * })
61
94
  */
62
95
  addPayment(params) {
63
96
  this.txns.push({ ...params, type: 'pay' });
@@ -67,6 +100,36 @@ class TransactionComposer {
67
100
  * Add an asset create transaction to the transaction group.
68
101
  * @param params The asset create transaction parameters
69
102
  * @returns The composer so you can chain method calls
103
+ * @example Basic example
104
+ * ```typescript
105
+ * composer.addAssetCreate({ sender: "CREATORADDRESS", total: 100n})
106
+ * ```
107
+ * @example Advanced example
108
+ * ```typescript
109
+ * composer.addAssetCreate({
110
+ * sender: 'CREATORADDRESS',
111
+ * total: 100n,
112
+ * decimals: 2,
113
+ * assetName: 'asset',
114
+ * unitName: 'unit',
115
+ * url: 'url',
116
+ * metadataHash: 'metadataHash',
117
+ * defaultFrozen: false,
118
+ * manager: 'MANAGERADDRESS',
119
+ * reserve: 'RESERVEADDRESS',
120
+ * freeze: 'FREEZEADDRESS',
121
+ * clawback: 'CLAWBACKADDRESS',
122
+ * lease: 'lease',
123
+ * note: 'note',
124
+ * // You wouldn't normally set this field
125
+ * firstValidRound: 1000n,
126
+ * validityWindow: 10,
127
+ * extraFee: (1000).microAlgo(),
128
+ * staticFee: (1000).microAlgo(),
129
+ * // Max fee doesn't make sense with extraFee AND staticFee
130
+ * // already specified, but here for completeness
131
+ * maxFee: (3000).microAlgo(),
132
+ * })
70
133
  */
71
134
  addAssetCreate(params) {
72
135
  this.txns.push({ ...params, type: 'assetCreate' });
@@ -76,6 +139,30 @@ class TransactionComposer {
76
139
  * Add an asset config transaction to the transaction group.
77
140
  * @param params The asset config transaction parameters
78
141
  * @returns The composer so you can chain method calls
142
+ * @example Basic example
143
+ * ```typescript
144
+ * composer.addAssetConfig({ sender: "MANAGERADDRESS", assetId: 123456n, manager: "MANAGERADDRESS" })
145
+ * ```
146
+ * @example Advanced example
147
+ * ```typescript
148
+ * composer.addAssetConfig({
149
+ * sender: 'MANAGERADDRESS',
150
+ * assetId: 123456n,
151
+ * manager: 'MANAGERADDRESS',
152
+ * reserve: 'RESERVEADDRESS',
153
+ * freeze: 'FREEZEADDRESS',
154
+ * clawback: 'CLAWBACKADDRESS',
155
+ * lease: 'lease',
156
+ * note: 'note',
157
+ * // You wouldn't normally set this field
158
+ * firstValidRound: 1000n,
159
+ * validityWindow: 10,
160
+ * extraFee: (1000).microAlgo(),
161
+ * staticFee: (1000).microAlgo(),
162
+ * // Max fee doesn't make sense with extraFee AND staticFee
163
+ * // already specified, but here for completeness
164
+ * maxFee: (3000).microAlgo(),
165
+ * })
79
166
  */
80
167
  addAssetConfig(params) {
81
168
  this.txns.push({ ...params, type: 'assetConfig' });
@@ -85,6 +172,29 @@ class TransactionComposer {
85
172
  * Add an asset freeze transaction to the transaction group.
86
173
  * @param params The asset freeze transaction parameters
87
174
  * @returns The composer so you can chain method calls
175
+ * @example Basic example
176
+ * ```typescript
177
+ * composer.addAssetFreeze({ sender: "MANAGERADDRESS", assetId: 123456n, account: "ACCOUNTADDRESS", frozen: true })
178
+ * ```
179
+ * @example Advanced example
180
+ * ```typescript
181
+ * composer.addAssetFreeze({
182
+ * sender: 'MANAGERADDRESS',
183
+ * assetId: 123456n,
184
+ * account: 'ACCOUNTADDRESS',
185
+ * frozen: true,
186
+ * lease: 'lease',
187
+ * note: 'note',
188
+ * // You wouldn't normally set this field
189
+ * firstValidRound: 1000n,
190
+ * validityWindow: 10,
191
+ * extraFee: (1000).microAlgo(),
192
+ * staticFee: (1000).microAlgo(),
193
+ * // Max fee doesn't make sense with extraFee AND staticFee
194
+ * // already specified, but here for completeness
195
+ * maxFee: (3000).microAlgo(),
196
+ * })
197
+ * ```
88
198
  */
89
199
  addAssetFreeze(params) {
90
200
  this.txns.push({ ...params, type: 'assetFreeze' });
@@ -94,6 +204,27 @@ class TransactionComposer {
94
204
  * Add an asset destroy transaction to the transaction group.
95
205
  * @param params The asset destroy transaction parameters
96
206
  * @returns The composer so you can chain method calls
207
+ * @example Basic example
208
+ * ```typescript
209
+ * composer.addAssetDestroy({ sender: "MANAGERADDRESS", assetId: 123456n })
210
+ * ```
211
+ * @example Advanced example
212
+ * ```typescript
213
+ * composer.addAssetDestroy({
214
+ * sender: 'MANAGERADDRESS',
215
+ * assetId: 123456n,
216
+ * lease: 'lease',
217
+ * note: 'note',
218
+ * // You wouldn't normally set this field
219
+ * firstValidRound: 1000n,
220
+ * validityWindow: 10,
221
+ * extraFee: (1000).microAlgo(),
222
+ * staticFee: (1000).microAlgo(),
223
+ * // Max fee doesn't make sense with extraFee AND staticFee
224
+ * // already specified, but here for completeness
225
+ * maxFee: (3000).microAlgo(),
226
+ * })
227
+ * ```
97
228
  */
98
229
  addAssetDestroy(params) {
99
230
  this.txns.push({ ...params, type: 'assetDestroy' });
@@ -103,6 +234,32 @@ class TransactionComposer {
103
234
  * Add an asset transfer transaction to the transaction group.
104
235
  * @param params The asset transfer transaction parameters
105
236
  * @returns The composer so you can chain method calls
237
+ * @example Basic example
238
+ * ```typescript
239
+ * composer.addAssetTransfer({ sender: "HOLDERADDRESS", assetId: 123456n, amount: 1n, receiver: "RECEIVERADDRESS" })
240
+ * ```
241
+ * @example Advanced example (with clawback)
242
+ * ```typescript
243
+ * composer.addAssetTransfer({
244
+ * sender: 'CLAWBACKADDRESS',
245
+ * assetId: 123456n,
246
+ * amount: 1n,
247
+ * receiver: 'RECEIVERADDRESS',
248
+ * clawbackTarget: 'HOLDERADDRESS',
249
+ * // This field needs to be used with caution
250
+ * closeAssetTo: 'ADDRESSTOCLOSETO'
251
+ * lease: 'lease',
252
+ * note: 'note',
253
+ * // You wouldn't normally set this field
254
+ * firstValidRound: 1000n,
255
+ * validityWindow: 10,
256
+ * extraFee: (1000).microAlgo(),
257
+ * staticFee: (1000).microAlgo(),
258
+ * // Max fee doesn't make sense with extraFee AND staticFee
259
+ * // already specified, but here for completeness
260
+ * maxFee: (3000).microAlgo(),
261
+ * })
262
+ * ```
106
263
  */
107
264
  addAssetTransfer(params) {
108
265
  this.txns.push({ ...params, type: 'assetTransfer' });
@@ -112,6 +269,27 @@ class TransactionComposer {
112
269
  * Add an asset opt-in transaction to the transaction group.
113
270
  * @param params The asset opt-in transaction parameters
114
271
  * @returns The composer so you can chain method calls
272
+ * @example Basic example
273
+ * ```typescript
274
+ * composer.addAssetOptIn({ sender: "SENDERADDRESS", assetId: 123456n })
275
+ * ```
276
+ * @example Advanced example
277
+ * ```typescript
278
+ * composer.addAssetOptIn({
279
+ * sender: 'SENDERADDRESS',
280
+ * assetId: 123456n,
281
+ * lease: 'lease',
282
+ * note: 'note',
283
+ * // You wouldn't normally set this field
284
+ * firstValidRound: 1000n,
285
+ * validityWindow: 10,
286
+ * extraFee: (1000).microAlgo(),
287
+ * staticFee: (1000).microAlgo(),
288
+ * // Max fee doesn't make sense with extraFee AND staticFee
289
+ * // already specified, but here for completeness
290
+ * maxFee: (3000).microAlgo(),
291
+ * })
292
+ * ```
115
293
  */
116
294
  addAssetOptIn(params) {
117
295
  this.txns.push({ ...params, type: 'assetOptIn' });
@@ -121,6 +299,33 @@ class TransactionComposer {
121
299
  * Add an asset opt-out transaction to the transaction group.
122
300
  * @param params The asset opt-out transaction parameters
123
301
  * @returns The composer so you can chain method calls
302
+ * @example Basic example (without creator, will be retrieved from algod)
303
+ * ```typescript
304
+ * composer.addAssetOptOut({ sender: "SENDERADDRESS", assetId: 123456n, ensureZeroBalance: true })
305
+ * ```
306
+ * @example Basic example (with creator)
307
+ * ```typescript
308
+ * composer.addAssetOptOut({ sender: "SENDERADDRESS", creator: "CREATORADDRESS", assetId: 123456n, ensureZeroBalance: true })
309
+ * ```
310
+ * @example Advanced example
311
+ * ```typescript
312
+ * composer.addAssetOptOut({
313
+ * sender: 'SENDERADDRESS',
314
+ * assetId: 123456n,
315
+ * creator: 'CREATORADDRESS',
316
+ * ensureZeroBalance: true,
317
+ * lease: 'lease',
318
+ * note: 'note',
319
+ * // You wouldn't normally set this field
320
+ * firstValidRound: 1000n,
321
+ * validityWindow: 10,
322
+ * extraFee: (1000).microAlgo(),
323
+ * staticFee: (1000).microAlgo(),
324
+ * // Max fee doesn't make sense with extraFee AND staticFee
325
+ * // already specified, but here for completeness
326
+ * maxFee: (3000).microAlgo(),
327
+ * })
328
+ * ```
124
329
  */
125
330
  addAssetOptOut(params) {
126
331
  this.txns.push({ ...params, type: 'assetOptOut' });
@@ -132,6 +337,47 @@ class TransactionComposer {
132
337
  * Note: we recommend using app clients to make it easier to make app calls.
133
338
  * @param params The application create transaction parameters
134
339
  * @returns The composer so you can chain method calls
340
+ * @example Basic example
341
+ * ```typescript
342
+ * composer.addAppCreate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })
343
+ * ```
344
+ * @example Advanced example
345
+ * ```typescript
346
+ * composer.addAppCreate({
347
+ * sender: 'CREATORADDRESS',
348
+ * approvalProgram: "TEALCODE",
349
+ * clearStateProgram: "TEALCODE",
350
+ * schema: {
351
+ * globalInts: 1,
352
+ * globalByteSlices: 2,
353
+ * localInts: 3,
354
+ * localByteSlices: 4
355
+ * },
356
+ * extraProgramPages: 1,
357
+ * onComplete: algosdk.OnApplicationComplete.OptInOC,
358
+ * args: [new Uint8Array(1, 2, 3, 4)]
359
+ * accountReferences: ["ACCOUNT_1"]
360
+ * appReferences: [123n, 1234n]
361
+ * assetReferences: [12345n]
362
+ * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
363
+ * lease: 'lease',
364
+ * note: 'note',
365
+ * // You wouldn't normally set this field
366
+ * firstValidRound: 1000n,
367
+ * validityWindow: 10,
368
+ * extraFee: (1000).microAlgo(),
369
+ * staticFee: (1000).microAlgo(),
370
+ * // Max fee doesn't make sense with extraFee AND staticFee
371
+ * // already specified, but here for completeness
372
+ * maxFee: (3000).microAlgo(),
373
+ * // Signer only needed if you want to provide one,
374
+ * // generally you'd register it with AlgorandClient
375
+ * // against the sender and not need to pass it in
376
+ * signer: transactionSigner,
377
+ * maxRoundsToWaitForConfirmation: 5,
378
+ * suppressLog: true,
379
+ *})
380
+ * ```
135
381
  */
136
382
  addAppCreate(params) {
137
383
  this.txns.push({ ...params, type: 'appCall' });
@@ -143,6 +389,34 @@ class TransactionComposer {
143
389
  * Note: we recommend using app clients to make it easier to make app calls.
144
390
  * @param params The application update transaction parameters
145
391
  * @returns The composer so you can chain method calls
392
+ * @example Basic example
393
+ * ```typescript
394
+ * composer.addAppUpdate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })
395
+ * ```
396
+ * @example Advanced example
397
+ * ```typescript
398
+ * composer.addAppUpdate({
399
+ * sender: 'CREATORADDRESS',
400
+ * approvalProgram: "TEALCODE",
401
+ * clearStateProgram: "TEALCODE",
402
+ * onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,
403
+ * args: [new Uint8Array(1, 2, 3, 4)]
404
+ * accountReferences: ["ACCOUNT_1"]
405
+ * appReferences: [123n, 1234n]
406
+ * assetReferences: [12345n]
407
+ * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
408
+ * lease: 'lease',
409
+ * note: 'note',
410
+ * // You wouldn't normally set this field
411
+ * firstValidRound: 1000n,
412
+ * validityWindow: 10,
413
+ * extraFee: (1000).microAlgo(),
414
+ * staticFee: (1000).microAlgo(),
415
+ * // Max fee doesn't make sense with extraFee AND staticFee
416
+ * // already specified, but here for completeness
417
+ * maxFee: (3000).microAlgo(),
418
+ *})
419
+ * ```
146
420
  */
147
421
  addAppUpdate(params) {
148
422
  this.txns.push({ ...params, type: 'appCall', onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC });
@@ -154,6 +428,32 @@ class TransactionComposer {
154
428
  * Note: we recommend using app clients to make it easier to make app calls.
155
429
  * @param params The application delete transaction parameters
156
430
  * @returns The composer so you can chain method calls
431
+ * @example Basic example
432
+ * ```typescript
433
+ * composer.addAppDelete({ sender: 'CREATORADDRESS' })
434
+ * ```
435
+ * @example Advanced example
436
+ * ```typescript
437
+ * composer.addAppDelete({
438
+ * sender: 'CREATORADDRESS',
439
+ * onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC,
440
+ * args: [new Uint8Array(1, 2, 3, 4)]
441
+ * accountReferences: ["ACCOUNT_1"]
442
+ * appReferences: [123n, 1234n]
443
+ * assetReferences: [12345n]
444
+ * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
445
+ * lease: 'lease',
446
+ * note: 'note',
447
+ * // You wouldn't normally set this field
448
+ * firstValidRound: 1000n,
449
+ * validityWindow: 10,
450
+ * extraFee: (1000).microAlgo(),
451
+ * staticFee: (1000).microAlgo(),
452
+ * // Max fee doesn't make sense with extraFee AND staticFee
453
+ * // already specified, but here for completeness
454
+ * maxFee: (3000).microAlgo(),
455
+ *})
456
+ * ```
157
457
  */
158
458
  addAppDelete(params) {
159
459
  this.txns.push({ ...params, type: 'appCall', onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC });
@@ -167,6 +467,32 @@ class TransactionComposer {
167
467
  * Note: we recommend using app clients to make it easier to make app calls.
168
468
  * @param params The application call transaction parameters
169
469
  * @returns The composer so you can chain method calls
470
+ * @example Basic example
471
+ * ```typescript
472
+ * composer.addAppCall({ sender: 'CREATORADDRESS' })
473
+ * ```
474
+ * @example Advanced example
475
+ * ```typescript
476
+ * composer.addAppCall({
477
+ * sender: 'CREATORADDRESS',
478
+ * onComplete: algosdk.OnApplicationComplete.OptInOC,
479
+ * args: [new Uint8Array(1, 2, 3, 4)]
480
+ * accountReferences: ["ACCOUNT_1"]
481
+ * appReferences: [123n, 1234n]
482
+ * assetReferences: [12345n]
483
+ * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
484
+ * lease: 'lease',
485
+ * note: 'note',
486
+ * // You wouldn't normally set this field
487
+ * firstValidRound: 1000n,
488
+ * validityWindow: 10,
489
+ * extraFee: (1000).microAlgo(),
490
+ * staticFee: (1000).microAlgo(),
491
+ * // Max fee doesn't make sense with extraFee AND staticFee
492
+ * // already specified, but here for completeness
493
+ * maxFee: (3000).microAlgo(),
494
+ *})
495
+ * ```
170
496
  */
171
497
  addAppCall(params) {
172
498
  this.txns.push({ ...params, type: 'appCall' });
@@ -178,6 +504,53 @@ class TransactionComposer {
178
504
  * Note: we recommend using app clients to make it easier to make app calls.
179
505
  * @param params The ABI create method application call transaction parameters
180
506
  * @returns The composer so you can chain method calls
507
+ * @example Basic example
508
+ * ```typescript
509
+ * const method = new ABIMethod({
510
+ * name: 'method',
511
+ * args: [{ name: 'arg1', type: 'string' }],
512
+ * returns: { type: 'string' },
513
+ * })
514
+ * composer.addAppCreateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: ["arg1_value"] })
515
+ * ```
516
+ * @example Advanced example
517
+ * ```typescript
518
+ * const method = new ABIMethod({
519
+ * name: 'method',
520
+ * args: [{ name: 'arg1', type: 'string' }],
521
+ * returns: { type: 'string' },
522
+ * })
523
+ * composer.addAppCreateMethodCall({
524
+ * sender: 'CREATORADDRESS',
525
+ * method: method,
526
+ * args: ["arg1_value"],
527
+ * approvalProgram: "TEALCODE",
528
+ * clearStateProgram: "TEALCODE",
529
+ * schema: {
530
+ * globalInts: 1,
531
+ * globalByteSlices: 2,
532
+ * localInts: 3,
533
+ * localByteSlices: 4
534
+ * },
535
+ * extraProgramPages: 1,
536
+ * onComplete: algosdk.OnApplicationComplete.OptInOC,
537
+ * args: [new Uint8Array(1, 2, 3, 4)]
538
+ * accountReferences: ["ACCOUNT_1"]
539
+ * appReferences: [123n, 1234n]
540
+ * assetReferences: [12345n]
541
+ * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
542
+ * lease: 'lease',
543
+ * note: 'note',
544
+ * // You wouldn't normally set this field
545
+ * firstValidRound: 1000n,
546
+ * validityWindow: 10,
547
+ * extraFee: (1000).microAlgo(),
548
+ * staticFee: (1000).microAlgo(),
549
+ * // Max fee doesn't make sense with extraFee AND staticFee
550
+ * // already specified, but here for completeness
551
+ * maxFee: (3000).microAlgo(),
552
+ *})
553
+ * ```
181
554
  */
182
555
  addAppCreateMethodCall(params) {
183
556
  this.txns.push({ ...params, type: 'methodCall' });
@@ -189,6 +562,46 @@ class TransactionComposer {
189
562
  * Note: we recommend using app clients to make it easier to make app calls.
190
563
  * @param params The ABI update method application call transaction parameters
191
564
  * @returns The composer so you can chain method calls
565
+ * @example Basic example
566
+ * ```typescript
567
+ * const method = new ABIMethod({
568
+ * name: 'method',
569
+ * args: [{ name: 'arg1', type: 'string' }],
570
+ * returns: { type: 'string' },
571
+ * })
572
+ * composer.addAppUpdateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: ["arg1_value"] })
573
+ * ```
574
+ * @example Advanced example
575
+ * ```typescript
576
+ * const method = new ABIMethod({
577
+ * name: 'method',
578
+ * args: [{ name: 'arg1', type: 'string' }],
579
+ * returns: { type: 'string' },
580
+ * })
581
+ * composer.addAppUpdateMethodCall({
582
+ * sender: 'CREATORADDRESS',
583
+ * method: method,
584
+ * args: ["arg1_value"],
585
+ * approvalProgram: "TEALCODE",
586
+ * clearStateProgram: "TEALCODE",
587
+ * onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,
588
+ * args: [new Uint8Array(1, 2, 3, 4)]
589
+ * accountReferences: ["ACCOUNT_1"]
590
+ * appReferences: [123n, 1234n]
591
+ * assetReferences: [12345n]
592
+ * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
593
+ * lease: 'lease',
594
+ * note: 'note',
595
+ * // You wouldn't normally set this field
596
+ * firstValidRound: 1000n,
597
+ * validityWindow: 10,
598
+ * extraFee: (1000).microAlgo(),
599
+ * staticFee: (1000).microAlgo(),
600
+ * // Max fee doesn't make sense with extraFee AND staticFee
601
+ * // already specified, but here for completeness
602
+ * maxFee: (3000).microAlgo(),
603
+ *})
604
+ * ```
192
605
  */
193
606
  addAppUpdateMethodCall(params) {
194
607
  this.txns.push({ ...params, type: 'methodCall', onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC });
@@ -200,6 +613,44 @@ class TransactionComposer {
200
613
  * Note: we recommend using app clients to make it easier to make app calls.
201
614
  * @param params The ABI delete method application call transaction parameters
202
615
  * @returns The composer so you can chain method calls
616
+ * @example Basic example
617
+ * ```typescript
618
+ * const method = new ABIMethod({
619
+ * name: 'method',
620
+ * args: [{ name: 'arg1', type: 'string' }],
621
+ * returns: { type: 'string' },
622
+ * })
623
+ * composer.addAppDeleteMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"] })
624
+ * ```
625
+ * @example Advanced example
626
+ * ```typescript
627
+ * const method = new ABIMethod({
628
+ * name: 'method',
629
+ * args: [{ name: 'arg1', type: 'string' }],
630
+ * returns: { type: 'string' },
631
+ * })
632
+ * composer.addAppDeleteMethodCall({
633
+ * sender: 'CREATORADDRESS',
634
+ * method: method,
635
+ * args: ["arg1_value"],
636
+ * onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC,
637
+ * args: [new Uint8Array(1, 2, 3, 4)]
638
+ * accountReferences: ["ACCOUNT_1"]
639
+ * appReferences: [123n, 1234n]
640
+ * assetReferences: [12345n]
641
+ * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
642
+ * lease: 'lease',
643
+ * note: 'note',
644
+ * // You wouldn't normally set this field
645
+ * firstValidRound: 1000n,
646
+ * validityWindow: 10,
647
+ * extraFee: (1000).microAlgo(),
648
+ * staticFee: (1000).microAlgo(),
649
+ * // Max fee doesn't make sense with extraFee AND staticFee
650
+ * // already specified, but here for completeness
651
+ * maxFee: (3000).microAlgo(),
652
+ *})
653
+ * ```
203
654
  */
204
655
  addAppDeleteMethodCall(params) {
205
656
  this.txns.push({ ...params, type: 'methodCall', onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC });
@@ -211,6 +662,44 @@ class TransactionComposer {
211
662
  * Note: we recommend using app clients to make it easier to make app calls.
212
663
  * @param params The ABI method application call transaction parameters
213
664
  * @returns The composer so you can chain method calls
665
+ * @example Basic example
666
+ * ```typescript
667
+ * const method = new ABIMethod({
668
+ * name: 'method',
669
+ * args: [{ name: 'arg1', type: 'string' }],
670
+ * returns: { type: 'string' },
671
+ * })
672
+ * composer.addAppCallMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"] })
673
+ * ```
674
+ * @example Advanced example
675
+ * ```typescript
676
+ * const method = new ABIMethod({
677
+ * name: 'method',
678
+ * args: [{ name: 'arg1', type: 'string' }],
679
+ * returns: { type: 'string' },
680
+ * })
681
+ * composer.addAppCallMethodCall({
682
+ * sender: 'CREATORADDRESS',
683
+ * method: method,
684
+ * args: ["arg1_value"],
685
+ * onComplete: algosdk.OnApplicationComplete.OptInOC,
686
+ * args: [new Uint8Array(1, 2, 3, 4)]
687
+ * accountReferences: ["ACCOUNT_1"]
688
+ * appReferences: [123n, 1234n]
689
+ * assetReferences: [12345n]
690
+ * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
691
+ * lease: 'lease',
692
+ * note: 'note',
693
+ * // You wouldn't normally set this field
694
+ * firstValidRound: 1000n,
695
+ * validityWindow: 10,
696
+ * extraFee: (1000).microAlgo(),
697
+ * staticFee: (1000).microAlgo(),
698
+ * // Max fee doesn't make sense with extraFee AND staticFee
699
+ * // already specified, but here for completeness
700
+ * maxFee: (3000).microAlgo(),
701
+ *})
702
+ * ```
214
703
  */
215
704
  addAppCallMethodCall(params) {
216
705
  this.txns.push({ ...params, type: 'methodCall' });
@@ -220,6 +709,42 @@ class TransactionComposer {
220
709
  * Add an online key registration transaction to the transaction group.
221
710
  * @param params The online key registration transaction parameters
222
711
  * @returns The composer so you can chain method calls
712
+ * @example Basic example
713
+ * ```typescript
714
+ * composer.addOnlineKeyRegistration({
715
+ * sender: 'SENDERADDRESS',
716
+ * voteKey: Uint8Array.from(Buffer.from("voteKeyBase64", 'base64')),
717
+ * selectionKey: Uint8Array.from(Buffer.from("selectionKeyBase64", 'base64')),
718
+ * stateProofKey: Uint8Array.from(Buffer.from("stateProofKeyBase64", 'base64')),
719
+ * voteFirst: 1n,
720
+ * voteLast: 1000n,
721
+ * voteKeyDilution: 1n,
722
+ * })
723
+ * ```
724
+ * @example Advanced example
725
+ * ```typescript
726
+ * composer.addOnlineKeyRegistration({
727
+ * sender: 'SENDERADDRESS',
728
+ * voteKey: Uint8Array.from(Buffer.from("voteKeyBase64", 'base64')),
729
+ * selectionKey: Uint8Array.from(Buffer.from("selectionKeyBase64", 'base64')),
730
+ * stateProofKey: Uint8Array.from(Buffer.from("stateProofKeyBase64", 'base64')),
731
+ * voteFirst: 1n,
732
+ * voteLast: 1000n,
733
+ * voteKeyDilution: 1n,
734
+ * lease: 'lease',
735
+ * note: 'note',
736
+ * // Use this with caution, it's generally better to use algorand.account.rekeyAccount
737
+ * rekeyTo: 'REKEYTOADDRESS',
738
+ * // You wouldn't normally set this field
739
+ * firstValidRound: 1000n,
740
+ * validityWindow: 10,
741
+ * extraFee: (1000).microAlgo(),
742
+ * staticFee: (1000).microAlgo(),
743
+ * // Max fee doesn't make sense with extraFee AND staticFee
744
+ * // already specified, but here for completeness
745
+ * maxFee: (3000).microAlgo(),
746
+ * })
747
+ * ```
223
748
  */
224
749
  addOnlineKeyRegistration(params) {
225
750
  this.txns.push({ ...params, type: 'keyReg' });
@@ -229,6 +754,30 @@ class TransactionComposer {
229
754
  * Add an offline key registration transaction to the transaction group.
230
755
  * @param params The offline key registration transaction parameters
231
756
  * @returns The composer so you can chain method calls
757
+ * @example Basic example
758
+ * ```typescript
759
+ * composer.addOfflineKeyRegistration({
760
+ * sender: 'SENDERADDRESS',
761
+ * })
762
+ * ```
763
+ * @example Advanced example
764
+ * ```typescript
765
+ * composer.addOfflineKeyRegistration({
766
+ * sender: 'SENDERADDRESS',
767
+ * lease: 'lease',
768
+ * note: 'note',
769
+ * // Use this with caution, it's generally better to use algorand.account.rekeyAccount
770
+ * rekeyTo: 'REKEYTOADDRESS',
771
+ * // You wouldn't normally set this field
772
+ * firstValidRound: 1000n,
773
+ * validityWindow: 10,
774
+ * extraFee: (1000).microAlgo(),
775
+ * staticFee: (1000).microAlgo(),
776
+ * // Max fee doesn't make sense with extraFee AND staticFee
777
+ * // already specified, but here for completeness
778
+ * maxFee: (3000).microAlgo(),
779
+ * })
780
+ * ```
232
781
  */
233
782
  addOfflineKeyRegistration(params) {
234
783
  this.txns.push({ ...params, type: 'keyReg' });
@@ -238,6 +787,12 @@ class TransactionComposer {
238
787
  * Add the transactions within an `AtomicTransactionComposer` to the transaction group.
239
788
  * @param atc The `AtomicTransactionComposer` to build transactions from and add to the group
240
789
  * @returns The composer so you can chain method calls
790
+ * @example
791
+ * ```typescript
792
+ * const atc = new AtomicTransactionComposer()
793
+ * .addPayment({ sender: 'SENDERADDRESS', receiver: 'RECEIVERADDRESS', amount: 1000n })
794
+ * composer.addAtc(atc)
795
+ * ```
241
796
  */
242
797
  addAtc(atc) {
243
798
  this.txns.push({ atc, type: 'atc' });
@@ -643,6 +1198,10 @@ class TransactionComposer {
643
1198
  * Compose all of the transactions without signers and return the transaction objects directly along with any ABI method calls.
644
1199
  *
645
1200
  * @returns The array of built transactions and any corresponding method calls
1201
+ * @example
1202
+ * ```typescript
1203
+ * const { transactions, methodCalls, signers } = await composer.buildTransactions()
1204
+ * ```
646
1205
  */
647
1206
  async buildTransactions() {
648
1207
  const suggestedParams = await this.getSuggestedParams();
@@ -676,6 +1235,7 @@ class TransactionComposer {
676
1235
  }
677
1236
  /**
678
1237
  * Get the number of transactions currently added to this composer.
1238
+ * @returns The number of transactions currently added to this composer
679
1239
  */
680
1240
  async count() {
681
1241
  return (await this.buildTransactions()).transactions.length;
@@ -687,7 +1247,11 @@ class TransactionComposer {
687
1247
  *
688
1248
  * Once this method is called, no further transactions will be able to be added.
689
1249
  * You can safely call this method multiple times to get the same result.
690
- * @returns The built atomic transaction composer and the transactions
1250
+ * @returns The built atomic transaction composer, the transactions and any corresponding method calls
1251
+ * @example
1252
+ * ```typescript
1253
+ * const { atc, transactions, methodCalls } = await composer.build()
1254
+ * ```
691
1255
  */
692
1256
  async build() {
693
1257
  if (this.atc.getStatus() === algosdk.AtomicTransactionComposerStatus.BUILDING) {
@@ -717,6 +1281,10 @@ class TransactionComposer {
717
1281
  * Rebuild the group, discarding any previously built transactions.
718
1282
  * This will potentially cause new signers and suggested params to be used if the callbacks return a new value compared to the first build.
719
1283
  * @returns The newly built atomic transaction composer and the transactions
1284
+ * @example
1285
+ * ```typescript
1286
+ * const { atc, transactions, methodCalls } = await composer.rebuild()
1287
+ * ```
720
1288
  */
721
1289
  async rebuild() {
722
1290
  this.atc = new algosdk.AtomicTransactionComposer();
@@ -726,6 +1294,12 @@ class TransactionComposer {
726
1294
  * Compose the atomic transaction group and send it to the network.
727
1295
  * @param params The parameters to control execution with
728
1296
  * @returns The execution result
1297
+ * @example
1298
+ * ```typescript
1299
+ * const result = await composer.send({
1300
+ * populateAppCallResources: true,
1301
+ * })
1302
+ * ```
729
1303
  */
730
1304
  async send(params) {
731
1305
  const group = (await this.build()).transactions;