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