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