@algorandfoundation/algokit-utils 7.0.0-beta.9 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +9 -2
- package/account/account.js +6 -4
- package/account/account.js.map +1 -1
- package/account/account.mjs +6 -4
- package/account/account.mjs.map +1 -1
- package/account/get-account-config-from-environment.js.map +1 -1
- package/account/get-account-config-from-environment.mjs.map +1 -1
- package/account/get-account.js.map +1 -1
- package/account/get-account.mjs.map +1 -1
- package/account/get-dispenser-account.js.map +1 -1
- package/account/get-dispenser-account.mjs.map +1 -1
- package/account/mnemonic-account.js.map +1 -1
- package/account/mnemonic-account.mjs.map +1 -1
- package/amount.js.map +1 -1
- package/amount.mjs.map +1 -1
- package/app-client.js.map +1 -1
- package/app-client.mjs.map +1 -1
- package/app-deploy.js +2 -10
- package/app-deploy.js.map +1 -1
- package/app-deploy.mjs +3 -11
- package/app-deploy.mjs.map +1 -1
- package/app.d.ts +2 -2
- package/app.js +2 -2
- package/app.js.map +1 -1
- package/app.mjs +2 -2
- package/app.mjs.map +1 -1
- package/asset.js.map +1 -1
- package/asset.mjs.map +1 -1
- package/debugging/debugging.js.map +1 -1
- package/debugging/debugging.mjs.map +1 -1
- package/dispenser-client.js.map +1 -1
- package/dispenser-client.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +6 -0
- package/index.js.map +1 -1
- package/index.mjs +2 -1
- package/index.mjs.map +1 -1
- package/indexer-lookup.js.map +1 -1
- package/indexer-lookup.mjs.map +1 -1
- package/localnet/get-kmd-wallet-account.js.map +1 -1
- package/localnet/get-kmd-wallet-account.mjs.map +1 -1
- package/localnet/get-localnet-dispenser-account.js.map +1 -1
- package/localnet/get-localnet-dispenser-account.mjs.map +1 -1
- package/localnet/get-or-create-kmd-wallet-account.js.map +1 -1
- package/localnet/get-or-create-kmd-wallet-account.mjs.map +1 -1
- package/localnet/is-localnet.js.map +1 -1
- package/localnet/is-localnet.mjs.map +1 -1
- package/network-client.js.map +1 -1
- package/network-client.mjs.map +1 -1
- package/package.json +5 -5
- package/testing/account.js.map +1 -1
- package/testing/account.mjs.map +1 -1
- package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -1
- package/testing/fixtures/algokit-log-capture-fixture.mjs.map +1 -1
- package/testing/fixtures/algorand-fixture.js.map +1 -1
- package/testing/fixtures/algorand-fixture.mjs.map +1 -1
- package/testing/indexer.js.map +1 -1
- package/testing/indexer.mjs.map +1 -1
- package/testing/test-logger.js.map +1 -1
- package/testing/test-logger.mjs.map +1 -1
- package/testing/transaction-logger.js.map +1 -1
- package/testing/transaction-logger.mjs.map +1 -1
- package/transaction/legacy-bridge.js +2 -2
- package/transaction/legacy-bridge.js.map +1 -1
- package/transaction/legacy-bridge.mjs +3 -3
- package/transaction/legacy-bridge.mjs.map +1 -1
- package/transaction/perform-atomic-transaction-composer-simulate.js +1 -0
- package/transaction/perform-atomic-transaction-composer-simulate.js.map +1 -1
- package/transaction/perform-atomic-transaction-composer-simulate.mjs +1 -0
- package/transaction/perform-atomic-transaction-composer-simulate.mjs.map +1 -1
- package/transaction/transaction.d.ts +14 -7
- package/transaction/transaction.js +57 -31
- package/transaction/transaction.js.map +1 -1
- package/transaction/transaction.mjs +55 -30
- package/transaction/transaction.mjs.map +1 -1
- package/transfer/transfer-algos.js.map +1 -1
- package/transfer/transfer-algos.mjs.map +1 -1
- package/transfer/transfer.js.map +1 -1
- package/transfer/transfer.mjs.map +1 -1
- package/types/account-manager.d.ts +1 -1
- package/types/account-manager.js +10 -8
- package/types/account-manager.js.map +1 -1
- package/types/account-manager.mjs +11 -9
- package/types/account-manager.mjs.map +1 -1
- package/types/account.d.ts +9 -0
- package/types/account.js.map +1 -1
- package/types/account.mjs.map +1 -1
- package/types/algo-http-client-with-retry.js.map +1 -1
- package/types/algo-http-client-with-retry.mjs.map +1 -1
- package/types/algorand-client-interface.d.ts +2 -2
- package/types/algorand-client-transaction-creator.d.ts +5 -3
- package/types/algorand-client-transaction-creator.js +3 -1
- package/types/algorand-client-transaction-creator.js.map +1 -1
- package/types/algorand-client-transaction-creator.mjs +3 -1
- package/types/algorand-client-transaction-creator.mjs.map +1 -1
- package/types/algorand-client-transaction-sender.d.ts +12 -8
- package/types/algorand-client-transaction-sender.js +6 -2
- package/types/algorand-client-transaction-sender.js.map +1 -1
- package/types/algorand-client-transaction-sender.mjs +6 -2
- package/types/algorand-client-transaction-sender.mjs.map +1 -1
- package/types/algorand-client.d.ts +3 -4
- package/types/algorand-client.js +2 -5
- package/types/algorand-client.js.map +1 -1
- package/types/algorand-client.mjs +4 -4
- package/types/algorand-client.mjs.map +1 -1
- package/types/amount.js.map +1 -1
- package/types/amount.mjs.map +1 -1
- package/types/app-arc56.d.ts +31 -20
- package/types/app-arc56.js.map +1 -1
- package/types/app-arc56.mjs.map +1 -1
- package/types/app-client.d.ts +21 -10
- package/types/app-client.js +143 -36
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +141 -34
- package/types/app-client.mjs.map +1 -1
- package/types/app-deployer.js +1 -1
- package/types/app-deployer.js.map +1 -1
- package/types/app-deployer.mjs +2 -2
- package/types/app-deployer.mjs.map +1 -1
- package/types/app-factory.d.ts +32 -21
- package/types/app-factory.js +8 -2
- package/types/app-factory.js.map +1 -1
- package/types/app-factory.mjs +8 -2
- package/types/app-factory.mjs.map +1 -1
- package/types/app-manager.js +105 -23
- package/types/app-manager.js.map +1 -1
- package/types/app-manager.mjs +105 -23
- package/types/app-manager.mjs.map +1 -1
- package/types/app-spec.js +8 -2
- package/types/app-spec.js.map +1 -1
- package/types/app-spec.mjs +8 -2
- package/types/app-spec.mjs.map +1 -1
- package/types/app.d.ts +8 -7
- package/types/app.js.map +1 -1
- package/types/app.mjs.map +1 -1
- package/types/asset-manager.d.ts +4 -4
- package/types/asset-manager.js +2 -2
- package/types/asset-manager.js.map +1 -1
- package/types/asset-manager.mjs +2 -2
- package/types/asset-manager.mjs.map +1 -1
- package/types/async-event-emitter.d.ts +1 -10
- package/types/async-event-emitter.js +0 -5
- package/types/async-event-emitter.js.map +1 -1
- package/types/async-event-emitter.mjs +1 -6
- package/types/async-event-emitter.mjs.map +1 -1
- package/types/client-manager.js +2 -2
- package/types/client-manager.js.map +1 -1
- package/types/client-manager.mjs +2 -2
- package/types/client-manager.mjs.map +1 -1
- package/types/composer.d.ts +56 -30
- package/types/composer.js +103 -47
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +104 -46
- package/types/composer.mjs.map +1 -1
- package/types/config.d.ts +0 -4
- package/types/config.js.map +1 -1
- package/types/config.mjs.map +1 -1
- package/types/debugging.d.ts +1 -1
- package/types/debugging.js +1 -1
- package/types/debugging.js.map +1 -1
- package/types/debugging.mjs +1 -1
- package/types/debugging.mjs.map +1 -1
- package/types/dispenser-client.js.map +1 -1
- package/types/dispenser-client.mjs.map +1 -1
- package/types/indexer.js.map +1 -1
- package/types/indexer.mjs.map +1 -1
- package/types/kmd-account-manager.js +1 -1
- package/types/kmd-account-manager.js.map +1 -1
- package/types/kmd-account-manager.mjs +2 -2
- package/types/kmd-account-manager.mjs.map +1 -1
- package/types/lifecycle-events.d.ts +10 -0
- package/types/lifecycle-events.js +8 -0
- package/types/lifecycle-events.js.map +1 -0
- package/types/lifecycle-events.mjs +8 -0
- package/types/lifecycle-events.mjs.map +1 -0
- package/types/logging.js.map +1 -1
- package/types/logging.mjs.map +1 -1
- package/types/logic-error.d.ts +2 -3
- package/types/logic-error.js +3 -3
- package/types/logic-error.js.map +1 -1
- package/types/logic-error.mjs +3 -3
- package/types/logic-error.mjs.map +1 -1
- package/types/network-client.js.map +1 -1
- package/types/network-client.mjs.map +1 -1
- package/types/testing.d.ts +1 -1
- package/types/transaction.d.ts +1 -1
- package/types/urlTokenBaseHTTPClient.js.map +1 -1
- package/types/urlTokenBaseHTTPClient.mjs.map +1 -1
- package/util.js.map +1 -1
- package/util.mjs.map +1 -1
package/types/composer.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import algosdk from 'algosdk';
|
|
2
2
|
import { Config } from '../config.mjs';
|
|
3
|
-
import {
|
|
4
|
-
import { encodeLease, sendAtomicTransactionComposer } from '../transaction/transaction.mjs';
|
|
3
|
+
import { encodeLease, sendAtomicTransactionComposer, getABIReturnValue } from '../transaction/transaction.mjs';
|
|
5
4
|
import { APP_PAGE_MAX_SIZE } from './app.mjs';
|
|
6
5
|
import { AppManager } from './app-manager.mjs';
|
|
7
|
-
import { EventType } from './
|
|
6
|
+
import { EventType } from './lifecycle-events.mjs';
|
|
8
7
|
import { genesisIdIsLocalNet } from './network-client.mjs';
|
|
9
8
|
|
|
10
9
|
var AtomicTransactionComposer = algosdk.AtomicTransactionComposer;
|
|
@@ -12,10 +11,10 @@ var isTransactionWithSigner = algosdk.isTransactionWithSigner;
|
|
|
12
11
|
var encodeAddress = algosdk.encodeAddress;
|
|
13
12
|
var modelsv2 = algosdk.modelsv2;
|
|
14
13
|
const MAX_TRANSACTION_GROUP_SIZE = 16;
|
|
15
|
-
/**
|
|
16
|
-
class
|
|
14
|
+
/** TransactionComposer helps you compose and execute transactions as a transaction group. */
|
|
15
|
+
class TransactionComposer {
|
|
17
16
|
/**
|
|
18
|
-
* Create
|
|
17
|
+
* Create a `TransactionComposer`.
|
|
19
18
|
* @param params The configuration for this composer
|
|
20
19
|
*/
|
|
21
20
|
constructor(params) {
|
|
@@ -222,6 +221,15 @@ class AlgoKitComposer {
|
|
|
222
221
|
this.txns.push({ ...params, type: 'keyReg' });
|
|
223
222
|
return this;
|
|
224
223
|
}
|
|
224
|
+
/**
|
|
225
|
+
* Add an offline key registration transaction to the transaction group.
|
|
226
|
+
* @param params The offline key registration transaction parameters
|
|
227
|
+
* @returns The composer so you can chain method calls
|
|
228
|
+
*/
|
|
229
|
+
addOfflineKeyRegistration(params) {
|
|
230
|
+
this.txns.push({ ...params, type: 'keyReg' });
|
|
231
|
+
return this;
|
|
232
|
+
}
|
|
225
233
|
/**
|
|
226
234
|
* Add the transactions within an `AtomicTransactionComposer` to the transaction group.
|
|
227
235
|
* @param atc The `AtomicTransactionComposer` to build transactions from and add to the group
|
|
@@ -235,7 +243,7 @@ class AlgoKitComposer {
|
|
|
235
243
|
buildAtc(atc, processTransaction) {
|
|
236
244
|
const group = atc.buildGroup();
|
|
237
245
|
const txnWithSigners = group.map((ts, idx) => {
|
|
238
|
-
// Remove underlying group ID from the transaction since it will be re-grouped when this
|
|
246
|
+
// Remove underlying group ID from the transaction since it will be re-grouped when this TransactionComposer is built
|
|
239
247
|
ts.txn.group = undefined;
|
|
240
248
|
// Process transaction if a function is provided
|
|
241
249
|
ts.txn = processTransaction?.(ts.txn, idx) ?? ts.txn;
|
|
@@ -292,14 +300,22 @@ class AlgoKitComposer {
|
|
|
292
300
|
*/
|
|
293
301
|
async buildMethodCall(params, suggestedParams, includeSigner) {
|
|
294
302
|
const methodArgs = [];
|
|
303
|
+
const transactionsForGroup = [];
|
|
295
304
|
const isAbiValue = (x) => {
|
|
296
305
|
if (Array.isArray(x))
|
|
297
306
|
return x.length == 0 || x.every(isAbiValue);
|
|
298
307
|
return typeof x === 'bigint' || typeof x === 'boolean' || typeof x === 'number' || typeof x === 'string' || x instanceof Uint8Array;
|
|
299
308
|
};
|
|
300
|
-
for (let i =
|
|
309
|
+
for (let i = (params.args ?? []).length - 1; i >= 0; i--) {
|
|
301
310
|
const arg = params.args[i];
|
|
302
311
|
if (arg === undefined) {
|
|
312
|
+
// An undefined transaction argument signals that the value will be supplied by a method call argument
|
|
313
|
+
if (algosdk.abiTypeIsTransaction(params.method.args[i].type) && transactionsForGroup.length > 0) {
|
|
314
|
+
// Move the last transaction from the group to the method call arguments to appease algosdk
|
|
315
|
+
const placeholderTransaction = transactionsForGroup.splice(-1, 1)[0];
|
|
316
|
+
methodArgs.push(placeholderTransaction);
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
303
319
|
throw Error(`No value provided for argument ${i + 1} within call to ${params.method.name}`);
|
|
304
320
|
}
|
|
305
321
|
if (isAbiValue(arg)) {
|
|
@@ -312,7 +328,10 @@ class AlgoKitComposer {
|
|
|
312
328
|
}
|
|
313
329
|
if ('method' in arg) {
|
|
314
330
|
const tempTxnWithSigners = await this.buildMethodCall(arg, suggestedParams, includeSigner);
|
|
315
|
-
|
|
331
|
+
// If there is any transaction args, add to the atc
|
|
332
|
+
// Everything else should be added as method args
|
|
333
|
+
methodArgs.push(...tempTxnWithSigners.slice(-1)); // Add the method call itself as a method arg
|
|
334
|
+
transactionsForGroup.push(...tempTxnWithSigners.slice(0, -1).reverse()); // Add any transaction arguments to the atc
|
|
316
335
|
continue;
|
|
317
336
|
}
|
|
318
337
|
const txn = await arg;
|
|
@@ -324,10 +343,11 @@ class AlgoKitComposer {
|
|
|
324
343
|
? params.signer.signer
|
|
325
344
|
: params.signer
|
|
326
345
|
: this.getSigner(encodeAddress(txn.from.publicKey))
|
|
327
|
-
:
|
|
346
|
+
: TransactionComposer.NULL_SIGNER,
|
|
328
347
|
});
|
|
329
348
|
}
|
|
330
349
|
const methodAtc = new algosdk.AtomicTransactionComposer();
|
|
350
|
+
transactionsForGroup.reverse().forEach((txn) => methodAtc.addTransaction(txn));
|
|
331
351
|
const appId = Number('appId' in params ? params.appId : 0n);
|
|
332
352
|
const approvalProgram = 'approvalProgram' in params
|
|
333
353
|
? typeof params.approvalProgram === 'string'
|
|
@@ -357,10 +377,10 @@ class AlgoKitComposer {
|
|
|
357
377
|
? Math.floor((approvalProgram.length + (clearStateProgram?.length ?? 0)) / APP_PAGE_MAX_SIZE)
|
|
358
378
|
: 0
|
|
359
379
|
: undefined,
|
|
360
|
-
numLocalInts: appId === 0 ? ('schema' in params ? params.schema?.localInts ?? 0 : 0) : undefined,
|
|
361
|
-
numLocalByteSlices: appId === 0 ? ('schema' in params ? params.schema?.localByteSlices ?? 0 : 0) : undefined,
|
|
362
|
-
numGlobalInts: appId === 0 ? ('schema' in params ? params.schema?.globalInts ?? 0 : 0) : undefined,
|
|
363
|
-
numGlobalByteSlices: appId === 0 ? ('schema' in params ? params.schema?.globalByteSlices ?? 0 : 0) : undefined,
|
|
380
|
+
numLocalInts: appId === 0 ? ('schema' in params ? (params.schema?.localInts ?? 0) : 0) : undefined,
|
|
381
|
+
numLocalByteSlices: appId === 0 ? ('schema' in params ? (params.schema?.localByteSlices ?? 0) : 0) : undefined,
|
|
382
|
+
numGlobalInts: appId === 0 ? ('schema' in params ? (params.schema?.globalInts ?? 0) : 0) : undefined,
|
|
383
|
+
numGlobalByteSlices: appId === 0 ? ('schema' in params ? (params.schema?.globalByteSlices ?? 0) : 0) : undefined,
|
|
364
384
|
method: params.method,
|
|
365
385
|
signer: includeSigner
|
|
366
386
|
? params.signer
|
|
@@ -368,8 +388,8 @@ class AlgoKitComposer {
|
|
|
368
388
|
? params.signer.signer
|
|
369
389
|
: params.signer
|
|
370
390
|
: this.getSigner(params.sender)
|
|
371
|
-
:
|
|
372
|
-
methodArgs: methodArgs,
|
|
391
|
+
: TransactionComposer.NULL_SIGNER,
|
|
392
|
+
methodArgs: methodArgs.reverse(),
|
|
373
393
|
// note, lease, and rekeyTo are set in the common build step
|
|
374
394
|
note: undefined,
|
|
375
395
|
lease: undefined,
|
|
@@ -482,12 +502,12 @@ class AlgoKitComposer {
|
|
|
482
502
|
txn = algosdk.makeApplicationCreateTxnFromObject({
|
|
483
503
|
...sdkParams,
|
|
484
504
|
extraPages: 'extraProgramPages' in params
|
|
485
|
-
? params.extraProgramPages ?? Math.floor((approvalProgram.length + clearStateProgram.length) / APP_PAGE_MAX_SIZE)
|
|
505
|
+
? (params.extraProgramPages ?? Math.floor((approvalProgram.length + clearStateProgram.length) / APP_PAGE_MAX_SIZE))
|
|
486
506
|
: 0,
|
|
487
|
-
numLocalInts: 'schema' in params ? params.schema?.localInts ?? 0 : 0,
|
|
488
|
-
numLocalByteSlices: 'schema' in params ? params.schema?.localByteSlices ?? 0 : 0,
|
|
489
|
-
numGlobalInts: 'schema' in params ? params.schema?.globalInts ?? 0 : 0,
|
|
490
|
-
numGlobalByteSlices: 'schema' in params ? params.schema?.globalByteSlices ?? 0 : 0,
|
|
507
|
+
numLocalInts: 'schema' in params ? (params.schema?.localInts ?? 0) : 0,
|
|
508
|
+
numLocalByteSlices: 'schema' in params ? (params.schema?.localByteSlices ?? 0) : 0,
|
|
509
|
+
numGlobalInts: 'schema' in params ? (params.schema?.globalInts ?? 0) : 0,
|
|
510
|
+
numGlobalByteSlices: 'schema' in params ? (params.schema?.globalByteSlices ?? 0) : 0,
|
|
491
511
|
approvalProgram: approvalProgram,
|
|
492
512
|
clearProgram: clearStateProgram,
|
|
493
513
|
});
|
|
@@ -498,7 +518,32 @@ class AlgoKitComposer {
|
|
|
498
518
|
return this.commonTxnBuildStep(params, txn, suggestedParams);
|
|
499
519
|
}
|
|
500
520
|
buildKeyReg(params, suggestedParams) {
|
|
501
|
-
|
|
521
|
+
let txn;
|
|
522
|
+
if ('voteKey' in params) {
|
|
523
|
+
// algosdk throws when voteFirst is 0, so we need to set it to 1, then switch back to 0 after creating the transaction
|
|
524
|
+
const voteFirst = params.voteFirst === 0n ? 1n : params.voteFirst;
|
|
525
|
+
txn = algosdk.makeKeyRegistrationTxnWithSuggestedParamsFromObject({
|
|
526
|
+
from: params.sender,
|
|
527
|
+
voteKey: params.voteKey,
|
|
528
|
+
selectionKey: params.selectionKey,
|
|
529
|
+
voteFirst: Number(voteFirst),
|
|
530
|
+
voteLast: Number(params.voteLast),
|
|
531
|
+
voteKeyDilution: Number(params.voteKeyDilution),
|
|
532
|
+
suggestedParams,
|
|
533
|
+
nonParticipation: false,
|
|
534
|
+
stateProofKey: params.stateProofKey,
|
|
535
|
+
});
|
|
536
|
+
if (params.voteFirst === 0n) {
|
|
537
|
+
txn.voteFirst = 0;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
else {
|
|
541
|
+
txn = algosdk.makeKeyRegistrationTxnWithSuggestedParamsFromObject({
|
|
542
|
+
from: params.sender,
|
|
543
|
+
suggestedParams,
|
|
544
|
+
nonParticipation: params.preventAccountFromEverParticipatingAgain,
|
|
545
|
+
});
|
|
546
|
+
}
|
|
502
547
|
return this.commonTxnBuildStep(params, txn, suggestedParams);
|
|
503
548
|
}
|
|
504
549
|
/** Builds all transaction types apart from `txnWithSigner`, `atc` and `methodCall` since those ones can have custom signers that need to be retrieved. */
|
|
@@ -565,7 +610,7 @@ class AlgoKitComposer {
|
|
|
565
610
|
: [];
|
|
566
611
|
transactions.push(...transactionsWithSigner.map((ts) => ts.txn));
|
|
567
612
|
transactionsWithSigner.forEach((ts, idx) => {
|
|
568
|
-
if (ts.signer && ts.signer !==
|
|
613
|
+
if (ts.signer && ts.signer !== TransactionComposer.NULL_SIGNER) {
|
|
569
614
|
signers.set(idx, ts.signer);
|
|
570
615
|
}
|
|
571
616
|
});
|
|
@@ -655,19 +700,17 @@ class AlgoKitComposer {
|
|
|
655
700
|
async execute(params) {
|
|
656
701
|
return this.send(params);
|
|
657
702
|
}
|
|
658
|
-
/**
|
|
659
|
-
* Compose the atomic transaction group and simulate sending it to the network
|
|
660
|
-
* @returns The simulation result
|
|
661
|
-
*/
|
|
662
703
|
async simulate(options) {
|
|
663
|
-
const
|
|
704
|
+
const { skipSignatures = false, ...rawOptions } = options ?? {};
|
|
705
|
+
const atc = skipSignatures ? new AtomicTransactionComposer() : this.atc;
|
|
664
706
|
// Build the transactions
|
|
665
|
-
if (
|
|
666
|
-
|
|
707
|
+
if (skipSignatures) {
|
|
708
|
+
rawOptions.allowEmptySignatures = true;
|
|
709
|
+
rawOptions.fixSigners = true;
|
|
667
710
|
// Build transactions uses empty signers
|
|
668
711
|
const transactions = await this.buildTransactions();
|
|
669
712
|
for (const txn of transactions.transactions) {
|
|
670
|
-
atc.addTransaction({ txn, signer:
|
|
713
|
+
atc.addTransaction({ txn, signer: TransactionComposer.NULL_SIGNER });
|
|
671
714
|
}
|
|
672
715
|
atc['methodCalls'] = transactions.methodCalls;
|
|
673
716
|
}
|
|
@@ -675,21 +718,36 @@ class AlgoKitComposer {
|
|
|
675
718
|
// Build creates real signatures
|
|
676
719
|
await this.build();
|
|
677
720
|
}
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
721
|
+
const { methodResults, simulateResponse } = await atc.simulate(this.algod, new modelsv2.SimulateRequest({
|
|
722
|
+
txnGroups: [],
|
|
723
|
+
...rawOptions,
|
|
724
|
+
...(Config.debug
|
|
725
|
+
? {
|
|
726
|
+
allowEmptySignatures: true,
|
|
727
|
+
fixSigners: true,
|
|
728
|
+
allowMoreLogging: true,
|
|
729
|
+
execTraceConfig: new modelsv2.SimulateTraceConfig({
|
|
730
|
+
enable: true,
|
|
731
|
+
scratchChange: true,
|
|
732
|
+
stackChange: true,
|
|
733
|
+
stateChange: true,
|
|
734
|
+
}),
|
|
735
|
+
}
|
|
736
|
+
: undefined),
|
|
737
|
+
}));
|
|
738
|
+
const failedGroup = simulateResponse?.txnGroups[0];
|
|
739
|
+
if (failedGroup?.failureMessage) {
|
|
740
|
+
const errorMessage = `Transaction failed at transaction(s) ${failedGroup.failedAt?.join(', ') || 'unknown'} in the group. ${failedGroup.failureMessage}`;
|
|
741
|
+
const error = new Error(errorMessage);
|
|
742
|
+
if (Config.debug) {
|
|
743
|
+
await Config.events.emitAsync(EventType.TxnGroupSimulated, { simulateResponse });
|
|
744
|
+
}
|
|
690
745
|
error.simulateResponse = simulateResponse;
|
|
691
746
|
throw error;
|
|
692
747
|
}
|
|
748
|
+
if (Config.debug && Config.traceAll) {
|
|
749
|
+
await Config.events.emitAsync(EventType.TxnGroupSimulated, { simulateResponse });
|
|
750
|
+
}
|
|
693
751
|
const transactions = atc.buildGroup().map((t) => t.txn);
|
|
694
752
|
return {
|
|
695
753
|
confirmations: simulateResponse.txnGroups[0].txnResults.map((t) => t.txnResult),
|
|
@@ -697,7 +755,7 @@ class AlgoKitComposer {
|
|
|
697
755
|
txIds: transactions.map((t) => t.txID()),
|
|
698
756
|
groupId: Buffer.from(transactions[0].group ?? new Uint8Array()).toString('base64'),
|
|
699
757
|
simulateResponse,
|
|
700
|
-
returns: methodResults.map(
|
|
758
|
+
returns: methodResults.map(getABIReturnValue),
|
|
701
759
|
};
|
|
702
760
|
}
|
|
703
761
|
/**
|
|
@@ -714,7 +772,7 @@ class AlgoKitComposer {
|
|
|
714
772
|
}
|
|
715
773
|
}
|
|
716
774
|
/** Signer used to represent a lack of signer */
|
|
717
|
-
|
|
775
|
+
TransactionComposer.NULL_SIGNER = algosdk.makeEmptyTransactionSigner();
|
|
718
776
|
|
|
719
|
-
export { MAX_TRANSACTION_GROUP_SIZE,
|
|
777
|
+
export { MAX_TRANSACTION_GROUP_SIZE, TransactionComposer };
|
|
720
778
|
//# sourceMappingURL=composer.mjs.map
|