@algorandfoundation/algokit-utils 6.3.0-beta.1 → 7.0.0-alpha.2
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 +22 -26
- package/account/account.d.ts +12 -10
- package/account/account.js +17 -14
- package/account/account.js.map +1 -1
- package/account/account.mjs +18 -15
- package/account/account.mjs.map +1 -1
- package/account/get-account-config-from-environment.d.ts +0 -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.d.ts +2 -3
- package/account/get-account.js +1 -1
- package/account/get-account.js.map +1 -1
- package/account/get-account.mjs +1 -1
- package/account/get-account.mjs.map +1 -1
- package/account/get-dispenser-account.d.ts +2 -3
- package/account/get-dispenser-account.js +1 -1
- package/account/get-dispenser-account.js.map +1 -1
- package/account/get-dispenser-account.mjs +1 -1
- package/account/get-dispenser-account.mjs.map +1 -1
- package/account/index.d.ts +0 -1
- package/account/mnemonic-account.d.ts +1 -2
- package/account/mnemonic-account.js +1 -1
- package/account/mnemonic-account.js.map +1 -1
- package/account/mnemonic-account.mjs +1 -1
- package/account/mnemonic-account.mjs.map +1 -1
- package/amount.d.ts +15 -5
- package/amount.js +9 -2
- package/amount.js.map +1 -1
- package/amount.mjs +9 -3
- package/amount.mjs.map +1 -1
- package/app-client.d.ts +19 -5
- package/app-client.js +19 -4
- package/app-client.js.map +1 -1
- package/app-client.mjs +19 -4
- package/app-client.mjs.map +1 -1
- package/app-deploy.d.ts +18 -2
- package/app-deploy.js +159 -342
- package/app-deploy.js.map +1 -1
- package/app-deploy.mjs +163 -346
- package/app-deploy.mjs.map +1 -1
- package/app.d.ts +39 -3
- package/app.js +121 -371
- package/app.js.map +1 -1
- package/app.mjs +122 -372
- package/app.mjs.map +1 -1
- package/asset.d.ts +5 -6
- package/asset.js +5 -8
- package/asset.js.map +1 -1
- package/asset.mjs +5 -8
- package/asset.mjs.map +1 -1
- package/config.d.ts +0 -1
- package/config.js.map +1 -1
- package/config.mjs.map +1 -1
- package/debugging/debugging.d.ts +3 -5
- package/debugging/debugging.js +4 -128
- package/debugging/debugging.js.map +1 -1
- package/debugging/debugging.mjs +4 -109
- package/debugging/debugging.mjs.map +1 -1
- package/debugging/index.d.ts +0 -2
- package/dispenser-client.d.ts +0 -1
- package/dispenser-client.js.map +1 -1
- package/dispenser-client.mjs.map +1 -1
- package/index.d.ts +5 -4
- package/index.js +36 -26
- package/index.js.map +1 -1
- package/index.mjs +6 -5
- package/index.mjs.map +1 -1
- package/indexer-lookup.d.ts +10 -9
- package/indexer-lookup.js +14 -10
- package/indexer-lookup.js.map +1 -1
- package/indexer-lookup.mjs +14 -10
- package/indexer-lookup.mjs.map +1 -1
- package/localnet/get-kmd-wallet-account.d.ts +1 -2
- package/localnet/get-kmd-wallet-account.js +1 -1
- package/localnet/get-kmd-wallet-account.js.map +1 -1
- package/localnet/get-kmd-wallet-account.mjs +1 -1
- package/localnet/get-kmd-wallet-account.mjs.map +1 -1
- package/localnet/get-localnet-dispenser-account.d.ts +1 -2
- package/localnet/get-localnet-dispenser-account.js +1 -1
- package/localnet/get-localnet-dispenser-account.js.map +1 -1
- package/localnet/get-localnet-dispenser-account.mjs +1 -1
- package/localnet/get-localnet-dispenser-account.mjs.map +1 -1
- package/localnet/get-or-create-kmd-wallet-account.d.ts +1 -2
- package/localnet/get-or-create-kmd-wallet-account.js +1 -1
- package/localnet/get-or-create-kmd-wallet-account.js.map +1 -1
- package/localnet/get-or-create-kmd-wallet-account.mjs +1 -1
- package/localnet/get-or-create-kmd-wallet-account.mjs.map +1 -1
- package/localnet/index.d.ts +0 -1
- package/localnet/is-localnet.d.ts +1 -2
- package/localnet/is-localnet.js +1 -1
- package/localnet/is-localnet.js.map +1 -1
- package/localnet/is-localnet.mjs +1 -1
- package/localnet/is-localnet.mjs.map +1 -1
- package/network-client.d.ts +3 -10
- package/network-client.js +4 -11
- package/network-client.js.map +1 -1
- package/network-client.mjs +4 -11
- package/network-client.mjs.map +1 -1
- package/package.json +3 -4
- package/testing/_asset.d.ts +2 -2
- package/testing/account.d.ts +4 -4
- package/testing/account.js +8 -2
- package/testing/account.js.map +1 -1
- package/testing/account.mjs +9 -3
- package/testing/account.mjs.map +1 -1
- package/testing/fixtures/algokit-log-capture-fixture.d.ts +0 -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.d.ts +0 -1
- package/testing/fixtures/algorand-fixture.js +13 -14
- package/testing/fixtures/algorand-fixture.js.map +1 -1
- package/testing/fixtures/algorand-fixture.mjs +13 -14
- package/testing/fixtures/algorand-fixture.mjs.map +1 -1
- package/testing/fixtures/index.d.ts +0 -1
- package/testing/index.d.ts +0 -1
- package/testing/indexer.d.ts +0 -1
- package/testing/indexer.js.map +1 -1
- package/testing/indexer.mjs.map +1 -1
- package/testing/test-logger.d.ts +0 -1
- package/testing/test-logger.js +7 -3
- package/testing/test-logger.js.map +1 -1
- package/testing/test-logger.mjs +7 -3
- package/testing/test-logger.mjs.map +1 -1
- package/testing/transaction-logger.d.ts +0 -1
- package/testing/transaction-logger.js.map +1 -1
- package/testing/transaction-logger.mjs.map +1 -1
- package/transaction/index.d.ts +0 -1
- package/transaction/legacy-bridge.d.ts +31 -6
- package/transaction/legacy-bridge.js +101 -7
- package/transaction/legacy-bridge.js.map +1 -1
- package/transaction/legacy-bridge.mjs +101 -10
- package/transaction/legacy-bridge.mjs.map +1 -1
- package/transaction/perform-atomic-transaction-composer-simulate.d.ts +4 -2
- package/transaction/perform-atomic-transaction-composer-simulate.js +14 -9
- package/transaction/perform-atomic-transaction-composer-simulate.js.map +1 -1
- package/transaction/perform-atomic-transaction-composer-simulate.mjs +15 -10
- package/transaction/perform-atomic-transaction-composer-simulate.mjs.map +1 -1
- package/transaction/transaction.d.ts +38 -19
- package/transaction/transaction.js +217 -137
- package/transaction/transaction.js.map +1 -1
- package/transaction/transaction.mjs +218 -138
- package/transaction/transaction.mjs.map +1 -1
- package/transfer/index.d.ts +0 -1
- package/transfer/transfer-algos.d.ts +1 -2
- package/transfer/transfer-algos.js +1 -1
- package/transfer/transfer-algos.js.map +1 -1
- package/transfer/transfer-algos.mjs +1 -1
- package/transfer/transfer-algos.mjs.map +1 -1
- package/transfer/transfer.d.ts +1 -2
- package/transfer/transfer.js +6 -4
- package/transfer/transfer.js.map +1 -1
- package/transfer/transfer.mjs +6 -4
- package/transfer/transfer.mjs.map +1 -1
- package/types/account-manager.d.ts +33 -25
- package/types/account-manager.js +54 -31
- package/types/account-manager.js.map +1 -1
- package/types/account-manager.mjs +56 -33
- package/types/account-manager.mjs.map +1 -1
- package/types/account.d.ts +17 -9
- package/types/account.js +2 -2
- package/types/account.js.map +1 -1
- package/types/account.mjs +3 -3
- package/types/account.mjs.map +1 -1
- package/types/algo-http-client-with-retry.d.ts +1 -3
- package/types/algo-http-client-with-retry.js +33 -3
- package/types/algo-http-client-with-retry.js.map +1 -1
- package/types/algo-http-client-with-retry.mjs +32 -2
- package/types/algo-http-client-with-retry.mjs.map +1 -1
- package/types/algorand-client-interface.d.ts +28 -0
- package/types/algorand-client-interface.js +3 -0
- package/types/algorand-client-interface.js.map +1 -0
- package/types/algorand-client-interface.mjs +2 -0
- package/types/algorand-client-interface.mjs.map +1 -0
- package/types/algorand-client-transaction-creator.d.ts +452 -23
- package/types/algorand-client-transaction-creator.js +407 -23
- package/types/algorand-client-transaction-creator.js.map +1 -1
- package/types/algorand-client-transaction-creator.mjs +407 -23
- package/types/algorand-client-transaction-creator.mjs.map +1 -1
- package/types/algorand-client-transaction-sender.d.ts +772 -47
- package/types/algorand-client-transaction-sender.js +445 -15
- package/types/algorand-client-transaction-sender.js.map +1 -1
- package/types/algorand-client-transaction-sender.mjs +445 -15
- package/types/algorand-client-transaction-sender.mjs.map +1 -1
- package/types/algorand-client.d.ts +24 -17
- package/types/algorand-client.js +26 -16
- package/types/algorand-client.js.map +1 -1
- package/types/algorand-client.mjs +28 -15
- package/types/algorand-client.mjs.map +1 -1
- package/types/amount.d.ts +10 -11
- package/types/amount.js +7 -7
- package/types/amount.js.map +1 -1
- package/types/amount.mjs +7 -7
- package/types/amount.mjs.map +1 -1
- package/types/app-arc56.d.ts +359 -0
- package/types/app-arc56.js +184 -0
- package/types/app-arc56.js.map +1 -0
- package/types/app-arc56.mjs +175 -0
- package/types/app-arc56.mjs.map +1 -0
- package/types/app-client.d.ts +1508 -12
- package/types/app-client.js +1018 -29
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +1020 -32
- package/types/app-client.mjs.map +1 -1
- package/types/app-deployer.d.ts +126 -0
- package/types/app-deployer.js +353 -0
- package/types/app-deployer.js.map +1 -0
- package/types/app-deployer.mjs +351 -0
- package/types/app-deployer.mjs.map +1 -0
- package/types/app-factory.d.ts +846 -0
- package/types/app-factory.js +410 -0
- package/types/app-factory.js.map +1 -0
- package/types/app-factory.mjs +408 -0
- package/types/app-factory.mjs.map +1 -0
- package/types/app-manager.d.ts +244 -0
- package/types/app-manager.js +423 -0
- package/types/app-manager.js.map +1 -0
- package/types/app-manager.mjs +421 -0
- package/types/app-manager.mjs.map +1 -0
- package/types/app-spec.d.ts +2 -1
- package/types/app-spec.js +127 -0
- package/types/app-spec.js.map +1 -1
- package/types/app-spec.mjs +126 -0
- package/types/app-spec.mjs.map +1 -1
- package/types/app.d.ts +57 -18
- package/types/app.js +1 -1
- package/types/app.js.map +1 -1
- package/types/app.mjs +1 -1
- package/types/app.mjs.map +1 -1
- package/types/asset-manager.d.ts +10 -10
- package/types/asset-manager.js +13 -17
- package/types/asset-manager.js.map +1 -1
- package/types/asset-manager.mjs +13 -17
- package/types/asset-manager.mjs.map +1 -1
- package/types/asset.d.ts +0 -1
- package/types/async-event-emitter.d.ts +14 -0
- package/types/async-event-emitter.js +50 -0
- package/types/async-event-emitter.js.map +1 -0
- package/types/async-event-emitter.mjs +48 -0
- package/types/async-event-emitter.mjs.map +1 -0
- package/types/client-manager.d.ts +135 -60
- package/types/client-manager.js +158 -44
- package/types/client-manager.js.map +1 -1
- package/types/client-manager.mjs +159 -45
- package/types/client-manager.mjs.map +1 -1
- package/types/composer.d.ts +271 -87
- package/types/composer.js +405 -125
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +407 -125
- package/types/composer.mjs.map +1 -1
- package/types/config.d.ts +3 -6
- package/types/config.js +5 -44
- package/types/config.js.map +1 -1
- package/types/config.mjs +5 -27
- package/types/config.mjs.map +1 -1
- package/types/debugging.d.ts +29 -101
- package/types/debugging.js +16 -109
- package/types/debugging.js.map +1 -1
- package/types/debugging.mjs +12 -107
- package/types/debugging.mjs.map +1 -1
- package/types/dispenser-client.d.ts +2 -2
- package/types/dispenser-client.js +10 -5
- package/types/dispenser-client.js.map +1 -1
- package/types/dispenser-client.mjs +10 -5
- package/types/dispenser-client.mjs.map +1 -1
- package/types/expand.d.ts +7 -0
- package/types/expand.js +3 -0
- package/types/expand.js.map +1 -0
- package/types/expand.mjs +2 -0
- package/types/expand.mjs.map +1 -0
- package/types/indexer.d.ts +74 -756
- package/types/indexer.js.map +1 -1
- package/types/indexer.mjs.map +1 -1
- package/types/kmd-account-manager.d.ts +2 -3
- package/types/kmd-account-manager.js +3 -3
- package/types/kmd-account-manager.js.map +1 -1
- package/types/kmd-account-manager.mjs +4 -4
- 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.d.ts +0 -1
- package/types/logging.js.map +1 -1
- package/types/logging.mjs.map +1 -1
- package/types/logic-error.d.ts +2 -4
- 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.d.ts +14 -2
- package/types/network-client.js.map +1 -1
- package/types/network-client.mjs.map +1 -1
- package/types/testing.d.ts +8 -10
- package/types/transaction.d.ts +17 -4
- package/types/transfer.d.ts +0 -1
- package/util.d.ts +2 -2
- package/util.js +11 -10
- package/util.js.map +1 -1
- package/util.mjs +11 -10
- package/util.mjs.map +1 -1
- package/account/account.d.ts.map +0 -1
- package/account/get-account-config-from-environment.d.ts.map +0 -1
- package/account/get-account.d.ts.map +0 -1
- package/account/get-dispenser-account.d.ts.map +0 -1
- package/account/index.d.ts.map +0 -1
- package/account/mnemonic-account.d.ts.map +0 -1
- package/amount.d.ts.map +0 -1
- package/app-client.d.ts.map +0 -1
- package/app-deploy.d.ts.map +0 -1
- package/app.d.ts.map +0 -1
- package/asset.d.ts.map +0 -1
- package/config.d.ts.map +0 -1
- package/debugging/debugging.d.ts.map +0 -1
- package/debugging/index.d.ts.map +0 -1
- package/debugging/simulate-and-persist-response.d.ts +0 -20
- package/debugging/simulate-and-persist-response.d.ts.map +0 -1
- package/debugging/simulate-and-persist-response.js +0 -108
- package/debugging/simulate-and-persist-response.js.map +0 -1
- package/debugging/simulate-and-persist-response.mjs +0 -89
- package/debugging/simulate-and-persist-response.mjs.map +0 -1
- package/dispenser-client.d.ts.map +0 -1
- package/index.d.ts.map +0 -1
- package/indexer-lookup.d.ts.map +0 -1
- package/localnet/get-kmd-wallet-account.d.ts.map +0 -1
- package/localnet/get-localnet-dispenser-account.d.ts.map +0 -1
- package/localnet/get-or-create-kmd-wallet-account.d.ts.map +0 -1
- package/localnet/index.d.ts.map +0 -1
- package/localnet/is-localnet.d.ts.map +0 -1
- package/network-client.d.ts.map +0 -1
- package/testing/_asset.d.ts.map +0 -1
- package/testing/account.d.ts.map +0 -1
- package/testing/fixtures/algokit-log-capture-fixture.d.ts.map +0 -1
- package/testing/fixtures/algorand-fixture.d.ts.map +0 -1
- package/testing/fixtures/index.d.ts.map +0 -1
- package/testing/index.d.ts.map +0 -1
- package/testing/indexer.d.ts.map +0 -1
- package/testing/test-logger.d.ts.map +0 -1
- package/testing/transaction-logger.d.ts.map +0 -1
- package/transaction/index.d.ts.map +0 -1
- package/transaction/legacy-bridge.d.ts.map +0 -1
- package/transaction/perform-atomic-transaction-composer-simulate.d.ts.map +0 -1
- package/transaction/transaction.d.ts.map +0 -1
- package/transfer/index.d.ts.map +0 -1
- package/transfer/transfer-algos.d.ts.map +0 -1
- package/transfer/transfer.d.ts.map +0 -1
- package/types/account-manager.d.ts.map +0 -1
- package/types/account.d.ts.map +0 -1
- package/types/algo-http-client-with-retry.d.ts.map +0 -1
- package/types/algorand-client-transaction-creator.d.ts.map +0 -1
- package/types/algorand-client-transaction-sender.d.ts.map +0 -1
- package/types/algorand-client.d.ts.map +0 -1
- package/types/amount.d.ts.map +0 -1
- package/types/app-client.d.ts.map +0 -1
- package/types/app-spec.d.ts.map +0 -1
- package/types/app.d.ts.map +0 -1
- package/types/asset-manager.d.ts.map +0 -1
- package/types/asset.d.ts.map +0 -1
- package/types/client-manager.d.ts.map +0 -1
- package/types/composer.d.ts.map +0 -1
- package/types/config.d.ts.map +0 -1
- package/types/debugging.d.ts.map +0 -1
- package/types/dispenser-client.d.ts.map +0 -1
- package/types/indexer.d.ts.map +0 -1
- package/types/kmd-account-manager.d.ts.map +0 -1
- package/types/logging.d.ts.map +0 -1
- package/types/logic-error.d.ts.map +0 -1
- package/types/network-client.d.ts.map +0 -1
- package/types/testing.d.ts.map +0 -1
- package/types/transaction.d.ts.map +0 -1
- package/types/transfer.d.ts.map +0 -1
- package/types/urlTokenBaseHTTPClient.d.ts +0 -41
- package/types/urlTokenBaseHTTPClient.d.ts.map +0 -1
- package/types/urlTokenBaseHTTPClient.js +0 -153
- package/types/urlTokenBaseHTTPClient.js.map +0 -1
- package/types/urlTokenBaseHTTPClient.mjs +0 -151
- package/types/urlTokenBaseHTTPClient.mjs.map +0 -1
- package/util.d.ts.map +0 -1
|
@@ -1,17 +1,22 @@
|
|
|
1
|
+
import algosdk from 'algosdk';
|
|
1
2
|
import { AlgorandClientTransactionCreator } from '../types/algorand-client-transaction-creator.mjs';
|
|
2
3
|
import { AlgorandClientTransactionSender } from '../types/algorand-client-transaction-sender.mjs';
|
|
4
|
+
import { AppManager } from '../types/app-manager.mjs';
|
|
3
5
|
import { AssetManager } from '../types/asset-manager.mjs';
|
|
4
|
-
import
|
|
5
|
-
import { getSenderTransactionSigner,
|
|
6
|
+
import { TransactionComposer } from '../types/composer.mjs';
|
|
7
|
+
import { getSenderTransactionSigner, getSenderAddress, encodeTransactionNote, encodeLease } from './transaction.mjs';
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
var ABIMethod = algosdk.ABIMethod;
|
|
10
|
+
/** @deprecated Bridges between legacy `sendTransaction` behaviour and new `AlgorandClient` behaviour. */
|
|
8
11
|
async function legacySendTransactionBridge(algod, from, sendParams, params, txn, send, suggestedParams) {
|
|
9
|
-
const
|
|
12
|
+
const appManager = new AppManager(algod);
|
|
13
|
+
const newGroup = () => new TransactionComposer({
|
|
10
14
|
algod,
|
|
11
15
|
getSigner: () => getSenderTransactionSigner(from),
|
|
12
|
-
getSuggestedParams: async () => await getTransactionParams(
|
|
16
|
+
getSuggestedParams: async () => (suggestedParams ? { ...suggestedParams } : await algod.getTransactionParams().do()),
|
|
17
|
+
appManager,
|
|
13
18
|
});
|
|
14
|
-
const transactionSender = new AlgorandClientTransactionSender(newGroup, new AssetManager(algod, newGroup));
|
|
19
|
+
const transactionSender = new AlgorandClientTransactionSender(newGroup, new AssetManager(algod, newGroup), appManager);
|
|
15
20
|
const transactionCreator = new AlgorandClientTransactionCreator(newGroup);
|
|
16
21
|
if (sendParams.fee) {
|
|
17
22
|
params.staticFee = sendParams.fee;
|
|
@@ -21,13 +26,99 @@ async function legacySendTransactionBridge(algod, from, sendParams, params, txn,
|
|
|
21
26
|
}
|
|
22
27
|
if (sendParams.atc || sendParams.skipSending) {
|
|
23
28
|
const transaction = await txn(transactionCreator)(params);
|
|
29
|
+
const txns = 'transactions' in transaction ? transaction.transactions : [transaction];
|
|
24
30
|
if (sendParams.atc) {
|
|
25
|
-
sendParams.atc.
|
|
31
|
+
const baseIndex = sendParams.atc.count();
|
|
32
|
+
txns
|
|
33
|
+
.map((txn, i) => ({
|
|
34
|
+
txn,
|
|
35
|
+
signer: 'signers' in transaction ? (transaction.signers.get(i) ?? getSenderTransactionSigner(from)) : getSenderTransactionSigner(from),
|
|
36
|
+
}))
|
|
37
|
+
.forEach((t) => sendParams.atc.addTransaction(t));
|
|
38
|
+
// Populate ATC with method calls
|
|
39
|
+
if ('transactions' in transaction) {
|
|
40
|
+
transaction.methodCalls.forEach((m, i) => sendParams.atc['methodCalls'].set(i + baseIndex, m));
|
|
41
|
+
}
|
|
26
42
|
}
|
|
27
|
-
return { transaction };
|
|
43
|
+
return { transaction: txns.at(-1), transactions: txns };
|
|
28
44
|
}
|
|
29
|
-
return await send(transactionSender)({ ...sendParams, ...params });
|
|
45
|
+
return { ...(await send(transactionSender)({ ...sendParams, ...params })) };
|
|
46
|
+
}
|
|
47
|
+
/** @deprecated Bridges between legacy `sendTransaction` behaviour for app transactions and new `AlgorandClient` behaviour. */
|
|
48
|
+
async function legacySendAppTransactionBridge(algod, from, appArgs, sendParams, params, txn, send, suggestedParams) {
|
|
49
|
+
const encoder = new TextEncoder();
|
|
50
|
+
const paramsWithAppArgs = {
|
|
51
|
+
...params,
|
|
52
|
+
accountReferences: appArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),
|
|
53
|
+
appReferences: appArgs?.apps?.map((a) => BigInt(a)),
|
|
54
|
+
assetReferences: appArgs?.assets?.map((a) => BigInt(a)),
|
|
55
|
+
boxReferences: appArgs?.boxes?.map(_getBoxReference)?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name })),
|
|
56
|
+
lease: appArgs?.lease,
|
|
57
|
+
rekeyTo: appArgs?.rekeyTo ? getSenderAddress(appArgs?.rekeyTo) : undefined,
|
|
58
|
+
args: appArgs
|
|
59
|
+
? 'methodArgs' in appArgs
|
|
60
|
+
? (await _getAppArgsForABICall(appArgs, from)).methodArgs
|
|
61
|
+
: appArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))
|
|
62
|
+
: undefined,
|
|
63
|
+
note: encodeTransactionNote(sendParams?.note),
|
|
64
|
+
};
|
|
65
|
+
return await legacySendTransactionBridge(algod, from, sendParams, paramsWithAppArgs, txn, send, suggestedParams);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* @deprecated
|
|
69
|
+
*/
|
|
70
|
+
async function _getAppArgsForABICall(args, from) {
|
|
71
|
+
const signer = getSenderTransactionSigner(from);
|
|
72
|
+
const methodArgs = await Promise.all(('methodArgs' in args ? args.methodArgs : args)?.map(async (a, index) => {
|
|
73
|
+
if (a === undefined) {
|
|
74
|
+
throw new Error(`Argument at position ${index} does not have a value`);
|
|
75
|
+
}
|
|
76
|
+
if (typeof a !== 'object') {
|
|
77
|
+
return a;
|
|
78
|
+
}
|
|
79
|
+
// Handle the various forms of transactions to wrangle them for ATC
|
|
80
|
+
return 'txn' in a
|
|
81
|
+
? a
|
|
82
|
+
: a instanceof Promise
|
|
83
|
+
? { txn: (await a).transaction, signer }
|
|
84
|
+
: 'transaction' in a
|
|
85
|
+
? { txn: a.transaction, signer: 'signer' in a ? getSenderTransactionSigner(a.signer) : signer }
|
|
86
|
+
: 'txID' in a
|
|
87
|
+
? { txn: a, signer }
|
|
88
|
+
: a;
|
|
89
|
+
}));
|
|
90
|
+
return {
|
|
91
|
+
method: 'txnCount' in args.method ? args.method : new ABIMethod(args.method),
|
|
92
|
+
sender: getSenderAddress(from),
|
|
93
|
+
signer: signer,
|
|
94
|
+
boxes: args.boxes?.map(_getBoxReference),
|
|
95
|
+
lease: encodeLease(args.lease),
|
|
96
|
+
appForeignApps: args.apps,
|
|
97
|
+
appForeignAssets: args.assets,
|
|
98
|
+
appAccounts: args.accounts?.map(_getAccountAddress),
|
|
99
|
+
methodArgs: methodArgs,
|
|
100
|
+
rekeyTo: args?.rekeyTo ? (typeof args.rekeyTo === 'string' ? args.rekeyTo : getSenderAddress(args.rekeyTo)) : undefined,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function _getAccountAddress(account) {
|
|
104
|
+
return typeof account === 'string' ? account : algosdk.encodeAddress(account.publicKey);
|
|
105
|
+
}
|
|
106
|
+
/** @deprecated */
|
|
107
|
+
function _getBoxReference(box) {
|
|
108
|
+
const encoder = new TextEncoder();
|
|
109
|
+
if (typeof box === 'object' && 'appIndex' in box) {
|
|
110
|
+
return box;
|
|
111
|
+
}
|
|
112
|
+
const ref = typeof box === 'object' && 'appId' in box ? box : { appId: 0, name: box };
|
|
113
|
+
return {
|
|
114
|
+
appIndex: ref.appId,
|
|
115
|
+
name: typeof ref.name === 'string'
|
|
116
|
+
? encoder.encode(ref.name)
|
|
117
|
+
: 'length' in ref.name
|
|
118
|
+
? ref.name
|
|
119
|
+
: algosdk.decodeAddress(getSenderAddress(ref.name)).publicKey,
|
|
120
|
+
};
|
|
30
121
|
}
|
|
31
122
|
|
|
32
|
-
export { legacySendTransactionBridge };
|
|
123
|
+
export { _getAppArgsForABICall, _getBoxReference, legacySendAppTransactionBridge, legacySendTransactionBridge };
|
|
33
124
|
//# sourceMappingURL=legacy-bridge.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-bridge.mjs","sources":["../../src/transaction/legacy-bridge.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAUA;AACO,eAAe,2BAA2B,CAC/C,KAAc,EACd,IAAyB,EACzB,UAAiC,EACjC,MAAS,EACT,GAAiF,EACjF,IAAiH,EACjH,eAAyC,EAAA;AAEzC,IAAA,MAAM,QAAQ,GAAG,MACf,IAAI,eAAe,CAAC;QAClB,KAAK;AACL,QAAA,SAAS,EAAE,MAAM,0BAA0B,CAAC,IAAI,CAAC;QACjD,kBAAkB,EAAE,YAAY,MAAM,oBAAoB,CAAC,eAAe,EAAE,KAAK,CAAC;AACnF,KAAA,CAAC,CAAA;AACJ,IAAA,MAAM,iBAAiB,GAAG,IAAI,+BAA+B,CAAC,QAAQ,EAAE,IAAI,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAA;AAC1G,IAAA,MAAM,kBAAkB,GAAG,IAAI,gCAAgC,CAAC,QAAQ,CAAC,CAAA;AAEzE,IAAA,IAAI,UAAU,CAAC,GAAG,EAAE;AAClB,QAAA,MAAM,CAAC,SAAS,GAAG,UAAU,CAAC,GAAG,CAAA;KAClC;AACD,IAAA,IAAI,UAAU,CAAC,MAAM,EAAE;AACrB,QAAA,MAAM,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAA;KAClC;IAED,IAAI,UAAU,CAAC,GAAG,IAAI,UAAU,CAAC,WAAW,EAAE;QAC5C,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAA;AACzD,QAAA,IAAI,UAAU,CAAC,GAAG,EAAE;AAClB,YAAA,UAAU,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,0BAA0B,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;SAC9F;QACD,OAAO,EAAE,WAAW,EAAE,CAAA;KACvB;AAED,IAAA,OAAO,MAAM,IAAI,CAAC,iBAAiB,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,EAAE,CAAC,CAAA;AACpE;;;;"}
|
|
1
|
+
{"version":3,"file":"legacy-bridge.mjs","sources":["../../src/transaction/legacy-bridge.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AlgorandClientTransactionCreator } from '../types/algorand-client-transaction-creator'\nimport { AlgorandClientTransactionSender } from '../types/algorand-client-transaction-sender'\nimport { ABIAppCallArgs, BoxIdentifier as LegacyBoxIdentifier, BoxReference as LegacyBoxReference, RawAppCallArgs } from '../types/app'\nimport { AppManager, BoxReference } from '../types/app-manager'\nimport { AssetManager } from '../types/asset-manager'\nimport {\n AppCallMethodCall,\n AppCallParams,\n AppCreateMethodCall,\n AppCreateParams,\n AppDeleteMethodCall,\n AppDeleteParams,\n AppUpdateMethodCall,\n AppUpdateParams,\n BuiltTransactions,\n CommonTransactionParams,\n TransactionComposer,\n} from '../types/composer'\nimport {\n SendParams,\n SendSingleTransactionResult,\n SendTransactionFrom,\n SendTransactionParams,\n SendTransactionResult,\n TransactionNote,\n} from '../types/transaction'\nimport { encodeLease, encodeTransactionNote, getSenderAddress, getSenderTransactionSigner } from './transaction'\nimport Algodv2 = algosdk.Algodv2\nimport Transaction = algosdk.Transaction\nimport ABIMethod = algosdk.ABIMethod\n\n/** @deprecated Bridges between legacy `sendTransaction` behaviour and new `AlgorandClient` behaviour. */\nexport async function legacySendTransactionBridge<T extends CommonTransactionParams, TResult extends SendSingleTransactionResult>(\n algod: Algodv2,\n from: SendTransactionFrom,\n sendParams: SendTransactionParams,\n params: T,\n txn:\n | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise<Transaction>)\n | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise<BuiltTransactions>),\n send: (c: AlgorandClientTransactionSender) => (params: T & SendParams) => Promise<TResult>,\n suggestedParams?: algosdk.SuggestedParams,\n): Promise<(SendTransactionResult | TResult) & { transactions: Transaction[] }> {\n const appManager = new AppManager(algod)\n const newGroup = () =>\n new TransactionComposer({\n algod,\n getSigner: () => getSenderTransactionSigner(from),\n getSuggestedParams: async () => (suggestedParams ? { ...suggestedParams } : await algod.getTransactionParams().do()),\n appManager,\n })\n const transactionSender = new AlgorandClientTransactionSender(newGroup, new AssetManager(algod, newGroup), appManager)\n const transactionCreator = new AlgorandClientTransactionCreator(newGroup)\n\n if (sendParams.fee) {\n params.staticFee = sendParams.fee\n }\n\n if (sendParams.maxFee) {\n params.maxFee = sendParams.maxFee\n }\n\n if (sendParams.atc || sendParams.skipSending) {\n const transaction = await txn(transactionCreator)(params)\n const txns = 'transactions' in transaction ? transaction.transactions : [transaction]\n if (sendParams.atc) {\n const baseIndex = sendParams.atc.count()\n txns\n .map((txn, i) => ({\n txn,\n signer:\n 'signers' in transaction ? (transaction.signers.get(i) ?? getSenderTransactionSigner(from)) : getSenderTransactionSigner(from),\n }))\n .forEach((t) => sendParams.atc!.addTransaction(t))\n // Populate ATC with method calls\n if ('transactions' in transaction) {\n transaction.methodCalls.forEach((m, i) => sendParams.atc!['methodCalls'].set(i + baseIndex, m))\n }\n }\n return { transaction: txns.at(-1)!, transactions: txns }\n }\n\n return { ...(await send(transactionSender)({ ...sendParams, ...params })) }\n}\n\n/** @deprecated Bridges between legacy `sendTransaction` behaviour for app transactions and new `AlgorandClient` behaviour. */\nexport async function legacySendAppTransactionBridge<\n T extends\n | AppCreateParams\n | AppUpdateParams\n | AppDeleteParams\n | AppCallParams\n | AppCreateMethodCall\n | AppUpdateMethodCall\n | AppDeleteMethodCall\n | AppCallMethodCall,\n TResult extends SendSingleTransactionResult,\n>(\n algod: Algodv2,\n from: SendTransactionFrom,\n appArgs: RawAppCallArgs | ABIAppCallArgs | undefined,\n sendParams: SendTransactionParams & { note?: TransactionNote },\n params: Omit<T, 'accountReferences' | 'appReferences' | 'assetReferences' | 'boxReferences' | 'args' | 'lease' | 'rekeyTo' | 'note'>,\n txn:\n | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise<Transaction>)\n | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise<BuiltTransactions>),\n send: (c: AlgorandClientTransactionSender) => (params: T & SendParams) => Promise<TResult>,\n suggestedParams?: algosdk.SuggestedParams,\n): Promise<(SendTransactionResult | TResult) & { transactions: Transaction[] }> {\n const encoder = new TextEncoder()\n\n const paramsWithAppArgs = {\n ...params,\n accountReferences: appArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: appArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: appArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: appArgs?.boxes?.map(_getBoxReference)?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: appArgs?.lease,\n rekeyTo: appArgs?.rekeyTo ? getSenderAddress(appArgs?.rekeyTo) : undefined,\n args: appArgs\n ? 'methodArgs' in appArgs\n ? (await _getAppArgsForABICall(appArgs, from)).methodArgs\n : appArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n note: encodeTransactionNote(sendParams?.note),\n } as T\n\n return await legacySendTransactionBridge(algod, from, sendParams, paramsWithAppArgs, txn, send, suggestedParams)\n}\n\n/**\n * @deprecated\n */\nexport async function _getAppArgsForABICall(args: ABIAppCallArgs, from: SendTransactionFrom) {\n const signer = getSenderTransactionSigner(from)\n const methodArgs = await Promise.all(\n ('methodArgs' in args ? args.methodArgs : args)?.map(async (a, index) => {\n if (a === undefined) {\n throw new Error(`Argument at position ${index} does not have a value`)\n }\n if (typeof a !== 'object') {\n return a\n }\n // Handle the various forms of transactions to wrangle them for ATC\n return 'txn' in a\n ? a\n : a instanceof Promise\n ? { txn: (await a).transaction, signer }\n : 'transaction' in a\n ? { txn: a.transaction, signer: 'signer' in a ? getSenderTransactionSigner(a.signer) : signer }\n : 'txID' in a\n ? { txn: a, signer }\n : a\n }),\n )\n return {\n method: 'txnCount' in args.method ? args.method : new ABIMethod(args.method),\n sender: getSenderAddress(from),\n signer: signer,\n boxes: args.boxes?.map(_getBoxReference),\n lease: encodeLease(args.lease),\n appForeignApps: args.apps,\n appForeignAssets: args.assets,\n appAccounts: args.accounts?.map(_getAccountAddress),\n methodArgs: methodArgs,\n rekeyTo: args?.rekeyTo ? (typeof args.rekeyTo === 'string' ? args.rekeyTo : getSenderAddress(args.rekeyTo)) : undefined,\n }\n}\n\nfunction _getAccountAddress(account: string | algosdk.Address) {\n return typeof account === 'string' ? account : algosdk.encodeAddress(account.publicKey)\n}\n\n/** @deprecated */\nexport function _getBoxReference(box: LegacyBoxIdentifier | LegacyBoxReference | algosdk.BoxReference): algosdk.BoxReference {\n const encoder = new TextEncoder()\n\n if (typeof box === 'object' && 'appIndex' in box) {\n return box\n }\n\n const ref = typeof box === 'object' && 'appId' in box ? box : { appId: 0, name: box }\n return {\n appIndex: ref.appId,\n name:\n typeof ref.name === 'string'\n ? encoder.encode(ref.name)\n : 'length' in ref.name\n ? ref.name\n : algosdk.decodeAddress(getSenderAddress(ref.name)).publicKey,\n } as algosdk.BoxReference\n}\n"],"names":[],"mappings":";;;;;;;;AA8BA,IAAO,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;AAEpC;AACO,eAAe,2BAA2B,CAC/C,KAAc,EACd,IAAyB,EACzB,UAAiC,EACjC,MAAS,EACT,GAEwF,EACxF,IAA0F,EAC1F,eAAyC,EAAA;AAEzC,IAAA,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAA;AACxC,IAAA,MAAM,QAAQ,GAAG,MACf,IAAI,mBAAmB,CAAC;QACtB,KAAK;AACL,QAAA,SAAS,EAAE,MAAM,0BAA0B,CAAC,IAAI,CAAC;QACjD,kBAAkB,EAAE,aAAa,eAAe,GAAG,EAAE,GAAG,eAAe,EAAE,GAAG,MAAM,KAAK,CAAC,oBAAoB,EAAE,CAAC,EAAE,EAAE,CAAC;QACpH,UAAU;AACX,KAAA,CAAC,CAAA;AACJ,IAAA,MAAM,iBAAiB,GAAG,IAAI,+BAA+B,CAAC,QAAQ,EAAE,IAAI,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAA;AACtH,IAAA,MAAM,kBAAkB,GAAG,IAAI,gCAAgC,CAAC,QAAQ,CAAC,CAAA;AAEzE,IAAA,IAAI,UAAU,CAAC,GAAG,EAAE;AAClB,QAAA,MAAM,CAAC,SAAS,GAAG,UAAU,CAAC,GAAG,CAAA;KAClC;AAED,IAAA,IAAI,UAAU,CAAC,MAAM,EAAE;AACrB,QAAA,MAAM,CAAC,MAAM,GAAG,UAAU,CA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E,CAAA;IACrF,OAAO;QACL,QAAQ,EAAE,GAAG,CAAC,KAAK;AACnB,QAAA,IAAI,EACF,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ;cACxB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;AAC1B,cAAE,QAAQ,IAAI,GAAG,CAAC,IAAI;kBAClB,GAAG,CAAC,IAAI;AACV,kBAAE,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;KAC5C,CAAA;AAC3B;;;;"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import algosdk from 'algosdk';
|
|
2
2
|
import Algodv2 = algosdk.Algodv2;
|
|
3
3
|
import AtomicTransactionComposer = algosdk.AtomicTransactionComposer;
|
|
4
|
+
import modelsv2 = algosdk.modelsv2;
|
|
4
5
|
/**
|
|
5
6
|
* Performs a simulation of the transactions loaded into the given AtomicTransactionComposer.
|
|
7
|
+
* Uses empty transaction signers for all transactions.
|
|
8
|
+
*
|
|
6
9
|
* @param atc The AtomicTransactionComposer with transaction(s) loaded.
|
|
7
10
|
* @param algod An Algod client to perform the simulation.
|
|
8
11
|
* @returns The simulation result, which includes various details about how the transactions would be processed.
|
|
9
12
|
*/
|
|
10
|
-
export declare function performAtomicTransactionComposerSimulate(atc: AtomicTransactionComposer, algod: Algodv2): Promise<algosdk.modelsv2.SimulateResponse>;
|
|
11
|
-
//# sourceMappingURL=perform-atomic-transaction-composer-simulate.d.ts.map
|
|
13
|
+
export declare function performAtomicTransactionComposerSimulate(atc: AtomicTransactionComposer, algod: Algodv2, options?: Omit<ConstructorParameters<typeof modelsv2.SimulateRequest>[0], 'txnGroups'>): Promise<algosdk.modelsv2.SimulateResponse>;
|
|
@@ -5,25 +5,30 @@ var algosdk = require('algosdk');
|
|
|
5
5
|
var modelsv2 = algosdk.modelsv2;
|
|
6
6
|
/**
|
|
7
7
|
* Performs a simulation of the transactions loaded into the given AtomicTransactionComposer.
|
|
8
|
+
* Uses empty transaction signers for all transactions.
|
|
9
|
+
*
|
|
8
10
|
* @param atc The AtomicTransactionComposer with transaction(s) loaded.
|
|
9
11
|
* @param algod An Algod client to perform the simulation.
|
|
10
12
|
* @returns The simulation result, which includes various details about how the transactions would be processed.
|
|
11
13
|
*/
|
|
12
|
-
async function performAtomicTransactionComposerSimulate(atc, algod) {
|
|
14
|
+
async function performAtomicTransactionComposerSimulate(atc, algod, options) {
|
|
13
15
|
const unsignedTransactionsSigners = atc.buildGroup();
|
|
14
16
|
const decodedSignedTransactions = unsignedTransactionsSigners.map((ts) => algosdk.encodeUnsignedSimulateTransaction(ts.txn));
|
|
15
17
|
const simulateRequest = new modelsv2.SimulateRequest({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
...(options ?? {
|
|
19
|
+
allowEmptySignatures: true,
|
|
20
|
+
fixSigners: true,
|
|
21
|
+
allowMoreLogging: true,
|
|
22
|
+
execTraceConfig: new modelsv2.SimulateTraceConfig({
|
|
23
|
+
enable: true,
|
|
24
|
+
scratchChange: true,
|
|
25
|
+
stackChange: true,
|
|
26
|
+
stateChange: true,
|
|
27
|
+
}),
|
|
23
28
|
}),
|
|
24
29
|
txnGroups: [
|
|
25
30
|
new modelsv2.SimulateRequestTransactionGroup({
|
|
26
|
-
txns: decodedSignedTransactions.map((txn) => algosdk.
|
|
31
|
+
txns: decodedSignedTransactions.map((txn) => algosdk.decodeMsgpack(txn, algosdk.SignedTransaction)),
|
|
27
32
|
}),
|
|
28
33
|
],
|
|
29
34
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perform-atomic-transaction-composer-simulate.js","sources":["../../src/transaction/perform-atomic-transaction-composer-simulate.ts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"perform-atomic-transaction-composer-simulate.js","sources":["../../src/transaction/perform-atomic-transaction-composer-simulate.ts"],"sourcesContent":["import algosdk, { SignedTransaction, decodeMsgpack } from 'algosdk'\nimport Algodv2 = algosdk.Algodv2\nimport AtomicTransactionComposer = algosdk.AtomicTransactionComposer\nimport modelsv2 = algosdk.modelsv2\n\n/**\n * Performs a simulation of the transactions loaded into the given AtomicTransactionComposer.\n * Uses empty transaction signers for all transactions.\n *\n * @param atc The AtomicTransactionComposer with transaction(s) loaded.\n * @param algod An Algod client to perform the simulation.\n * @returns The simulation result, which includes various details about how the transactions would be processed.\n */\nexport async function performAtomicTransactionComposerSimulate(\n atc: AtomicTransactionComposer,\n algod: Algodv2,\n options?: Omit<ConstructorParameters<typeof modelsv2.SimulateRequest>[0], 'txnGroups'>,\n) {\n const unsignedTransactionsSigners = atc.buildGroup()\n const decodedSignedTransactions = unsignedTransactionsSigners.map((ts) => algosdk.encodeUnsignedSimulateTransaction(ts.txn))\n\n const simulateRequest = new modelsv2.SimulateRequest({\n ...(options ?? {\n allowEmptySignatures: true,\n fixSigners: true,\n allowMoreLogging: true,\n execTraceConfig: new modelsv2.SimulateTraceConfig({\n enable: true,\n scratchChange: true,\n stackChange: true,\n stateChange: true,\n }),\n }),\n txnGroups: [\n new modelsv2.SimulateRequestTransactionGroup({\n txns: decodedSignedTransactions.map((txn) => decodeMsgpack(txn, SignedTransaction)),\n }),\n ],\n })\n const simulateResult = await algod.simulateTransactions(simulateRequest).do()\n return simulateResult\n}\n"],"names":["decodeMsgpack","SignedTransaction"],"mappings":";;;;AAGA,IAAO,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;AAElC;;;;;;;AAOG;AACI,eAAe,wCAAwC,CAC5D,GAA8B,EAC9B,KAAc,EACd,OAAsF,EAAA;AAEtF,IAAA,MAAM,2BAA2B,GAAG,GAAG,CAAC,UAAU,EAAE,CAAA;IACpD,MAAM,yBAAyB,GAAG,2BAA2B,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,iCAAiC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;AAE5H,IAAA,MAAM,eAAe,GAAG,IAAI,QAAQ,CAAC,eAAe,CAAC;QACnD,IAAI,OAAO,IAAI;AACb,YAAA,oBAAoB,EAAE,IAAI;AAC1B,YAAA,UAAU,EAAE,IAAI;AAChB,YAAA,gBAAgB,EAAE,IAAI;AACtB,YAAA,eAAe,EAAE,IAAI,QAAQ,CAAC,mBAAmB,CAAC;AAChD,gBAAA,MAAM,EAAE,IAAI;AACZ,gBAAA,aAAa,EAAE,IAAI;AACnB,gBAAA,WAAW,EAAE,IAAI;AACjB,gBAAA,WAAW,EAAE,IAAI;aAClB,CAAC;SACH,CAAC;AACF,QAAA,SAAS,EAAE;YACT,IAAI,QAAQ,CAAC,+BAA+B,CAAC;AAC3C,gBAAA,IAAI,EAAE,yBAAyB,CAAC,GAAG,CAAC,CAAC,GAAG,KAAKA,qBAAa,CAAC,GAAG,EAAEC,yBAAiB,CAAC,CAAC;aACpF,CAAC;AACH,SAAA;AACF,KAAA,CAAC,CAAA;AACF,IAAA,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,oBAAoB,CAAC,eAAe,CAAC,CAAC,EAAE,EAAE,CAAA;AAC7E,IAAA,OAAO,cAAc,CAAA;AACvB;;;;"}
|
|
@@ -1,27 +1,32 @@
|
|
|
1
|
-
import algosdk from 'algosdk';
|
|
1
|
+
import algosdk, { decodeMsgpack, SignedTransaction } from 'algosdk';
|
|
2
2
|
|
|
3
3
|
var modelsv2 = algosdk.modelsv2;
|
|
4
4
|
/**
|
|
5
5
|
* Performs a simulation of the transactions loaded into the given AtomicTransactionComposer.
|
|
6
|
+
* Uses empty transaction signers for all transactions.
|
|
7
|
+
*
|
|
6
8
|
* @param atc The AtomicTransactionComposer with transaction(s) loaded.
|
|
7
9
|
* @param algod An Algod client to perform the simulation.
|
|
8
10
|
* @returns The simulation result, which includes various details about how the transactions would be processed.
|
|
9
11
|
*/
|
|
10
|
-
async function performAtomicTransactionComposerSimulate(atc, algod) {
|
|
12
|
+
async function performAtomicTransactionComposerSimulate(atc, algod, options) {
|
|
11
13
|
const unsignedTransactionsSigners = atc.buildGroup();
|
|
12
14
|
const decodedSignedTransactions = unsignedTransactionsSigners.map((ts) => algosdk.encodeUnsignedSimulateTransaction(ts.txn));
|
|
13
15
|
const simulateRequest = new modelsv2.SimulateRequest({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
...(options ?? {
|
|
17
|
+
allowEmptySignatures: true,
|
|
18
|
+
fixSigners: true,
|
|
19
|
+
allowMoreLogging: true,
|
|
20
|
+
execTraceConfig: new modelsv2.SimulateTraceConfig({
|
|
21
|
+
enable: true,
|
|
22
|
+
scratchChange: true,
|
|
23
|
+
stackChange: true,
|
|
24
|
+
stateChange: true,
|
|
25
|
+
}),
|
|
21
26
|
}),
|
|
22
27
|
txnGroups: [
|
|
23
28
|
new modelsv2.SimulateRequestTransactionGroup({
|
|
24
|
-
txns: decodedSignedTransactions.map((txn) =>
|
|
29
|
+
txns: decodedSignedTransactions.map((txn) => decodeMsgpack(txn, SignedTransaction)),
|
|
25
30
|
}),
|
|
26
31
|
],
|
|
27
32
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perform-atomic-transaction-composer-simulate.mjs","sources":["../../src/transaction/perform-atomic-transaction-composer-simulate.ts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"perform-atomic-transaction-composer-simulate.mjs","sources":["../../src/transaction/perform-atomic-transaction-composer-simulate.ts"],"sourcesContent":["import algosdk, { SignedTransaction, decodeMsgpack } from 'algosdk'\nimport Algodv2 = algosdk.Algodv2\nimport AtomicTransactionComposer = algosdk.AtomicTransactionComposer\nimport modelsv2 = algosdk.modelsv2\n\n/**\n * Performs a simulation of the transactions loaded into the given AtomicTransactionComposer.\n * Uses empty transaction signers for all transactions.\n *\n * @param atc The AtomicTransactionComposer with transaction(s) loaded.\n * @param algod An Algod client to perform the simulation.\n * @returns The simulation result, which includes various details about how the transactions would be processed.\n */\nexport async function performAtomicTransactionComposerSimulate(\n atc: AtomicTransactionComposer,\n algod: Algodv2,\n options?: Omit<ConstructorParameters<typeof modelsv2.SimulateRequest>[0], 'txnGroups'>,\n) {\n const unsignedTransactionsSigners = atc.buildGroup()\n const decodedSignedTransactions = unsignedTransactionsSigners.map((ts) => algosdk.encodeUnsignedSimulateTransaction(ts.txn))\n\n const simulateRequest = new modelsv2.SimulateRequest({\n ...(options ?? {\n allowEmptySignatures: true,\n fixSigners: true,\n allowMoreLogging: true,\n execTraceConfig: new modelsv2.SimulateTraceConfig({\n enable: true,\n scratchChange: true,\n stackChange: true,\n stateChange: true,\n }),\n }),\n txnGroups: [\n new modelsv2.SimulateRequestTransactionGroup({\n txns: decodedSignedTransactions.map((txn) => decodeMsgpack(txn, SignedTransaction)),\n }),\n ],\n })\n const simulateResult = await algod.simulateTransactions(simulateRequest).do()\n return simulateResult\n}\n"],"names":[],"mappings":";;AAGA,IAAO,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;AAElC;;;;;;;AAOG;AACI,eAAe,wCAAwC,CAC5D,GAA8B,EAC9B,KAAc,EACd,OAAsF,EAAA;AAEtF,IAAA,MAAM,2BAA2B,GAAG,GAAG,CAAC,UAAU,EAAE,CAAA;IACpD,MAAM,yBAAyB,GAAG,2BAA2B,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,iCAAiC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;AAE5H,IAAA,MAAM,eAAe,GAAG,IAAI,QAAQ,CAAC,eAAe,CAAC;QACnD,IAAI,OAAO,IAAI;AACb,YAAA,oBAAoB,EAAE,IAAI;AAC1B,YAAA,UAAU,EAAE,IAAI;AAChB,YAAA,gBAAgB,EAAE,IAAI;AACtB,YAAA,eAAe,EAAE,IAAI,QAAQ,CAAC,mBAAmB,CAAC;AAChD,gBAAA,MAAM,EAAE,IAAI;AACZ,gBAAA,aAAa,EAAE,IAAI;AACnB,gBAAA,WAAW,EAAE,IAAI;AACjB,gBAAA,WAAW,EAAE,IAAI;aAClB,CAAC;SACH,CAAC;AACF,QAAA,SAAS,EAAE;YACT,IAAI,QAAQ,CAAC,+BAA+B,CAAC;AAC3C,gBAAA,IAAI,EAAE,yBAAyB,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,aAAa,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;aACpF,CAAC;AACH,SAAA;AACF,KAAA,CAAC,CAAA;AACF,IAAA,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,oBAAoB,CAAC,eAAe,CAAC,CAAC,EAAE,EAAE,CAAA;AAC7E,IAAA,OAAO,cAAc,CAAA;AACvB;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import algosdk from 'algosdk';
|
|
2
2
|
import { AlgoAmount } from '../types/amount';
|
|
3
|
+
import { ABIReturn } from '../types/app';
|
|
3
4
|
import { AtomicTransactionComposerToSend, SendAtomicTransactionComposerResults, SendTransactionFrom, SendTransactionParams, SendTransactionResult, TransactionGroupToSend, TransactionNote, TransactionToSign } from '../types/transaction';
|
|
4
5
|
import Algodv2 = algosdk.Algodv2;
|
|
5
6
|
import AtomicTransactionComposer = algosdk.AtomicTransactionComposer;
|
|
@@ -10,7 +11,10 @@ import TransactionWithSigner = algosdk.TransactionWithSigner;
|
|
|
10
11
|
export declare const MAX_TRANSACTION_GROUP_SIZE = 16;
|
|
11
12
|
export declare const MAX_APP_CALL_FOREIGN_REFERENCES = 8;
|
|
12
13
|
export declare const MAX_APP_CALL_ACCOUNT_REFERENCES = 4;
|
|
13
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Convert your data to a `string` or `Uint8Array`, if using ARC-2 use `TransactionComposer.arc2Note`.
|
|
16
|
+
*
|
|
17
|
+
* Encodes a transaction note into a byte array ready to be included in an Algorand transaction.
|
|
14
18
|
*
|
|
15
19
|
* @param note The transaction note
|
|
16
20
|
* @returns the transaction note ready for inclusion in a transaction
|
|
@@ -33,12 +37,18 @@ export declare function encodeTransactionNote(note?: TransactionNote): Uint8Arra
|
|
|
33
37
|
*/
|
|
34
38
|
export declare function encodeLease(lease?: string | Uint8Array): Uint8Array | undefined;
|
|
35
39
|
/**
|
|
40
|
+
* @deprecated Use `algorand.client` to interact with accounts, and use `.addr` to get the address
|
|
41
|
+
* and/or move from using `SendTransactionFrom` to `TransactionSignerAccount` and use `.addr` instead.
|
|
42
|
+
*
|
|
36
43
|
* Returns the public address of the given transaction sender.
|
|
37
44
|
* @param sender A transaction sender
|
|
38
45
|
* @returns The public address
|
|
39
46
|
*/
|
|
40
47
|
export declare const getSenderAddress: (sender: string | SendTransactionFrom) => string;
|
|
41
48
|
/**
|
|
49
|
+
* @deprecated Use `AlgorandClient` / `TransactionComposer` to construct transactions instead or
|
|
50
|
+
* construct an `algosdk.TransactionWithSigner` manually instead.
|
|
51
|
+
*
|
|
42
52
|
* Given a transaction in a variety of supported formats, returns a TransactionWithSigner object ready to be passed to an
|
|
43
53
|
* AtomicTransactionComposer's addTransaction method.
|
|
44
54
|
* @param transaction One of: A TransactionWithSigner object (returned as is), a TransactionToSign object (signer is obtained from the
|
|
@@ -50,6 +60,9 @@ export declare const getSenderAddress: (sender: string | SendTransactionFrom) =>
|
|
|
50
60
|
*/
|
|
51
61
|
export declare const getTransactionWithSigner: (transaction: TransactionWithSigner | TransactionToSign | Transaction | Promise<SendTransactionResult>, defaultSender?: SendTransactionFrom) => Promise<TransactionWithSigner>;
|
|
52
62
|
/**
|
|
63
|
+
* @deprecated Use `TransactionSignerAccount` instead of `SendTransactionFrom` or use
|
|
64
|
+
* `algosdk.makeBasicAccountTransactionSigner` / `algosdk.makeLogicSigAccountTransactionSigner`.
|
|
65
|
+
*
|
|
53
66
|
* Returns a `TransactionSigner` for the given transaction sender.
|
|
54
67
|
* This function has memoization, so will return the same transaction signer for a given sender.
|
|
55
68
|
* @param sender A transaction sender
|
|
@@ -57,13 +70,20 @@ export declare const getTransactionWithSigner: (transaction: TransactionWithSign
|
|
|
57
70
|
*/
|
|
58
71
|
export declare const getSenderTransactionSigner: (val: SendTransactionFrom) => algosdk.TransactionSigner;
|
|
59
72
|
/**
|
|
73
|
+
* @deprecated Use `AlgorandClient` / `TransactionComposer` to sign transactions
|
|
74
|
+
* or use the relevant underlying `account.signTxn` / `algosdk.signLogicSigTransactionObject`
|
|
75
|
+
* / `multiSigAccount.sign` / `TransactionSigner` methods directly.
|
|
76
|
+
*
|
|
60
77
|
* Signs a single transaction by the given signer.
|
|
61
78
|
* @param transaction The transaction to sign
|
|
62
79
|
* @param signer The signer to sign
|
|
63
80
|
* @returns The signed transaction as a `Uint8Array`
|
|
64
81
|
*/
|
|
65
82
|
export declare const signTransaction: (transaction: Transaction, signer: SendTransactionFrom) => Promise<Uint8Array>;
|
|
66
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* @deprecated Use `AlgorandClient` / `TransactionComposer` to send transactions.
|
|
85
|
+
*
|
|
86
|
+
* Prepares a transaction for sending and then (if instructed) signs and sends the given transaction to the chain.
|
|
67
87
|
*
|
|
68
88
|
* @param send The details for the transaction to prepare/send, including:
|
|
69
89
|
* * `transaction`: The unsigned transaction
|
|
@@ -98,21 +118,20 @@ export declare const sendTransaction: (send: {
|
|
|
98
118
|
export declare function populateAppCallResources(atc: algosdk.AtomicTransactionComposer, algod: algosdk.Algodv2): Promise<algosdk.AtomicTransactionComposer>;
|
|
99
119
|
/**
|
|
100
120
|
* Signs and sends transactions that have been collected by an `AtomicTransactionComposer`.
|
|
101
|
-
* @param atcSend The parameters controlling the send, including
|
|
102
|
-
* * `atc` The `AtomicTransactionComposer`
|
|
103
|
-
* * `sendParams` The parameters to control the send behaviour
|
|
121
|
+
* @param atcSend The parameters controlling the send, including `atc` The `AtomicTransactionComposer` and params to control send behaviour
|
|
104
122
|
* @param algod An algod client
|
|
105
123
|
* @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)
|
|
106
124
|
*/
|
|
107
125
|
export declare const sendAtomicTransactionComposer: (atcSend: AtomicTransactionComposerToSend, algod: Algodv2) => Promise<SendAtomicTransactionComposerResults>;
|
|
108
126
|
/**
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* @param
|
|
112
|
-
* @returns The dryrun result
|
|
127
|
+
* Takes an algosdk `ABIResult` and converts it to an `ABIReturn`.
|
|
128
|
+
* Converts `bigint`'s for Uint's < 64 to `number` for easier use.
|
|
129
|
+
* @param result The `ABIReturn`
|
|
113
130
|
*/
|
|
114
|
-
export declare function
|
|
131
|
+
export declare function getABIReturnValue(result: algosdk.ABIResult): ABIReturn;
|
|
115
132
|
/**
|
|
133
|
+
* @deprecated Use `TransactionComposer` (`algorand.newGroup()`) or `AtomicTransactionComposer` to construct and send group transactions instead.
|
|
134
|
+
*
|
|
116
135
|
* Signs and sends a group of [up to 16](https://developer.algorand.org/docs/get-details/atomic_transfers/#create-transactions) transactions to the chain
|
|
117
136
|
*
|
|
118
137
|
* @param groupSend The group details to send, with:
|
|
@@ -135,6 +154,8 @@ export declare const sendGroupOfTransactions: (groupSend: TransactionGroupToSend
|
|
|
135
154
|
*/
|
|
136
155
|
export declare const waitForConfirmation: (transactionId: string, maxRoundsToWait: number | bigint, algod: Algodv2) => Promise<modelsv2.PendingTransactionResponse>;
|
|
137
156
|
/**
|
|
157
|
+
* @deprecated Use `TransactionComposer` and the `maxFee` field in the transaction params instead.
|
|
158
|
+
*
|
|
138
159
|
* Limit the acceptable fee to a defined amount of µAlgo.
|
|
139
160
|
* This also sets the transaction to be flatFee to ensure the transaction only succeeds at
|
|
140
161
|
* the estimated rate.
|
|
@@ -143,6 +164,8 @@ export declare const waitForConfirmation: (transactionId: string, maxRoundsToWai
|
|
|
143
164
|
*/
|
|
144
165
|
export declare function capTransactionFee(transaction: algosdk.Transaction | SuggestedParams, maxAcceptableFee: AlgoAmount): void;
|
|
145
166
|
/**
|
|
167
|
+
* @deprecated Use `TransactionComposer` and the `maxFee` and `staticFee` fields in the transaction params instead.
|
|
168
|
+
*
|
|
146
169
|
* Allows for control of fees on a `Transaction` or `SuggestedParams` object
|
|
147
170
|
* @param transaction The transaction or suggested params
|
|
148
171
|
* @param feeControl The fee control parameters
|
|
@@ -152,23 +175,19 @@ export declare function controlFees<T extends SuggestedParams | Transaction>(tra
|
|
|
152
175
|
maxFee?: AlgoAmount;
|
|
153
176
|
}): T;
|
|
154
177
|
/**
|
|
178
|
+
* @deprecated Use `suggestedParams ? { ...suggestedParams } : await algod.getTransactionParams().do()` instead
|
|
179
|
+
*
|
|
155
180
|
* Returns suggested transaction parameters from algod unless some are already provided.
|
|
156
181
|
* @param params Optionally provide parameters to use
|
|
157
182
|
* @param algod Algod algod
|
|
158
183
|
* @returns The suggested transaction parameters
|
|
159
184
|
*/
|
|
160
|
-
export declare function getTransactionParams(params: SuggestedParams | undefined, algod: Algodv2): Promise<
|
|
161
|
-
flatFee?: boolean | undefined;
|
|
162
|
-
fee: number;
|
|
163
|
-
firstRound: number;
|
|
164
|
-
lastRound: number;
|
|
165
|
-
genesisID: string;
|
|
166
|
-
genesisHash: string;
|
|
167
|
-
}>;
|
|
185
|
+
export declare function getTransactionParams(params: SuggestedParams | undefined, algod: Algodv2): Promise<SuggestedParams>;
|
|
168
186
|
/**
|
|
187
|
+
* @deprecated Use `atc.clone().buildGroup()` instead.
|
|
188
|
+
*
|
|
169
189
|
* Returns the array of transactions currently present in the given `AtomicTransactionComposer`
|
|
170
190
|
* @param atc The atomic transaction composer
|
|
171
191
|
* @returns The array of transactions with signers
|
|
172
192
|
*/
|
|
173
193
|
export declare function getAtomicTransactionComposerTransactions(atc: AtomicTransactionComposer): algosdk.TransactionWithSigner[];
|
|
174
|
-
//# sourceMappingURL=transaction.d.ts.map
|