@algorandfoundation/algokit-utils 7.0.0-beta.6 → 7.0.0-beta.7

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 (98) hide show
  1. package/app.d.ts +6 -6
  2. package/app.js +6 -6
  3. package/app.js.map +1 -1
  4. package/app.mjs +6 -6
  5. package/app.mjs.map +1 -1
  6. package/asset.d.ts +3 -3
  7. package/asset.js +3 -3
  8. package/asset.js.map +1 -1
  9. package/asset.mjs +3 -3
  10. package/asset.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/testing/fixtures/algorand-fixture.js +1 -1
  13. package/testing/fixtures/algorand-fixture.js.map +1 -1
  14. package/testing/fixtures/algorand-fixture.mjs +1 -1
  15. package/testing/fixtures/algorand-fixture.mjs.map +1 -1
  16. package/transaction/legacy-bridge.d.ts +3 -3
  17. package/transaction/legacy-bridge.js.map +1 -1
  18. package/transaction/legacy-bridge.mjs.map +1 -1
  19. package/transaction/transaction.d.ts +1 -3
  20. package/transaction/transaction.js +17 -11
  21. package/transaction/transaction.js.map +1 -1
  22. package/transaction/transaction.mjs +17 -11
  23. package/transaction/transaction.mjs.map +1 -1
  24. package/transfer/transfer-algos.d.ts +1 -1
  25. package/transfer/transfer-algos.js +1 -1
  26. package/transfer/transfer-algos.js.map +1 -1
  27. package/transfer/transfer-algos.mjs +1 -1
  28. package/transfer/transfer-algos.mjs.map +1 -1
  29. package/transfer/transfer.d.ts +1 -1
  30. package/transfer/transfer.js +1 -1
  31. package/transfer/transfer.js.map +1 -1
  32. package/transfer/transfer.mjs +1 -1
  33. package/transfer/transfer.mjs.map +1 -1
  34. package/types/account-manager.d.ts +13 -4
  35. package/types/account-manager.js +17 -3
  36. package/types/account-manager.js.map +1 -1
  37. package/types/account-manager.mjs +17 -3
  38. package/types/account-manager.mjs.map +1 -1
  39. package/types/algorand-client-interface.d.ts +1 -1
  40. package/types/algorand-client-transaction-creator.d.ts +30 -30
  41. package/types/algorand-client-transaction-creator.js +30 -30
  42. package/types/algorand-client-transaction-creator.js.map +1 -1
  43. package/types/algorand-client-transaction-creator.mjs +30 -30
  44. package/types/algorand-client-transaction-creator.mjs.map +1 -1
  45. package/types/algorand-client-transaction-sender.d.ts +18 -18
  46. package/types/algorand-client-transaction-sender.js +1 -1
  47. package/types/algorand-client-transaction-sender.js.map +1 -1
  48. package/types/algorand-client-transaction-sender.mjs +1 -1
  49. package/types/algorand-client-transaction-sender.mjs.map +1 -1
  50. package/types/algorand-client.d.ts +8 -8
  51. package/types/algorand-client.js +8 -8
  52. package/types/algorand-client.js.map +1 -1
  53. package/types/algorand-client.mjs +8 -8
  54. package/types/algorand-client.mjs.map +1 -1
  55. package/types/app-arc56.d.ts +60 -37
  56. package/types/app-arc56.js +37 -16
  57. package/types/app-arc56.js.map +1 -1
  58. package/types/app-arc56.mjs +37 -16
  59. package/types/app-arc56.mjs.map +1 -1
  60. package/types/app-client.d.ts +101 -78
  61. package/types/app-client.js +145 -84
  62. package/types/app-client.js.map +1 -1
  63. package/types/app-client.mjs +145 -84
  64. package/types/app-client.mjs.map +1 -1
  65. package/types/app-deployer.d.ts +2 -2
  66. package/types/app-deployer.js +24 -24
  67. package/types/app-deployer.js.map +1 -1
  68. package/types/app-deployer.mjs +24 -24
  69. package/types/app-deployer.mjs.map +1 -1
  70. package/types/app-factory.d.ts +141 -86
  71. package/types/app-factory.js +106 -34
  72. package/types/app-factory.js.map +1 -1
  73. package/types/app-factory.mjs +107 -35
  74. package/types/app-factory.mjs.map +1 -1
  75. package/types/app-spec.js +15 -9
  76. package/types/app-spec.js.map +1 -1
  77. package/types/app-spec.mjs +15 -9
  78. package/types/app-spec.mjs.map +1 -1
  79. package/types/asset-manager.d.ts +3 -3
  80. package/types/asset-manager.js +2 -2
  81. package/types/asset-manager.js.map +1 -1
  82. package/types/asset-manager.mjs +2 -2
  83. package/types/asset-manager.mjs.map +1 -1
  84. package/types/client-manager.d.ts +30 -8
  85. package/types/client-manager.js +6 -0
  86. package/types/client-manager.js.map +1 -1
  87. package/types/client-manager.mjs +6 -0
  88. package/types/client-manager.mjs.map +1 -1
  89. package/types/composer.d.ts +29 -4
  90. package/types/composer.js +24 -7
  91. package/types/composer.js.map +1 -1
  92. package/types/composer.mjs +24 -7
  93. package/types/composer.mjs.map +1 -1
  94. package/types/kmd-account-manager.js +1 -1
  95. package/types/kmd-account-manager.js.map +1 -1
  96. package/types/kmd-account-manager.mjs +1 -1
  97. package/types/kmd-account-manager.mjs.map +1 -1
  98. package/types/transaction.d.ts +4 -6
@@ -59,10 +59,19 @@ class AppClient {
59
59
  this._boxStateMethods = this.getBoxMethods();
60
60
  this._paramsMethods = {
61
61
  ...this.getMethodCallParamsMethods(),
62
+ /** Get parameters to define bare (raw) transactions to the current app */
62
63
  bare: this.getBareParamsMethods(),
63
64
  };
64
- this._transactionsMethods = { ...this.getMethodCallTransactionsMethods(), bare: this.getBareTransactionsMethods() };
65
- this._sendMethods = { ...this.getMethodCallSendMethods(), bare: this.getBareSendMethods() };
65
+ this._createTransactionsMethods = {
66
+ ...this.getMethodCallCreateTransactionMethods(),
67
+ /** Get transactions for bare (raw) calls to the current app */
68
+ bare: this.getBareCreateTransactionMethods(),
69
+ };
70
+ this._sendMethods = {
71
+ ...this.getMethodCallSendMethods(),
72
+ /** Send bare (raw) transactions to the current app */
73
+ bare: this.getBareSendMethods(),
74
+ };
66
75
  }
67
76
  /** Start a new `AlgoKitComposer` transaction group */
68
77
  newGroup() {
@@ -138,18 +147,33 @@ class AppClient {
138
147
  get appSpec() {
139
148
  return this._appSpec;
140
149
  }
141
- /** Get parameters to define transactions to the current app */
150
+ /** Get parameters to create transactions for the current app.
151
+ *
152
+ * A good mental model for this is that these parameters represent a deferred transaction creation.
153
+ * @example Create a transaction in the future using Algorand Client
154
+ * ```typescript
155
+ * const myMethodCall = appClient.params.call({method: 'my_method', args: [123, 'hello']})
156
+ * // ...
157
+ * await algorand.send.AppMethodCall(myMethodCall)
158
+ * ```
159
+ * @example Define a nested transaction as an ABI argument
160
+ * ```typescript
161
+ * const myMethodCall = appClient.params.call({method: 'my_method', args: [123, 'hello']})
162
+ * await appClient.send.call({method: 'my_method2', args: [myMethodCall]})
163
+ * ```
164
+ */
142
165
  get params() {
143
166
  return this._paramsMethods;
144
167
  }
145
- /** Get transactions for the current app */
146
- get transactions() {
147
- return this._transactionsMethods;
168
+ /** Create transactions for the current app */
169
+ get createTransaction() {
170
+ return this._createTransactionsMethods;
148
171
  }
149
- /** Send calls to the current app */
172
+ /** Send transactions to the current app */
150
173
  get send() {
151
174
  return this._sendMethods;
152
175
  }
176
+ /** Get state (local, global, box) from the current app */
153
177
  get state() {
154
178
  return {
155
179
  /**
@@ -169,6 +193,8 @@ class AppClient {
169
193
  }
170
194
  /**
171
195
  * Funds Algo into the app account for this app.
196
+ *
197
+ * An alias for `appClient.send.fundAppAccount(params)`.
172
198
  * @param params The parameters for the funding transaction
173
199
  * @returns The result of the funding
174
200
  */
@@ -281,7 +307,7 @@ class AppClient {
281
307
  this._clearSourceMap = new SourceMap(sourceMaps.clearSourceMap);
282
308
  }
283
309
  /**
284
- * Returns the ABI Method for the given method name string for the app represented by this application client instance
310
+ * Returns the ABI Method spec for the given method string for the app represented by this application client instance
285
311
  * @param methodNameOrSignature The method name or method signature to call if an ABI call is being emitted.
286
312
  * e.g. `my_method` or `my_method(unit64,string)bytes`
287
313
  * @returns A tuple with: [ARC-56 `Method`, algosdk `ABIMethod`]
@@ -291,18 +317,37 @@ class AppClient {
291
317
  }
292
318
  /**
293
319
  * Checks for decode errors on the SendAppTransactionResult and maps the return value to the specified type
294
- * on the ARC-56 method.
320
+ * on the ARC-56 method, replacing the `return` property with the decoded type.
295
321
  *
296
- * If the return type is a struct then the struct will be returned.
322
+ * If the return type is an ARC-56 struct then the struct will be returned.
297
323
  *
298
324
  * @param result The SendAppTransactionResult to be mapped
299
325
  * @param method The method that was called
300
326
  * @returns The smart contract response with an updated return value
301
327
  */
302
- async parseMethodCallReturn(result, method) {
328
+ async processMethodCallReturn(result, method) {
303
329
  const resultValue = await result;
304
330
  return { ...resultValue, return: types_appArc56.getArc56ReturnValue(resultValue.return, method, this._appSpec.structs) };
305
331
  }
332
+ /**
333
+ * Compiles the approval and clear state programs (if TEAL templates provided),
334
+ * performing any provided deploy-time parameter replacement and stores
335
+ * the source maps.
336
+ *
337
+ * If no TEAL templates provided it will use any byte code provided in the app spec.
338
+ *
339
+ * Will store any generated source maps for later use in debugging.
340
+ */
341
+ async compile(compilation) {
342
+ const result = await AppClient.compile(this._appSpec, this._algorand.app, compilation);
343
+ if (result.compiledApproval) {
344
+ this._approvalSourceMap = result.compiledApproval.sourceMap;
345
+ }
346
+ if (result.compiledClear) {
347
+ this._clearSourceMap = result.compiledClear.sourceMap;
348
+ }
349
+ return result;
350
+ }
306
351
  /**
307
352
  * Takes an error that may include a logic error from a call to the current app and re-exposes the
308
353
  * error to include source code information via the source map and ARC-56 spec.
@@ -351,7 +396,9 @@ class AppClient {
351
396
  }
352
397
  return {
353
398
  approvalProgram: buffer.Buffer.from(appSpec.byteCode.approval, 'base64'),
399
+ compiledApproval: undefined,
354
400
  clearStateProgram: buffer.Buffer.from(appSpec.byteCode.clear, 'base64'),
401
+ compiledClear: undefined,
355
402
  };
356
403
  }
357
404
  const approvalTemplate = buffer.Buffer.from(appSpec.source.approval, 'base64').toString('utf-8');
@@ -384,24 +431,53 @@ class AppClient {
384
431
  * @param methodNameOrSignature The method name or method signature to call if an ABI call is being emitted.
385
432
  * e.g. `my_method` or `my_method(unit64,string)bytes`
386
433
  * @param args The arguments to the method with `undefined` for any that should be populated with a default value
387
- * @param appSpec The app spec for the app
388
434
  */
389
- static getABIArgsWithDefaultValues(methodNameOrSignature, args, appSpec) {
390
- const m = types_appArc56.getArc56Method(methodNameOrSignature, appSpec);
391
- return args?.map((a, i) => {
435
+ async getABIArgsWithDefaultValues(methodNameOrSignature, args, sender) {
436
+ const m = types_appArc56.getArc56Method(methodNameOrSignature, this._appSpec);
437
+ return await Promise.all(args?.map(async (a, i) => {
392
438
  const arg = m.args[i];
393
439
  if (a !== undefined) {
394
440
  // If a struct then convert to tuple for the underlying call
395
441
  return arg.struct && typeof a === 'object' && !Array.isArray(a)
396
- ? types_appArc56.getABITupleFromABIStruct(a, appSpec.structs[arg.struct])
442
+ ? types_appArc56.getABITupleFromABIStruct(a, this._appSpec.structs[arg.struct], this._appSpec.structs)
397
443
  : a;
398
444
  }
399
- // todo: expand this to match previous ApplicationClient implementation when ARC-56 spec is updated to support other default value options
400
445
  const defaultValue = arg.defaultValue;
401
- if (defaultValue)
402
- return types_appArc56.getABIDecodedValue(buffer.Buffer.from(defaultValue, 'base64'), m.method.args[i].type, {});
446
+ if (defaultValue) {
447
+ switch (defaultValue.source) {
448
+ case 'literal':
449
+ if (typeof defaultValue.data === 'number')
450
+ return defaultValue.data;
451
+ return types_appArc56.getABIDecodedValue(buffer.Buffer.from(defaultValue.data, 'base64'), m.method.args[i].defaultValue?.type ?? m.method.args[i].type, this._appSpec.structs);
452
+ // todo: When ARC-56 supports ABI calls as default args
453
+ // case 'abi': {
454
+ // const method = this.getABIMethod(defaultValue.data as string)
455
+ // const result = await this.send.call({
456
+ // method: defaultValue.data as string,
457
+ // methodArgs: method.args.map(() => undefined),
458
+ // sender,
459
+ // })
460
+ // return result.return!
461
+ // }
462
+ case 'local':
463
+ case 'global': {
464
+ const state = defaultValue.source === 'global' ? await this.getGlobalState() : await this.getLocalState(sender);
465
+ const value = Object.values(state).find((s) => s.keyBase64 === defaultValue.data);
466
+ if (!value) {
467
+ throw new Error(`Preparing default value for argument ${arg.name ?? `arg${i + 1}`} resulted in the failure: The key '${defaultValue.data}' could not be found in ${defaultValue.source} storage`);
468
+ }
469
+ return 'valueRaw' in value
470
+ ? types_appArc56.getABIDecodedValue(value.valueRaw, m.method.args[i].defaultValue?.type ?? m.method.args[i].type, this._appSpec.structs)
471
+ : value.value;
472
+ }
473
+ case 'box': {
474
+ const value = await this.getBoxValue(buffer.Buffer.from(defaultValue.data, 'base64'));
475
+ return types_appArc56.getABIDecodedValue(value, m.method.args[i].defaultValue?.type ?? m.method.args[i].type, this._appSpec.structs);
476
+ }
477
+ }
478
+ }
403
479
  throw new Error(`No value provided for required argument ${arg.name ?? `arg${i + 1}`} in call to method ${m.name}`);
404
- });
480
+ }) ?? []);
405
481
  }
406
482
  getBareParamsMethods() {
407
483
  return {
@@ -434,31 +510,31 @@ class AppClient {
434
510
  },
435
511
  };
436
512
  }
437
- getBareTransactionsMethods() {
513
+ getBareCreateTransactionMethods() {
438
514
  return {
439
515
  /** Returns a transaction for an update call, including deploy-time TEAL template replacements and compilation if provided */
440
516
  update: async (params) => {
441
- return this._algorand.transactions.appUpdate(await this.params.bare.update(params));
517
+ return this._algorand.createTransaction.appUpdate(await this.params.bare.update(params));
442
518
  },
443
519
  /** Returns a transaction for an opt-in call */
444
520
  optIn: (params) => {
445
- return this._algorand.transactions.appCall(this.params.bare.optIn(params));
521
+ return this._algorand.createTransaction.appCall(this.params.bare.optIn(params));
446
522
  },
447
523
  /** Returns a transaction for a delete call */
448
524
  delete: (params) => {
449
- return this._algorand.transactions.appDelete(this.params.bare.delete(params));
525
+ return this._algorand.createTransaction.appDelete(this.params.bare.delete(params));
450
526
  },
451
527
  /** Returns a transaction for a clear state call */
452
528
  clearState: (params) => {
453
- return this._algorand.transactions.appCall(this.params.bare.clearState(params));
529
+ return this._algorand.createTransaction.appCall(this.params.bare.clearState(params));
454
530
  },
455
531
  /** Returns a transaction for a close out call */
456
532
  closeOut: (params) => {
457
- return this._algorand.transactions.appCall(this.params.bare.closeOut(params));
533
+ return this._algorand.createTransaction.appCall(this.params.bare.closeOut(params));
458
534
  },
459
535
  /** Returns a transaction for a call (defaults to no-op) */
460
536
  call: (params) => {
461
- return this._algorand.transactions.appCall(this.params.bare.call(params));
537
+ return this._algorand.createTransaction.appCall(this.params.bare.call(params));
462
538
  },
463
539
  };
464
540
  }
@@ -502,26 +578,26 @@ class AppClient {
502
578
  },
503
579
  /** Return params for an update ABI call, including deploy-time TEAL template replacements and compilation if provided */
504
580
  update: async (params) => {
505
- return this.getABIParams({
581
+ return (await this.getABIParams({
506
582
  ...params,
507
583
  ...(await this.compile(params)),
508
- }, OnApplicationComplete.UpdateApplicationOC);
584
+ }, OnApplicationComplete.UpdateApplicationOC));
509
585
  },
510
586
  /** Return params for an opt-in ABI call */
511
- optIn: (params) => {
512
- return this.getABIParams(params, OnApplicationComplete.OptInOC);
587
+ optIn: async (params) => {
588
+ return (await this.getABIParams(params, OnApplicationComplete.OptInOC));
513
589
  },
514
590
  /** Return params for an delete ABI call */
515
- delete: (params) => {
516
- return this.getABIParams(params, OnApplicationComplete.DeleteApplicationOC);
591
+ delete: async (params) => {
592
+ return (await this.getABIParams(params, OnApplicationComplete.DeleteApplicationOC));
517
593
  },
518
594
  /** Return params for an close out ABI call */
519
- closeOut: (params) => {
520
- return this.getABIParams(params, OnApplicationComplete.CloseOutOC);
595
+ closeOut: async (params) => {
596
+ return (await this.getABIParams(params, OnApplicationComplete.CloseOutOC));
521
597
  },
522
598
  /** Return params for an ABI call */
523
- call: (params) => {
524
- return this.getABIParams(params, params.onComplete ?? OnApplicationComplete.NoOpOC);
599
+ call: async (params) => {
600
+ return (await this.getABIParams(params, params.onComplete ?? OnApplicationComplete.NoOpOC));
525
601
  },
526
602
  };
527
603
  }
@@ -537,7 +613,7 @@ class AppClient {
537
613
  update: async (params) => {
538
614
  const compiled = await this.compile(params);
539
615
  return {
540
- ...(await this.handleCallErrors(async () => this.parseMethodCallReturn(this._algorand.send.appUpdateMethodCall(await this.params.update({ ...params })), types_appArc56.getArc56Method(params.method, this._appSpec)))),
616
+ ...(await this.handleCallErrors(async () => this.processMethodCallReturn(this._algorand.send.appUpdateMethodCall(await this.params.update({ ...params })), types_appArc56.getArc56Method(params.method, this._appSpec)))),
541
617
  ...compiled,
542
618
  };
543
619
  },
@@ -545,19 +621,19 @@ class AppClient {
545
621
  * Sign and send transactions for an opt-in ABI call
546
622
  */
547
623
  optIn: (params) => {
548
- return this.handleCallErrors(() => this.parseMethodCallReturn(this._algorand.send.appCallMethodCall(this.params.optIn(params)), types_appArc56.getArc56Method(params.method, this._appSpec)));
624
+ return this.handleCallErrors(async () => this.processMethodCallReturn(this._algorand.send.appCallMethodCall(await this.params.optIn(params)), types_appArc56.getArc56Method(params.method, this._appSpec)));
549
625
  },
550
626
  /**
551
627
  * Sign and send transactions for a delete ABI call
552
628
  */
553
629
  delete: (params) => {
554
- return this.handleCallErrors(() => this.parseMethodCallReturn(this._algorand.send.appDeleteMethodCall(this.params.delete(params)), types_appArc56.getArc56Method(params.method, this._appSpec)));
630
+ return this.handleCallErrors(async () => this.processMethodCallReturn(this._algorand.send.appDeleteMethodCall(await this.params.delete(params)), types_appArc56.getArc56Method(params.method, this._appSpec)));
555
631
  },
556
632
  /**
557
633
  * Sign and send transactions for a close out ABI call
558
634
  */
559
635
  closeOut: (params) => {
560
- return this.handleCallErrors(() => this.parseMethodCallReturn(this._algorand.send.appCallMethodCall(this.params.closeOut(params)), types_appArc56.getArc56Method(params.method, this._appSpec)));
636
+ return this.handleCallErrors(async () => this.processMethodCallReturn(this._algorand.send.appCallMethodCall(await this.params.closeOut(params)), types_appArc56.getArc56Method(params.method, this._appSpec)));
561
637
  },
562
638
  /**
563
639
  * Sign and send transactions for a call (defaults to no-op)
@@ -566,8 +642,11 @@ class AppClient {
566
642
  // Read-only call - do it via simulate
567
643
  if (params.onComplete === OnApplicationComplete.NoOpOC ||
568
644
  (!params.onComplete && types_appArc56.getArc56Method(params.method, this._appSpec).method.readonly)) {
569
- const result = await this._algorand.newGroup().addAppCallMethodCall(this.params.call(params)).simulate();
570
- return this.parseMethodCallReturn({
645
+ const result = await this._algorand
646
+ .newGroup()
647
+ .addAppCallMethodCall(await this.params.call(params))
648
+ .simulate();
649
+ return this.processMethodCallReturn({
571
650
  ...result,
572
651
  transaction: result.transactions.at(-1),
573
652
  confirmation: result.confirmations.at(-1),
@@ -575,67 +654,48 @@ class AppClient {
575
654
  return: (result.returns?.length ?? 0 > 0) ? result.returns?.at(-1) : undefined,
576
655
  }, types_appArc56.getArc56Method(params.method, this._appSpec));
577
656
  }
578
- return this.handleCallErrors(() => this.parseMethodCallReturn(this._algorand.send.appCallMethodCall(this.params.call(params)), types_appArc56.getArc56Method(params.method, this._appSpec)));
657
+ return this.handleCallErrors(async () => this.processMethodCallReturn(this._algorand.send.appCallMethodCall(await this.params.call(params)), types_appArc56.getArc56Method(params.method, this._appSpec)));
579
658
  },
580
659
  };
581
660
  }
582
- getMethodCallTransactionsMethods() {
661
+ getMethodCallCreateTransactionMethods() {
583
662
  return {
584
663
  /** Return transaction for a payment transaction to fund the app account */
585
664
  fundAppAccount: (params) => {
586
- return this._algorand.transactions.payment(this.params.fundAppAccount(params));
665
+ return this._algorand.createTransaction.payment(this.params.fundAppAccount(params));
587
666
  },
588
667
  /**
589
668
  * Return transactions for an update ABI call, including deploy-time TEAL template replacements and compilation if provided
590
669
  */
591
670
  update: async (params) => {
592
- return this._algorand.transactions.appUpdateMethodCall(await this.params.update(params));
671
+ return this._algorand.createTransaction.appUpdateMethodCall(await this.params.update(params));
593
672
  },
594
673
  /**
595
674
  * Return transactions for an opt-in ABI call
596
675
  */
597
- optIn: (params) => {
598
- return this._algorand.transactions.appCallMethodCall(this.params.optIn(params));
676
+ optIn: async (params) => {
677
+ return this._algorand.createTransaction.appCallMethodCall(await this.params.optIn(params));
599
678
  },
600
679
  /**
601
680
  * Return transactions for a delete ABI call
602
681
  */
603
- delete: (params) => {
604
- return this._algorand.transactions.appDeleteMethodCall(this.params.delete(params));
682
+ delete: async (params) => {
683
+ return this._algorand.createTransaction.appDeleteMethodCall(await this.params.delete(params));
605
684
  },
606
685
  /**
607
686
  * Return transactions for a close out ABI call
608
687
  */
609
- closeOut: (params) => {
610
- return this._algorand.transactions.appCallMethodCall(this.params.closeOut(params));
688
+ closeOut: async (params) => {
689
+ return this._algorand.createTransaction.appCallMethodCall(await this.params.closeOut(params));
611
690
  },
612
691
  /**
613
692
  * Return transactions for an ABI call (defaults to no-op)
614
693
  */
615
- call: (params) => {
616
- return this._algorand.transactions.appCallMethodCall(this.params.call(params));
694
+ call: async (params) => {
695
+ return this._algorand.createTransaction.appCallMethodCall(await this.params.call(params));
617
696
  },
618
697
  };
619
698
  }
620
- /**
621
- * Compiles the approval and clear state programs (if TEAL templates provided),
622
- * performing any provided deploy-time parameter replacement and stores
623
- * the source maps.
624
- *
625
- * If no TEAL templates provided it will use any byte code provided in the app spec.
626
- *
627
- * Will store any generated source maps for later use in debugging.
628
- */
629
- async compile(compilation) {
630
- const result = await AppClient.compile(this._appSpec, this._algorand.app, compilation);
631
- if (result.compiledApproval) {
632
- this._approvalSourceMap = result.compiledApproval.sourceMap;
633
- }
634
- if (result.compiledClear) {
635
- this._clearSourceMap = result.compiledClear.sourceMap;
636
- }
637
- return result;
638
- }
639
699
  /** Returns the sender for a call, using the `defaultSender`
640
700
  * if none provided and throws an error if neither provided */
641
701
  getSender(sender) {
@@ -652,13 +712,14 @@ class AppClient {
652
712
  onComplete,
653
713
  };
654
714
  }
655
- getABIParams(params, onComplete) {
715
+ async getABIParams(params, onComplete) {
716
+ const sender = this.getSender(params.sender);
656
717
  const method = types_appArc56.getArc56Method(params.method, this._appSpec);
657
- const args = AppClient.getABIArgsWithDefaultValues(params.method, params.args, this._appSpec);
718
+ const args = await this.getABIArgsWithDefaultValues(params.method, params.args, sender);
658
719
  return {
659
720
  ...params,
660
721
  appId: this._appId,
661
- sender: this.getSender(params.sender),
722
+ sender: sender,
662
723
  method,
663
724
  onComplete,
664
725
  args,
@@ -1038,7 +1099,7 @@ class ApplicationClient {
1038
1099
  }
1039
1100
  }
1040
1101
  /**
1041
- * @deprecated Use `appClient.send.update` or `appClient.transactions.update` from an `AppClient` instance instead.
1102
+ * @deprecated Use `appClient.send.update` or `appClient.createTransaction.update` from an `AppClient` instance instead.
1042
1103
  *
1043
1104
  * Updates the smart contract app.
1044
1105
  * @param update The parameters to update the app with
@@ -1072,7 +1133,7 @@ class ApplicationClient {
1072
1133
  }
1073
1134
  }
1074
1135
  /**
1075
- * @deprecated Use `appClient.send.call` or `appClient.transactions.call` from an `AppClient` instance instead.
1136
+ * @deprecated Use `appClient.send.call` or `appClient.createTransaction.call` from an `AppClient` instance instead.
1076
1137
  *
1077
1138
  * Issues a no_op (normal) call to the app.
1078
1139
  * @param call The call details.
@@ -1107,7 +1168,7 @@ class ApplicationClient {
1107
1168
  return await this.callOfType(call, 'no_op');
1108
1169
  }
1109
1170
  /**
1110
- * @deprecated Use `appClient.send.optIn` or `appClient.transactions.optIn` from an `AppClient` instance instead.
1171
+ * @deprecated Use `appClient.send.optIn` or `appClient.createTransaction.optIn` from an `AppClient` instance instead.
1111
1172
  *
1112
1173
  * Issues a opt_in call to the app.
1113
1174
  * @param call The call details.
@@ -1117,7 +1178,7 @@ class ApplicationClient {
1117
1178
  return await this.callOfType(call, 'opt_in');
1118
1179
  }
1119
1180
  /**
1120
- * @deprecated Use `appClient.send.closeOut` or `appClient.transactions.closeOut` from an `AppClient` instance instead.
1181
+ * @deprecated Use `appClient.send.closeOut` or `appClient.createTransaction.closeOut` from an `AppClient` instance instead.
1121
1182
  *
1122
1183
  * Issues a close_out call to the app.
1123
1184
  * @param call The call details.
@@ -1127,7 +1188,7 @@ class ApplicationClient {
1127
1188
  return await this.callOfType(call, 'close_out');
1128
1189
  }
1129
1190
  /**
1130
- * @deprecated Use `appClient.send.clearState` or `appClient.transactions.clearState` from an `AppClient` instance instead.
1191
+ * @deprecated Use `appClient.send.clearState` or `appClient.createTransaction.clearState` from an `AppClient` instance instead.
1131
1192
  *
1132
1193
  * Issues a clear_state call to the app.
1133
1194
  * @param call The call details.
@@ -1137,7 +1198,7 @@ class ApplicationClient {
1137
1198
  return await this.callOfType(call, 'clear_state');
1138
1199
  }
1139
1200
  /**
1140
- * @deprecated Use `appClient.send.delete` or `appClient.transactions.delete` from an `AppClient` instance instead.
1201
+ * @deprecated Use `appClient.send.delete` or `appClient.createTransaction.delete` from an `AppClient` instance instead.
1141
1202
  *
1142
1203
  * Issues a delete_application call to the app.
1143
1204
  * @param call The call details.
@@ -1147,7 +1208,7 @@ class ApplicationClient {
1147
1208
  return await this.callOfType(call, 'delete_application');
1148
1209
  }
1149
1210
  /**
1150
- * @deprecated Use `appClient.send.call` or `appClient.transactions.call` from an `AppClient` instance instead.
1211
+ * @deprecated Use `appClient.send.call` or `appClient.createTransaction.call` from an `AppClient` instance instead.
1151
1212
  *
1152
1213
  * Issues a call to the app with the given call type.
1153
1214
  * @param call The call details.