@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
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import algosdk, { Address } from 'algosdk';
|
|
2
|
+
import { Buffer } from 'buffer';
|
|
3
|
+
import { Config } from '../src/config.mjs';
|
|
4
|
+
import { AppManager } from './app-manager.mjs';
|
|
2
5
|
|
|
6
|
+
const getMethodCallForLog = ({ method, args }) => {
|
|
7
|
+
return `${method.name}(${(args ?? []).map((a) => (a instanceof Address ? a.toString() : typeof a === 'object' ? JSON.stringify(a, (_, v) => (typeof v === 'bigint' ? Number(v) : v instanceof Address ? v.toString() : v instanceof Uint8Array ? Buffer.from(v).toString('base64') : v)) : a))})`;
|
|
8
|
+
};
|
|
3
9
|
/** Orchestrates sending transactions for `AlgorandClient`. */
|
|
4
10
|
class AlgorandClientTransactionSender {
|
|
5
11
|
/**
|
|
6
12
|
* Creates a new `AlgorandClientSender`
|
|
7
|
-
* @param newGroup A lambda that starts a new `
|
|
13
|
+
* @param newGroup A lambda that starts a new `TransactionComposer` transaction group
|
|
8
14
|
* @param assetManager An `AssetManager` instance
|
|
9
15
|
*/
|
|
10
|
-
constructor(newGroup, assetManager) {
|
|
16
|
+
constructor(newGroup, assetManager, appManager) {
|
|
11
17
|
/**
|
|
12
18
|
* Send a payment transaction to transfer Algo between accounts.
|
|
13
19
|
* @param params The parameters for the payment transaction
|
|
14
20
|
* @example Basic example
|
|
15
21
|
* ```typescript
|
|
16
|
-
* const result = await
|
|
22
|
+
* const result = await algorand.send.payment({
|
|
17
23
|
* sender: 'SENDERADDRESS',
|
|
18
24
|
* receiver: 'RECEIVERADDRESS',
|
|
19
25
|
* amount: (4).algo(),
|
|
@@ -21,7 +27,7 @@ class AlgorandClientTransactionSender {
|
|
|
21
27
|
* ```
|
|
22
28
|
* @example Advanced example
|
|
23
29
|
* ```typescript
|
|
24
|
-
* const result = await
|
|
30
|
+
* const result = await algorand.send.payment({
|
|
25
31
|
* amount: (4).algo(),
|
|
26
32
|
* receiver: 'RECEIVERADDRESS',
|
|
27
33
|
* sender: 'SENDERADDRESS',
|
|
@@ -318,7 +324,7 @@ class AlgorandClientTransactionSender {
|
|
|
318
324
|
*
|
|
319
325
|
* @param params The parameters for the asset opt-out transaction
|
|
320
326
|
*
|
|
321
|
-
* @example Basic example (without creator)
|
|
327
|
+
* @example Basic example (without creator, will be retrieved from algod)
|
|
322
328
|
* ```typescript
|
|
323
329
|
* await algorand.send.assetOptOut({sender: "SENDERADDRESS", assetId: 123456n, ensureZeroBalance: true })
|
|
324
330
|
* ```
|
|
@@ -360,7 +366,7 @@ class AlgorandClientTransactionSender {
|
|
|
360
366
|
const accountAssetInfo = await this._assetManager.getAccountInformation(params.sender, params.assetId);
|
|
361
367
|
balance = accountAssetInfo.balance;
|
|
362
368
|
}
|
|
363
|
-
catch
|
|
369
|
+
catch {
|
|
364
370
|
throw new Error(`Account ${params.sender} is not opted-in to Asset ${params.assetId}; can't opt-out.`);
|
|
365
371
|
}
|
|
366
372
|
if (balance !== 0n) {
|
|
@@ -372,24 +378,424 @@ class AlgorandClientTransactionSender {
|
|
|
372
378
|
preLog: (params, transaction) => `Opting ${params.sender} out of asset with ID ${params.assetId} to creator ${params.creator} via transaction ${transaction.txID()}`,
|
|
373
379
|
})(params);
|
|
374
380
|
};
|
|
381
|
+
/**
|
|
382
|
+
* Create a smart contract.
|
|
383
|
+
*
|
|
384
|
+
* Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.
|
|
385
|
+
*
|
|
386
|
+
* @param params The parameters for the app creation transaction
|
|
387
|
+
* @example Basic example
|
|
388
|
+
* ```typescript
|
|
389
|
+
* const result = await algorand.send.appCreate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })
|
|
390
|
+
* const createdAppId = result.appId
|
|
391
|
+
* ```
|
|
392
|
+
* @example Advanced example
|
|
393
|
+
* ```typescript
|
|
394
|
+
* await algorand.send.appCreate({
|
|
395
|
+
* sender: 'CREATORADDRESS',
|
|
396
|
+
* approvalProgram: "TEALCODE",
|
|
397
|
+
* clearStateProgram: "TEALCODE",
|
|
398
|
+
* schema: {
|
|
399
|
+
* globalInts: 1,
|
|
400
|
+
* globalByteSlices: 2,
|
|
401
|
+
* localInts: 3,
|
|
402
|
+
* localByteSlices: 4
|
|
403
|
+
* },
|
|
404
|
+
* extraProgramPages: 1,
|
|
405
|
+
* onComplete: algosdk.OnApplicationComplete.OptInOC,
|
|
406
|
+
* args: [new Uint8Array(1, 2, 3, 4)]
|
|
407
|
+
* accountReferences: ["ACCOUNT_1"]
|
|
408
|
+
* appReferences: [123n, 1234n]
|
|
409
|
+
* assetReferences: [12345n]
|
|
410
|
+
* boxReferences: ["box1", {appId: 1234n, name: "box2"}]
|
|
411
|
+
* lease: 'lease',
|
|
412
|
+
* note: 'note',
|
|
413
|
+
* // You wouldn't normally set this field
|
|
414
|
+
* firstValidRound: 1000n,
|
|
415
|
+
* validityWindow: 10,
|
|
416
|
+
* extraFee: (1000).microAlgo(),
|
|
417
|
+
* staticFee: (1000).microAlgo(),
|
|
418
|
+
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
419
|
+
* // already specified, but here for completeness
|
|
420
|
+
* maxFee: (3000).microAlgo(),
|
|
421
|
+
* // Signer only needed if you want to provide one,
|
|
422
|
+
* // generally you'd register it with AlgorandClient
|
|
423
|
+
* // against the sender and not need to pass it in
|
|
424
|
+
* signer: transactionSigner,
|
|
425
|
+
* maxRoundsToWaitForConfirmation: 5,
|
|
426
|
+
* suppressLog: true,
|
|
427
|
+
*})
|
|
428
|
+
* ```
|
|
429
|
+
*/
|
|
430
|
+
this.appCreate = this._sendAppCreateCall((c) => c.addAppCreate, {
|
|
431
|
+
postLog: (params, result) => `App created by ${params.sender} with ID ${result.confirmation.applicationIndex} via transaction ${result.txIds.at(-1)}`,
|
|
432
|
+
});
|
|
433
|
+
/**
|
|
434
|
+
* Update a smart contract.
|
|
435
|
+
*
|
|
436
|
+
* Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.
|
|
437
|
+
*
|
|
438
|
+
* @param params The parameters for the app update transaction
|
|
439
|
+
* @example Basic example
|
|
440
|
+
* ```typescript
|
|
441
|
+
* await algorand.send.appUpdate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })
|
|
442
|
+
* ```
|
|
443
|
+
* @example Advanced example
|
|
444
|
+
* ```typescript
|
|
445
|
+
* await algorand.send.appUpdate({
|
|
446
|
+
* sender: 'CREATORADDRESS',
|
|
447
|
+
* approvalProgram: "TEALCODE",
|
|
448
|
+
* clearStateProgram: "TEALCODE",
|
|
449
|
+
* onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,
|
|
450
|
+
* args: [new Uint8Array(1, 2, 3, 4)]
|
|
451
|
+
* accountReferences: ["ACCOUNT_1"]
|
|
452
|
+
* appReferences: [123n, 1234n]
|
|
453
|
+
* assetReferences: [12345n]
|
|
454
|
+
* boxReferences: ["box1", {appId: 1234n, name: "box2"}]
|
|
455
|
+
* lease: 'lease',
|
|
456
|
+
* note: 'note',
|
|
457
|
+
* // You wouldn't normally set this field
|
|
458
|
+
* firstValidRound: 1000n,
|
|
459
|
+
* validityWindow: 10,
|
|
460
|
+
* extraFee: (1000).microAlgo(),
|
|
461
|
+
* staticFee: (1000).microAlgo(),
|
|
462
|
+
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
463
|
+
* // already specified, but here for completeness
|
|
464
|
+
* maxFee: (3000).microAlgo(),
|
|
465
|
+
* // Signer only needed if you want to provide one,
|
|
466
|
+
* // generally you'd register it with AlgorandClient
|
|
467
|
+
* // against the sender and not need to pass it in
|
|
468
|
+
* signer: transactionSigner,
|
|
469
|
+
* maxRoundsToWaitForConfirmation: 5,
|
|
470
|
+
* suppressLog: true,
|
|
471
|
+
*})
|
|
472
|
+
* ```
|
|
473
|
+
*/
|
|
474
|
+
this.appUpdate = this._sendAppUpdateCall((c) => c.addAppUpdate, {
|
|
475
|
+
postLog: (params, result) => `App ${params.appId} updated ${params.args ? ` with ${params.args.map((a) => Buffer.from(a).toString('base64'))}` : ''} by ${params.sender} via transaction ${result.txIds.at(-1)}`,
|
|
476
|
+
});
|
|
477
|
+
/**
|
|
478
|
+
* Delete a smart contract.
|
|
479
|
+
*
|
|
480
|
+
* Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.
|
|
481
|
+
*
|
|
482
|
+
* @param params The parameters for the app deletion transaction
|
|
483
|
+
* @example Basic example
|
|
484
|
+
* ```typescript
|
|
485
|
+
* await algorand.send.appDelete({ sender: 'CREATORADDRESS' })
|
|
486
|
+
* ```
|
|
487
|
+
* @example Advanced example
|
|
488
|
+
* ```typescript
|
|
489
|
+
* await algorand.send.appDelete({
|
|
490
|
+
* sender: 'CREATORADDRESS',
|
|
491
|
+
* onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC,
|
|
492
|
+
* args: [new Uint8Array(1, 2, 3, 4)]
|
|
493
|
+
* accountReferences: ["ACCOUNT_1"]
|
|
494
|
+
* appReferences: [123n, 1234n]
|
|
495
|
+
* assetReferences: [12345n]
|
|
496
|
+
* boxReferences: ["box1", {appId: 1234n, name: "box2"}]
|
|
497
|
+
* lease: 'lease',
|
|
498
|
+
* note: 'note',
|
|
499
|
+
* // You wouldn't normally set this field
|
|
500
|
+
* firstValidRound: 1000n,
|
|
501
|
+
* validityWindow: 10,
|
|
502
|
+
* extraFee: (1000).microAlgo(),
|
|
503
|
+
* staticFee: (1000).microAlgo(),
|
|
504
|
+
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
505
|
+
* // already specified, but here for completeness
|
|
506
|
+
* maxFee: (3000).microAlgo(),
|
|
507
|
+
* // Signer only needed if you want to provide one,
|
|
508
|
+
* // generally you'd register it with AlgorandClient
|
|
509
|
+
* // against the sender and not need to pass it in
|
|
510
|
+
* signer: transactionSigner,
|
|
511
|
+
* maxRoundsToWaitForConfirmation: 5,
|
|
512
|
+
* suppressLog: true,
|
|
513
|
+
*})
|
|
514
|
+
* ```
|
|
515
|
+
*/
|
|
516
|
+
this.appDelete = this._sendAppCall((c) => c.addAppDelete, {
|
|
517
|
+
postLog: (params, result) => `App ${params.appId} deleted ${params.args ? ` with ${params.args.map((a) => Buffer.from(a).toString('base64'))}` : ''} by ${params.sender} via transaction ${result.txIds.at(-1)}`,
|
|
518
|
+
});
|
|
375
519
|
/**
|
|
376
520
|
* Call a smart contract.
|
|
377
521
|
*
|
|
378
|
-
* Note: you may prefer to use `
|
|
522
|
+
* Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.
|
|
523
|
+
*
|
|
524
|
+
* @param params The parameters for the app call transaction
|
|
525
|
+
* @example Basic example
|
|
526
|
+
* ```typescript
|
|
527
|
+
* await algorand.send.appCall({ sender: 'CREATORADDRESS' })
|
|
528
|
+
* ```
|
|
529
|
+
* @example Advanced example
|
|
530
|
+
* ```typescript
|
|
531
|
+
* await algorand.send.appCall({
|
|
532
|
+
* sender: 'CREATORADDRESS',
|
|
533
|
+
* onComplete: algosdk.OnApplicationComplete.OptInOC,
|
|
534
|
+
* args: [new Uint8Array(1, 2, 3, 4)]
|
|
535
|
+
* accountReferences: ["ACCOUNT_1"]
|
|
536
|
+
* appReferences: [123n, 1234n]
|
|
537
|
+
* assetReferences: [12345n]
|
|
538
|
+
* boxReferences: ["box1", {appId: 1234n, name: "box2"}]
|
|
539
|
+
* lease: 'lease',
|
|
540
|
+
* note: 'note',
|
|
541
|
+
* // You wouldn't normally set this field
|
|
542
|
+
* firstValidRound: 1000n,
|
|
543
|
+
* validityWindow: 10,
|
|
544
|
+
* extraFee: (1000).microAlgo(),
|
|
545
|
+
* staticFee: (1000).microAlgo(),
|
|
546
|
+
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
547
|
+
* // already specified, but here for completeness
|
|
548
|
+
* maxFee: (3000).microAlgo(),
|
|
549
|
+
* // Signer only needed if you want to provide one,
|
|
550
|
+
* // generally you'd register it with AlgorandClient
|
|
551
|
+
* // against the sender and not need to pass it in
|
|
552
|
+
* signer: transactionSigner,
|
|
553
|
+
* maxRoundsToWaitForConfirmation: 5,
|
|
554
|
+
* suppressLog: true,
|
|
555
|
+
*})
|
|
556
|
+
* ```
|
|
379
557
|
*/
|
|
380
|
-
this.appCall = this.
|
|
558
|
+
this.appCall = this._sendAppCall((c) => c.addAppCall, {
|
|
559
|
+
postLog: (params, result) => `App ${params.appId} called ${params.args ? ` with ${params.args.map((a) => Buffer.from(a).toString('base64'))}` : ''} by ${params.sender} via transaction ${result.txIds.at(-1)}`,
|
|
560
|
+
});
|
|
381
561
|
/**
|
|
382
|
-
*
|
|
562
|
+
* Create a smart contract via an ABI method.
|
|
563
|
+
*
|
|
564
|
+
* Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.
|
|
383
565
|
*
|
|
384
|
-
*
|
|
566
|
+
* @param params The parameters for the app creation transaction
|
|
567
|
+
* @example Basic example
|
|
568
|
+
* ```typescript
|
|
569
|
+
* const method = new ABIMethod({
|
|
570
|
+
* name: 'method',
|
|
571
|
+
* args: [{ name: 'arg1', type: 'string' }],
|
|
572
|
+
* returns: { type: 'string' },
|
|
573
|
+
* })
|
|
574
|
+
* const result = await algorand.send.appCreateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: ["arg1_value"] })
|
|
575
|
+
* const createdAppId = result.appId
|
|
576
|
+
* ```
|
|
577
|
+
* @example Advanced example
|
|
578
|
+
* ```typescript
|
|
579
|
+
* const method = new ABIMethod({
|
|
580
|
+
* name: 'method',
|
|
581
|
+
* args: [{ name: 'arg1', type: 'string' }],
|
|
582
|
+
* returns: { type: 'string' },
|
|
583
|
+
* })
|
|
584
|
+
* await algorand.send.appCreate({
|
|
585
|
+
* sender: 'CREATORADDRESS',
|
|
586
|
+
* method: method,
|
|
587
|
+
* args: ["arg1_value"],
|
|
588
|
+
* approvalProgram: "TEALCODE",
|
|
589
|
+
* clearStateProgram: "TEALCODE",
|
|
590
|
+
* schema: {
|
|
591
|
+
* globalInts: 1,
|
|
592
|
+
* globalByteSlices: 2,
|
|
593
|
+
* localInts: 3,
|
|
594
|
+
* localByteSlices: 4
|
|
595
|
+
* },
|
|
596
|
+
* extraProgramPages: 1,
|
|
597
|
+
* onComplete: algosdk.OnApplicationComplete.OptInOC,
|
|
598
|
+
* args: [new Uint8Array(1, 2, 3, 4)]
|
|
599
|
+
* accountReferences: ["ACCOUNT_1"]
|
|
600
|
+
* appReferences: [123n, 1234n]
|
|
601
|
+
* assetReferences: [12345n]
|
|
602
|
+
* boxReferences: ["box1", {appId: 1234n, name: "box2"}]
|
|
603
|
+
* lease: 'lease',
|
|
604
|
+
* note: 'note',
|
|
605
|
+
* // You wouldn't normally set this field
|
|
606
|
+
* firstValidRound: 1000n,
|
|
607
|
+
* validityWindow: 10,
|
|
608
|
+
* extraFee: (1000).microAlgo(),
|
|
609
|
+
* staticFee: (1000).microAlgo(),
|
|
610
|
+
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
611
|
+
* // already specified, but here for completeness
|
|
612
|
+
* maxFee: (3000).microAlgo(),
|
|
613
|
+
* // Signer only needed if you want to provide one,
|
|
614
|
+
* // generally you'd register it with AlgorandClient
|
|
615
|
+
* // against the sender and not need to pass it in
|
|
616
|
+
* signer: transactionSigner,
|
|
617
|
+
* maxRoundsToWaitForConfirmation: 5,
|
|
618
|
+
* suppressLog: true,
|
|
619
|
+
*})
|
|
620
|
+
* ```
|
|
385
621
|
*/
|
|
386
|
-
this.
|
|
622
|
+
this.appCreateMethodCall = this._sendAppCreateCall((c) => c.addAppCreateMethodCall, {
|
|
623
|
+
postLog: (params, result) => `App created by ${params.sender} with ID ${result.confirmation.applicationIndex} via transaction ${result.txIds.at(-1)}`,
|
|
624
|
+
});
|
|
625
|
+
/**
|
|
626
|
+
* Update a smart contract via an ABI method.
|
|
627
|
+
*
|
|
628
|
+
* Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.
|
|
629
|
+
*
|
|
630
|
+
* @param params The parameters for the app update transaction
|
|
631
|
+
* @example Basic example
|
|
632
|
+
* ```typescript
|
|
633
|
+
* const method = new ABIMethod({
|
|
634
|
+
* name: 'method',
|
|
635
|
+
* args: [{ name: 'arg1', type: 'string' }],
|
|
636
|
+
* returns: { type: 'string' },
|
|
637
|
+
* })
|
|
638
|
+
* await algorand.send.appUpdateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: ["arg1_value"] })
|
|
639
|
+
* ```
|
|
640
|
+
* @example Advanced example
|
|
641
|
+
* ```typescript
|
|
642
|
+
* const method = new ABIMethod({
|
|
643
|
+
* name: 'method',
|
|
644
|
+
* args: [{ name: 'arg1', type: 'string' }],
|
|
645
|
+
* returns: { type: 'string' },
|
|
646
|
+
* })
|
|
647
|
+
* await algorand.send.appUpdateMethodCall({
|
|
648
|
+
* sender: 'CREATORADDRESS',
|
|
649
|
+
* method: method,
|
|
650
|
+
* args: ["arg1_value"],
|
|
651
|
+
* approvalProgram: "TEALCODE",
|
|
652
|
+
* clearStateProgram: "TEALCODE",
|
|
653
|
+
* onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,
|
|
654
|
+
* args: [new Uint8Array(1, 2, 3, 4)]
|
|
655
|
+
* accountReferences: ["ACCOUNT_1"]
|
|
656
|
+
* appReferences: [123n, 1234n]
|
|
657
|
+
* assetReferences: [12345n]
|
|
658
|
+
* boxReferences: ["box1", {appId: 1234n, name: "box2"}]
|
|
659
|
+
* lease: 'lease',
|
|
660
|
+
* note: 'note',
|
|
661
|
+
* // You wouldn't normally set this field
|
|
662
|
+
* firstValidRound: 1000n,
|
|
663
|
+
* validityWindow: 10,
|
|
664
|
+
* extraFee: (1000).microAlgo(),
|
|
665
|
+
* staticFee: (1000).microAlgo(),
|
|
666
|
+
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
667
|
+
* // already specified, but here for completeness
|
|
668
|
+
* maxFee: (3000).microAlgo(),
|
|
669
|
+
* // Signer only needed if you want to provide one,
|
|
670
|
+
* // generally you'd register it with AlgorandClient
|
|
671
|
+
* // against the sender and not need to pass it in
|
|
672
|
+
* signer: transactionSigner,
|
|
673
|
+
* maxRoundsToWaitForConfirmation: 5,
|
|
674
|
+
* suppressLog: true,
|
|
675
|
+
*})
|
|
676
|
+
* ```
|
|
677
|
+
*/
|
|
678
|
+
this.appUpdateMethodCall = this._sendAppUpdateCall((c) => c.addAppUpdateMethodCall, {
|
|
679
|
+
postLog: (params, result) => `App ${params.appId} updated with ${getMethodCallForLog(params)} by ${params.sender} via transaction ${result.txIds.at(-1)}`,
|
|
680
|
+
});
|
|
681
|
+
/**
|
|
682
|
+
* Delete a smart contract via an ABI method.
|
|
683
|
+
*
|
|
684
|
+
* Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.
|
|
685
|
+
*
|
|
686
|
+
* @param params The parameters for the app deletion transaction
|
|
687
|
+
* @example Basic example
|
|
688
|
+
* ```typescript
|
|
689
|
+
* const method = new ABIMethod({
|
|
690
|
+
* name: 'method',
|
|
691
|
+
* args: [{ name: 'arg1', type: 'string' }],
|
|
692
|
+
* returns: { type: 'string' },
|
|
693
|
+
* })
|
|
694
|
+
* await algorand.send.appDeleteMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"] })
|
|
695
|
+
* ```
|
|
696
|
+
* @example Advanced example
|
|
697
|
+
* ```typescript
|
|
698
|
+
* const method = new ABIMethod({
|
|
699
|
+
* name: 'method',
|
|
700
|
+
* args: [{ name: 'arg1', type: 'string' }],
|
|
701
|
+
* returns: { type: 'string' },
|
|
702
|
+
* })
|
|
703
|
+
* await algorand.send.appDeleteMethodCall({
|
|
704
|
+
* sender: 'CREATORADDRESS',
|
|
705
|
+
* method: method,
|
|
706
|
+
* args: ["arg1_value"],
|
|
707
|
+
* onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC,
|
|
708
|
+
* args: [new Uint8Array(1, 2, 3, 4)]
|
|
709
|
+
* accountReferences: ["ACCOUNT_1"]
|
|
710
|
+
* appReferences: [123n, 1234n]
|
|
711
|
+
* assetReferences: [12345n]
|
|
712
|
+
* boxReferences: ["box1", {appId: 1234n, name: "box2"}]
|
|
713
|
+
* lease: 'lease',
|
|
714
|
+
* note: 'note',
|
|
715
|
+
* // You wouldn't normally set this field
|
|
716
|
+
* firstValidRound: 1000n,
|
|
717
|
+
* validityWindow: 10,
|
|
718
|
+
* extraFee: (1000).microAlgo(),
|
|
719
|
+
* staticFee: (1000).microAlgo(),
|
|
720
|
+
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
721
|
+
* // already specified, but here for completeness
|
|
722
|
+
* maxFee: (3000).microAlgo(),
|
|
723
|
+
* // Signer only needed if you want to provide one,
|
|
724
|
+
* // generally you'd register it with AlgorandClient
|
|
725
|
+
* // against the sender and not need to pass it in
|
|
726
|
+
* signer: transactionSigner,
|
|
727
|
+
* maxRoundsToWaitForConfirmation: 5,
|
|
728
|
+
* suppressLog: true,
|
|
729
|
+
*})
|
|
730
|
+
* ```
|
|
731
|
+
*/
|
|
732
|
+
this.appDeleteMethodCall = this._sendAppCall((c) => c.addAppDeleteMethodCall, {
|
|
733
|
+
postLog: (params, result) => `App ${params.appId} deleted with ${getMethodCallForLog(params)} by ${params.sender} via transaction ${result.txIds.at(-1)}`,
|
|
734
|
+
});
|
|
735
|
+
/**
|
|
736
|
+
* Call a smart contract via an ABI method.
|
|
737
|
+
*
|
|
738
|
+
* Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.
|
|
739
|
+
*
|
|
740
|
+
* @param params The parameters for the app call transaction
|
|
741
|
+
* @example Basic example
|
|
742
|
+
* ```typescript
|
|
743
|
+
* const method = new ABIMethod({
|
|
744
|
+
* name: 'method',
|
|
745
|
+
* args: [{ name: 'arg1', type: 'string' }],
|
|
746
|
+
* returns: { type: 'string' },
|
|
747
|
+
* })
|
|
748
|
+
* await algorand.send.appCallMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"] })
|
|
749
|
+
* ```
|
|
750
|
+
* @example Advanced example
|
|
751
|
+
* ```typescript
|
|
752
|
+
* const method = new ABIMethod({
|
|
753
|
+
* name: 'method',
|
|
754
|
+
* args: [{ name: 'arg1', type: 'string' }],
|
|
755
|
+
* returns: { type: 'string' },
|
|
756
|
+
* })
|
|
757
|
+
* await algorand.send.appCallMethodCall({
|
|
758
|
+
* sender: 'CREATORADDRESS',
|
|
759
|
+
* method: method,
|
|
760
|
+
* args: ["arg1_value"],
|
|
761
|
+
* onComplete: algosdk.OnApplicationComplete.OptInOC,
|
|
762
|
+
* args: [new Uint8Array(1, 2, 3, 4)]
|
|
763
|
+
* accountReferences: ["ACCOUNT_1"]
|
|
764
|
+
* appReferences: [123n, 1234n]
|
|
765
|
+
* assetReferences: [12345n]
|
|
766
|
+
* boxReferences: ["box1", {appId: 1234n, name: "box2"}]
|
|
767
|
+
* lease: 'lease',
|
|
768
|
+
* note: 'note',
|
|
769
|
+
* // You wouldn't normally set this field
|
|
770
|
+
* firstValidRound: 1000n,
|
|
771
|
+
* validityWindow: 10,
|
|
772
|
+
* extraFee: (1000).microAlgo(),
|
|
773
|
+
* staticFee: (1000).microAlgo(),
|
|
774
|
+
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
775
|
+
* // already specified, but here for completeness
|
|
776
|
+
* maxFee: (3000).microAlgo(),
|
|
777
|
+
* // Signer only needed if you want to provide one,
|
|
778
|
+
* // generally you'd register it with AlgorandClient
|
|
779
|
+
* // against the sender and not need to pass it in
|
|
780
|
+
* signer: transactionSigner,
|
|
781
|
+
* maxRoundsToWaitForConfirmation: 5,
|
|
782
|
+
* suppressLog: true,
|
|
783
|
+
*})
|
|
784
|
+
* ```
|
|
785
|
+
*/
|
|
786
|
+
this.appCallMethodCall = this._sendAppCall((c) => c.addAppCallMethodCall, {
|
|
787
|
+
postLog: (params, result) => `App ${params.appId} called with ${getMethodCallForLog(params)} by ${params.sender} via transaction ${result.txIds.at(-1)}`,
|
|
788
|
+
});
|
|
387
789
|
/** Register an online key. */
|
|
388
790
|
this.onlineKeyRegistration = this._send((c) => c.addOnlineKeyRegistration, {
|
|
389
791
|
preLog: (params, transaction) => `Registering online key for ${params.sender} via transaction ${transaction.txID()}`,
|
|
390
792
|
});
|
|
391
793
|
this._newGroup = newGroup;
|
|
392
794
|
this._assetManager = assetManager;
|
|
795
|
+
this._appManager = appManager;
|
|
796
|
+
}
|
|
797
|
+
newGroup() {
|
|
798
|
+
return this._newGroup();
|
|
393
799
|
}
|
|
394
800
|
_send(c, log) {
|
|
395
801
|
return async (params) => {
|
|
@@ -400,12 +806,12 @@ class AlgorandClientTransactionSender {
|
|
|
400
806
|
const transaction = (await composer.build()).transactions.at(-1).txn;
|
|
401
807
|
Config.getLogger(params?.suppressLog).debug(log.preLog(params, transaction));
|
|
402
808
|
}
|
|
403
|
-
const rawResult = await composer.
|
|
809
|
+
const rawResult = await composer.send(params);
|
|
404
810
|
const result = {
|
|
405
811
|
// Last item covers when a group is created by an app call with ABI transaction parameters
|
|
406
|
-
transaction: rawResult.transactions
|
|
407
|
-
confirmation: rawResult.confirmations
|
|
408
|
-
txId: rawResult.txIds
|
|
812
|
+
transaction: rawResult.transactions.at(-1),
|
|
813
|
+
confirmation: rawResult.confirmations.at(-1),
|
|
814
|
+
txId: rawResult.txIds.at(-1),
|
|
409
815
|
...rawResult,
|
|
410
816
|
};
|
|
411
817
|
if (log?.postLog) {
|
|
@@ -414,6 +820,30 @@ class AlgorandClientTransactionSender {
|
|
|
414
820
|
return result;
|
|
415
821
|
};
|
|
416
822
|
}
|
|
823
|
+
_sendAppCall(c, log) {
|
|
824
|
+
return async (params) => {
|
|
825
|
+
const result = await this._send(c, log)(params);
|
|
826
|
+
return { ...result, return: AppManager.getABIReturn(result.confirmation, 'method' in params ? params.method : undefined) };
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
_sendAppUpdateCall(c, log) {
|
|
830
|
+
return async (params) => {
|
|
831
|
+
const result = await this._sendAppCall(c, log)(params);
|
|
832
|
+
const compiledApproval = typeof params.approvalProgram === 'string' ? this._appManager.getCompilationResult(params.approvalProgram) : undefined;
|
|
833
|
+
const compiledClear = typeof params.clearStateProgram === 'string' ? this._appManager.getCompilationResult(params.clearStateProgram) : undefined;
|
|
834
|
+
return { ...result, compiledApproval, compiledClear };
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
_sendAppCreateCall(c, log) {
|
|
838
|
+
return async (params) => {
|
|
839
|
+
const result = await this._sendAppUpdateCall(c, log)(params);
|
|
840
|
+
return {
|
|
841
|
+
...result,
|
|
842
|
+
appId: BigInt(result.confirmation.applicationIndex),
|
|
843
|
+
appAddress: algosdk.getApplicationAddress(result.confirmation.applicationIndex),
|
|
844
|
+
};
|
|
845
|
+
};
|
|
846
|
+
}
|
|
417
847
|
}
|
|
418
848
|
|
|
419
849
|
export { AlgorandClientTransactionSender };
|