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

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 (101) 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 +123 -132
  61. package/types/app-client.js +165 -94
  62. package/types/app-client.js.map +1 -1
  63. package/types/app-client.mjs +165 -94
  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 +116 -246
  71. package/types/app-factory.js +120 -39
  72. package/types/app-factory.js.map +1 -1
  73. package/types/app-factory.mjs +121 -40
  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/app.d.ts +1 -1
  80. package/types/app.js.map +1 -1
  81. package/types/app.mjs.map +1 -1
  82. package/types/asset-manager.d.ts +3 -3
  83. package/types/asset-manager.js +2 -2
  84. package/types/asset-manager.js.map +1 -1
  85. package/types/asset-manager.mjs +2 -2
  86. package/types/asset-manager.mjs.map +1 -1
  87. package/types/client-manager.d.ts +30 -8
  88. package/types/client-manager.js +6 -0
  89. package/types/client-manager.js.map +1 -1
  90. package/types/client-manager.mjs +6 -0
  91. package/types/client-manager.mjs.map +1 -1
  92. package/types/composer.d.ts +29 -4
  93. package/types/composer.js +24 -7
  94. package/types/composer.js.map +1 -1
  95. package/types/composer.mjs +24 -7
  96. package/types/composer.mjs.map +1 -1
  97. package/types/kmd-account-manager.js +1 -1
  98. package/types/kmd-account-manager.js.map +1 -1
  99. package/types/kmd-account-manager.mjs +1 -1
  100. package/types/kmd-account-manager.mjs.map +1 -1
  101. 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.approvalProgramCompilationResult) {
344
+ this._approvalSourceMap = result.approvalProgramCompilationResult.sourceMap;
345
+ }
346
+ if (result.clearStateProgramCompilationResult) {
347
+ this._clearSourceMap = result.clearStateProgramCompilationResult.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.
@@ -355,25 +400,25 @@ class AppClient {
355
400
  };
356
401
  }
357
402
  const approvalTemplate = buffer.Buffer.from(appSpec.source.approval, 'base64').toString('utf-8');
358
- const compiledApproval = await appManager.compileTealTemplate(approvalTemplate, deployTimeParams, {
403
+ const approvalProgramCompilationResult = await appManager.compileTealTemplate(approvalTemplate, deployTimeParams, {
359
404
  updatable,
360
405
  deletable,
361
406
  });
362
407
  const clearTemplate = buffer.Buffer.from(appSpec.source.clear, 'base64').toString('utf-8');
363
- const compiledClear = await appManager.compileTealTemplate(clearTemplate, deployTimeParams);
408
+ const clearStateProgramCompilationResult = await appManager.compileTealTemplate(clearTemplate, deployTimeParams);
364
409
  if (config.Config.debug) {
365
410
  await config.Config.events.emitAsync(types_asyncEventEmitter.EventType.AppCompiled, {
366
411
  sources: [
367
- { compiledTeal: compiledApproval, appName: appSpec.name, fileName: 'approval' },
368
- { compiledTeal: compiledClear, appName: appSpec.name, fileName: 'clear' },
412
+ { compiledTeal: approvalProgramCompilationResult, appName: appSpec.name, fileName: 'approval' },
413
+ { compiledTeal: clearStateProgramCompilationResult, appName: appSpec.name, fileName: 'clear' },
369
414
  ],
370
415
  });
371
416
  }
372
417
  return {
373
- approvalProgram: compiledApproval.compiledBase64ToBytes,
374
- compiledApproval,
375
- clearStateProgram: compiledClear.compiledBase64ToBytes,
376
- compiledClear,
418
+ approvalProgram: approvalProgramCompilationResult.compiledBase64ToBytes,
419
+ approvalProgramCompilationResult,
420
+ clearStateProgram: clearStateProgramCompilationResult.compiledBase64ToBytes,
421
+ clearStateProgramCompilationResult,
377
422
  };
378
423
  }
379
424
  /**
@@ -384,24 +429,53 @@ class AppClient {
384
429
  * @param methodNameOrSignature The method name or method signature to call if an ABI call is being emitted.
385
430
  * e.g. `my_method` or `my_method(unit64,string)bytes`
386
431
  * @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
432
  */
389
- static getABIArgsWithDefaultValues(methodNameOrSignature, args, appSpec) {
390
- const m = types_appArc56.getArc56Method(methodNameOrSignature, appSpec);
391
- return args?.map((a, i) => {
433
+ async getABIArgsWithDefaultValues(methodNameOrSignature, args, sender) {
434
+ const m = types_appArc56.getArc56Method(methodNameOrSignature, this._appSpec);
435
+ return await Promise.all(args?.map(async (a, i) => {
392
436
  const arg = m.args[i];
393
437
  if (a !== undefined) {
394
438
  // If a struct then convert to tuple for the underlying call
395
439
  return arg.struct && typeof a === 'object' && !Array.isArray(a)
396
- ? types_appArc56.getABITupleFromABIStruct(a, appSpec.structs[arg.struct])
440
+ ? types_appArc56.getABITupleFromABIStruct(a, this._appSpec.structs[arg.struct], this._appSpec.structs)
397
441
  : a;
398
442
  }
399
- // todo: expand this to match previous ApplicationClient implementation when ARC-56 spec is updated to support other default value options
400
443
  const defaultValue = arg.defaultValue;
401
- if (defaultValue)
402
- return types_appArc56.getABIDecodedValue(buffer.Buffer.from(defaultValue, 'base64'), m.method.args[i].type, {});
444
+ if (defaultValue) {
445
+ switch (defaultValue.source) {
446
+ case 'literal':
447
+ if (typeof defaultValue.data === 'number')
448
+ return defaultValue.data;
449
+ return types_appArc56.getABIDecodedValue(buffer.Buffer.from(defaultValue.data, 'base64'), m.method.args[i].defaultValue?.type ?? m.method.args[i].type, this._appSpec.structs);
450
+ // todo: When ARC-56 supports ABI calls as default args
451
+ // case 'abi': {
452
+ // const method = this.getABIMethod(defaultValue.data as string)
453
+ // const result = await this.send.call({
454
+ // method: defaultValue.data as string,
455
+ // methodArgs: method.args.map(() => undefined),
456
+ // sender,
457
+ // })
458
+ // return result.return!
459
+ // }
460
+ case 'local':
461
+ case 'global': {
462
+ const state = defaultValue.source === 'global' ? await this.getGlobalState() : await this.getLocalState(sender);
463
+ const value = Object.values(state).find((s) => s.keyBase64 === defaultValue.data);
464
+ if (!value) {
465
+ 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`);
466
+ }
467
+ return 'valueRaw' in value
468
+ ? types_appArc56.getABIDecodedValue(value.valueRaw, m.method.args[i].defaultValue?.type ?? m.method.args[i].type, this._appSpec.structs)
469
+ : value.value;
470
+ }
471
+ case 'box': {
472
+ const value = await this.getBoxValue(buffer.Buffer.from(defaultValue.data, 'base64'));
473
+ return types_appArc56.getABIDecodedValue(value, m.method.args[i].defaultValue?.type ?? m.method.args[i].type, this._appSpec.structs);
474
+ }
475
+ }
476
+ }
403
477
  throw new Error(`No value provided for required argument ${arg.name ?? `arg${i + 1}`} in call to method ${m.name}`);
404
- });
478
+ }) ?? []);
405
479
  }
406
480
  getBareParamsMethods() {
407
481
  return {
@@ -434,31 +508,31 @@ class AppClient {
434
508
  },
435
509
  };
436
510
  }
437
- getBareTransactionsMethods() {
511
+ getBareCreateTransactionMethods() {
438
512
  return {
439
513
  /** Returns a transaction for an update call, including deploy-time TEAL template replacements and compilation if provided */
440
514
  update: async (params) => {
441
- return this._algorand.transactions.appUpdate(await this.params.bare.update(params));
515
+ return this._algorand.createTransaction.appUpdate(await this.params.bare.update(params));
442
516
  },
443
517
  /** Returns a transaction for an opt-in call */
444
518
  optIn: (params) => {
445
- return this._algorand.transactions.appCall(this.params.bare.optIn(params));
519
+ return this._algorand.createTransaction.appCall(this.params.bare.optIn(params));
446
520
  },
447
521
  /** Returns a transaction for a delete call */
448
522
  delete: (params) => {
449
- return this._algorand.transactions.appDelete(this.params.bare.delete(params));
523
+ return this._algorand.createTransaction.appDelete(this.params.bare.delete(params));
450
524
  },
451
525
  /** Returns a transaction for a clear state call */
452
526
  clearState: (params) => {
453
- return this._algorand.transactions.appCall(this.params.bare.clearState(params));
527
+ return this._algorand.createTransaction.appCall(this.params.bare.clearState(params));
454
528
  },
455
529
  /** Returns a transaction for a close out call */
456
530
  closeOut: (params) => {
457
- return this._algorand.transactions.appCall(this.params.bare.closeOut(params));
531
+ return this._algorand.createTransaction.appCall(this.params.bare.closeOut(params));
458
532
  },
459
533
  /** Returns a transaction for a call (defaults to no-op) */
460
534
  call: (params) => {
461
- return this._algorand.transactions.appCall(this.params.bare.call(params));
535
+ return this._algorand.createTransaction.appCall(this.params.bare.call(params));
462
536
  },
463
537
  };
464
538
  }
@@ -466,7 +540,14 @@ class AppClient {
466
540
  return {
467
541
  /** Signs and sends an update call, including deploy-time TEAL template replacements and compilation if provided */
468
542
  update: async (params) => {
469
- return await this.handleCallErrors(async () => this._algorand.send.appUpdate(await this.params.bare.update(params)));
543
+ const compiled = await this.compile(params);
544
+ return {
545
+ ...(await this.handleCallErrors(async () => this._algorand.send.appUpdate(await this.params.bare.update(params)))),
546
+ ...{
547
+ compiledApproval: compiled.approvalProgramCompilationResult,
548
+ compiledClear: compiled.clearStateProgramCompilationResult,
549
+ },
550
+ };
470
551
  },
471
552
  /** Signs and sends an opt-in call */
472
553
  optIn: (params) => {
@@ -502,26 +583,26 @@ class AppClient {
502
583
  },
503
584
  /** Return params for an update ABI call, including deploy-time TEAL template replacements and compilation if provided */
504
585
  update: async (params) => {
505
- return this.getABIParams({
586
+ return (await this.getABIParams({
506
587
  ...params,
507
588
  ...(await this.compile(params)),
508
- }, OnApplicationComplete.UpdateApplicationOC);
589
+ }, OnApplicationComplete.UpdateApplicationOC));
509
590
  },
510
591
  /** Return params for an opt-in ABI call */
511
- optIn: (params) => {
512
- return this.getABIParams(params, OnApplicationComplete.OptInOC);
592
+ optIn: async (params) => {
593
+ return (await this.getABIParams(params, OnApplicationComplete.OptInOC));
513
594
  },
514
595
  /** Return params for an delete ABI call */
515
- delete: (params) => {
516
- return this.getABIParams(params, OnApplicationComplete.DeleteApplicationOC);
596
+ delete: async (params) => {
597
+ return (await this.getABIParams(params, OnApplicationComplete.DeleteApplicationOC));
517
598
  },
518
599
  /** Return params for an close out ABI call */
519
- closeOut: (params) => {
520
- return this.getABIParams(params, OnApplicationComplete.CloseOutOC);
600
+ closeOut: async (params) => {
601
+ return (await this.getABIParams(params, OnApplicationComplete.CloseOutOC));
521
602
  },
522
603
  /** Return params for an ABI call */
523
- call: (params) => {
524
- return this.getABIParams(params, params.onComplete ?? OnApplicationComplete.NoOpOC);
604
+ call: async (params) => {
605
+ return (await this.getABIParams(params, params.onComplete ?? OnApplicationComplete.NoOpOC));
525
606
  },
526
607
  };
527
608
  }
@@ -537,27 +618,30 @@ class AppClient {
537
618
  update: async (params) => {
538
619
  const compiled = await this.compile(params);
539
620
  return {
540
- ...(await this.handleCallErrors(async () => this.parseMethodCallReturn(this._algorand.send.appUpdateMethodCall(await this.params.update({ ...params })), types_appArc56.getArc56Method(params.method, this._appSpec)))),
541
- ...compiled,
621
+ ...(await this.handleCallErrors(async () => this.processMethodCallReturn(this._algorand.send.appUpdateMethodCall(await this.params.update({ ...params })), types_appArc56.getArc56Method(params.method, this._appSpec)))),
622
+ ...{
623
+ compiledApproval: compiled.approvalProgramCompilationResult,
624
+ compiledClear: compiled.clearStateProgramCompilationResult,
625
+ },
542
626
  };
543
627
  },
544
628
  /**
545
629
  * Sign and send transactions for an opt-in ABI call
546
630
  */
547
631
  optIn: (params) => {
548
- return this.handleCallErrors(() => this.parseMethodCallReturn(this._algorand.send.appCallMethodCall(this.params.optIn(params)), types_appArc56.getArc56Method(params.method, this._appSpec)));
632
+ return this.handleCallErrors(async () => this.processMethodCallReturn(this._algorand.send.appCallMethodCall(await this.params.optIn(params)), types_appArc56.getArc56Method(params.method, this._appSpec)));
549
633
  },
550
634
  /**
551
635
  * Sign and send transactions for a delete ABI call
552
636
  */
553
637
  delete: (params) => {
554
- return this.handleCallErrors(() => this.parseMethodCallReturn(this._algorand.send.appDeleteMethodCall(this.params.delete(params)), types_appArc56.getArc56Method(params.method, this._appSpec)));
638
+ return this.handleCallErrors(async () => this.processMethodCallReturn(this._algorand.send.appDeleteMethodCall(await this.params.delete(params)), types_appArc56.getArc56Method(params.method, this._appSpec)));
555
639
  },
556
640
  /**
557
641
  * Sign and send transactions for a close out ABI call
558
642
  */
559
643
  closeOut: (params) => {
560
- return this.handleCallErrors(() => this.parseMethodCallReturn(this._algorand.send.appCallMethodCall(this.params.closeOut(params)), types_appArc56.getArc56Method(params.method, this._appSpec)));
644
+ return this.handleCallErrors(async () => this.processMethodCallReturn(this._algorand.send.appCallMethodCall(await this.params.closeOut(params)), types_appArc56.getArc56Method(params.method, this._appSpec)));
561
645
  },
562
646
  /**
563
647
  * Sign and send transactions for a call (defaults to no-op)
@@ -566,8 +650,13 @@ class AppClient {
566
650
  // Read-only call - do it via simulate
567
651
  if (params.onComplete === OnApplicationComplete.NoOpOC ||
568
652
  (!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({
653
+ const result = await this._algorand
654
+ .newGroup()
655
+ .addAppCallMethodCall(await this.params.call(params))
656
+ .simulate({
657
+ allowUnnamedResources: params.populateAppCallResources,
658
+ });
659
+ return this.processMethodCallReturn({
571
660
  ...result,
572
661
  transaction: result.transactions.at(-1),
573
662
  confirmation: result.confirmations.at(-1),
@@ -575,67 +664,48 @@ class AppClient {
575
664
  return: (result.returns?.length ?? 0 > 0) ? result.returns?.at(-1) : undefined,
576
665
  }, types_appArc56.getArc56Method(params.method, this._appSpec));
577
666
  }
578
- return this.handleCallErrors(() => this.parseMethodCallReturn(this._algorand.send.appCallMethodCall(this.params.call(params)), types_appArc56.getArc56Method(params.method, this._appSpec)));
667
+ return this.handleCallErrors(async () => this.processMethodCallReturn(this._algorand.send.appCallMethodCall(await this.params.call(params)), types_appArc56.getArc56Method(params.method, this._appSpec)));
579
668
  },
580
669
  };
581
670
  }
582
- getMethodCallTransactionsMethods() {
671
+ getMethodCallCreateTransactionMethods() {
583
672
  return {
584
673
  /** Return transaction for a payment transaction to fund the app account */
585
674
  fundAppAccount: (params) => {
586
- return this._algorand.transactions.payment(this.params.fundAppAccount(params));
675
+ return this._algorand.createTransaction.payment(this.params.fundAppAccount(params));
587
676
  },
588
677
  /**
589
678
  * Return transactions for an update ABI call, including deploy-time TEAL template replacements and compilation if provided
590
679
  */
591
680
  update: async (params) => {
592
- return this._algorand.transactions.appUpdateMethodCall(await this.params.update(params));
681
+ return this._algorand.createTransaction.appUpdateMethodCall(await this.params.update(params));
593
682
  },
594
683
  /**
595
684
  * Return transactions for an opt-in ABI call
596
685
  */
597
- optIn: (params) => {
598
- return this._algorand.transactions.appCallMethodCall(this.params.optIn(params));
686
+ optIn: async (params) => {
687
+ return this._algorand.createTransaction.appCallMethodCall(await this.params.optIn(params));
599
688
  },
600
689
  /**
601
690
  * Return transactions for a delete ABI call
602
691
  */
603
- delete: (params) => {
604
- return this._algorand.transactions.appDeleteMethodCall(this.params.delete(params));
692
+ delete: async (params) => {
693
+ return this._algorand.createTransaction.appDeleteMethodCall(await this.params.delete(params));
605
694
  },
606
695
  /**
607
696
  * Return transactions for a close out ABI call
608
697
  */
609
- closeOut: (params) => {
610
- return this._algorand.transactions.appCallMethodCall(this.params.closeOut(params));
698
+ closeOut: async (params) => {
699
+ return this._algorand.createTransaction.appCallMethodCall(await this.params.closeOut(params));
611
700
  },
612
701
  /**
613
702
  * Return transactions for an ABI call (defaults to no-op)
614
703
  */
615
- call: (params) => {
616
- return this._algorand.transactions.appCallMethodCall(this.params.call(params));
704
+ call: async (params) => {
705
+ return this._algorand.createTransaction.appCallMethodCall(await this.params.call(params));
617
706
  },
618
707
  };
619
708
  }
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
709
  /** Returns the sender for a call, using the `defaultSender`
640
710
  * if none provided and throws an error if neither provided */
641
711
  getSender(sender) {
@@ -652,13 +722,14 @@ class AppClient {
652
722
  onComplete,
653
723
  };
654
724
  }
655
- getABIParams(params, onComplete) {
725
+ async getABIParams(params, onComplete) {
726
+ const sender = this.getSender(params.sender);
656
727
  const method = types_appArc56.getArc56Method(params.method, this._appSpec);
657
- const args = AppClient.getABIArgsWithDefaultValues(params.method, params.args, this._appSpec);
728
+ const args = await this.getABIArgsWithDefaultValues(params.method, params.args, sender);
658
729
  return {
659
730
  ...params,
660
731
  appId: this._appId,
661
- sender: this.getSender(params.sender),
732
+ sender: sender,
662
733
  method,
663
734
  onComplete,
664
735
  args,
@@ -1038,7 +1109,7 @@ class ApplicationClient {
1038
1109
  }
1039
1110
  }
1040
1111
  /**
1041
- * @deprecated Use `appClient.send.update` or `appClient.transactions.update` from an `AppClient` instance instead.
1112
+ * @deprecated Use `appClient.send.update` or `appClient.createTransaction.update` from an `AppClient` instance instead.
1042
1113
  *
1043
1114
  * Updates the smart contract app.
1044
1115
  * @param update The parameters to update the app with
@@ -1072,7 +1143,7 @@ class ApplicationClient {
1072
1143
  }
1073
1144
  }
1074
1145
  /**
1075
- * @deprecated Use `appClient.send.call` or `appClient.transactions.call` from an `AppClient` instance instead.
1146
+ * @deprecated Use `appClient.send.call` or `appClient.createTransaction.call` from an `AppClient` instance instead.
1076
1147
  *
1077
1148
  * Issues a no_op (normal) call to the app.
1078
1149
  * @param call The call details.
@@ -1107,7 +1178,7 @@ class ApplicationClient {
1107
1178
  return await this.callOfType(call, 'no_op');
1108
1179
  }
1109
1180
  /**
1110
- * @deprecated Use `appClient.send.optIn` or `appClient.transactions.optIn` from an `AppClient` instance instead.
1181
+ * @deprecated Use `appClient.send.optIn` or `appClient.createTransaction.optIn` from an `AppClient` instance instead.
1111
1182
  *
1112
1183
  * Issues a opt_in call to the app.
1113
1184
  * @param call The call details.
@@ -1117,7 +1188,7 @@ class ApplicationClient {
1117
1188
  return await this.callOfType(call, 'opt_in');
1118
1189
  }
1119
1190
  /**
1120
- * @deprecated Use `appClient.send.closeOut` or `appClient.transactions.closeOut` from an `AppClient` instance instead.
1191
+ * @deprecated Use `appClient.send.closeOut` or `appClient.createTransaction.closeOut` from an `AppClient` instance instead.
1121
1192
  *
1122
1193
  * Issues a close_out call to the app.
1123
1194
  * @param call The call details.
@@ -1127,7 +1198,7 @@ class ApplicationClient {
1127
1198
  return await this.callOfType(call, 'close_out');
1128
1199
  }
1129
1200
  /**
1130
- * @deprecated Use `appClient.send.clearState` or `appClient.transactions.clearState` from an `AppClient` instance instead.
1201
+ * @deprecated Use `appClient.send.clearState` or `appClient.createTransaction.clearState` from an `AppClient` instance instead.
1131
1202
  *
1132
1203
  * Issues a clear_state call to the app.
1133
1204
  * @param call The call details.
@@ -1137,7 +1208,7 @@ class ApplicationClient {
1137
1208
  return await this.callOfType(call, 'clear_state');
1138
1209
  }
1139
1210
  /**
1140
- * @deprecated Use `appClient.send.delete` or `appClient.transactions.delete` from an `AppClient` instance instead.
1211
+ * @deprecated Use `appClient.send.delete` or `appClient.createTransaction.delete` from an `AppClient` instance instead.
1141
1212
  *
1142
1213
  * Issues a delete_application call to the app.
1143
1214
  * @param call The call details.
@@ -1147,7 +1218,7 @@ class ApplicationClient {
1147
1218
  return await this.callOfType(call, 'delete_application');
1148
1219
  }
1149
1220
  /**
1150
- * @deprecated Use `appClient.send.call` or `appClient.transactions.call` from an `AppClient` instance instead.
1221
+ * @deprecated Use `appClient.send.call` or `appClient.createTransaction.call` from an `AppClient` instance instead.
1151
1222
  *
1152
1223
  * Issues a call to the app with the given call type.
1153
1224
  * @param call The call details.