@algorandfoundation/algokit-utils 6.3.0-beta.1 → 7.0.0-alpha.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 +22 -26
- package/account/account.d.ts +12 -10
- package/account/get-account-config-from-environment.d.ts +0 -1
- package/account/get-account.d.ts +2 -3
- package/account/get-dispenser-account.d.ts +2 -3
- package/account/index.d.ts +0 -1
- package/account/mnemonic-account.d.ts +1 -2
- package/amount.d.ts +15 -5
- package/app-client.d.ts +19 -5
- package/app-deploy.d.ts +18 -2
- package/app.d.ts +39 -3
- package/asset.d.ts +5 -6
- package/config.d.ts +0 -1
- package/debugging/debugging.d.ts +3 -5
- package/debugging/index.d.ts +0 -2
- package/dispenser-client.d.ts +0 -1
- package/index.d.ts +5 -4
- package/index.js +56 -46
- package/index.js.map +1 -1
- package/index.mjs +26 -25
- package/index.mjs.map +1 -1
- package/indexer-lookup.d.ts +10 -9
- package/localnet/get-kmd-wallet-account.d.ts +1 -2
- package/localnet/get-localnet-dispenser-account.d.ts +1 -2
- package/localnet/get-or-create-kmd-wallet-account.d.ts +1 -2
- package/localnet/index.d.ts +0 -1
- package/localnet/is-localnet.d.ts +1 -2
- package/network-client.d.ts +3 -10
- package/package.json +3 -4
- package/{account → src/account}/account.js +21 -18
- package/src/account/account.js.map +1 -0
- package/{account → src/account}/account.mjs +22 -19
- package/src/account/account.mjs.map +1 -0
- package/src/account/get-account-config-from-environment.js.map +1 -0
- package/src/account/get-account-config-from-environment.mjs.map +1 -0
- package/{account → src/account}/get-account.js +3 -3
- package/src/account/get-account.js.map +1 -0
- package/{account → src/account}/get-account.mjs +3 -3
- package/src/account/get-account.mjs.map +1 -0
- package/{account → src/account}/get-dispenser-account.js +3 -3
- package/src/account/get-dispenser-account.js.map +1 -0
- package/{account → src/account}/get-dispenser-account.mjs +3 -3
- package/src/account/get-dispenser-account.mjs.map +1 -0
- package/{account → src/account}/mnemonic-account.js +1 -1
- package/src/account/mnemonic-account.js.map +1 -0
- package/{account → src/account}/mnemonic-account.mjs +1 -1
- package/src/account/mnemonic-account.mjs.map +1 -0
- package/{amount.js → src/amount.js} +10 -3
- package/src/amount.js.map +1 -0
- package/{amount.mjs → src/amount.mjs} +10 -4
- package/src/amount.mjs.map +1 -0
- package/{app-client.js → src/app-client.js} +20 -5
- package/src/app-client.js.map +1 -0
- package/{app-client.mjs → src/app-client.mjs} +20 -5
- package/src/app-client.mjs.map +1 -0
- package/src/app-deploy.js +285 -0
- package/src/app-deploy.js.map +1 -0
- package/src/app-deploy.mjs +276 -0
- package/src/app-deploy.mjs.map +1 -0
- package/src/app.js +349 -0
- package/src/app.js.map +1 -0
- package/src/app.mjs +329 -0
- package/src/app.mjs.map +1 -0
- package/{asset.js → src/asset.js} +6 -9
- package/src/asset.js.map +1 -0
- package/{asset.mjs → src/asset.mjs} +6 -9
- package/src/asset.mjs.map +1 -0
- package/{config.js → src/config.js} +1 -1
- package/src/config.js.map +1 -0
- package/{config.mjs → src/config.mjs} +1 -1
- package/src/config.mjs.map +1 -0
- package/src/debugging/debugging.js +15 -0
- package/src/debugging/debugging.js.map +1 -0
- package/src/debugging/debugging.mjs +13 -0
- package/src/debugging/debugging.mjs.map +1 -0
- package/{dispenser-client.js → src/dispenser-client.js} +1 -1
- package/src/dispenser-client.js.map +1 -0
- package/{dispenser-client.mjs → src/dispenser-client.mjs} +1 -1
- package/src/dispenser-client.mjs.map +1 -0
- package/{indexer-lookup.js → src/indexer-lookup.js} +14 -10
- package/src/indexer-lookup.js.map +1 -0
- package/{indexer-lookup.mjs → src/indexer-lookup.mjs} +14 -10
- package/src/indexer-lookup.mjs.map +1 -0
- package/{localnet → src/localnet}/get-kmd-wallet-account.js +3 -3
- package/src/localnet/get-kmd-wallet-account.js.map +1 -0
- package/{localnet → src/localnet}/get-kmd-wallet-account.mjs +3 -3
- package/src/localnet/get-kmd-wallet-account.mjs.map +1 -0
- package/{localnet → src/localnet}/get-localnet-dispenser-account.js +3 -3
- package/src/localnet/get-localnet-dispenser-account.js.map +1 -0
- package/{localnet → src/localnet}/get-localnet-dispenser-account.mjs +3 -3
- package/src/localnet/get-localnet-dispenser-account.mjs.map +1 -0
- package/{localnet → src/localnet}/get-or-create-kmd-wallet-account.js +3 -3
- package/src/localnet/get-or-create-kmd-wallet-account.js.map +1 -0
- package/{localnet → src/localnet}/get-or-create-kmd-wallet-account.mjs +3 -3
- package/src/localnet/get-or-create-kmd-wallet-account.mjs.map +1 -0
- package/{localnet → src/localnet}/is-localnet.js +2 -2
- package/src/localnet/is-localnet.js.map +1 -0
- package/{localnet → src/localnet}/is-localnet.mjs +2 -2
- package/src/localnet/is-localnet.mjs.map +1 -0
- package/{network-client.js → src/network-client.js} +5 -12
- package/src/network-client.js.map +1 -0
- package/{network-client.mjs → src/network-client.mjs} +5 -12
- package/src/network-client.mjs.map +1 -0
- package/{testing → src/testing}/account.js +9 -3
- package/src/testing/account.js.map +1 -0
- package/{testing → src/testing}/account.mjs +10 -4
- package/src/testing/account.mjs.map +1 -0
- package/src/testing/fixtures/algokit-log-capture-fixture.js.map +1 -0
- package/src/testing/fixtures/algokit-log-capture-fixture.mjs.map +1 -0
- package/{testing → src/testing}/fixtures/algorand-fixture.js +15 -16
- package/src/testing/fixtures/algorand-fixture.js.map +1 -0
- package/{testing → src/testing}/fixtures/algorand-fixture.mjs +15 -16
- package/src/testing/fixtures/algorand-fixture.mjs.map +1 -0
- package/src/testing/indexer.js.map +1 -0
- package/src/testing/indexer.mjs.map +1 -0
- package/{testing → src/testing}/test-logger.js +7 -3
- package/src/testing/test-logger.js.map +1 -0
- package/{testing → src/testing}/test-logger.mjs +7 -3
- package/src/testing/test-logger.mjs.map +1 -0
- package/src/testing/transaction-logger.js.map +1 -0
- package/src/testing/transaction-logger.mjs.map +1 -0
- package/src/transaction/legacy-bridge.js +129 -0
- package/src/transaction/legacy-bridge.js.map +1 -0
- package/src/transaction/legacy-bridge.mjs +124 -0
- package/src/transaction/legacy-bridge.mjs.map +1 -0
- package/{transaction → src/transaction}/perform-atomic-transaction-composer-simulate.js +14 -9
- package/src/transaction/perform-atomic-transaction-composer-simulate.js.map +1 -0
- package/{transaction → src/transaction}/perform-atomic-transaction-composer-simulate.mjs +15 -10
- package/src/transaction/perform-atomic-transaction-composer-simulate.mjs.map +1 -0
- package/{transaction → src/transaction}/transaction.js +217 -137
- package/src/transaction/transaction.js.map +1 -0
- package/{transaction → src/transaction}/transaction.mjs +218 -138
- package/src/transaction/transaction.mjs.map +1 -0
- package/{transfer → src/transfer}/transfer-algos.js +1 -1
- package/src/transfer/transfer-algos.js.map +1 -0
- package/{transfer → src/transfer}/transfer-algos.mjs +1 -1
- package/src/transfer/transfer-algos.mjs.map +1 -0
- package/{transfer → src/transfer}/transfer.js +8 -6
- package/src/transfer/transfer.js.map +1 -0
- package/{transfer → src/transfer}/transfer.mjs +8 -6
- package/src/transfer/transfer.mjs.map +1 -0
- package/{util.js → src/util.js} +11 -10
- package/src/util.js.map +1 -0
- package/{util.mjs → src/util.mjs} +11 -10
- package/src/util.mjs.map +1 -0
- package/testing/_asset.d.ts +2 -2
- package/testing/account.d.ts +4 -4
- package/testing/fixtures/algokit-log-capture-fixture.d.ts +0 -1
- package/testing/fixtures/algorand-fixture.d.ts +0 -1
- package/testing/fixtures/index.d.ts +0 -1
- package/testing/index.d.ts +0 -1
- package/testing/index.js +6 -6
- package/testing/index.mjs +6 -6
- package/testing/indexer.d.ts +0 -1
- package/testing/test-logger.d.ts +0 -1
- package/testing/transaction-logger.d.ts +0 -1
- package/transaction/index.d.ts +0 -1
- package/transaction/legacy-bridge.d.ts +31 -6
- package/transaction/perform-atomic-transaction-composer-simulate.d.ts +4 -2
- package/transaction/transaction.d.ts +38 -19
- package/transfer/index.d.ts +0 -1
- package/transfer/transfer-algos.d.ts +1 -2
- package/transfer/transfer.d.ts +1 -2
- package/types/account-manager.d.ts +33 -25
- package/types/account-manager.js +56 -33
- package/types/account-manager.js.map +1 -1
- package/types/account-manager.mjs +58 -35
- 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 +34 -4
- package/types/algo-http-client-with-retry.js.map +1 -1
- package/types/algo-http-client-with-retry.mjs +33 -3
- 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 +446 -16
- package/types/algorand-client-transaction-sender.js.map +1 -1
- package/types/algorand-client-transaction-sender.mjs +446 -16
- 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 +1023 -34
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +1024 -36
- 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 +15 -19
- package/types/asset-manager.js.map +1 -1
- package/types/asset-manager.mjs +15 -19
- 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 +406 -126
- 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 +4 -4
- package/types/kmd-account-manager.js.map +1 -1
- package/types/kmd-account-manager.mjs +5 -5
- 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/account/account.d.ts.map +0 -1
- package/account/account.js.map +0 -1
- package/account/account.mjs.map +0 -1
- package/account/get-account-config-from-environment.d.ts.map +0 -1
- package/account/get-account-config-from-environment.js.map +0 -1
- package/account/get-account-config-from-environment.mjs.map +0 -1
- package/account/get-account.d.ts.map +0 -1
- package/account/get-account.js.map +0 -1
- package/account/get-account.mjs.map +0 -1
- package/account/get-dispenser-account.d.ts.map +0 -1
- package/account/get-dispenser-account.js.map +0 -1
- package/account/get-dispenser-account.mjs.map +0 -1
- package/account/index.d.ts.map +0 -1
- package/account/mnemonic-account.d.ts.map +0 -1
- package/account/mnemonic-account.js.map +0 -1
- package/account/mnemonic-account.mjs.map +0 -1
- package/amount.d.ts.map +0 -1
- package/amount.js.map +0 -1
- package/amount.mjs.map +0 -1
- package/app-client.d.ts.map +0 -1
- package/app-client.js.map +0 -1
- package/app-client.mjs.map +0 -1
- package/app-deploy.d.ts.map +0 -1
- package/app-deploy.js +0 -468
- package/app-deploy.js.map +0 -1
- package/app-deploy.mjs +0 -459
- package/app-deploy.mjs.map +0 -1
- package/app.d.ts.map +0 -1
- package/app.js +0 -599
- package/app.js.map +0 -1
- package/app.mjs +0 -579
- package/app.mjs.map +0 -1
- package/asset.d.ts.map +0 -1
- package/asset.js.map +0 -1
- package/asset.mjs.map +0 -1
- package/config.d.ts.map +0 -1
- package/config.js.map +0 -1
- package/config.mjs.map +0 -1
- package/debugging/debugging.d.ts.map +0 -1
- package/debugging/debugging.js +0 -139
- package/debugging/debugging.js.map +0 -1
- package/debugging/debugging.mjs +0 -118
- package/debugging/debugging.mjs.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/dispenser-client.js.map +0 -1
- package/dispenser-client.mjs.map +0 -1
- package/index.d.ts.map +0 -1
- package/indexer-lookup.d.ts.map +0 -1
- package/indexer-lookup.js.map +0 -1
- package/indexer-lookup.mjs.map +0 -1
- package/localnet/get-kmd-wallet-account.d.ts.map +0 -1
- package/localnet/get-kmd-wallet-account.js.map +0 -1
- package/localnet/get-kmd-wallet-account.mjs.map +0 -1
- package/localnet/get-localnet-dispenser-account.d.ts.map +0 -1
- package/localnet/get-localnet-dispenser-account.js.map +0 -1
- package/localnet/get-localnet-dispenser-account.mjs.map +0 -1
- package/localnet/get-or-create-kmd-wallet-account.d.ts.map +0 -1
- package/localnet/get-or-create-kmd-wallet-account.js.map +0 -1
- package/localnet/get-or-create-kmd-wallet-account.mjs.map +0 -1
- package/localnet/index.d.ts.map +0 -1
- package/localnet/is-localnet.d.ts.map +0 -1
- package/localnet/is-localnet.js.map +0 -1
- package/localnet/is-localnet.mjs.map +0 -1
- package/network-client.d.ts.map +0 -1
- package/network-client.js.map +0 -1
- package/network-client.mjs.map +0 -1
- package/testing/_asset.d.ts.map +0 -1
- package/testing/account.d.ts.map +0 -1
- package/testing/account.js.map +0 -1
- package/testing/account.mjs.map +0 -1
- package/testing/fixtures/algokit-log-capture-fixture.d.ts.map +0 -1
- package/testing/fixtures/algokit-log-capture-fixture.js.map +0 -1
- package/testing/fixtures/algokit-log-capture-fixture.mjs.map +0 -1
- package/testing/fixtures/algorand-fixture.d.ts.map +0 -1
- package/testing/fixtures/algorand-fixture.js.map +0 -1
- package/testing/fixtures/algorand-fixture.mjs.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/indexer.js.map +0 -1
- package/testing/indexer.mjs.map +0 -1
- package/testing/test-logger.d.ts.map +0 -1
- package/testing/test-logger.js.map +0 -1
- package/testing/test-logger.mjs.map +0 -1
- package/testing/transaction-logger.d.ts.map +0 -1
- package/testing/transaction-logger.js.map +0 -1
- package/testing/transaction-logger.mjs.map +0 -1
- package/transaction/index.d.ts.map +0 -1
- package/transaction/legacy-bridge.d.ts.map +0 -1
- package/transaction/legacy-bridge.js +0 -35
- package/transaction/legacy-bridge.js.map +0 -1
- package/transaction/legacy-bridge.mjs +0 -33
- package/transaction/legacy-bridge.mjs.map +0 -1
- package/transaction/perform-atomic-transaction-composer-simulate.d.ts.map +0 -1
- package/transaction/perform-atomic-transaction-composer-simulate.js.map +0 -1
- package/transaction/perform-atomic-transaction-composer-simulate.mjs.map +0 -1
- package/transaction/transaction.d.ts.map +0 -1
- package/transaction/transaction.js.map +0 -1
- package/transaction/transaction.mjs.map +0 -1
- package/transfer/index.d.ts.map +0 -1
- package/transfer/transfer-algos.d.ts.map +0 -1
- package/transfer/transfer-algos.js.map +0 -1
- package/transfer/transfer-algos.mjs.map +0 -1
- package/transfer/transfer.d.ts.map +0 -1
- package/transfer/transfer.js.map +0 -1
- package/transfer/transfer.mjs.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
- package/util.js.map +0 -1
- package/util.mjs.map +0 -1
- /package/{account → src/account}/get-account-config-from-environment.js +0 -0
- /package/{account → src/account}/get-account-config-from-environment.mjs +0 -0
- /package/{testing → src/testing}/fixtures/algokit-log-capture-fixture.js +0 -0
- /package/{testing → src/testing}/fixtures/algokit-log-capture-fixture.mjs +0 -0
- /package/{testing → src/testing}/indexer.js +0 -0
- /package/{testing → src/testing}/indexer.mjs +0 -0
- /package/{testing → src/testing}/transaction-logger.js +0 -0
- /package/{testing → src/testing}/transaction-logger.mjs +0 -0
|
@@ -3,16 +3,18 @@
|
|
|
3
3
|
var algosdk = require('algosdk');
|
|
4
4
|
var buffer = require('buffer');
|
|
5
5
|
var config = require('../config.js');
|
|
6
|
-
var
|
|
6
|
+
var types_lifecycleEvents = require('../../types/lifecycle-events.js');
|
|
7
7
|
var util = require('../util.js');
|
|
8
8
|
var performAtomicTransactionComposerSimulate = require('./perform-atomic-transaction-composer-simulate.js');
|
|
9
9
|
|
|
10
10
|
var AtomicTransactionComposer = algosdk.AtomicTransactionComposer;
|
|
11
|
-
var modelsv2 = algosdk.modelsv2;
|
|
12
11
|
const MAX_TRANSACTION_GROUP_SIZE = 16;
|
|
13
12
|
const MAX_APP_CALL_FOREIGN_REFERENCES = 8;
|
|
14
13
|
const MAX_APP_CALL_ACCOUNT_REFERENCES = 4;
|
|
15
|
-
/**
|
|
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.
|
|
16
18
|
*
|
|
17
19
|
* @param note The transaction note
|
|
18
20
|
* @returns the transaction note ready for inclusion in a transaction
|
|
@@ -78,14 +80,20 @@ function encodeLease(lease) {
|
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
/**
|
|
83
|
+
* @deprecated Use `algorand.client` to interact with accounts, and use `.addr` to get the address
|
|
84
|
+
* and/or move from using `SendTransactionFrom` to `TransactionSignerAccount` and use `.addr` instead.
|
|
85
|
+
*
|
|
81
86
|
* Returns the public address of the given transaction sender.
|
|
82
87
|
* @param sender A transaction sender
|
|
83
88
|
* @returns The public address
|
|
84
89
|
*/
|
|
85
90
|
const getSenderAddress = function (sender) {
|
|
86
|
-
return typeof sender === 'string' ? sender : 'addr' in sender ? sender.addr : sender.address();
|
|
91
|
+
return typeof sender === 'string' ? sender : 'addr' in sender ? sender.addr.toString() : sender.address().toString();
|
|
87
92
|
};
|
|
88
93
|
/**
|
|
94
|
+
* @deprecated Use `AlgorandClient` / `TransactionComposer` to construct transactions instead or
|
|
95
|
+
* construct an `algosdk.TransactionWithSigner` manually instead.
|
|
96
|
+
*
|
|
89
97
|
* Given a transaction in a variety of supported formats, returns a TransactionWithSigner object ready to be passed to an
|
|
90
98
|
* AtomicTransactionComposer's addTransaction method.
|
|
91
99
|
* @param transaction One of: A TransactionWithSigner object (returned as is), a TransactionToSign object (signer is obtained from the
|
|
@@ -124,6 +132,9 @@ const memoize = (fn) => {
|
|
|
124
132
|
return cached;
|
|
125
133
|
};
|
|
126
134
|
/**
|
|
135
|
+
* @deprecated Use `TransactionSignerAccount` instead of `SendTransactionFrom` or use
|
|
136
|
+
* `algosdk.makeBasicAccountTransactionSigner` / `algosdk.makeLogicSigAccountTransactionSigner`.
|
|
137
|
+
*
|
|
127
138
|
* Returns a `TransactionSigner` for the given transaction sender.
|
|
128
139
|
* This function has memoization, so will return the same transaction signer for a given sender.
|
|
129
140
|
* @param sender A transaction sender
|
|
@@ -137,6 +148,10 @@ const getSenderTransactionSigner = memoize(function (sender) {
|
|
|
137
148
|
: algosdk.makeBasicAccountTransactionSigner(sender);
|
|
138
149
|
});
|
|
139
150
|
/**
|
|
151
|
+
* @deprecated Use `AlgorandClient` / `TransactionComposer` to sign transactions
|
|
152
|
+
* or use the relevant underlying `account.signTxn` / `algosdk.signLogicSigTransactionObject`
|
|
153
|
+
* / `multiSigAccount.sign` / `TransactionSigner` methods directly.
|
|
154
|
+
*
|
|
140
155
|
* Signs a single transaction by the given signer.
|
|
141
156
|
* @param transaction The transaction to sign
|
|
142
157
|
* @param signer The signer to sign
|
|
@@ -151,7 +166,10 @@ const signTransaction = async (transaction, signer) => {
|
|
|
151
166
|
? signer.sign(transaction)
|
|
152
167
|
: (await signer.signer([transaction], [0]))[0];
|
|
153
168
|
};
|
|
154
|
-
/**
|
|
169
|
+
/**
|
|
170
|
+
* @deprecated Use `AlgorandClient` / `TransactionComposer` to send transactions.
|
|
171
|
+
*
|
|
172
|
+
* Prepares a transaction for sending and then (if instructed) signs and sends the given transaction to the chain.
|
|
155
173
|
*
|
|
156
174
|
* @param send The details for the transaction to prepare/send, including:
|
|
157
175
|
* * `transaction`: The unsigned transaction
|
|
@@ -199,29 +217,18 @@ const sendTransaction = async function (send, algod) {
|
|
|
199
217
|
* @returns The unnamed resources accessed by the group and by each transaction in the group
|
|
200
218
|
*/
|
|
201
219
|
async function getUnnamedAppCallResourcesAccessed(atc, algod) {
|
|
202
|
-
const
|
|
220
|
+
const simulateRequest = new algosdk.modelsv2.SimulateRequest({
|
|
203
221
|
txnGroups: [],
|
|
204
222
|
allowUnnamedResources: true,
|
|
205
223
|
allowEmptySignatures: true,
|
|
224
|
+
fixSigners: true,
|
|
206
225
|
});
|
|
207
|
-
const
|
|
208
|
-
const stxns = await algosdk.makeEmptyTransactionSigner()(txns, indexes);
|
|
209
|
-
return Promise.all(stxns.map(async (stxn) => {
|
|
210
|
-
const decodedStxn = algosdk.decodeSignedTransaction(stxn);
|
|
211
|
-
const sender = algosdk.encodeAddress(decodedStxn.txn.from.publicKey);
|
|
212
|
-
const authAddr = (await algod.accountInformation(sender).do())['auth-addr'];
|
|
213
|
-
const stxnObj = { txn: decodedStxn.txn.get_obj_for_encoding() };
|
|
214
|
-
if (authAddr !== undefined) {
|
|
215
|
-
stxnObj.sgnr = buffer.Buffer.from(algosdk.decodeAddress(authAddr).publicKey);
|
|
216
|
-
}
|
|
217
|
-
return algosdk.encodeObj(stxnObj);
|
|
218
|
-
}));
|
|
219
|
-
};
|
|
226
|
+
const nullSigner = algosdk.makeEmptyTransactionSigner();
|
|
220
227
|
const emptySignerAtc = atc.clone();
|
|
221
228
|
emptySignerAtc['transactions'].forEach((t) => {
|
|
222
|
-
t.signer =
|
|
229
|
+
t.signer = nullSigner;
|
|
223
230
|
});
|
|
224
|
-
const result = await emptySignerAtc.simulate(algod,
|
|
231
|
+
const result = await emptySignerAtc.simulate(algod, simulateRequest);
|
|
225
232
|
const groupResponse = result.simulateResponse.txnGroups[0];
|
|
226
233
|
if (groupResponse.failureMessage) {
|
|
227
234
|
throw Error(`Error during resource population simulation in transaction ${groupResponse.failedAt}: ${groupResponse.failureMessage}`);
|
|
@@ -254,7 +261,7 @@ async function populateAppCallResources(atc, algod) {
|
|
|
254
261
|
const unnamedResourcesAccessed = await getUnnamedAppCallResourcesAccessed(atc, algod);
|
|
255
262
|
const group = atc.buildGroup();
|
|
256
263
|
unnamedResourcesAccessed.txns.forEach((r, i) => {
|
|
257
|
-
if (r === undefined)
|
|
264
|
+
if (r === undefined || group[i].txn.type !== algosdk.TransactionType.appl)
|
|
258
265
|
return;
|
|
259
266
|
if (r.boxes || r.extraBoxRefs)
|
|
260
267
|
throw Error('Unexpected boxes at the transaction level');
|
|
@@ -262,22 +269,19 @@ async function populateAppCallResources(atc, algod) {
|
|
|
262
269
|
throw Error('Unexpected app local at the transaction level');
|
|
263
270
|
if (r.assetHoldings)
|
|
264
271
|
throw Error('Unexpected asset holding at the transaction level');
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
group[i].txn.appForeignAssets = [...(group[i].txn.appForeignAssets ?? []), Number(a)];
|
|
274
|
-
});
|
|
275
|
-
const accounts = group[i].txn.appAccounts?.length || 0;
|
|
272
|
+
group[i].txn['applicationCall'] = {
|
|
273
|
+
...group[i].txn.applicationCall,
|
|
274
|
+
accounts: [...(group[i].txn?.applicationCall?.accounts ?? []), ...(r.accounts ?? [])],
|
|
275
|
+
foreignApps: [...(group[i].txn?.applicationCall?.foreignApps ?? []), ...(r.apps ?? [])],
|
|
276
|
+
foreignAssets: [...(group[i].txn?.applicationCall?.foreignAssets ?? []), ...(r.assets ?? [])],
|
|
277
|
+
boxes: [...(group[i].txn?.applicationCall?.boxes ?? []), ...(r.boxes ?? [])],
|
|
278
|
+
};
|
|
279
|
+
const accounts = group[i].txn.applicationCall?.accounts?.length ?? 0;
|
|
276
280
|
if (accounts > MAX_APP_CALL_ACCOUNT_REFERENCES)
|
|
277
281
|
throw Error(`Account reference limit of ${MAX_APP_CALL_ACCOUNT_REFERENCES} exceeded in transaction ${i}`);
|
|
278
|
-
const assets = group[i].txn.
|
|
279
|
-
const apps = group[i].txn.
|
|
280
|
-
const boxes = group[i].txn.boxes?.length
|
|
282
|
+
const assets = group[i].txn.applicationCall?.foreignAssets?.length ?? 0;
|
|
283
|
+
const apps = group[i].txn.applicationCall?.foreignApps?.length ?? 0;
|
|
284
|
+
const boxes = group[i].txn.applicationCall?.boxes?.length ?? 0;
|
|
281
285
|
if (accounts + assets + apps + boxes > MAX_APP_CALL_FOREIGN_REFERENCES) {
|
|
282
286
|
throw Error(`Resource reference limit of ${MAX_APP_CALL_FOREIGN_REFERENCES} exceeded in transaction ${i}`);
|
|
283
287
|
}
|
|
@@ -286,10 +290,10 @@ async function populateAppCallResources(atc, algod) {
|
|
|
286
290
|
const isApplBelowLimit = (t) => {
|
|
287
291
|
if (t.txn.type !== algosdk.TransactionType.appl)
|
|
288
292
|
return false;
|
|
289
|
-
const accounts = t.txn.
|
|
290
|
-
const assets = t.txn.
|
|
291
|
-
const apps = t.txn.
|
|
292
|
-
const boxes = t.txn.boxes?.length
|
|
293
|
+
const accounts = t.txn.applicationCall?.accounts?.length ?? 0;
|
|
294
|
+
const assets = t.txn.applicationCall?.foreignAssets?.length ?? 0;
|
|
295
|
+
const apps = t.txn.applicationCall?.foreignApps?.length ?? 0;
|
|
296
|
+
const boxes = t.txn.applicationCall?.boxes?.length ?? 0;
|
|
293
297
|
return accounts + assets + apps + boxes < MAX_APP_CALL_FOREIGN_REFERENCES;
|
|
294
298
|
};
|
|
295
299
|
// If this is a asset holding or app local, first try to find a transaction that already has the account available
|
|
@@ -300,22 +304,26 @@ async function populateAppCallResources(atc, algod) {
|
|
|
300
304
|
return false;
|
|
301
305
|
return (
|
|
302
306
|
// account is in the foreign accounts array
|
|
303
|
-
t.txn.
|
|
307
|
+
t.txn.applicationCall?.accounts?.map((a) => a.toString()).includes(account.toString()) ||
|
|
304
308
|
// account is available as an app account
|
|
305
|
-
t.txn.
|
|
309
|
+
t.txn.applicationCall?.foreignApps?.map((a) => algosdk.getApplicationAddress(a).toString()).includes(account.toString()) ||
|
|
306
310
|
// account is available since it's in one of the fields
|
|
307
|
-
Object.values(t.txn)
|
|
308
|
-
.map((f) => JSON.stringify(f))
|
|
309
|
-
.includes(JSON.stringify(algosdk.decodeAddress(account))));
|
|
311
|
+
Object.values(t.txn).some((f) => algosdk.stringifyJSON(f, (_, v) => (v instanceof algosdk.Address ? v.toString() : v))?.includes(account.toString())));
|
|
310
312
|
});
|
|
311
313
|
if (txnIndex > -1) {
|
|
312
314
|
if (type === 'assetHolding') {
|
|
313
315
|
const { asset } = reference;
|
|
314
|
-
txns[txnIndex].txn
|
|
316
|
+
txns[txnIndex].txn['applicationCall'] = {
|
|
317
|
+
...txns[txnIndex].txn.applicationCall,
|
|
318
|
+
foreignAssets: [...(txns[txnIndex].txn?.applicationCall?.foreignAssets ?? []), ...[asset]],
|
|
319
|
+
};
|
|
315
320
|
}
|
|
316
321
|
else {
|
|
317
322
|
const { app } = reference;
|
|
318
|
-
txns[txnIndex].txn
|
|
323
|
+
txns[txnIndex].txn['applicationCall'] = {
|
|
324
|
+
...txns[txnIndex].txn.applicationCall,
|
|
325
|
+
foreignApps: [...(txns[txnIndex].txn?.applicationCall?.foreignApps ?? []), ...[app]],
|
|
326
|
+
};
|
|
319
327
|
}
|
|
320
328
|
return;
|
|
321
329
|
}
|
|
@@ -324,20 +332,23 @@ async function populateAppCallResources(atc, algod) {
|
|
|
324
332
|
if (!isApplBelowLimit(t))
|
|
325
333
|
return false;
|
|
326
334
|
// check if there is space in the accounts array
|
|
327
|
-
if ((t.txn.
|
|
335
|
+
if ((t.txn.applicationCall?.accounts?.length ?? 0) >= MAX_APP_CALL_ACCOUNT_REFERENCES)
|
|
328
336
|
return false;
|
|
329
337
|
if (type === 'assetHolding') {
|
|
330
338
|
const { asset } = reference;
|
|
331
|
-
return t.txn.
|
|
339
|
+
return t.txn.applicationCall?.foreignAssets?.includes(asset);
|
|
332
340
|
}
|
|
333
341
|
else {
|
|
334
342
|
const { app } = reference;
|
|
335
|
-
return t.txn.
|
|
343
|
+
return t.txn.applicationCall?.foreignApps?.includes(app) || t.txn.applicationCall?.appIndex === app;
|
|
336
344
|
}
|
|
337
345
|
});
|
|
338
346
|
if (txnIndex > -1) {
|
|
339
347
|
const { account } = reference;
|
|
340
|
-
txns[txnIndex].txn
|
|
348
|
+
txns[txnIndex].txn['applicationCall'] = {
|
|
349
|
+
...txns[txnIndex].txn.applicationCall,
|
|
350
|
+
accounts: [...(txns[txnIndex].txn?.applicationCall?.accounts ?? []), ...[account]],
|
|
351
|
+
};
|
|
341
352
|
return;
|
|
342
353
|
}
|
|
343
354
|
}
|
|
@@ -348,10 +359,13 @@ async function populateAppCallResources(atc, algod) {
|
|
|
348
359
|
if (!isApplBelowLimit(t))
|
|
349
360
|
return false;
|
|
350
361
|
// If the app is in the foreign array OR the app being called, then we know it's available
|
|
351
|
-
return t.txn.
|
|
362
|
+
return t.txn.applicationCall?.foreignApps?.includes(app) || t.txn.applicationCall?.appIndex === app;
|
|
352
363
|
});
|
|
353
364
|
if (txnIndex > -1) {
|
|
354
|
-
txns[txnIndex].txn
|
|
365
|
+
txns[txnIndex].txn['applicationCall'] = {
|
|
366
|
+
...txns[txnIndex].txn.applicationCall,
|
|
367
|
+
boxes: [...(txns[txnIndex].txn?.applicationCall?.boxes ?? []), ...[{ appIndex: app, name }]],
|
|
368
|
+
};
|
|
355
369
|
return;
|
|
356
370
|
}
|
|
357
371
|
}
|
|
@@ -359,12 +373,12 @@ async function populateAppCallResources(atc, algod) {
|
|
|
359
373
|
const txnIndex = txns.findIndex((t) => {
|
|
360
374
|
if (t.txn.type !== algosdk.TransactionType.appl)
|
|
361
375
|
return false;
|
|
362
|
-
const accounts = t.txn.
|
|
376
|
+
const accounts = t.txn.applicationCall?.accounts?.length ?? 0;
|
|
363
377
|
if (type === 'account')
|
|
364
378
|
return accounts < MAX_APP_CALL_ACCOUNT_REFERENCES;
|
|
365
|
-
const assets = t.txn.
|
|
366
|
-
const apps = t.txn.
|
|
367
|
-
const boxes = t.txn.boxes?.length
|
|
379
|
+
const assets = t.txn.applicationCall?.foreignAssets?.length ?? 0;
|
|
380
|
+
const apps = t.txn.applicationCall?.foreignApps?.length ?? 0;
|
|
381
|
+
const boxes = t.txn.applicationCall?.boxes?.length ?? 0;
|
|
368
382
|
// If we're adding local state or asset holding, we need space for the acocunt and the other reference
|
|
369
383
|
if (type === 'assetHolding' || type === 'appLocal') {
|
|
370
384
|
return accounts + assets + apps + boxes < MAX_APP_CALL_FOREIGN_REFERENCES - 1 && accounts < MAX_APP_CALL_ACCOUNT_REFERENCES;
|
|
@@ -379,30 +393,57 @@ async function populateAppCallResources(atc, algod) {
|
|
|
379
393
|
throw Error('No more transactions below reference limit. Add another app call to the group.');
|
|
380
394
|
}
|
|
381
395
|
if (type === 'account') {
|
|
382
|
-
txns[txnIndex].txn
|
|
396
|
+
txns[txnIndex].txn['applicationCall'] = {
|
|
397
|
+
...txns[txnIndex].txn.applicationCall,
|
|
398
|
+
accounts: [...(txns[txnIndex].txn?.applicationCall?.accounts ?? []), ...[reference]],
|
|
399
|
+
};
|
|
383
400
|
}
|
|
384
401
|
else if (type === 'app') {
|
|
385
|
-
txns[txnIndex].txn
|
|
402
|
+
txns[txnIndex].txn['applicationCall'] = {
|
|
403
|
+
...txns[txnIndex].txn.applicationCall,
|
|
404
|
+
foreignApps: [
|
|
405
|
+
...(txns[txnIndex].txn?.applicationCall?.foreignApps ?? []),
|
|
406
|
+
...[typeof reference === 'bigint' ? reference : BigInt(reference)],
|
|
407
|
+
],
|
|
408
|
+
};
|
|
386
409
|
}
|
|
387
410
|
else if (type === 'box') {
|
|
388
411
|
const { app, name } = reference;
|
|
389
|
-
txns[txnIndex].txn
|
|
412
|
+
txns[txnIndex].txn['applicationCall'] = {
|
|
413
|
+
...txns[txnIndex].txn.applicationCall,
|
|
414
|
+
boxes: [...(txns[txnIndex].txn?.applicationCall?.boxes ?? []), ...[{ appIndex: app, name }]],
|
|
415
|
+
};
|
|
390
416
|
if (app.toString() !== '0') {
|
|
391
|
-
txns[txnIndex].txn
|
|
417
|
+
txns[txnIndex].txn['applicationCall'] = {
|
|
418
|
+
...txns[txnIndex].txn.applicationCall,
|
|
419
|
+
foreignApps: [...(txns[txnIndex].txn?.applicationCall?.foreignApps ?? []), ...[app]],
|
|
420
|
+
};
|
|
392
421
|
}
|
|
393
422
|
}
|
|
394
423
|
else if (type === 'assetHolding') {
|
|
395
424
|
const { asset, account } = reference;
|
|
396
|
-
txns[txnIndex].txn
|
|
397
|
-
|
|
425
|
+
txns[txnIndex].txn['applicationCall'] = {
|
|
426
|
+
...txns[txnIndex].txn.applicationCall,
|
|
427
|
+
foreignAssets: [...(txns[txnIndex].txn?.applicationCall?.foreignAssets ?? []), ...[asset]],
|
|
428
|
+
accounts: [...(txns[txnIndex].txn?.applicationCall?.accounts ?? []), ...[account]],
|
|
429
|
+
};
|
|
398
430
|
}
|
|
399
431
|
else if (type === 'appLocal') {
|
|
400
432
|
const { app, account } = reference;
|
|
401
|
-
txns[txnIndex].txn
|
|
402
|
-
|
|
433
|
+
txns[txnIndex].txn['applicationCall'] = {
|
|
434
|
+
...txns[txnIndex].txn.applicationCall,
|
|
435
|
+
foreignApps: [...(txns[txnIndex].txn?.applicationCall?.foreignApps ?? []), ...[app]],
|
|
436
|
+
accounts: [...(txns[txnIndex].txn?.applicationCall?.accounts ?? []), ...[account]],
|
|
437
|
+
};
|
|
403
438
|
}
|
|
404
439
|
else if (type === 'asset') {
|
|
405
|
-
txns[txnIndex].txn
|
|
440
|
+
txns[txnIndex].txn['applicationCall'] = {
|
|
441
|
+
...txns[txnIndex].txn.applicationCall,
|
|
442
|
+
foreignAssets: [
|
|
443
|
+
...(txns[txnIndex].txn?.applicationCall?.foreignAssets ?? []),
|
|
444
|
+
...[typeof reference === 'bigint' ? reference : BigInt(reference)],
|
|
445
|
+
],
|
|
446
|
+
};
|
|
406
447
|
}
|
|
407
448
|
};
|
|
408
449
|
const g = unnamedResourcesAccessed.group;
|
|
@@ -454,98 +495,87 @@ async function populateAppCallResources(atc, algod) {
|
|
|
454
495
|
}
|
|
455
496
|
/**
|
|
456
497
|
* Signs and sends transactions that have been collected by an `AtomicTransactionComposer`.
|
|
457
|
-
* @param atcSend The parameters controlling the send, including
|
|
458
|
-
* * `atc` The `AtomicTransactionComposer`
|
|
459
|
-
* * `sendParams` The parameters to control the send behaviour
|
|
498
|
+
* @param atcSend The parameters controlling the send, including `atc` The `AtomicTransactionComposer` and params to control send behaviour
|
|
460
499
|
* @param algod An algod client
|
|
461
500
|
* @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`)
|
|
462
501
|
*/
|
|
463
502
|
const sendAtomicTransactionComposer = async function (atcSend, algod) {
|
|
464
|
-
const { atc: givenAtc, sendParams } = atcSend;
|
|
503
|
+
const { atc: givenAtc, sendParams, ...executeParams } = atcSend;
|
|
465
504
|
let atc;
|
|
466
|
-
// const hasAppCalls = () =>
|
|
467
|
-
// givenAtc
|
|
468
|
-
// .buildGroup()
|
|
469
|
-
// .map((t) => t.txn.type)
|
|
470
|
-
// .includes(algosdk.TransactionType.appl)
|
|
471
505
|
atc = givenAtc;
|
|
472
506
|
try {
|
|
507
|
+
const transactionsWithSigner = atc.buildGroup();
|
|
473
508
|
// If populateAppCallResources is true OR if populateAppCallResources is undefined and there are app calls, then populate resources
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
if (populateResources) {
|
|
509
|
+
const populateResources = executeParams?.populateAppCallResources ?? sendParams?.populateAppCallResources ?? config.Config.populateAppCallResources;
|
|
510
|
+
if (populateResources && transactionsWithSigner.map((t) => t.txn.type).includes(algosdk.TransactionType.appl)) {
|
|
477
511
|
atc = await populateAppCallResources(givenAtc, algod);
|
|
478
512
|
}
|
|
479
|
-
const transactionsWithSigner = atc.buildGroup();
|
|
480
513
|
const transactionsToSend = transactionsWithSigner.map((t) => {
|
|
481
514
|
return t.txn;
|
|
482
515
|
});
|
|
483
516
|
let groupId = undefined;
|
|
484
517
|
if (transactionsToSend.length > 1) {
|
|
485
518
|
groupId = transactionsToSend[0].group ? buffer.Buffer.from(transactionsToSend[0].group).toString('base64') : '';
|
|
486
|
-
config.Config.getLogger(sendParams?.suppressLog).verbose(`Sending group of ${transactionsToSend.length} transactions (${groupId})`, {
|
|
519
|
+
config.Config.getLogger(executeParams?.suppressLog ?? sendParams?.suppressLog).verbose(`Sending group of ${transactionsToSend.length} transactions (${groupId})`, {
|
|
487
520
|
transactionsToSend,
|
|
488
521
|
});
|
|
489
|
-
config.Config.getLogger(sendParams?.suppressLog).debug(`Transaction IDs (${groupId})`, transactionsToSend.map((t) => t.txID()));
|
|
522
|
+
config.Config.getLogger(executeParams?.suppressLog ?? sendParams?.suppressLog).debug(`Transaction IDs (${groupId})`, transactionsToSend.map((t) => t.txID()));
|
|
490
523
|
}
|
|
491
|
-
if (config.Config.debug && config.Config.
|
|
524
|
+
if (config.Config.debug && config.Config.traceAll) {
|
|
492
525
|
// Dump the traces to a file for use with AlgoKit AVM debugger
|
|
493
|
-
await
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
algod,
|
|
497
|
-
bufferSizeMb: config.Config.traceBufferSizeMb,
|
|
526
|
+
const simulateResponse = await performAtomicTransactionComposerSimulate.performAtomicTransactionComposerSimulate(atc, algod);
|
|
527
|
+
await config.Config.events.emitAsync(types_lifecycleEvents.EventType.TxnGroupSimulated, {
|
|
528
|
+
simulateResponse,
|
|
498
529
|
});
|
|
499
530
|
}
|
|
500
|
-
const result = await atc.execute(algod, sendParams?.maxRoundsToWaitForConfirmation ?? 5);
|
|
531
|
+
const result = await atc.execute(algod, executeParams?.maxRoundsToWaitForConfirmation ?? sendParams?.maxRoundsToWaitForConfirmation ?? 5);
|
|
501
532
|
if (transactionsToSend.length > 1) {
|
|
502
|
-
config.Config.getLogger(sendParams?.suppressLog).verbose(`Group transaction (${groupId}) sent with ${transactionsToSend.length} transactions`);
|
|
533
|
+
config.Config.getLogger(executeParams?.suppressLog ?? sendParams?.suppressLog).verbose(`Group transaction (${groupId}) sent with ${transactionsToSend.length} transactions`);
|
|
503
534
|
}
|
|
504
535
|
else {
|
|
505
|
-
config.Config.getLogger(sendParams?.suppressLog).verbose(`Sent transaction ID ${transactionsToSend[0].txID()} ${transactionsToSend[0].type} from ${
|
|
536
|
+
config.Config.getLogger(executeParams?.suppressLog ?? sendParams?.suppressLog).verbose(`Sent transaction ID ${transactionsToSend[0].txID()} ${transactionsToSend[0].type} from ${transactionsToSend[0].sender.toString()}`);
|
|
506
537
|
}
|
|
507
538
|
let confirmations = undefined;
|
|
508
539
|
if (!sendParams?.skipWaiting) {
|
|
509
|
-
confirmations = await Promise.all(transactionsToSend.map(async (t) =>
|
|
540
|
+
confirmations = await Promise.all(transactionsToSend.map(async (t) => await algod.pendingTransactionInformation(t.txID()).do()));
|
|
510
541
|
}
|
|
511
542
|
return {
|
|
512
543
|
groupId,
|
|
513
544
|
confirmations,
|
|
514
545
|
txIds: transactionsToSend.map((t) => t.txID()),
|
|
515
546
|
transactions: transactionsToSend,
|
|
516
|
-
returns: result.methodResults.map(
|
|
517
|
-
decodeError: r.decodeError,
|
|
518
|
-
returnValue: r.returnValue,
|
|
519
|
-
rawReturnValue: r.rawReturnValue,
|
|
520
|
-
})),
|
|
547
|
+
returns: result.methodResults.map(getABIReturnValue),
|
|
521
548
|
};
|
|
522
549
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
523
550
|
}
|
|
524
551
|
catch (e) {
|
|
525
|
-
//
|
|
526
|
-
|
|
552
|
+
// Create a new error object so the stack trace is correct (algosdk throws an error with a more limited stack trace)
|
|
553
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
554
|
+
const err = new Error(typeof e === 'object' ? e?.message : 'Received error executing Atomic Transaction Composer');
|
|
555
|
+
err.cause = e;
|
|
556
|
+
if (typeof e === 'object') {
|
|
557
|
+
// Remove headers as it doesn't have anything useful.
|
|
558
|
+
delete e.response?.headers;
|
|
559
|
+
err.response = e.response;
|
|
560
|
+
// body property very noisy
|
|
561
|
+
if (e.response && 'body' in e.response)
|
|
562
|
+
delete err.response.body;
|
|
563
|
+
err.name = e.name;
|
|
564
|
+
}
|
|
527
565
|
if (config.Config.debug && typeof e === 'object') {
|
|
528
|
-
|
|
529
|
-
config.Config.logger.error('Received error executing Atomic Transaction Composer and debug flag enabled; attempting simulation to get more information',
|
|
530
|
-
|
|
531
|
-
if (config.Config.debug &&
|
|
532
|
-
//
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
simulate = await simulateAndPersistResponse.simulateAndPersistResponse({
|
|
536
|
-
atc,
|
|
537
|
-
projectRoot: config.Config.projectRoot,
|
|
538
|
-
algod,
|
|
539
|
-
bufferSizeMb: config.Config.traceBufferSizeMb,
|
|
566
|
+
err.traces = [];
|
|
567
|
+
config.Config.logger.error('Received error executing Atomic Transaction Composer and debug flag enabled; attempting simulation to get more information', err);
|
|
568
|
+
const simulate = await performAtomicTransactionComposerSimulate.performAtomicTransactionComposerSimulate(atc, algod);
|
|
569
|
+
if (config.Config.debug && !config.Config.traceAll) {
|
|
570
|
+
// Emit the event only if traceAll: false, as it should have already been emitted above
|
|
571
|
+
await config.Config.events.emitAsync(types_lifecycleEvents.EventType.TxnGroupSimulated, {
|
|
572
|
+
simulateResponse: simulate,
|
|
540
573
|
});
|
|
541
574
|
}
|
|
542
|
-
else {
|
|
543
|
-
simulate = await performAtomicTransactionComposerSimulate.performAtomicTransactionComposerSimulate(atc, algod);
|
|
544
|
-
}
|
|
545
575
|
if (simulate && simulate.txnGroups[0].failedAt) {
|
|
546
576
|
for (const txn of simulate.txnGroups[0].txnResults) {
|
|
547
|
-
|
|
548
|
-
trace: txn.execTrace?.
|
|
577
|
+
err.traces.push({
|
|
578
|
+
trace: txn.execTrace?.toEncodingData(),
|
|
549
579
|
appBudget: txn.appBudgetConsumed,
|
|
550
580
|
logicSigBudget: txn.logicSigBudgetConsumed,
|
|
551
581
|
logs: txn.txnResult.logs,
|
|
@@ -555,26 +585,53 @@ const sendAtomicTransactionComposer = async function (atcSend, algod) {
|
|
|
555
585
|
}
|
|
556
586
|
}
|
|
557
587
|
else {
|
|
558
|
-
config.Config.logger.error('Received error executing Atomic Transaction Composer, for more information enable the debug flag',
|
|
588
|
+
config.Config.logger.error('Received error executing Atomic Transaction Composer, for more information enable the debug flag', err);
|
|
559
589
|
}
|
|
560
|
-
throw
|
|
590
|
+
throw err;
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
const convertABIDecodedBigIntToNumber = (value, type) => {
|
|
594
|
+
if (typeof value === 'bigint') {
|
|
595
|
+
if (type instanceof algosdk.ABIUintType) {
|
|
596
|
+
return type.bitSize < 53 ? Number(value) : value;
|
|
597
|
+
}
|
|
598
|
+
else {
|
|
599
|
+
return value;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
else if (Array.isArray(value) && (type instanceof algosdk.ABIArrayStaticType || type instanceof algosdk.ABIArrayDynamicType)) {
|
|
603
|
+
return value.map((v) => convertABIDecodedBigIntToNumber(v, type.childType));
|
|
604
|
+
}
|
|
605
|
+
else if (Array.isArray(value) && type instanceof algosdk.ABITupleType) {
|
|
606
|
+
return value.map((v, i) => convertABIDecodedBigIntToNumber(v, type.childTypes[i]));
|
|
607
|
+
}
|
|
608
|
+
else {
|
|
609
|
+
return value;
|
|
561
610
|
}
|
|
562
611
|
};
|
|
563
612
|
/**
|
|
564
|
-
*
|
|
565
|
-
*
|
|
566
|
-
* @param
|
|
567
|
-
* @returns The dryrun result
|
|
613
|
+
* Takes an algosdk `ABIResult` and converts it to an `ABIReturn`.
|
|
614
|
+
* Converts `bigint`'s for Uint's < 64 to `number` for easier use.
|
|
615
|
+
* @param result The `ABIReturn`
|
|
568
616
|
*/
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
return
|
|
617
|
+
function getABIReturnValue(result) {
|
|
618
|
+
if (result.decodeError) {
|
|
619
|
+
return {
|
|
620
|
+
decodeError: result.decodeError,
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
return {
|
|
624
|
+
method: result.method,
|
|
625
|
+
rawReturnValue: result.rawReturnValue,
|
|
626
|
+
decodeError: undefined,
|
|
627
|
+
returnValue: result.returnValue !== undefined && result.method.returns.type !== 'void'
|
|
628
|
+
? convertABIDecodedBigIntToNumber(result.returnValue, result.method.returns.type)
|
|
629
|
+
: result.returnValue,
|
|
630
|
+
};
|
|
576
631
|
}
|
|
577
632
|
/**
|
|
633
|
+
* @deprecated Use `TransactionComposer` (`algorand.newGroup()`) or `AtomicTransactionComposer` to construct and send group transactions instead.
|
|
634
|
+
*
|
|
578
635
|
* Signs and sends a group of [up to 16](https://developer.algorand.org/docs/get-details/atomic_transfers/#create-transactions) transactions to the chain
|
|
579
636
|
*
|
|
580
637
|
* @param groupSend The group details to send, with:
|
|
@@ -624,7 +681,7 @@ const waitForConfirmation = async function (transactionId, maxRoundsToWait, algo
|
|
|
624
681
|
throw new Error(`Invalid timeout, received ${maxRoundsToWait}, expected > 0`);
|
|
625
682
|
}
|
|
626
683
|
// Get current round
|
|
627
|
-
const status =
|
|
684
|
+
const status = await algod.status().do();
|
|
628
685
|
if (status === undefined) {
|
|
629
686
|
throw new Error('Unable to get node status');
|
|
630
687
|
}
|
|
@@ -633,7 +690,7 @@ const waitForConfirmation = async function (transactionId, maxRoundsToWait, algo
|
|
|
633
690
|
let currentRound = startRound;
|
|
634
691
|
while (currentRound < startRound + BigInt(maxRoundsToWait)) {
|
|
635
692
|
try {
|
|
636
|
-
const pendingInfo =
|
|
693
|
+
const pendingInfo = await algod.pendingTransactionInformation(transactionId).do();
|
|
637
694
|
if (pendingInfo !== undefined) {
|
|
638
695
|
const confirmedRound = pendingInfo.confirmedRound;
|
|
639
696
|
if (confirmedRound && confirmedRound > 0) {
|
|
@@ -661,6 +718,8 @@ const waitForConfirmation = async function (transactionId, maxRoundsToWait, algo
|
|
|
661
718
|
throw new Error(`Transaction ${transactionId} not confirmed after ${maxRoundsToWait} rounds`);
|
|
662
719
|
};
|
|
663
720
|
/**
|
|
721
|
+
* @deprecated Use `TransactionComposer` and the `maxFee` field in the transaction params instead.
|
|
722
|
+
*
|
|
664
723
|
* Limit the acceptable fee to a defined amount of µAlgo.
|
|
665
724
|
* This also sets the transaction to be flatFee to ensure the transaction only succeeds at
|
|
666
725
|
* the estimated rate.
|
|
@@ -669,20 +728,24 @@ const waitForConfirmation = async function (transactionId, maxRoundsToWait, algo
|
|
|
669
728
|
*/
|
|
670
729
|
function capTransactionFee(transaction, maxAcceptableFee) {
|
|
671
730
|
// If a flat fee hasn't already been defined
|
|
672
|
-
if (!transaction.flatFee) {
|
|
731
|
+
if (!('flatFee' in transaction) || !transaction.flatFee) {
|
|
673
732
|
// Once a transaction has been constructed by algosdk, transaction.fee indicates what the total transaction fee
|
|
674
733
|
// Will be based on the current suggested fee-per-byte value.
|
|
675
734
|
if (transaction.fee > maxAcceptableFee.microAlgo) {
|
|
676
735
|
throw new Error(`Cancelled transaction due to high network congestion fees. Algorand suggested fees would cause this transaction to cost ${transaction.fee} µALGO. Cap for this transaction is ${maxAcceptableFee.microAlgo} µALGO.`);
|
|
677
736
|
}
|
|
678
|
-
else if (transaction.fee >
|
|
737
|
+
else if (transaction.fee > 1000000) {
|
|
679
738
|
config.Config.logger.warn(`Algorand network congestion fees are in effect. This transaction will incur a fee of ${transaction.fee} µALGO.`);
|
|
680
739
|
}
|
|
681
740
|
// Now set the flat on the transaction. Otherwise the network may increase the fee above our cap and perform the transaction.
|
|
682
|
-
|
|
741
|
+
if ('flatFee' in transaction) {
|
|
742
|
+
transaction.flatFee = true;
|
|
743
|
+
}
|
|
683
744
|
}
|
|
684
745
|
}
|
|
685
746
|
/**
|
|
747
|
+
* @deprecated Use `TransactionComposer` and the `maxFee` and `staticFee` fields in the transaction params instead.
|
|
748
|
+
*
|
|
686
749
|
* Allows for control of fees on a `Transaction` or `SuggestedParams` object
|
|
687
750
|
* @param transaction The transaction or suggested params
|
|
688
751
|
* @param feeControl The fee control parameters
|
|
@@ -690,8 +753,10 @@ function capTransactionFee(transaction, maxAcceptableFee) {
|
|
|
690
753
|
function controlFees(transaction, feeControl) {
|
|
691
754
|
const { fee, maxFee } = feeControl;
|
|
692
755
|
if (fee) {
|
|
693
|
-
transaction.fee = fee.microAlgo;
|
|
694
|
-
|
|
756
|
+
transaction.fee = Number(fee.microAlgo);
|
|
757
|
+
if ('flatFee' in transaction) {
|
|
758
|
+
transaction.flatFee = true;
|
|
759
|
+
}
|
|
695
760
|
}
|
|
696
761
|
if (maxFee !== undefined) {
|
|
697
762
|
capTransactionFee(transaction, maxFee);
|
|
@@ -699,15 +764,30 @@ function controlFees(transaction, feeControl) {
|
|
|
699
764
|
return transaction;
|
|
700
765
|
}
|
|
701
766
|
/**
|
|
767
|
+
* @deprecated Use `suggestedParams ? { ...suggestedParams } : await algod.getTransactionParams().do()` instead
|
|
768
|
+
*
|
|
702
769
|
* Returns suggested transaction parameters from algod unless some are already provided.
|
|
703
770
|
* @param params Optionally provide parameters to use
|
|
704
771
|
* @param algod Algod algod
|
|
705
772
|
* @returns The suggested transaction parameters
|
|
706
773
|
*/
|
|
707
774
|
async function getTransactionParams(params, algod) {
|
|
708
|
-
|
|
775
|
+
if (params) {
|
|
776
|
+
return { ...params };
|
|
777
|
+
}
|
|
778
|
+
const p = await algod.getTransactionParams().do();
|
|
779
|
+
return {
|
|
780
|
+
fee: p.fee,
|
|
781
|
+
firstValid: p.firstValid,
|
|
782
|
+
lastValid: p.lastValid,
|
|
783
|
+
genesisID: p.genesisID,
|
|
784
|
+
genesisHash: p.genesisHash,
|
|
785
|
+
minFee: p.minFee,
|
|
786
|
+
};
|
|
709
787
|
}
|
|
710
788
|
/**
|
|
789
|
+
* @deprecated Use `atc.clone().buildGroup()` instead.
|
|
790
|
+
*
|
|
711
791
|
* Returns the array of transactions currently present in the given `AtomicTransactionComposer`
|
|
712
792
|
* @param atc The atomic transaction composer
|
|
713
793
|
* @returns The array of transactions with signers
|
|
@@ -728,12 +808,12 @@ exports.capTransactionFee = capTransactionFee;
|
|
|
728
808
|
exports.controlFees = controlFees;
|
|
729
809
|
exports.encodeLease = encodeLease;
|
|
730
810
|
exports.encodeTransactionNote = encodeTransactionNote;
|
|
811
|
+
exports.getABIReturnValue = getABIReturnValue;
|
|
731
812
|
exports.getAtomicTransactionComposerTransactions = getAtomicTransactionComposerTransactions;
|
|
732
813
|
exports.getSenderAddress = getSenderAddress;
|
|
733
814
|
exports.getSenderTransactionSigner = getSenderTransactionSigner;
|
|
734
815
|
exports.getTransactionParams = getTransactionParams;
|
|
735
816
|
exports.getTransactionWithSigner = getTransactionWithSigner;
|
|
736
|
-
exports.performAtomicTransactionComposerDryrun = performAtomicTransactionComposerDryrun;
|
|
737
817
|
exports.populateAppCallResources = populateAppCallResources;
|
|
738
818
|
exports.sendAtomicTransactionComposer = sendAtomicTransactionComposer;
|
|
739
819
|
exports.sendGroupOfTransactions = sendGroupOfTransactions;
|