@algorandfoundation/algokit-utils 10.0.0-alpha.3 → 10.0.0-alpha.32
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/_virtual/rolldown_runtime.js +10 -15
- package/abi/index.d.ts +2 -1
- package/abi/index.js +3 -0
- package/abi/index.mjs +2 -1
- package/account-manager.d.ts +448 -0
- package/account-manager.js +623 -0
- package/account-manager.js.map +1 -0
- package/account-manager.mjs +620 -0
- package/account-manager.mjs.map +1 -0
- package/account.d.ts +156 -0
- package/account.js +10 -0
- package/account.js.map +1 -0
- package/account.mjs +9 -0
- package/account.mjs.map +1 -0
- package/algod-client/index.d.ts +3 -7
- package/algod-client/index.js +2 -5
- package/algod-client/index.mjs +2 -2
- package/algorand-client-transaction-creator.d.ts +1103 -0
- package/algorand-client-transaction-creator.js +735 -0
- package/algorand-client-transaction-creator.js.map +1 -0
- package/algorand-client-transaction-creator.mjs +734 -0
- package/algorand-client-transaction-creator.mjs.map +1 -0
- package/algorand-client-transaction-sender.d.ts +1317 -0
- package/algorand-client-transaction-sender.js +933 -0
- package/algorand-client-transaction-sender.js.map +1 -0
- package/algorand-client-transaction-sender.mjs +932 -0
- package/algorand-client-transaction-sender.mjs.map +1 -0
- package/algorand-client.d.ts +246 -0
- package/algorand-client.js +325 -0
- package/algorand-client.js.map +1 -0
- package/algorand-client.mjs +325 -0
- package/algorand-client.mjs.map +1 -0
- package/amount.d.ts +46 -3
- package/amount.js +92 -13
- package/amount.js.map +1 -1
- package/amount.mjs +80 -3
- package/amount.mjs.map +1 -1
- package/app-client.d.ts +2130 -0
- package/app-client.js +909 -0
- package/app-client.js.map +1 -0
- package/app-client.mjs +908 -0
- package/app-client.mjs.map +1 -0
- package/app-deployer.d.ts +166 -0
- package/app-deployer.js +353 -0
- package/app-deployer.js.map +1 -0
- package/app-deployer.mjs +353 -0
- package/app-deployer.mjs.map +1 -0
- package/app-factory.d.ts +965 -0
- package/app-factory.js +448 -0
- package/app-factory.js.map +1 -0
- package/app-factory.mjs +448 -0
- package/app-factory.mjs.map +1 -0
- package/app-manager.d.ts +323 -0
- package/app-manager.js +468 -0
- package/app-manager.js.map +1 -0
- package/app-manager.mjs +468 -0
- package/app-manager.mjs.map +1 -0
- package/app-spec.d.ts +203 -0
- package/app-spec.js +137 -0
- package/app-spec.js.map +1 -0
- package/app-spec.mjs +137 -0
- package/app-spec.mjs.map +1 -0
- package/app.d.ts +257 -0
- package/app.js +49 -0
- package/app.js.map +1 -0
- package/app.mjs +42 -0
- package/app.mjs.map +1 -0
- package/asset-manager.d.ts +212 -0
- package/asset-manager.js +166 -0
- package/asset-manager.js.map +1 -0
- package/asset-manager.mjs +166 -0
- package/asset-manager.mjs.map +1 -0
- package/async-event-emitter.d.ts +16 -0
- package/async-event-emitter.js +38 -0
- package/async-event-emitter.js.map +1 -0
- package/async-event-emitter.mjs +37 -0
- package/async-event-emitter.mjs.map +1 -0
- package/client-manager.d.ts +475 -0
- package/client-manager.js +616 -0
- package/client-manager.js.map +1 -0
- package/client-manager.mjs +616 -0
- package/client-manager.mjs.map +1 -0
- package/composer.d.ts +947 -0
- package/composer.js +1584 -0
- package/composer.js.map +1 -0
- package/composer.mjs +1583 -0
- package/composer.mjs.map +1 -0
- package/config.d.ts +1 -1
- package/config.js +2 -2
- package/config.js.map +1 -1
- package/config.mjs +1 -1
- package/config.mjs.map +1 -1
- package/debugging.d.ts +47 -0
- package/debugging.js +20 -0
- package/debugging.js.map +1 -0
- package/debugging.mjs +15 -0
- package/debugging.mjs.map +1 -0
- package/dispenser-client.d.ts +90 -0
- package/dispenser-client.js +127 -0
- package/dispenser-client.js.map +1 -0
- package/dispenser-client.mjs +127 -0
- package/dispenser-client.mjs.map +1 -0
- package/expand.d.ts +2 -0
- package/expand.js +0 -0
- package/expand.mjs +0 -0
- package/index.d.ts +6 -6
- package/index.js +4 -10
- package/index.mjs +5 -6
- package/indexer-client/index.d.ts +2 -2
- package/indexer-client/index.js +6 -6
- package/indexer-client/index.mjs +2 -2
- package/{indexer-lookup.d.ts → indexer-client/indexer-lookup.d.ts} +8 -11
- package/{indexer-lookup.mjs → indexer-client/indexer-lookup.js} +6 -10
- package/indexer-client/indexer-lookup.js.map +1 -0
- package/{indexer-lookup.js → indexer-client/indexer-lookup.mjs} +3 -18
- package/indexer-client/indexer-lookup.mjs.map +1 -0
- package/indexer.d.ts +40 -0
- package/indexer.js +38 -0
- package/indexer.js.map +1 -0
- package/indexer.mjs +35 -0
- package/indexer.mjs.map +1 -0
- package/instance-of.d.ts +8 -0
- package/kmd-account-manager.d.ts +74 -0
- package/kmd-account-manager.js +167 -0
- package/kmd-account-manager.js.map +1 -0
- package/kmd-account-manager.mjs +165 -0
- package/kmd-account-manager.mjs.map +1 -0
- package/kmd-client/index.d.ts +1 -2
- package/kmd-client/index.js +0 -5
- package/kmd-client/index.mjs +1 -2
- package/lifecycle-events.d.ts +14 -0
- package/lifecycle-events.js +11 -0
- package/lifecycle-events.js.map +1 -0
- package/lifecycle-events.mjs +10 -0
- package/lifecycle-events.mjs.map +1 -0
- package/logging.d.ts +13 -0
- package/logging.js +47 -0
- package/logging.js.map +1 -0
- package/logging.mjs +42 -0
- package/logging.mjs.map +1 -0
- package/logic-error.d.ts +39 -0
- package/logic-error.js +54 -0
- package/logic-error.js.map +1 -0
- package/logic-error.mjs +53 -0
- package/logic-error.mjs.map +1 -0
- package/network-client.d.ts +43 -0
- package/network-client.js +14 -0
- package/network-client.js.map +1 -0
- package/network-client.mjs +13 -0
- package/network-client.mjs.map +1 -0
- package/package.json +14 -5
- package/packages/abi/src/abi-method.d.ts +1 -1
- package/packages/abi/src/abi-method.js +1 -1
- package/packages/abi/src/abi-method.js.map +1 -1
- package/packages/abi/src/abi-method.mjs +1 -1
- package/packages/abi/src/abi-method.mjs.map +1 -1
- package/packages/abi/src/abi-type.d.ts +1 -3
- package/packages/abi/src/abi-type.js +7 -36
- package/packages/abi/src/abi-type.js.map +1 -1
- package/packages/abi/src/abi-type.mjs +7 -36
- package/packages/abi/src/abi-type.mjs.map +1 -1
- package/packages/abi/src/arc56-contract.js +1 -0
- package/packages/abi/src/arc56-contract.js.map +1 -1
- package/packages/abi/src/arc56-contract.mjs +1 -0
- package/packages/abi/src/arc56-contract.mjs.map +1 -1
- package/packages/abi/src/utils.d.ts +22 -0
- package/packages/abi/src/utils.js +57 -0
- package/packages/abi/src/utils.js.map +1 -0
- package/packages/abi/src/utils.mjs +55 -0
- package/packages/abi/src/utils.mjs.map +1 -0
- package/packages/algo25/src/index.js +1 -1
- package/packages/algo25/src/index.mjs +1 -1
- package/packages/algod_client/src/apis/api-service.d.ts +44 -44
- package/packages/algod_client/src/apis/api-service.js +155 -155
- package/packages/algod_client/src/apis/api-service.js.map +1 -1
- package/packages/algod_client/src/apis/api-service.mjs +155 -155
- package/packages/algod_client/src/apis/api-service.mjs.map +1 -1
- package/packages/algod_client/src/core/api-error.js +3 -1
- package/packages/algod_client/src/core/api-error.js.map +1 -1
- package/packages/algod_client/src/core/api-error.mjs +3 -1
- package/packages/algod_client/src/core/api-error.mjs.map +1 -1
- package/packages/algod_client/src/core/model-runtime.js +6 -6
- package/packages/algod_client/src/core/model-runtime.js.map +1 -1
- package/packages/algod_client/src/core/model-runtime.mjs +8 -8
- package/packages/algod_client/src/core/model-runtime.mjs.map +1 -1
- package/packages/algod_client/src/models/account-participation.js +4 -4
- package/packages/algod_client/src/models/account-participation.js.map +1 -1
- package/packages/algod_client/src/models/account-participation.mjs +4 -4
- package/packages/algod_client/src/models/account-participation.mjs.map +1 -1
- package/packages/algod_client/src/models/application-state-schema.d.ts +2 -2
- package/packages/algod_client/src/models/application-state-schema.js +2 -2
- package/packages/algod_client/src/models/application-state-schema.js.map +1 -1
- package/packages/algod_client/src/models/application-state-schema.mjs +2 -2
- package/packages/algod_client/src/models/application-state-schema.mjs.map +1 -1
- package/packages/algod_client/src/models/asset-params.js +2 -1
- package/packages/algod_client/src/models/asset-params.js.map +1 -1
- package/packages/algod_client/src/models/asset-params.mjs +2 -1
- package/packages/algod_client/src/models/asset-params.mjs.map +1 -1
- package/packages/algod_client/src/models/block-response.js +1 -2
- package/packages/algod_client/src/models/block-response.js.map +1 -1
- package/packages/algod_client/src/models/block-response.mjs +2 -3
- package/packages/algod_client/src/models/block-response.mjs.map +1 -1
- package/packages/algod_client/src/models/block.d.ts +60 -40
- package/packages/algod_client/src/models/block.js +184 -108
- package/packages/algod_client/src/models/block.js.map +1 -1
- package/packages/algod_client/src/models/block.mjs +184 -108
- package/packages/algod_client/src/models/block.mjs.map +1 -1
- package/packages/algod_client/src/models/eval-delta-key-value.js +2 -2
- package/packages/algod_client/src/models/eval-delta-key-value.js.map +1 -1
- package/packages/algod_client/src/models/eval-delta-key-value.mjs +2 -2
- package/packages/algod_client/src/models/eval-delta-key-value.mjs.map +1 -1
- package/packages/algod_client/src/models/eval-delta.js +2 -2
- package/packages/algod_client/src/models/eval-delta.js.map +1 -1
- package/packages/algod_client/src/models/eval-delta.mjs +2 -2
- package/packages/algod_client/src/models/eval-delta.mjs.map +1 -1
- package/packages/algod_client/src/models/ledger-state-delta.js +1 -1
- package/packages/algod_client/src/models/ledger-state-delta.js.map +1 -1
- package/packages/algod_client/src/models/ledger-state-delta.mjs +2 -2
- package/packages/algod_client/src/models/ledger-state-delta.mjs.map +1 -1
- package/packages/algod_client/src/models/simulate-request.js +1 -1
- package/packages/algod_client/src/models/simulate-request.mjs +1 -1
- package/packages/algod_client/src/models/simulate-response.d.ts +2 -1
- package/packages/algod_client/src/models/simulate-response.js +6 -1
- package/packages/algod_client/src/models/simulate-response.js.map +1 -1
- package/packages/algod_client/src/models/simulate-response.mjs +6 -2
- package/packages/algod_client/src/models/simulate-response.mjs.map +1 -1
- package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.d.ts +3 -5
- package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.js +4 -6
- package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.js.map +1 -1
- package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.mjs +3 -5
- package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.mjs.map +1 -1
- package/packages/algod_client/src/models/transaction-parameters-response.js +2 -2
- package/packages/algod_client/src/models/transaction-parameters-response.js.map +1 -1
- package/packages/algod_client/src/models/transaction-parameters-response.mjs +2 -2
- package/packages/algod_client/src/models/transaction-parameters-response.mjs.map +1 -1
- package/packages/common/src/address.d.ts +0 -1
- package/packages/common/src/address.js +4 -17
- package/packages/common/src/address.js.map +1 -1
- package/packages/common/src/address.mjs +5 -17
- package/packages/common/src/address.mjs.map +1 -1
- package/packages/common/src/codecs/composite/map.js +7 -4
- package/packages/common/src/codecs/composite/map.js.map +1 -1
- package/packages/common/src/codecs/composite/map.mjs +7 -4
- package/packages/common/src/codecs/composite/map.mjs.map +1 -1
- package/packages/common/src/codecs/composite/record.js +0 -1
- package/packages/common/src/codecs/composite/record.js.map +1 -1
- package/packages/common/src/codecs/primitives/address.js +0 -1
- package/packages/common/src/codecs/primitives/address.js.map +1 -1
- package/packages/common/src/codecs/primitives/bytes-base64.js +26 -0
- package/packages/common/src/codecs/primitives/bytes-base64.js.map +1 -0
- package/packages/common/src/codecs/primitives/bytes-base64.mjs +25 -0
- package/packages/common/src/codecs/primitives/bytes-base64.mjs.map +1 -0
- package/packages/common/src/codecs/primitives/bytes.js +0 -1
- package/packages/common/src/codecs/primitives/bytes.js.map +1 -1
- package/packages/common/src/codecs/primitives/fixed-bytes.js +0 -1
- package/packages/common/src/codecs/primitives/fixed-bytes.js.map +1 -1
- package/packages/common/src/codecs/wire.js +0 -1
- package/packages/common/src/codecs/wire.js.map +1 -1
- package/packages/common/src/json.mjs +2 -2
- package/packages/common/src/json.mjs.map +1 -1
- package/packages/common/src/msgpack.js +0 -1
- package/packages/common/src/msgpack.js.map +1 -1
- package/packages/{sdk/src/logic → common/src}/sourcemap.d.ts +2 -2
- package/packages/{sdk/src/logic → common/src}/sourcemap.js +2 -2
- package/packages/{sdk/src/logic → common/src}/sourcemap.js.map +1 -1
- package/packages/{sdk/src/logic → common/src}/sourcemap.mjs +1 -1
- package/packages/{sdk/src/logic → common/src}/sourcemap.mjs.map +1 -1
- package/packages/indexer_client/src/apis/api-service.d.ts +1 -1
- package/packages/indexer_client/src/apis/api-service.js +12 -12
- package/packages/indexer_client/src/apis/api-service.js.map +1 -1
- package/packages/indexer_client/src/apis/api-service.mjs +12 -12
- package/packages/indexer_client/src/apis/api-service.mjs.map +1 -1
- package/packages/indexer_client/src/core/api-error.js +3 -1
- package/packages/indexer_client/src/core/api-error.js.map +1 -1
- package/packages/indexer_client/src/core/api-error.mjs +3 -1
- package/packages/indexer_client/src/core/api-error.mjs.map +1 -1
- package/packages/indexer_client/src/core/model-runtime.js +0 -15
- package/packages/indexer_client/src/core/model-runtime.js.map +1 -1
- package/packages/indexer_client/src/core/model-runtime.mjs +1 -13
- package/packages/indexer_client/src/core/model-runtime.mjs.map +1 -1
- package/packages/indexer_client/src/models/account-participation.js +4 -4
- package/packages/indexer_client/src/models/account-participation.js.map +1 -1
- package/packages/indexer_client/src/models/account-participation.mjs +4 -4
- package/packages/indexer_client/src/models/account-participation.mjs.map +1 -1
- package/packages/indexer_client/src/models/application-state-schema.d.ts +2 -2
- package/packages/indexer_client/src/models/application-state-schema.js +2 -2
- package/packages/indexer_client/src/models/application-state-schema.js.map +1 -1
- package/packages/indexer_client/src/models/application-state-schema.mjs +2 -2
- package/packages/indexer_client/src/models/application-state-schema.mjs.map +1 -1
- package/packages/indexer_client/src/models/asset-params.js +2 -1
- package/packages/indexer_client/src/models/asset-params.js.map +1 -1
- package/packages/indexer_client/src/models/asset-params.mjs +2 -1
- package/packages/indexer_client/src/models/asset-params.mjs.map +1 -1
- package/packages/indexer_client/src/models/block.d.ts +5 -5
- package/packages/indexer_client/src/models/block.js +13 -13
- package/packages/indexer_client/src/models/block.js.map +1 -1
- package/packages/indexer_client/src/models/block.mjs +13 -13
- package/packages/indexer_client/src/models/block.mjs.map +1 -1
- package/packages/indexer_client/src/models/eval-delta-key-value.d.ts +1 -1
- package/packages/indexer_client/src/models/eval-delta-key-value.js +2 -2
- package/packages/indexer_client/src/models/eval-delta-key-value.js.map +1 -1
- package/packages/indexer_client/src/models/eval-delta-key-value.mjs +2 -2
- package/packages/indexer_client/src/models/eval-delta-key-value.mjs.map +1 -1
- package/packages/indexer_client/src/models/eval-delta.d.ts +1 -1
- package/packages/indexer_client/src/models/eval-delta.js +2 -2
- package/packages/indexer_client/src/models/eval-delta.js.map +1 -1
- package/packages/indexer_client/src/models/eval-delta.mjs +2 -2
- package/packages/indexer_client/src/models/eval-delta.mjs.map +1 -1
- package/packages/indexer_client/src/models/hb-proof-fields.js +6 -6
- package/packages/indexer_client/src/models/hb-proof-fields.js.map +1 -1
- package/packages/indexer_client/src/models/hb-proof-fields.mjs +6 -6
- package/packages/indexer_client/src/models/hb-proof-fields.mjs.map +1 -1
- package/packages/indexer_client/src/models/participation-updates.d.ts +2 -2
- package/packages/indexer_client/src/models/participation-updates.js +2 -2
- package/packages/indexer_client/src/models/participation-updates.js.map +1 -1
- package/packages/indexer_client/src/models/participation-updates.mjs +2 -2
- package/packages/indexer_client/src/models/participation-updates.mjs.map +1 -1
- package/packages/indexer_client/src/models/state-proof-verifier.js +2 -2
- package/packages/indexer_client/src/models/state-proof-verifier.js.map +1 -1
- package/packages/indexer_client/src/models/state-proof-verifier.mjs +2 -2
- package/packages/indexer_client/src/models/state-proof-verifier.mjs.map +1 -1
- package/packages/indexer_client/src/models/state-schema.d.ts +2 -2
- package/packages/indexer_client/src/models/state-schema.js +2 -2
- package/packages/indexer_client/src/models/state-schema.js.map +1 -1
- package/packages/indexer_client/src/models/state-schema.mjs +2 -2
- package/packages/indexer_client/src/models/state-schema.mjs.map +1 -1
- package/packages/indexer_client/src/models/teal-key-value.d.ts +1 -1
- package/packages/indexer_client/src/models/teal-key-value.js +2 -2
- package/packages/indexer_client/src/models/teal-key-value.js.map +1 -1
- package/packages/indexer_client/src/models/teal-key-value.mjs +2 -2
- package/packages/indexer_client/src/models/teal-key-value.mjs.map +1 -1
- package/packages/indexer_client/src/models/transaction-heartbeat.js +2 -1
- package/packages/indexer_client/src/models/transaction-heartbeat.js.map +1 -1
- package/packages/indexer_client/src/models/transaction-heartbeat.mjs +2 -1
- package/packages/indexer_client/src/models/transaction-heartbeat.mjs.map +1 -1
- package/packages/indexer_client/src/models/transaction-keyreg.js +4 -4
- package/packages/indexer_client/src/models/transaction-keyreg.js.map +1 -1
- package/packages/indexer_client/src/models/transaction-keyreg.mjs +4 -4
- package/packages/indexer_client/src/models/transaction-keyreg.mjs.map +1 -1
- package/packages/indexer_client/src/models/transaction-signature-logicsig.js +2 -1
- package/packages/indexer_client/src/models/transaction-signature-logicsig.js.map +1 -1
- package/packages/indexer_client/src/models/transaction-signature-logicsig.mjs +2 -1
- package/packages/indexer_client/src/models/transaction-signature-logicsig.mjs.map +1 -1
- package/packages/indexer_client/src/models/transaction-signature-multisig-subsignature.js +3 -3
- package/packages/indexer_client/src/models/transaction-signature-multisig-subsignature.js.map +1 -1
- package/packages/indexer_client/src/models/transaction-signature-multisig-subsignature.mjs +3 -3
- package/packages/indexer_client/src/models/transaction-signature-multisig-subsignature.mjs.map +1 -1
- package/packages/indexer_client/src/models/transaction-state-proof.d.ts +1 -1
- package/packages/indexer_client/src/models/transaction-state-proof.js +2 -2
- package/packages/indexer_client/src/models/transaction-state-proof.js.map +1 -1
- package/packages/indexer_client/src/models/transaction-state-proof.mjs +2 -2
- package/packages/indexer_client/src/models/transaction-state-proof.mjs.map +1 -1
- package/packages/indexer_client/src/models/transaction.d.ts +2 -2
- package/packages/indexer_client/src/models/transaction.js +6 -5
- package/packages/indexer_client/src/models/transaction.js.map +1 -1
- package/packages/indexer_client/src/models/transaction.mjs +6 -5
- package/packages/indexer_client/src/models/transaction.mjs.map +1 -1
- package/packages/kmd_client/src/apis/api-service.d.ts +5 -5
- package/packages/kmd_client/src/apis/api-service.js +32 -32
- package/packages/kmd_client/src/apis/api-service.js.map +1 -1
- package/packages/kmd_client/src/apis/api-service.mjs +32 -32
- package/packages/kmd_client/src/apis/api-service.mjs.map +1 -1
- package/packages/kmd_client/src/core/api-error.js +3 -1
- package/packages/kmd_client/src/core/api-error.js.map +1 -1
- package/packages/kmd_client/src/core/api-error.mjs +3 -1
- package/packages/kmd_client/src/core/api-error.mjs.map +1 -1
- package/packages/kmd_client/src/core/model-runtime.js +2 -12
- package/packages/kmd_client/src/core/model-runtime.js.map +1 -1
- package/packages/kmd_client/src/core/model-runtime.mjs +3 -11
- package/packages/kmd_client/src/core/model-runtime.mjs.map +1 -1
- package/packages/transact/src/logicsig.d.ts +35 -33
- package/packages/transact/src/logicsig.js +74 -76
- package/packages/transact/src/logicsig.js.map +1 -1
- package/packages/transact/src/logicsig.mjs +77 -78
- package/packages/transact/src/logicsig.mjs.map +1 -1
- package/packages/transact/src/multisig.d.ts +11 -116
- package/packages/transact/src/multisig.js +106 -136
- package/packages/transact/src/multisig.js.map +1 -1
- package/packages/transact/src/multisig.mjs +108 -118
- package/packages/transact/src/multisig.mjs.map +1 -1
- package/packages/transact/src/signer.js +9 -2
- package/packages/transact/src/signer.js.map +1 -1
- package/packages/transact/src/signer.mjs +10 -3
- package/packages/transact/src/signer.mjs.map +1 -1
- package/packages/transact/src/transactions/app-call.d.ts +10 -15
- package/packages/transact/src/transactions/app-call.js.map +1 -1
- package/packages/transact/src/transactions/app-call.mjs.map +1 -1
- package/packages/transact/src/transactions/asset-config.d.ts +1 -6
- package/packages/transact/src/transactions/asset-config.js.map +1 -1
- package/packages/transact/src/transactions/asset-config.mjs.map +1 -1
- package/packages/transact/src/transactions/asset-freeze.d.ts +1 -6
- package/packages/transact/src/transactions/asset-transfer.d.ts +1 -6
- package/packages/transact/src/transactions/key-registration.d.ts +1 -8
- package/packages/transact/src/transactions/reference-types-meta.d.ts +26 -0
- package/packages/transact/src/transactions/reference-types-meta.js +71 -0
- package/packages/transact/src/transactions/reference-types-meta.js.map +1 -0
- package/packages/transact/src/transactions/reference-types-meta.mjs +69 -0
- package/packages/transact/src/transactions/reference-types-meta.mjs.map +1 -0
- package/packages/transact/src/transactions/signed-transaction-meta.js +8 -9
- package/packages/transact/src/transactions/signed-transaction-meta.js.map +1 -1
- package/packages/transact/src/transactions/signed-transaction-meta.mjs +8 -8
- package/packages/transact/src/transactions/signed-transaction-meta.mjs.map +1 -1
- package/packages/transact/src/transactions/signed-transaction.d.ts +10 -6
- package/packages/transact/src/transactions/signed-transaction.js +1 -1
- package/packages/transact/src/transactions/signed-transaction.js.map +1 -1
- package/packages/transact/src/transactions/signed-transaction.mjs +1 -2
- package/packages/transact/src/transactions/signed-transaction.mjs.map +1 -1
- package/packages/transact/src/transactions/state-proof.d.ts +1 -1
- package/packages/transact/src/transactions/transaction-meta.js +29 -23
- package/packages/transact/src/transactions/transaction-meta.js.map +1 -1
- package/packages/transact/src/transactions/transaction-meta.mjs +29 -23
- package/packages/transact/src/transactions/transaction-meta.mjs.map +1 -1
- package/packages/transact/src/transactions/transaction.d.ts +5 -2
- package/packages/transact/src/transactions/transaction.js +5 -4
- package/packages/transact/src/transactions/transaction.js.map +1 -1
- package/packages/transact/src/transactions/transaction.mjs +5 -4
- package/packages/transact/src/transactions/transaction.mjs.map +1 -1
- package/testing/account.d.ts +2 -2
- package/testing/account.js +2 -3
- package/testing/account.js.map +1 -1
- package/testing/account.mjs +2 -3
- package/testing/account.mjs.map +1 -1
- package/testing/fixtures/algokit-log-capture-fixture.d.ts +1 -1
- package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -1
- package/testing/fixtures/algokit-log-capture-fixture.mjs.map +1 -1
- package/testing/fixtures/algorand-fixture.d.ts +5 -5
- package/testing/fixtures/algorand-fixture.js +2 -2
- package/testing/fixtures/algorand-fixture.js.map +1 -1
- package/testing/fixtures/algorand-fixture.mjs +2 -2
- package/testing/fixtures/algorand-fixture.mjs.map +1 -1
- package/testing/index.d.ts +2 -1
- package/testing/test-logger.d.ts +1 -1
- package/testing/test-logger.js.map +1 -1
- package/testing/test-logger.mjs.map +1 -1
- package/testing/transaction-logger.js +1 -1
- package/testing/transaction-logger.mjs +1 -1
- package/testing/types.d.ts +156 -0
- package/transact/index.d.ts +11 -10
- package/transact/index.js +7 -31
- package/transact/index.mjs +7 -10
- package/transaction/index.d.ts +4 -0
- package/transaction/index.js +9 -0
- package/transaction/index.mjs +4 -0
- package/transaction/perform-transaction-composer-simulate.d.ts +1 -1
- package/transaction/perform-transaction-composer-simulate.js.map +1 -1
- package/transaction/perform-transaction-composer-simulate.mjs.map +1 -1
- package/transaction/transaction.d.ts +2 -2
- package/transaction/transaction.js +2 -2
- package/transaction/transaction.js.map +1 -1
- package/transaction/transaction.mjs +2 -2
- package/transaction/transaction.mjs.map +1 -1
- package/transaction/types.d.ts +133 -0
- package/transactions/app-call.d.ts +6 -5
- package/transactions/app-call.js +17 -17
- package/transactions/app-call.js.map +1 -1
- package/transactions/app-call.mjs +17 -17
- package/transactions/app-call.mjs.map +1 -1
- package/transactions/asset-config.d.ts +1 -1
- package/transactions/asset-config.js +1 -1
- package/transactions/asset-config.js.map +1 -1
- package/transactions/asset-config.mjs +1 -1
- package/transactions/asset-config.mjs.map +1 -1
- package/transactions/common.d.ts +1 -1
- package/transactions/common.js.map +1 -1
- package/transactions/common.mjs.map +1 -1
- package/transactions/key-registration.d.ts +1 -1
- package/transactions/key-registration.js.map +1 -1
- package/transactions/key-registration.mjs.map +1 -1
- package/transactions/method-call.d.ts +2 -2
- package/transactions/method-call.js +78 -85
- package/transactions/method-call.js.map +1 -1
- package/transactions/method-call.mjs +78 -85
- package/transactions/method-call.mjs.map +1 -1
- package/transactions/payment.d.ts +1 -1
- package/transactions/payment.js.map +1 -1
- package/transactions/payment.mjs.map +1 -1
- package/types/account-manager.d.ts +11 -444
- package/types/account-manager.js +5 -606
- package/types/account-manager.js.map +1 -1
- package/types/account-manager.mjs +5 -604
- package/types/account-manager.mjs.map +1 -1
- package/types/account.d.ts +8 -150
- package/types/account.js +3 -4
- package/types/account.js.map +1 -1
- package/types/account.mjs +4 -4
- package/types/account.mjs.map +1 -1
- package/types/algorand-client-transaction-creator.d.ts +5 -1084
- package/types/algorand-client-transaction-creator.js +3 -721
- package/types/algorand-client-transaction-creator.js.map +1 -1
- package/types/algorand-client-transaction-creator.mjs +4 -721
- package/types/algorand-client-transaction-creator.mjs.map +1 -1
- package/types/algorand-client-transaction-sender.d.ts +5 -1298
- package/types/algorand-client-transaction-sender.js +3 -920
- package/types/algorand-client-transaction-sender.js.map +1 -1
- package/types/algorand-client-transaction-sender.mjs +3 -918
- package/types/algorand-client-transaction-sender.mjs.map +1 -1
- package/types/algorand-client.d.ts +5 -241
- package/types/algorand-client.js +3 -319
- package/types/algorand-client.js.map +1 -1
- package/types/algorand-client.mjs +3 -319
- package/types/algorand-client.mjs.map +1 -1
- package/types/amount.d.ts +6 -45
- package/types/amount.js +3 -60
- package/types/amount.js.map +1 -1
- package/types/amount.mjs +3 -60
- package/types/amount.mjs.map +1 -1
- package/types/app-client.d.ts +75 -2120
- package/types/app-client.js +3 -904
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +3 -902
- package/types/app-client.mjs.map +1 -1
- package/types/app-deployer.d.ts +21 -161
- package/types/app-deployer.js +3 -347
- package/types/app-deployer.js.map +1 -1
- package/types/app-deployer.mjs +3 -347
- package/types/app-deployer.mjs.map +1 -1
- package/types/app-factory.d.ts +21 -957
- package/types/app-factory.js +3 -442
- package/types/app-factory.js.map +1 -1
- package/types/app-factory.mjs +3 -442
- package/types/app-factory.mjs.map +1 -1
- package/types/app-manager.d.ts +15 -316
- package/types/app-manager.js +3 -456
- package/types/app-manager.js.map +1 -1
- package/types/app-manager.mjs +3 -456
- package/types/app-manager.mjs.map +1 -1
- package/types/app-spec.d.ts +39 -198
- package/types/app-spec.js +3 -124
- package/types/app-spec.js.map +1 -1
- package/types/app-spec.mjs +3 -124
- package/types/app-spec.mjs.map +1 -1
- package/types/app.d.ts +62 -247
- package/types/app.js +15 -37
- package/types/app.js.map +1 -1
- package/types/app.mjs +16 -37
- package/types/app.mjs.map +1 -1
- package/types/asset-manager.d.ts +9 -207
- package/types/asset-manager.js +3 -160
- package/types/asset-manager.js.map +1 -1
- package/types/asset-manager.mjs +3 -160
- package/types/asset-manager.mjs.map +1 -1
- package/types/async-event-emitter.d.ts +7 -14
- package/types/async-event-emitter.js +3 -32
- package/types/async-event-emitter.js.map +1 -1
- package/types/async-event-emitter.mjs +4 -32
- package/types/async-event-emitter.mjs.map +1 -1
- package/types/client-manager.d.ts +27 -470
- package/types/client-manager.js +3 -610
- package/types/client-manager.js.map +1 -1
- package/types/client-manager.mjs +3 -610
- package/types/client-manager.mjs.map +1 -1
- package/types/composer.d.ts +79 -935
- package/types/composer.js +3 -1569
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +3 -1567
- package/types/composer.mjs.map +1 -1
- package/types/config.d.ts +7 -52
- package/types/config.js +3 -74
- package/types/config.js.map +1 -1
- package/types/config.mjs +3 -74
- package/types/config.mjs.map +1 -1
- package/types/debugging.d.ts +12 -33
- package/types/debugging.js +11 -10
- package/types/debugging.js.map +1 -1
- package/types/debugging.mjs +12 -10
- package/types/debugging.mjs.map +1 -1
- package/types/dispenser-client.d.ts +11 -85
- package/types/dispenser-client.js +3 -121
- package/types/dispenser-client.js.map +1 -1
- package/types/dispenser-client.mjs +3 -121
- package/types/dispenser-client.mjs.map +1 -1
- package/types/expand.d.ts +4 -5
- package/types/indexer.d.ts +16 -36
- package/types/indexer.js +7 -30
- package/types/indexer.js.map +1 -1
- package/types/indexer.mjs +8 -30
- package/types/indexer.mjs.map +1 -1
- package/types/instance-of.d.ts +4 -4
- package/types/kmd-account-manager.d.ts +5 -68
- package/types/kmd-account-manager.js +3 -150
- package/types/kmd-account-manager.js.map +1 -1
- package/types/kmd-account-manager.mjs +3 -148
- package/types/kmd-account-manager.mjs.map +1 -1
- package/types/lifecycle-events.d.ts +7 -10
- package/types/lifecycle-events.js +3 -5
- package/types/lifecycle-events.js.map +1 -1
- package/types/lifecycle-events.mjs +4 -5
- package/types/lifecycle-events.mjs.map +1 -1
- package/types/logging.d.ts +14 -9
- package/types/logging.js +11 -37
- package/types/logging.js.map +1 -1
- package/types/logging.mjs +12 -37
- package/types/logging.mjs.map +1 -1
- package/types/logic-error.d.ts +8 -35
- package/types/logic-error.js +3 -48
- package/types/logic-error.js.map +1 -1
- package/types/logic-error.mjs +4 -48
- package/types/logic-error.mjs.map +1 -1
- package/types/network-client.d.ts +10 -39
- package/types/network-client.js +3 -8
- package/types/network-client.js.map +1 -1
- package/types/network-client.mjs +4 -8
- package/types/network-client.mjs.map +1 -1
- package/types/testing.d.ts +13 -151
- package/types/transaction.d.ts +33 -128
- package/updatable-config.d.ts +57 -0
- package/updatable-config.js +80 -0
- package/updatable-config.js.map +1 -0
- package/updatable-config.mjs +80 -0
- package/updatable-config.mjs.map +1 -0
- package/util.js +1 -1
- package/util.js.map +1 -1
- package/util.mjs +1 -1
- package/util.mjs.map +1 -1
- package/_virtual/rolldown_runtime.mjs +0 -13
- package/indexer-lookup.js.map +0 -1
- package/indexer-lookup.mjs.map +0 -1
- package/packages/algod_client/src/core/model-runtime.d.ts +0 -10
- package/packages/algod_client/src/models/application-local-reference.d.ts +0 -20
- package/packages/algod_client/src/models/application-local-reference.js +0 -23
- package/packages/algod_client/src/models/application-local-reference.js.map +0 -1
- package/packages/algod_client/src/models/application-local-reference.mjs +0 -23
- package/packages/algod_client/src/models/application-local-reference.mjs.map +0 -1
- package/packages/algod_client/src/models/asset-holding-reference.d.ts +0 -20
- package/packages/algod_client/src/models/asset-holding-reference.js +0 -23
- package/packages/algod_client/src/models/asset-holding-reference.js.map +0 -1
- package/packages/algod_client/src/models/asset-holding-reference.mjs +0 -23
- package/packages/algod_client/src/models/asset-holding-reference.mjs.map +0 -1
- package/packages/algod_client/src/models/box-reference.d.ts +0 -17
- package/packages/algod_client/src/models/box-reference.js +0 -23
- package/packages/algod_client/src/models/box-reference.js.map +0 -1
- package/packages/algod_client/src/models/box-reference.mjs +0 -23
- package/packages/algod_client/src/models/box-reference.mjs.map +0 -1
- package/packages/indexer_client/src/core/model-runtime.d.ts +0 -10
- package/packages/kmd_client/src/core/model-runtime.d.ts +0 -10
- package/packages/sdk/src/convert.d.ts +0 -17
- package/packages/sdk/src/convert.js +0 -28
- package/packages/sdk/src/convert.js.map +0 -1
- package/packages/sdk/src/convert.mjs +0 -25
- package/packages/sdk/src/convert.mjs.map +0 -1
- package/packages/sdk/src/encoding/binarydata.d.ts +0 -34
- package/packages/sdk/src/encoding/binarydata.js +0 -65
- package/packages/sdk/src/encoding/binarydata.js.map +0 -1
- package/packages/sdk/src/encoding/binarydata.mjs +0 -60
- package/packages/sdk/src/encoding/binarydata.mjs.map +0 -1
- package/packages/sdk/src/encoding/encoding.d.ts +0 -237
- package/packages/sdk/src/encoding/encoding.js +0 -302
- package/packages/sdk/src/encoding/encoding.js.map +0 -1
- package/packages/sdk/src/encoding/encoding.mjs +0 -287
- package/packages/sdk/src/encoding/encoding.mjs.map +0 -1
- package/packages/sdk/src/encoding/schema/array.js +0 -35
- package/packages/sdk/src/encoding/schema/array.js.map +0 -1
- package/packages/sdk/src/encoding/schema/array.mjs +0 -35
- package/packages/sdk/src/encoding/schema/array.mjs.map +0 -1
- package/packages/sdk/src/encoding/schema/bytearray.js +0 -49
- package/packages/sdk/src/encoding/schema/bytearray.js.map +0 -1
- package/packages/sdk/src/encoding/schema/bytearray.mjs +0 -49
- package/packages/sdk/src/encoding/schema/bytearray.mjs.map +0 -1
- package/packages/sdk/src/encoding/schema/map.d.ts +0 -58
- package/packages/sdk/src/encoding/schema/map.js +0 -110
- package/packages/sdk/src/encoding/schema/map.js.map +0 -1
- package/packages/sdk/src/encoding/schema/map.mjs +0 -107
- package/packages/sdk/src/encoding/schema/map.mjs.map +0 -1
- package/packages/sdk/src/encoding/schema/optional.js +0 -46
- package/packages/sdk/src/encoding/schema/optional.js.map +0 -1
- package/packages/sdk/src/encoding/schema/optional.mjs +0 -46
- package/packages/sdk/src/encoding/schema/optional.mjs.map +0 -1
- package/packages/sdk/src/encoding/schema/uint64.js +0 -30
- package/packages/sdk/src/encoding/schema/uint64.js.map +0 -1
- package/packages/sdk/src/encoding/schema/uint64.mjs +0 -30
- package/packages/sdk/src/encoding/schema/uint64.mjs.map +0 -1
- package/packages/sdk/src/encoding/uint64.d.ts +0 -34
- package/packages/sdk/src/encoding/uint64.js +0 -34
- package/packages/sdk/src/encoding/uint64.js.map +0 -1
- package/packages/sdk/src/encoding/uint64.mjs +0 -33
- package/packages/sdk/src/encoding/uint64.mjs.map +0 -1
- package/packages/sdk/src/index.d.ts +0 -44
- package/packages/sdk/src/index.js +0 -62
- package/packages/sdk/src/index.js.map +0 -1
- package/packages/sdk/src/index.mjs +0 -58
- package/packages/sdk/src/index.mjs.map +0 -1
- package/packages/sdk/src/nacl/naclWrappers.js +0 -14
- package/packages/sdk/src/nacl/naclWrappers.js.map +0 -1
- package/packages/sdk/src/nacl/naclWrappers.mjs +0 -11
- package/packages/sdk/src/nacl/naclWrappers.mjs.map +0 -1
- package/packages/sdk/src/types/intDecoding.d.ts +0 -28
- package/packages/sdk/src/types/intDecoding.js +0 -32
- package/packages/sdk/src/types/intDecoding.js.map +0 -1
- package/packages/sdk/src/types/intDecoding.mjs +0 -31
- package/packages/sdk/src/types/intDecoding.mjs.map +0 -1
- package/packages/sdk/src/types/transactions/encoded.d.ts +0 -40
- package/packages/sdk/src/types/transactions/encoded.js +0 -64
- package/packages/sdk/src/types/transactions/encoded.js.map +0 -1
- package/packages/sdk/src/types/transactions/encoded.mjs +0 -59
- package/packages/sdk/src/types/transactions/encoded.mjs.map +0 -1
- package/packages/sdk/src/utils/utils.d.ts +0 -64
- package/packages/sdk/src/utils/utils.js +0 -140
- package/packages/sdk/src/utils/utils.js.map +0 -1
- package/packages/sdk/src/utils/utils.mjs +0 -128
- package/packages/sdk/src/utils/utils.mjs.map +0 -1
- package/packages/transact/src/transactions/common.d.ts +0 -37
- package/sdk/index.d.ts +0 -10
- package/sdk/index.js +0 -59
- package/sdk/index.mjs +0 -11
package/types/composer.js
CHANGED
|
@@ -1,1574 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_constants = require('../packages/common/src/constants.js');
|
|
3
|
-
const require_app_call = require('../packages/transact/src/transactions/app-call.js');
|
|
4
|
-
const require_transaction_type = require('../packages/transact/src/transactions/transaction-type.js');
|
|
5
|
-
const require_transaction = require('../packages/transact/src/transactions/transaction.js');
|
|
6
|
-
const require_signed_transaction = require('../packages/transact/src/transactions/signed-transaction.js');
|
|
7
|
-
const require_signer = require('../packages/transact/src/signer.js');
|
|
8
|
-
const require_amount = require('./amount.js');
|
|
9
|
-
const require_config = require('../config.js');
|
|
10
|
-
const require_util = require('../util.js');
|
|
11
|
-
const require_transaction$1 = require('../transaction/transaction.js');
|
|
12
|
-
const require_app_manager = require('./app-manager.js');
|
|
13
|
-
const require_app_call$1 = require('../transactions/app-call.js');
|
|
14
|
-
const require_asset_transfer = require('../transactions/asset-transfer.js');
|
|
15
|
-
const require_asset_config = require('../transactions/asset-config.js');
|
|
16
|
-
const require_fee_coverage = require('../transactions/fee-coverage.js');
|
|
17
|
-
const require_key_registration = require('../transactions/key-registration.js');
|
|
18
|
-
const require_method_call = require('../transactions/method-call.js');
|
|
19
|
-
const require_payment = require('../transactions/payment.js');
|
|
20
|
-
const require_lifecycle_events = require('./lifecycle-events.js');
|
|
21
|
-
const require_network_client = require('./network-client.js');
|
|
22
|
-
let buffer = require("buffer");
|
|
23
|
-
buffer = require_rolldown_runtime.__toESM(buffer);
|
|
1
|
+
const require_composer = require('../composer.js');
|
|
24
2
|
|
|
25
3
|
//#region src/types/composer.ts
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
super(`An error transformer returned a non-error value: ${value}. The original error before any transformation: ${originalError}`);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
var ErrorTransformerError = class extends Error {
|
|
32
|
-
constructor(originalError, cause) {
|
|
33
|
-
super(`An error transformer threw an error: ${cause}. The original error before any transformation: ${originalError} `, { cause });
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
/** TransactionComposer helps you compose and execute transactions as a transaction group. */
|
|
37
|
-
var TransactionComposer = class TransactionComposer {
|
|
38
|
-
/** Transactions that have not yet been composed */
|
|
39
|
-
txns = [];
|
|
40
|
-
/** The algod client used by the composer. */
|
|
41
|
-
algod;
|
|
42
|
-
/** An async function that will return suggested params for the transaction. */
|
|
43
|
-
getSuggestedParams;
|
|
44
|
-
/** A function that takes in an address and return a signer function for that address. */
|
|
45
|
-
getSigner;
|
|
46
|
-
/** The default transaction validity window */
|
|
47
|
-
defaultValidityWindow = 10n;
|
|
48
|
-
/** Whether the validity window was explicitly set on construction */
|
|
49
|
-
defaultValidityWindowIsExplicit = false;
|
|
50
|
-
appManager;
|
|
51
|
-
errorTransformers;
|
|
52
|
-
composerConfig;
|
|
53
|
-
transactionsWithSigners;
|
|
54
|
-
signedTransactions;
|
|
55
|
-
rawBuildTransactions;
|
|
56
|
-
async transformError(originalError) {
|
|
57
|
-
if (!(originalError instanceof Error)) return originalError;
|
|
58
|
-
let transformedError = originalError;
|
|
59
|
-
for (const transformer of this.errorTransformers) try {
|
|
60
|
-
transformedError = await transformer(transformedError);
|
|
61
|
-
if (!(transformedError instanceof Error)) return new InvalidErrorTransformerValue(originalError, transformedError);
|
|
62
|
-
} catch (errorFromTransformer) {
|
|
63
|
-
return new ErrorTransformerError(originalError, errorFromTransformer);
|
|
64
|
-
}
|
|
65
|
-
return transformedError;
|
|
66
|
-
}
|
|
67
|
-
validateReferenceParams(params) {
|
|
68
|
-
if (params.accessReferences && params.accessReferences.length > 0 && (params.appReferences && params.appReferences.length > 0 || params.assetReferences && params.assetReferences.length > 0 || params.boxReferences && params.boxReferences.length > 0)) throw new Error("Cannot specify both `accessReferences` and reference arrays (`appReferences`, `assetReferences`, `boxReferences`).");
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Create a `TransactionComposer`.
|
|
72
|
-
* @param params The configuration for this composer
|
|
73
|
-
* @returns The `TransactionComposer` instance
|
|
74
|
-
*/
|
|
75
|
-
constructor(params) {
|
|
76
|
-
this.algod = params.algod;
|
|
77
|
-
const defaultGetSuggestedParams = () => params.algod.suggestedParams();
|
|
78
|
-
this.getSuggestedParams = params.getSuggestedParams ?? defaultGetSuggestedParams;
|
|
79
|
-
this.getSigner = params.getSigner;
|
|
80
|
-
this.defaultValidityWindow = params.defaultValidityWindow ?? this.defaultValidityWindow;
|
|
81
|
-
this.defaultValidityWindowIsExplicit = params.defaultValidityWindow !== void 0;
|
|
82
|
-
this.appManager = params.appManager ?? new require_app_manager.AppManager(params.algod);
|
|
83
|
-
this.errorTransformers = params.errorTransformers ?? [];
|
|
84
|
-
this.composerConfig = params.composerConfig ?? {
|
|
85
|
-
coverAppCallInnerTransactionFees: false,
|
|
86
|
-
populateAppCallResources: true
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
cloneTransaction(txn) {
|
|
90
|
-
switch (txn.type) {
|
|
91
|
-
case "pay": return {
|
|
92
|
-
type: "pay",
|
|
93
|
-
data: { ...txn.data }
|
|
94
|
-
};
|
|
95
|
-
case "assetCreate": return {
|
|
96
|
-
type: "assetCreate",
|
|
97
|
-
data: { ...txn.data }
|
|
98
|
-
};
|
|
99
|
-
case "assetConfig": return {
|
|
100
|
-
type: "assetConfig",
|
|
101
|
-
data: { ...txn.data }
|
|
102
|
-
};
|
|
103
|
-
case "assetFreeze": return {
|
|
104
|
-
type: "assetFreeze",
|
|
105
|
-
data: { ...txn.data }
|
|
106
|
-
};
|
|
107
|
-
case "assetDestroy": return {
|
|
108
|
-
type: "assetDestroy",
|
|
109
|
-
data: { ...txn.data }
|
|
110
|
-
};
|
|
111
|
-
case "assetTransfer": return {
|
|
112
|
-
type: "assetTransfer",
|
|
113
|
-
data: { ...txn.data }
|
|
114
|
-
};
|
|
115
|
-
case "assetOptIn": return {
|
|
116
|
-
type: "assetOptIn",
|
|
117
|
-
data: { ...txn.data }
|
|
118
|
-
};
|
|
119
|
-
case "assetOptOut": return {
|
|
120
|
-
type: "assetOptOut",
|
|
121
|
-
data: { ...txn.data }
|
|
122
|
-
};
|
|
123
|
-
case "appCall": return {
|
|
124
|
-
type: "appCall",
|
|
125
|
-
data: { ...txn.data }
|
|
126
|
-
};
|
|
127
|
-
case "keyReg": return {
|
|
128
|
-
type: "keyReg",
|
|
129
|
-
data: { ...txn.data }
|
|
130
|
-
};
|
|
131
|
-
case "txn": {
|
|
132
|
-
const { txn: transaction, signer, maxFee } = txn.data;
|
|
133
|
-
const clonedTxn = require_transaction.decodeTransaction(require_transaction.encodeTransactionRaw(transaction));
|
|
134
|
-
delete clonedTxn.group;
|
|
135
|
-
return {
|
|
136
|
-
type: "txn",
|
|
137
|
-
data: {
|
|
138
|
-
txn: clonedTxn,
|
|
139
|
-
signer,
|
|
140
|
-
maxFee
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
case "asyncTxn": {
|
|
145
|
-
const { txn: txnPromise, signer, maxFee } = txn.data;
|
|
146
|
-
return {
|
|
147
|
-
type: "asyncTxn",
|
|
148
|
-
data: {
|
|
149
|
-
txn: txnPromise.then((resolvedTxn) => {
|
|
150
|
-
const clonedTxn = require_transaction.decodeTransaction(require_transaction.encodeTransactionRaw(resolvedTxn));
|
|
151
|
-
delete clonedTxn.group;
|
|
152
|
-
return clonedTxn;
|
|
153
|
-
}),
|
|
154
|
-
signer,
|
|
155
|
-
maxFee
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
case "methodCall": return {
|
|
160
|
-
type: "methodCall",
|
|
161
|
-
data: { ...txn.data }
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
push(...txns) {
|
|
166
|
-
if (this.transactionsWithSigners) throw new Error("Cannot add new transactions after building");
|
|
167
|
-
if (this.txns.length + txns.length > require_constants.MAX_TRANSACTION_GROUP_SIZE) throw new Error(`Adding ${txns.length} transaction(s) would exceed the maximum group size. Current: ${this.txns.length}, Maximum: ${require_constants.MAX_TRANSACTION_GROUP_SIZE}`);
|
|
168
|
-
this.txns.push(...txns);
|
|
169
|
-
}
|
|
170
|
-
clone(composerConfig) {
|
|
171
|
-
const newComposer = new TransactionComposer({
|
|
172
|
-
algod: this.algod,
|
|
173
|
-
getSuggestedParams: this.getSuggestedParams,
|
|
174
|
-
getSigner: this.getSigner,
|
|
175
|
-
defaultValidityWindow: this.defaultValidityWindow,
|
|
176
|
-
appManager: this.appManager,
|
|
177
|
-
errorTransformers: this.errorTransformers,
|
|
178
|
-
composerConfig: {
|
|
179
|
-
...this.composerConfig,
|
|
180
|
-
...composerConfig
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
this.txns.forEach((txn) => {
|
|
184
|
-
newComposer.txns.push(this.cloneTransaction(txn));
|
|
185
|
-
});
|
|
186
|
-
newComposer.defaultValidityWindowIsExplicit = this.defaultValidityWindowIsExplicit;
|
|
187
|
-
return newComposer;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Register a function that will be used to transform an error caught when simulating or executing
|
|
191
|
-
*
|
|
192
|
-
* @returns The composer so you can chain method calls
|
|
193
|
-
*/
|
|
194
|
-
registerErrorTransformer(transformer) {
|
|
195
|
-
this.errorTransformers.push(transformer);
|
|
196
|
-
return this;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Add a pre-built transaction to the transaction group.
|
|
200
|
-
* @param transaction The pre-built transaction
|
|
201
|
-
* @param signer Optional signer override for the transaction
|
|
202
|
-
* @returns The composer so you can chain method calls
|
|
203
|
-
* @example
|
|
204
|
-
* ```typescript
|
|
205
|
-
* composer.addTransaction(txn)
|
|
206
|
-
* ```
|
|
207
|
-
*/
|
|
208
|
-
addTransaction(transaction, signer) {
|
|
209
|
-
if (transaction.group) throw new Error("Cannot add a transaction to the composer because it is already in a group");
|
|
210
|
-
this.push({
|
|
211
|
-
data: {
|
|
212
|
-
txn: transaction,
|
|
213
|
-
signer: signer ?? this.getSigner(transaction.sender)
|
|
214
|
-
},
|
|
215
|
-
type: "txn"
|
|
216
|
-
});
|
|
217
|
-
return this;
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Add another transaction composer to the current transaction composer.
|
|
221
|
-
* The transaction params of the input transaction composer will be added.
|
|
222
|
-
* If the input transaction composer is updated, it won't affect the current transaction composer.
|
|
223
|
-
* @param composer The transaction composer to add
|
|
224
|
-
* @returns The composer so you can chain method calls
|
|
225
|
-
* @example
|
|
226
|
-
* ```typescript
|
|
227
|
-
* const innerComposer = algorand.newGroup()
|
|
228
|
-
* .addPayment({ sender: 'SENDER', receiver: 'RECEIVER', amount: (1).algo() })
|
|
229
|
-
* .addPayment({ sender: 'SENDER', receiver: 'RECEIVER', amount: (2).algo() })
|
|
230
|
-
*
|
|
231
|
-
* composer.addTransactionComposer(innerComposer)
|
|
232
|
-
* ```
|
|
233
|
-
*/
|
|
234
|
-
addTransactionComposer(composer) {
|
|
235
|
-
const clonedTxns = composer.txns.map((txn) => this.cloneTransaction(txn));
|
|
236
|
-
this.push(...clonedTxns);
|
|
237
|
-
return this;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Add a payment transaction to the transaction group.
|
|
241
|
-
* @param params The payment transaction parameters
|
|
242
|
-
* @returns The composer so you can chain method calls
|
|
243
|
-
* @example Basic example
|
|
244
|
-
* ```typescript
|
|
245
|
-
* composer.addPayment({
|
|
246
|
-
* sender: 'SENDERADDRESS',
|
|
247
|
-
* receiver: 'RECEIVERADDRESS',
|
|
248
|
-
* amount: (4).algo(),
|
|
249
|
-
* })
|
|
250
|
-
* ```
|
|
251
|
-
* @example Advanced example
|
|
252
|
-
* ```typescript
|
|
253
|
-
* composer.addPayment({
|
|
254
|
-
* amount: (4).algo(),
|
|
255
|
-
* receiver: 'RECEIVERADDRESS',
|
|
256
|
-
* sender: 'SENDERADDRESS',
|
|
257
|
-
* closeRemainderTo: 'CLOSEREMAINDERTOADDRESS',
|
|
258
|
-
* lease: 'lease',
|
|
259
|
-
* note: 'note',
|
|
260
|
-
* // Use this with caution, it's generally better to use algorand.account.rekeyAccount
|
|
261
|
-
* rekeyTo: 'REKEYTOADDRESS',
|
|
262
|
-
* // You wouldn't normally set this field
|
|
263
|
-
* firstValidRound: 1000n,
|
|
264
|
-
* validityWindow: 10,
|
|
265
|
-
* extraFee: (1000).microAlgo(),
|
|
266
|
-
* staticFee: (1000).microAlgo(),
|
|
267
|
-
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
268
|
-
* // already specified, but here for completeness
|
|
269
|
-
* maxFee: (3000).microAlgo(),
|
|
270
|
-
* })
|
|
271
|
-
*/
|
|
272
|
-
addPayment(params) {
|
|
273
|
-
this.push({
|
|
274
|
-
data: params,
|
|
275
|
-
type: "pay"
|
|
276
|
-
});
|
|
277
|
-
return this;
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Add an asset create transaction to the transaction group.
|
|
281
|
-
* @param params The asset create transaction parameters
|
|
282
|
-
* @returns The composer so you can chain method calls
|
|
283
|
-
* @example Basic example
|
|
284
|
-
* ```typescript
|
|
285
|
-
* composer.addAssetCreate({ sender: "CREATORADDRESS", total: 100n})
|
|
286
|
-
* ```
|
|
287
|
-
* @example Advanced example
|
|
288
|
-
* ```typescript
|
|
289
|
-
* composer.addAssetCreate({
|
|
290
|
-
* sender: 'CREATORADDRESS',
|
|
291
|
-
* total: 100n,
|
|
292
|
-
* decimals: 2,
|
|
293
|
-
* assetName: 'asset',
|
|
294
|
-
* unitName: 'unit',
|
|
295
|
-
* url: 'url',
|
|
296
|
-
* metadataHash: 'metadataHash',
|
|
297
|
-
* defaultFrozen: false,
|
|
298
|
-
* manager: 'MANAGERADDRESS',
|
|
299
|
-
* reserve: 'RESERVEADDRESS',
|
|
300
|
-
* freeze: 'FREEZEADDRESS',
|
|
301
|
-
* clawback: 'CLAWBACKADDRESS',
|
|
302
|
-
* lease: 'lease',
|
|
303
|
-
* note: 'note',
|
|
304
|
-
* // You wouldn't normally set this field
|
|
305
|
-
* firstValidRound: 1000n,
|
|
306
|
-
* validityWindow: 10,
|
|
307
|
-
* extraFee: (1000).microAlgo(),
|
|
308
|
-
* staticFee: (1000).microAlgo(),
|
|
309
|
-
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
310
|
-
* // already specified, but here for completeness
|
|
311
|
-
* maxFee: (3000).microAlgo(),
|
|
312
|
-
* })
|
|
313
|
-
*/
|
|
314
|
-
addAssetCreate(params) {
|
|
315
|
-
this.push({
|
|
316
|
-
data: params,
|
|
317
|
-
type: "assetCreate"
|
|
318
|
-
});
|
|
319
|
-
return this;
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Add an asset config transaction to the transaction group.
|
|
323
|
-
* @param params The asset config transaction parameters
|
|
324
|
-
* @returns The composer so you can chain method calls
|
|
325
|
-
* @example Basic example
|
|
326
|
-
* ```typescript
|
|
327
|
-
* composer.addAssetConfig({ sender: "MANAGERADDRESS", assetId: 123456n, manager: "MANAGERADDRESS" })
|
|
328
|
-
* ```
|
|
329
|
-
* @example Advanced example
|
|
330
|
-
* ```typescript
|
|
331
|
-
* composer.addAssetConfig({
|
|
332
|
-
* sender: 'MANAGERADDRESS',
|
|
333
|
-
* assetId: 123456n,
|
|
334
|
-
* manager: 'MANAGERADDRESS',
|
|
335
|
-
* reserve: 'RESERVEADDRESS',
|
|
336
|
-
* freeze: 'FREEZEADDRESS',
|
|
337
|
-
* clawback: 'CLAWBACKADDRESS',
|
|
338
|
-
* lease: 'lease',
|
|
339
|
-
* note: 'note',
|
|
340
|
-
* // You wouldn't normally set this field
|
|
341
|
-
* firstValidRound: 1000n,
|
|
342
|
-
* validityWindow: 10,
|
|
343
|
-
* extraFee: (1000).microAlgo(),
|
|
344
|
-
* staticFee: (1000).microAlgo(),
|
|
345
|
-
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
346
|
-
* // already specified, but here for completeness
|
|
347
|
-
* maxFee: (3000).microAlgo(),
|
|
348
|
-
* })
|
|
349
|
-
*/
|
|
350
|
-
addAssetConfig(params) {
|
|
351
|
-
this.push({
|
|
352
|
-
data: params,
|
|
353
|
-
type: "assetConfig"
|
|
354
|
-
});
|
|
355
|
-
return this;
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* Add an asset freeze transaction to the transaction group.
|
|
359
|
-
* @param params The asset freeze transaction parameters
|
|
360
|
-
* @returns The composer so you can chain method calls
|
|
361
|
-
* @example Basic example
|
|
362
|
-
* ```typescript
|
|
363
|
-
* composer.addAssetFreeze({ sender: "MANAGERADDRESS", assetId: 123456n, account: "ACCOUNTADDRESS", frozen: true })
|
|
364
|
-
* ```
|
|
365
|
-
* @example Advanced example
|
|
366
|
-
* ```typescript
|
|
367
|
-
* composer.addAssetFreeze({
|
|
368
|
-
* sender: 'MANAGERADDRESS',
|
|
369
|
-
* assetId: 123456n,
|
|
370
|
-
* account: 'ACCOUNTADDRESS',
|
|
371
|
-
* frozen: true,
|
|
372
|
-
* lease: 'lease',
|
|
373
|
-
* note: 'note',
|
|
374
|
-
* // You wouldn't normally set this field
|
|
375
|
-
* firstValidRound: 1000n,
|
|
376
|
-
* validityWindow: 10,
|
|
377
|
-
* extraFee: (1000).microAlgo(),
|
|
378
|
-
* staticFee: (1000).microAlgo(),
|
|
379
|
-
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
380
|
-
* // already specified, but here for completeness
|
|
381
|
-
* maxFee: (3000).microAlgo(),
|
|
382
|
-
* })
|
|
383
|
-
* ```
|
|
384
|
-
*/
|
|
385
|
-
addAssetFreeze(params) {
|
|
386
|
-
this.push({
|
|
387
|
-
data: params,
|
|
388
|
-
type: "assetFreeze"
|
|
389
|
-
});
|
|
390
|
-
return this;
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* Add an asset destroy transaction to the transaction group.
|
|
394
|
-
* @param params The asset destroy transaction parameters
|
|
395
|
-
* @returns The composer so you can chain method calls
|
|
396
|
-
* @example Basic example
|
|
397
|
-
* ```typescript
|
|
398
|
-
* composer.addAssetDestroy({ sender: "MANAGERADDRESS", assetId: 123456n })
|
|
399
|
-
* ```
|
|
400
|
-
* @example Advanced example
|
|
401
|
-
* ```typescript
|
|
402
|
-
* composer.addAssetDestroy({
|
|
403
|
-
* sender: 'MANAGERADDRESS',
|
|
404
|
-
* assetId: 123456n,
|
|
405
|
-
* lease: 'lease',
|
|
406
|
-
* note: 'note',
|
|
407
|
-
* // You wouldn't normally set this field
|
|
408
|
-
* firstValidRound: 1000n,
|
|
409
|
-
* validityWindow: 10,
|
|
410
|
-
* extraFee: (1000).microAlgo(),
|
|
411
|
-
* staticFee: (1000).microAlgo(),
|
|
412
|
-
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
413
|
-
* // already specified, but here for completeness
|
|
414
|
-
* maxFee: (3000).microAlgo(),
|
|
415
|
-
* })
|
|
416
|
-
* ```
|
|
417
|
-
*/
|
|
418
|
-
addAssetDestroy(params) {
|
|
419
|
-
this.push({
|
|
420
|
-
data: params,
|
|
421
|
-
type: "assetDestroy"
|
|
422
|
-
});
|
|
423
|
-
return this;
|
|
424
|
-
}
|
|
425
|
-
/**
|
|
426
|
-
* Add an asset transfer transaction to the transaction group.
|
|
427
|
-
* @param params The asset transfer transaction parameters
|
|
428
|
-
* @returns The composer so you can chain method calls
|
|
429
|
-
* @example Basic example
|
|
430
|
-
* ```typescript
|
|
431
|
-
* composer.addAssetTransfer({ sender: "HOLDERADDRESS", assetId: 123456n, amount: 1n, receiver: "RECEIVERADDRESS" })
|
|
432
|
-
* ```
|
|
433
|
-
* @example Advanced example (with clawback)
|
|
434
|
-
* ```typescript
|
|
435
|
-
* composer.addAssetTransfer({
|
|
436
|
-
* sender: 'CLAWBACKADDRESS',
|
|
437
|
-
* assetId: 123456n,
|
|
438
|
-
* amount: 1n,
|
|
439
|
-
* receiver: 'RECEIVERADDRESS',
|
|
440
|
-
* clawbackTarget: 'HOLDERADDRESS',
|
|
441
|
-
* // This field needs to be used with caution
|
|
442
|
-
* closeAssetTo: 'ADDRESSTOCLOSETO'
|
|
443
|
-
* lease: 'lease',
|
|
444
|
-
* note: 'note',
|
|
445
|
-
* // You wouldn't normally set this field
|
|
446
|
-
* firstValidRound: 1000n,
|
|
447
|
-
* validityWindow: 10,
|
|
448
|
-
* extraFee: (1000).microAlgo(),
|
|
449
|
-
* staticFee: (1000).microAlgo(),
|
|
450
|
-
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
451
|
-
* // already specified, but here for completeness
|
|
452
|
-
* maxFee: (3000).microAlgo(),
|
|
453
|
-
* })
|
|
454
|
-
* ```
|
|
455
|
-
*/
|
|
456
|
-
addAssetTransfer(params) {
|
|
457
|
-
this.push({
|
|
458
|
-
data: params,
|
|
459
|
-
type: "assetTransfer"
|
|
460
|
-
});
|
|
461
|
-
return this;
|
|
462
|
-
}
|
|
463
|
-
/**
|
|
464
|
-
* Add an asset opt-in transaction to the transaction group.
|
|
465
|
-
* @param params The asset opt-in transaction parameters
|
|
466
|
-
* @returns The composer so you can chain method calls
|
|
467
|
-
* @example Basic example
|
|
468
|
-
* ```typescript
|
|
469
|
-
* composer.addAssetOptIn({ sender: "SENDERADDRESS", assetId: 123456n })
|
|
470
|
-
* ```
|
|
471
|
-
* @example Advanced example
|
|
472
|
-
* ```typescript
|
|
473
|
-
* composer.addAssetOptIn({
|
|
474
|
-
* sender: 'SENDERADDRESS',
|
|
475
|
-
* assetId: 123456n,
|
|
476
|
-
* lease: 'lease',
|
|
477
|
-
* note: 'note',
|
|
478
|
-
* // You wouldn't normally set this field
|
|
479
|
-
* firstValidRound: 1000n,
|
|
480
|
-
* validityWindow: 10,
|
|
481
|
-
* extraFee: (1000).microAlgo(),
|
|
482
|
-
* staticFee: (1000).microAlgo(),
|
|
483
|
-
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
484
|
-
* // already specified, but here for completeness
|
|
485
|
-
* maxFee: (3000).microAlgo(),
|
|
486
|
-
* })
|
|
487
|
-
* ```
|
|
488
|
-
*/
|
|
489
|
-
addAssetOptIn(params) {
|
|
490
|
-
this.push({
|
|
491
|
-
data: params,
|
|
492
|
-
type: "assetOptIn"
|
|
493
|
-
});
|
|
494
|
-
return this;
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* Add an asset opt-out transaction to the transaction group.
|
|
498
|
-
* @param params The asset opt-out transaction parameters
|
|
499
|
-
* @returns The composer so you can chain method calls
|
|
500
|
-
* @example Basic example (without creator, will be retrieved from algod)
|
|
501
|
-
* ```typescript
|
|
502
|
-
* composer.addAssetOptOut({ sender: "SENDERADDRESS", assetId: 123456n, ensureZeroBalance: true })
|
|
503
|
-
* ```
|
|
504
|
-
* @example Basic example (with creator)
|
|
505
|
-
* ```typescript
|
|
506
|
-
* composer.addAssetOptOut({ sender: "SENDERADDRESS", creator: "CREATORADDRESS", assetId: 123456n, ensureZeroBalance: true })
|
|
507
|
-
* ```
|
|
508
|
-
* @example Advanced example
|
|
509
|
-
* ```typescript
|
|
510
|
-
* composer.addAssetOptOut({
|
|
511
|
-
* sender: 'SENDERADDRESS',
|
|
512
|
-
* assetId: 123456n,
|
|
513
|
-
* creator: 'CREATORADDRESS',
|
|
514
|
-
* ensureZeroBalance: true,
|
|
515
|
-
* lease: 'lease',
|
|
516
|
-
* note: 'note',
|
|
517
|
-
* // You wouldn't normally set this field
|
|
518
|
-
* firstValidRound: 1000n,
|
|
519
|
-
* validityWindow: 10,
|
|
520
|
-
* extraFee: (1000).microAlgo(),
|
|
521
|
-
* staticFee: (1000).microAlgo(),
|
|
522
|
-
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
523
|
-
* // already specified, but here for completeness
|
|
524
|
-
* maxFee: (3000).microAlgo(),
|
|
525
|
-
* })
|
|
526
|
-
* ```
|
|
527
|
-
*/
|
|
528
|
-
addAssetOptOut(params) {
|
|
529
|
-
this.push({
|
|
530
|
-
data: params,
|
|
531
|
-
type: "assetOptOut"
|
|
532
|
-
});
|
|
533
|
-
return this;
|
|
534
|
-
}
|
|
535
|
-
/**
|
|
536
|
-
* Add an application create transaction to the transaction group.
|
|
537
|
-
*
|
|
538
|
-
* Note: we recommend using app clients to make it easier to make app calls.
|
|
539
|
-
* @param params The application create transaction parameters
|
|
540
|
-
* @returns The composer so you can chain method calls
|
|
541
|
-
* @example Basic example
|
|
542
|
-
* ```typescript
|
|
543
|
-
* composer.addAppCreate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })
|
|
544
|
-
* ```
|
|
545
|
-
* @example Advanced example
|
|
546
|
-
* ```typescript
|
|
547
|
-
* composer.addAppCreate({
|
|
548
|
-
* sender: 'CREATORADDRESS',
|
|
549
|
-
* approvalProgram: "TEALCODE",
|
|
550
|
-
* clearStateProgram: "TEALCODE",
|
|
551
|
-
* schema: {
|
|
552
|
-
* globalInts: 1,
|
|
553
|
-
* globalByteSlices: 2,
|
|
554
|
-
* localInts: 3,
|
|
555
|
-
* localByteSlices: 4
|
|
556
|
-
* },
|
|
557
|
-
* extraProgramPages: 1,
|
|
558
|
-
* onComplete: OnApplicationComplete.OptIn,
|
|
559
|
-
* args: [new Uint8Array(1, 2, 3, 4)]
|
|
560
|
-
* accountReferences: ["ACCOUNT_1"]
|
|
561
|
-
* appReferences: [123n, 1234n]
|
|
562
|
-
* assetReferences: [12345n]
|
|
563
|
-
* boxReferences: ["box1", {appId: 1234n, name: "box2"}]
|
|
564
|
-
* accessReferences: [{ appId: 1234n }]
|
|
565
|
-
* lease: 'lease',
|
|
566
|
-
* note: 'note',
|
|
567
|
-
* // You wouldn't normally set this field
|
|
568
|
-
* firstValidRound: 1000n,
|
|
569
|
-
* validityWindow: 10,
|
|
570
|
-
* extraFee: (1000).microAlgo(),
|
|
571
|
-
* staticFee: (1000).microAlgo(),
|
|
572
|
-
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
573
|
-
* // already specified, but here for completeness
|
|
574
|
-
* maxFee: (3000).microAlgo(),
|
|
575
|
-
* // Signer only needed if you want to provide one,
|
|
576
|
-
* // generally you'd register it with AlgorandClient
|
|
577
|
-
* // against the sender and not need to pass it in
|
|
578
|
-
* signer: transactionSigner,
|
|
579
|
-
* maxRoundsToWaitForConfirmation: 5,
|
|
580
|
-
* suppressLog: true,
|
|
581
|
-
*})
|
|
582
|
-
* ```
|
|
583
|
-
*/
|
|
584
|
-
addAppCreate(params) {
|
|
585
|
-
this.validateReferenceParams(params);
|
|
586
|
-
this.push({
|
|
587
|
-
data: params,
|
|
588
|
-
type: "appCall"
|
|
589
|
-
});
|
|
590
|
-
return this;
|
|
591
|
-
}
|
|
592
|
-
/**
|
|
593
|
-
* Add an application update transaction to the transaction group.
|
|
594
|
-
*
|
|
595
|
-
* Note: we recommend using app clients to make it easier to make app calls.
|
|
596
|
-
* @param params The application update transaction parameters
|
|
597
|
-
* @returns The composer so you can chain method calls
|
|
598
|
-
* @example Basic example
|
|
599
|
-
* ```typescript
|
|
600
|
-
* composer.addAppUpdate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })
|
|
601
|
-
* ```
|
|
602
|
-
* @example Advanced example
|
|
603
|
-
* ```typescript
|
|
604
|
-
* composer.addAppUpdate({
|
|
605
|
-
* sender: 'CREATORADDRESS',
|
|
606
|
-
* approvalProgram: "TEALCODE",
|
|
607
|
-
* clearStateProgram: "TEALCODE",
|
|
608
|
-
* onComplete: OnApplicationComplete.UpdateApplication,
|
|
609
|
-
* args: [new Uint8Array(1, 2, 3, 4)]
|
|
610
|
-
* accountReferences: ["ACCOUNT_1"]
|
|
611
|
-
* appReferences: [123n, 1234n]
|
|
612
|
-
* assetReferences: [12345n]
|
|
613
|
-
* boxReferences: ["box1", {appId: 1234n, name: "box2"}]
|
|
614
|
-
* accessReferences: [{ appId: 1234n }]
|
|
615
|
-
* lease: 'lease',
|
|
616
|
-
* note: 'note',
|
|
617
|
-
* // You wouldn't normally set this field
|
|
618
|
-
* firstValidRound: 1000n,
|
|
619
|
-
* validityWindow: 10,
|
|
620
|
-
* extraFee: (1000).microAlgo(),
|
|
621
|
-
* staticFee: (1000).microAlgo(),
|
|
622
|
-
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
623
|
-
* // already specified, but here for completeness
|
|
624
|
-
* maxFee: (3000).microAlgo(),
|
|
625
|
-
*})
|
|
626
|
-
* ```
|
|
627
|
-
*/
|
|
628
|
-
addAppUpdate(params) {
|
|
629
|
-
this.validateReferenceParams(params);
|
|
630
|
-
this.push({
|
|
631
|
-
data: {
|
|
632
|
-
...params,
|
|
633
|
-
onComplete: require_app_call.OnApplicationComplete.UpdateApplication
|
|
634
|
-
},
|
|
635
|
-
type: "appCall"
|
|
636
|
-
});
|
|
637
|
-
return this;
|
|
638
|
-
}
|
|
639
|
-
/**
|
|
640
|
-
* Add an application delete transaction to the transaction group.
|
|
641
|
-
*
|
|
642
|
-
* Note: we recommend using app clients to make it easier to make app calls.
|
|
643
|
-
* @param params The application delete transaction parameters
|
|
644
|
-
* @returns The composer so you can chain method calls
|
|
645
|
-
* @example Basic example
|
|
646
|
-
* ```typescript
|
|
647
|
-
* composer.addAppDelete({ sender: 'CREATORADDRESS' })
|
|
648
|
-
* ```
|
|
649
|
-
* @example Advanced example
|
|
650
|
-
* ```typescript
|
|
651
|
-
* composer.addAppDelete({
|
|
652
|
-
* sender: 'CREATORADDRESS',
|
|
653
|
-
* onComplete: OnApplicationComplete.DeleteApplication,
|
|
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
|
-
* accessReferences: [{ appId: 1234n }]
|
|
660
|
-
* lease: 'lease',
|
|
661
|
-
* note: 'note',
|
|
662
|
-
* // You wouldn't normally set this field
|
|
663
|
-
* firstValidRound: 1000n,
|
|
664
|
-
* validityWindow: 10,
|
|
665
|
-
* extraFee: (1000).microAlgo(),
|
|
666
|
-
* staticFee: (1000).microAlgo(),
|
|
667
|
-
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
668
|
-
* // already specified, but here for completeness
|
|
669
|
-
* maxFee: (3000).microAlgo(),
|
|
670
|
-
*})
|
|
671
|
-
* ```
|
|
672
|
-
*/
|
|
673
|
-
addAppDelete(params) {
|
|
674
|
-
this.validateReferenceParams(params);
|
|
675
|
-
this.push({
|
|
676
|
-
data: {
|
|
677
|
-
...params,
|
|
678
|
-
onComplete: require_app_call.OnApplicationComplete.DeleteApplication
|
|
679
|
-
},
|
|
680
|
-
type: "appCall"
|
|
681
|
-
});
|
|
682
|
-
return this;
|
|
683
|
-
}
|
|
684
|
-
/**
|
|
685
|
-
* Add an application call transaction to the transaction group.
|
|
686
|
-
*
|
|
687
|
-
* If you want to create or update an app use `addAppCreate` or `addAppUpdate`.
|
|
688
|
-
*
|
|
689
|
-
* Note: we recommend using app clients to make it easier to make app calls.
|
|
690
|
-
* @param params The application call transaction parameters
|
|
691
|
-
* @returns The composer so you can chain method calls
|
|
692
|
-
* @example Basic example
|
|
693
|
-
* ```typescript
|
|
694
|
-
* composer.addAppCall({ sender: 'CREATORADDRESS' })
|
|
695
|
-
* ```
|
|
696
|
-
* @example Advanced example
|
|
697
|
-
* ```typescript
|
|
698
|
-
* composer.addAppCall({
|
|
699
|
-
* sender: 'CREATORADDRESS',
|
|
700
|
-
* onComplete: OnApplicationComplete.OptIn,
|
|
701
|
-
* args: [new Uint8Array(1, 2, 3, 4)]
|
|
702
|
-
* accountReferences: ["ACCOUNT_1"]
|
|
703
|
-
* appReferences: [123n, 1234n]
|
|
704
|
-
* assetReferences: [12345n]
|
|
705
|
-
* boxReferences: ["box1", {appId: 1234n, name: "box2"}]
|
|
706
|
-
* accessReferences: [{ appId: 1234n }]
|
|
707
|
-
* lease: 'lease',
|
|
708
|
-
* note: 'note',
|
|
709
|
-
* // You wouldn't normally set this field
|
|
710
|
-
* firstValidRound: 1000n,
|
|
711
|
-
* validityWindow: 10,
|
|
712
|
-
* extraFee: (1000).microAlgo(),
|
|
713
|
-
* staticFee: (1000).microAlgo(),
|
|
714
|
-
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
715
|
-
* // already specified, but here for completeness
|
|
716
|
-
* maxFee: (3000).microAlgo(),
|
|
717
|
-
*})
|
|
718
|
-
* ```
|
|
719
|
-
*/
|
|
720
|
-
addAppCall(params) {
|
|
721
|
-
this.validateReferenceParams(params);
|
|
722
|
-
this.push({
|
|
723
|
-
data: params,
|
|
724
|
-
type: "appCall"
|
|
725
|
-
});
|
|
726
|
-
return this;
|
|
727
|
-
}
|
|
728
|
-
/**
|
|
729
|
-
* Add an ABI method create application call transaction to the transaction group.
|
|
730
|
-
*
|
|
731
|
-
* Note: we recommend using app clients to make it easier to make app calls.
|
|
732
|
-
* @param params The ABI create method application call transaction parameters
|
|
733
|
-
* @returns The composer so you can chain method calls
|
|
734
|
-
* @example Basic example
|
|
735
|
-
* ```typescript
|
|
736
|
-
* const method = new ABIMethod({
|
|
737
|
-
* name: 'method',
|
|
738
|
-
* args: [{ name: 'arg1', type: 'string' }],
|
|
739
|
-
* returns: { type: 'string' },
|
|
740
|
-
* })
|
|
741
|
-
* composer.addAppCreateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: ["arg1_value"] })
|
|
742
|
-
* ```
|
|
743
|
-
* @example Advanced example
|
|
744
|
-
* ```typescript
|
|
745
|
-
* const method = new ABIMethod({
|
|
746
|
-
* name: 'method',
|
|
747
|
-
* args: [{ name: 'arg1', type: 'string' }],
|
|
748
|
-
* returns: { type: 'string' },
|
|
749
|
-
* })
|
|
750
|
-
* composer.addAppCreateMethodCall({
|
|
751
|
-
* sender: 'CREATORADDRESS',
|
|
752
|
-
* method: method,
|
|
753
|
-
* args: ["arg1_value"],
|
|
754
|
-
* approvalProgram: "TEALCODE",
|
|
755
|
-
* clearStateProgram: "TEALCODE",
|
|
756
|
-
* schema: {
|
|
757
|
-
* globalInts: 1,
|
|
758
|
-
* globalByteSlices: 2,
|
|
759
|
-
* localInts: 3,
|
|
760
|
-
* localByteSlices: 4
|
|
761
|
-
* },
|
|
762
|
-
* extraProgramPages: 1,
|
|
763
|
-
* onComplete: OnApplicationComplete.OptIn,
|
|
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
|
-
* accessReferences: [{ appId: 1234n }]
|
|
770
|
-
* lease: 'lease',
|
|
771
|
-
* note: 'note',
|
|
772
|
-
* // You wouldn't normally set this field
|
|
773
|
-
* firstValidRound: 1000n,
|
|
774
|
-
* validityWindow: 10,
|
|
775
|
-
* extraFee: (1000).microAlgo(),
|
|
776
|
-
* staticFee: (1000).microAlgo(),
|
|
777
|
-
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
778
|
-
* // already specified, but here for completeness
|
|
779
|
-
* maxFee: (3000).microAlgo(),
|
|
780
|
-
*})
|
|
781
|
-
* ```
|
|
782
|
-
*/
|
|
783
|
-
addAppCreateMethodCall(params) {
|
|
784
|
-
this.validateReferenceParams(params);
|
|
785
|
-
const txnArgs = require_method_call.extractComposerTransactionsFromAppMethodCallParams(params);
|
|
786
|
-
this.push(...txnArgs, {
|
|
787
|
-
data: {
|
|
788
|
-
...params,
|
|
789
|
-
args: require_method_call.processAppMethodCallArgs(params.args)
|
|
790
|
-
},
|
|
791
|
-
type: "methodCall"
|
|
792
|
-
});
|
|
793
|
-
return this;
|
|
794
|
-
}
|
|
795
|
-
/**
|
|
796
|
-
* Add an ABI method update application call transaction to the transaction group.
|
|
797
|
-
*
|
|
798
|
-
* Note: we recommend using app clients to make it easier to make app calls.
|
|
799
|
-
* @param params The ABI update method application call transaction parameters
|
|
800
|
-
* @returns The composer so you can chain method calls
|
|
801
|
-
* @example Basic example
|
|
802
|
-
* ```typescript
|
|
803
|
-
* const method = new ABIMethod({
|
|
804
|
-
* name: 'method',
|
|
805
|
-
* args: [{ name: 'arg1', type: 'string' }],
|
|
806
|
-
* returns: { type: 'string' },
|
|
807
|
-
* })
|
|
808
|
-
* composer.addAppUpdateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: ["arg1_value"] })
|
|
809
|
-
* ```
|
|
810
|
-
* @example Advanced example
|
|
811
|
-
* ```typescript
|
|
812
|
-
* const method = new ABIMethod({
|
|
813
|
-
* name: 'method',
|
|
814
|
-
* args: [{ name: 'arg1', type: 'string' }],
|
|
815
|
-
* returns: { type: 'string' },
|
|
816
|
-
* })
|
|
817
|
-
* composer.addAppUpdateMethodCall({
|
|
818
|
-
* sender: 'CREATORADDRESS',
|
|
819
|
-
* method: method,
|
|
820
|
-
* args: ["arg1_value"],
|
|
821
|
-
* approvalProgram: "TEALCODE",
|
|
822
|
-
* clearStateProgram: "TEALCODE",
|
|
823
|
-
* onComplete: OnApplicationComplete.UpdateApplication,
|
|
824
|
-
* args: [new Uint8Array(1, 2, 3, 4)]
|
|
825
|
-
* accountReferences: ["ACCOUNT_1"]
|
|
826
|
-
* appReferences: [123n, 1234n]
|
|
827
|
-
* assetReferences: [12345n]
|
|
828
|
-
* boxReferences: ["box1", {appId: 1234n, name: "box2"}]
|
|
829
|
-
* accessReferences: [{ appId: 1234n }]
|
|
830
|
-
* lease: 'lease',
|
|
831
|
-
* note: 'note',
|
|
832
|
-
* // You wouldn't normally set this field
|
|
833
|
-
* firstValidRound: 1000n,
|
|
834
|
-
* validityWindow: 10,
|
|
835
|
-
* extraFee: (1000).microAlgo(),
|
|
836
|
-
* staticFee: (1000).microAlgo(),
|
|
837
|
-
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
838
|
-
* // already specified, but here for completeness
|
|
839
|
-
* maxFee: (3000).microAlgo(),
|
|
840
|
-
*})
|
|
841
|
-
* ```
|
|
842
|
-
*/
|
|
843
|
-
addAppUpdateMethodCall(params) {
|
|
844
|
-
this.validateReferenceParams(params);
|
|
845
|
-
const txnArgs = require_method_call.extractComposerTransactionsFromAppMethodCallParams(params);
|
|
846
|
-
this.push(...txnArgs, {
|
|
847
|
-
data: {
|
|
848
|
-
...params,
|
|
849
|
-
args: require_method_call.processAppMethodCallArgs(params.args),
|
|
850
|
-
onComplete: require_app_call.OnApplicationComplete.UpdateApplication
|
|
851
|
-
},
|
|
852
|
-
type: "methodCall"
|
|
853
|
-
});
|
|
854
|
-
return this;
|
|
855
|
-
}
|
|
856
|
-
/**
|
|
857
|
-
* Add an ABI method delete application call transaction to the transaction group.
|
|
858
|
-
*
|
|
859
|
-
* Note: we recommend using app clients to make it easier to make app calls.
|
|
860
|
-
* @param params The ABI delete method application call transaction parameters
|
|
861
|
-
* @returns The composer so you can chain method calls
|
|
862
|
-
* @example Basic example
|
|
863
|
-
* ```typescript
|
|
864
|
-
* const method = new ABIMethod({
|
|
865
|
-
* name: 'method',
|
|
866
|
-
* args: [{ name: 'arg1', type: 'string' }],
|
|
867
|
-
* returns: { type: 'string' },
|
|
868
|
-
* })
|
|
869
|
-
* composer.addAppDeleteMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"] })
|
|
870
|
-
* ```
|
|
871
|
-
* @example Advanced example
|
|
872
|
-
* ```typescript
|
|
873
|
-
* const method = new ABIMethod({
|
|
874
|
-
* name: 'method',
|
|
875
|
-
* args: [{ name: 'arg1', type: 'string' }],
|
|
876
|
-
* returns: { type: 'string' },
|
|
877
|
-
* })
|
|
878
|
-
* composer.addAppDeleteMethodCall({
|
|
879
|
-
* sender: 'CREATORADDRESS',
|
|
880
|
-
* method: method,
|
|
881
|
-
* args: ["arg1_value"],
|
|
882
|
-
* onComplete: OnApplicationComplete.DeleteApplication,
|
|
883
|
-
* args: [new Uint8Array(1, 2, 3, 4)]
|
|
884
|
-
* accountReferences: ["ACCOUNT_1"]
|
|
885
|
-
* appReferences: [123n, 1234n]
|
|
886
|
-
* assetReferences: [12345n]
|
|
887
|
-
* boxReferences: ["box1", {appId: 1234n, name: "box2"}]
|
|
888
|
-
* accessReferences: [{ appId: 1234n }]
|
|
889
|
-
* lease: 'lease',
|
|
890
|
-
* note: 'note',
|
|
891
|
-
* // You wouldn't normally set this field
|
|
892
|
-
* firstValidRound: 1000n,
|
|
893
|
-
* validityWindow: 10,
|
|
894
|
-
* extraFee: (1000).microAlgo(),
|
|
895
|
-
* staticFee: (1000).microAlgo(),
|
|
896
|
-
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
897
|
-
* // already specified, but here for completeness
|
|
898
|
-
* maxFee: (3000).microAlgo(),
|
|
899
|
-
*})
|
|
900
|
-
* ```
|
|
901
|
-
*/
|
|
902
|
-
addAppDeleteMethodCall(params) {
|
|
903
|
-
this.validateReferenceParams(params);
|
|
904
|
-
const txnArgs = require_method_call.extractComposerTransactionsFromAppMethodCallParams(params);
|
|
905
|
-
this.push(...txnArgs, {
|
|
906
|
-
data: {
|
|
907
|
-
...params,
|
|
908
|
-
args: require_method_call.processAppMethodCallArgs(params.args),
|
|
909
|
-
onComplete: require_app_call.OnApplicationComplete.DeleteApplication
|
|
910
|
-
},
|
|
911
|
-
type: "methodCall"
|
|
912
|
-
});
|
|
913
|
-
return this;
|
|
914
|
-
}
|
|
915
|
-
/**
|
|
916
|
-
* Add a non-create/non-update ABI method application call transaction to the transaction group.
|
|
917
|
-
*
|
|
918
|
-
* Note: we recommend using app clients to make it easier to make app calls.
|
|
919
|
-
* @param params The ABI method application call transaction parameters
|
|
920
|
-
* @returns The composer so you can chain method calls
|
|
921
|
-
* @example Basic example
|
|
922
|
-
* ```typescript
|
|
923
|
-
* const method = new ABIMethod({
|
|
924
|
-
* name: 'method',
|
|
925
|
-
* args: [{ name: 'arg1', type: 'string' }],
|
|
926
|
-
* returns: { type: 'string' },
|
|
927
|
-
* })
|
|
928
|
-
* composer.addAppCallMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"] })
|
|
929
|
-
* ```
|
|
930
|
-
* @example Advanced example
|
|
931
|
-
* ```typescript
|
|
932
|
-
* const method = new ABIMethod({
|
|
933
|
-
* name: 'method',
|
|
934
|
-
* args: [{ name: 'arg1', type: 'string' }],
|
|
935
|
-
* returns: { type: 'string' },
|
|
936
|
-
* })
|
|
937
|
-
* composer.addAppCallMethodCall({
|
|
938
|
-
* sender: 'CREATORADDRESS',
|
|
939
|
-
* method: method,
|
|
940
|
-
* args: ["arg1_value"],
|
|
941
|
-
* onComplete: OnApplicationComplete.OptIn,
|
|
942
|
-
* args: [new Uint8Array(1, 2, 3, 4)]
|
|
943
|
-
* accountReferences: ["ACCOUNT_1"]
|
|
944
|
-
* appReferences: [123n, 1234n]
|
|
945
|
-
* assetReferences: [12345n]
|
|
946
|
-
* boxReferences: ["box1", {appId: 1234n, name: "box2"}]
|
|
947
|
-
* accessReferences: [{ appId: 1234n }]
|
|
948
|
-
* lease: 'lease',
|
|
949
|
-
* note: 'note',
|
|
950
|
-
* // You wouldn't normally set this field
|
|
951
|
-
* firstValidRound: 1000n,
|
|
952
|
-
* validityWindow: 10,
|
|
953
|
-
* extraFee: (1000).microAlgo(),
|
|
954
|
-
* staticFee: (1000).microAlgo(),
|
|
955
|
-
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
956
|
-
* // already specified, but here for completeness
|
|
957
|
-
* maxFee: (3000).microAlgo(),
|
|
958
|
-
*})
|
|
959
|
-
* ```
|
|
960
|
-
*/
|
|
961
|
-
addAppCallMethodCall(params) {
|
|
962
|
-
this.validateReferenceParams(params);
|
|
963
|
-
const txnArgs = require_method_call.extractComposerTransactionsFromAppMethodCallParams(params);
|
|
964
|
-
this.push(...txnArgs, {
|
|
965
|
-
data: {
|
|
966
|
-
...params,
|
|
967
|
-
args: require_method_call.processAppMethodCallArgs(params.args)
|
|
968
|
-
},
|
|
969
|
-
type: "methodCall"
|
|
970
|
-
});
|
|
971
|
-
return this;
|
|
972
|
-
}
|
|
973
|
-
/**
|
|
974
|
-
* Add an online key registration transaction to the transaction group.
|
|
975
|
-
* @param params The online key registration transaction parameters
|
|
976
|
-
* @returns The composer so you can chain method calls
|
|
977
|
-
* @example Basic example
|
|
978
|
-
* ```typescript
|
|
979
|
-
* composer.addOnlineKeyRegistration({
|
|
980
|
-
* sender: 'SENDERADDRESS',
|
|
981
|
-
* voteKey: Uint8Array.from(Buffer.from("voteKeyBase64", 'base64')),
|
|
982
|
-
* selectionKey: Uint8Array.from(Buffer.from("selectionKeyBase64", 'base64')),
|
|
983
|
-
* stateProofKey: Uint8Array.from(Buffer.from("stateProofKeyBase64", 'base64')),
|
|
984
|
-
* voteFirst: 1n,
|
|
985
|
-
* voteLast: 1000n,
|
|
986
|
-
* voteKeyDilution: 1n,
|
|
987
|
-
* })
|
|
988
|
-
* ```
|
|
989
|
-
* @example Advanced example
|
|
990
|
-
* ```typescript
|
|
991
|
-
* composer.addOnlineKeyRegistration({
|
|
992
|
-
* sender: 'SENDERADDRESS',
|
|
993
|
-
* voteKey: Uint8Array.from(Buffer.from("voteKeyBase64", 'base64')),
|
|
994
|
-
* selectionKey: Uint8Array.from(Buffer.from("selectionKeyBase64", 'base64')),
|
|
995
|
-
* stateProofKey: Uint8Array.from(Buffer.from("stateProofKeyBase64", 'base64')),
|
|
996
|
-
* voteFirst: 1n,
|
|
997
|
-
* voteLast: 1000n,
|
|
998
|
-
* voteKeyDilution: 1n,
|
|
999
|
-
* lease: 'lease',
|
|
1000
|
-
* note: 'note',
|
|
1001
|
-
* // Use this with caution, it's generally better to use algorand.account.rekeyAccount
|
|
1002
|
-
* rekeyTo: 'REKEYTOADDRESS',
|
|
1003
|
-
* // You wouldn't normally set this field
|
|
1004
|
-
* firstValidRound: 1000n,
|
|
1005
|
-
* validityWindow: 10,
|
|
1006
|
-
* extraFee: (1000).microAlgo(),
|
|
1007
|
-
* staticFee: (1000).microAlgo(),
|
|
1008
|
-
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
1009
|
-
* // already specified, but here for completeness
|
|
1010
|
-
* maxFee: (3000).microAlgo(),
|
|
1011
|
-
* })
|
|
1012
|
-
* ```
|
|
1013
|
-
*/
|
|
1014
|
-
addOnlineKeyRegistration(params) {
|
|
1015
|
-
this.push({
|
|
1016
|
-
data: params,
|
|
1017
|
-
type: "keyReg"
|
|
1018
|
-
});
|
|
1019
|
-
return this;
|
|
1020
|
-
}
|
|
1021
|
-
/**
|
|
1022
|
-
* Add an offline key registration transaction to the transaction group.
|
|
1023
|
-
* @param params The offline key registration transaction parameters
|
|
1024
|
-
* @returns The composer so you can chain method calls
|
|
1025
|
-
* @example Basic example
|
|
1026
|
-
* ```typescript
|
|
1027
|
-
* composer.addOfflineKeyRegistration({
|
|
1028
|
-
* sender: 'SENDERADDRESS',
|
|
1029
|
-
* })
|
|
1030
|
-
* ```
|
|
1031
|
-
* @example Advanced example
|
|
1032
|
-
* ```typescript
|
|
1033
|
-
* composer.addOfflineKeyRegistration({
|
|
1034
|
-
* sender: 'SENDERADDRESS',
|
|
1035
|
-
* lease: 'lease',
|
|
1036
|
-
* note: 'note',
|
|
1037
|
-
* // Use this with caution, it's generally better to use algorand.account.rekeyAccount
|
|
1038
|
-
* rekeyTo: 'REKEYTOADDRESS',
|
|
1039
|
-
* // You wouldn't normally set this field
|
|
1040
|
-
* firstValidRound: 1000n,
|
|
1041
|
-
* validityWindow: 10,
|
|
1042
|
-
* extraFee: (1000).microAlgo(),
|
|
1043
|
-
* staticFee: (1000).microAlgo(),
|
|
1044
|
-
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
1045
|
-
* // already specified, but here for completeness
|
|
1046
|
-
* maxFee: (3000).microAlgo(),
|
|
1047
|
-
* })
|
|
1048
|
-
* ```
|
|
1049
|
-
*/
|
|
1050
|
-
addOfflineKeyRegistration(params) {
|
|
1051
|
-
this.push({
|
|
1052
|
-
data: params,
|
|
1053
|
-
type: "keyReg"
|
|
1054
|
-
});
|
|
1055
|
-
return this;
|
|
1056
|
-
}
|
|
1057
|
-
/**
|
|
1058
|
-
* Get the number of transactions currently added to this composer.
|
|
1059
|
-
* @returns The number of transactions currently added to this composer
|
|
1060
|
-
*/
|
|
1061
|
-
count() {
|
|
1062
|
-
return this.txns.length;
|
|
1063
|
-
}
|
|
1064
|
-
/**
|
|
1065
|
-
* Build the transaction composer.
|
|
1066
|
-
*
|
|
1067
|
-
* This method performs resource population and inner transaction fee coverage if these options are set in the composer.
|
|
1068
|
-
*
|
|
1069
|
-
* Once this method is called, no further transactions will be able to be added.
|
|
1070
|
-
* You can safely call this method multiple times to get the same result.
|
|
1071
|
-
* @returns The built transaction composer, the transactions and any corresponding method calls
|
|
1072
|
-
* @example
|
|
1073
|
-
* ```typescript
|
|
1074
|
-
* const { transactions, methodCalls } = await composer.build()
|
|
1075
|
-
* ```
|
|
1076
|
-
*/
|
|
1077
|
-
async build() {
|
|
1078
|
-
if (!this.transactionsWithSigners) {
|
|
1079
|
-
const suggestedParams = await this.getSuggestedParams();
|
|
1080
|
-
const builtTransactions = await this._buildTransactions(suggestedParams);
|
|
1081
|
-
this.rawBuildTransactions = builtTransactions.transactions;
|
|
1082
|
-
const groupAnalysis = (this.composerConfig.coverAppCallInnerTransactionFees || this.composerConfig.populateAppCallResources) && builtTransactions.transactions.some((txn) => txn.type === require_transaction_type.TransactionType.AppCall) ? await this.analyzeGroupRequirements(builtTransactions.transactions, suggestedParams, this.composerConfig) : void 0;
|
|
1083
|
-
this.populateTransactionAndGroupResources(builtTransactions.transactions, groupAnalysis);
|
|
1084
|
-
this.transactionsWithSigners = builtTransactions.transactions.map((txn, index) => {
|
|
1085
|
-
return {
|
|
1086
|
-
txn,
|
|
1087
|
-
signer: builtTransactions.signers.get(index) ?? this.getSigner(txn.sender)
|
|
1088
|
-
};
|
|
1089
|
-
});
|
|
1090
|
-
}
|
|
1091
|
-
const methodCalls = /* @__PURE__ */ new Map();
|
|
1092
|
-
this.txns.forEach((txn, index) => {
|
|
1093
|
-
if (txn.type === "methodCall") methodCalls.set(index, txn.data.method);
|
|
1094
|
-
});
|
|
1095
|
-
return {
|
|
1096
|
-
transactions: this.transactionsWithSigners,
|
|
1097
|
-
methodCalls
|
|
1098
|
-
};
|
|
1099
|
-
}
|
|
1100
|
-
async _buildTransactions(suggestedParams) {
|
|
1101
|
-
const defaultValidityWindow = !this.defaultValidityWindowIsExplicit && require_network_client.genesisIdIsLocalNet(suggestedParams.genesisId ?? "unknown") ? 1000n : this.defaultValidityWindow;
|
|
1102
|
-
const signers = /* @__PURE__ */ new Map();
|
|
1103
|
-
const transactions = new Array();
|
|
1104
|
-
let transactionIndex = 0;
|
|
1105
|
-
for (const ctxn of this.txns) if (ctxn.type === "txn") {
|
|
1106
|
-
transactions.push(ctxn.data.txn);
|
|
1107
|
-
if (ctxn.data.signer) signers.set(transactionIndex, ctxn.data.signer);
|
|
1108
|
-
transactionIndex++;
|
|
1109
|
-
} else if (ctxn.type === "asyncTxn") {
|
|
1110
|
-
transactions.push(await ctxn.data.txn);
|
|
1111
|
-
if (ctxn.data.signer) signers.set(transactionIndex, ctxn.data.signer);
|
|
1112
|
-
transactionIndex++;
|
|
1113
|
-
} else {
|
|
1114
|
-
let transaction;
|
|
1115
|
-
switch (ctxn.type) {
|
|
1116
|
-
case "pay":
|
|
1117
|
-
transaction = require_payment.buildPayment(ctxn.data, suggestedParams, defaultValidityWindow);
|
|
1118
|
-
break;
|
|
1119
|
-
case "assetCreate":
|
|
1120
|
-
transaction = require_asset_config.buildAssetCreate(ctxn.data, suggestedParams, defaultValidityWindow);
|
|
1121
|
-
break;
|
|
1122
|
-
case "assetConfig":
|
|
1123
|
-
transaction = require_asset_config.buildAssetConfig(ctxn.data, suggestedParams, defaultValidityWindow);
|
|
1124
|
-
break;
|
|
1125
|
-
case "assetFreeze":
|
|
1126
|
-
transaction = require_asset_config.buildAssetFreeze(ctxn.data, suggestedParams, defaultValidityWindow);
|
|
1127
|
-
break;
|
|
1128
|
-
case "assetDestroy":
|
|
1129
|
-
transaction = require_asset_config.buildAssetDestroy(ctxn.data, suggestedParams, defaultValidityWindow);
|
|
1130
|
-
break;
|
|
1131
|
-
case "assetTransfer":
|
|
1132
|
-
transaction = require_asset_transfer.buildAssetTransfer(ctxn.data, suggestedParams, defaultValidityWindow);
|
|
1133
|
-
break;
|
|
1134
|
-
case "assetOptIn":
|
|
1135
|
-
transaction = require_asset_transfer.buildAssetOptIn(ctxn.data, suggestedParams, defaultValidityWindow);
|
|
1136
|
-
break;
|
|
1137
|
-
case "assetOptOut":
|
|
1138
|
-
transaction = require_asset_transfer.buildAssetOptOut(ctxn.data, suggestedParams, defaultValidityWindow);
|
|
1139
|
-
break;
|
|
1140
|
-
case "appCall":
|
|
1141
|
-
if (!("appId" in ctxn.data)) transaction = await require_app_call$1.buildAppCreate(ctxn.data, this.appManager, suggestedParams, defaultValidityWindow);
|
|
1142
|
-
else if ("approvalProgram" in ctxn.data && "clearStateProgram" in ctxn.data) transaction = await require_app_call$1.buildAppUpdate(ctxn.data, this.appManager, suggestedParams, defaultValidityWindow);
|
|
1143
|
-
else transaction = require_app_call$1.buildAppCall(ctxn.data, suggestedParams, defaultValidityWindow);
|
|
1144
|
-
break;
|
|
1145
|
-
case "keyReg":
|
|
1146
|
-
transaction = require_key_registration.buildKeyReg(ctxn.data, suggestedParams, defaultValidityWindow);
|
|
1147
|
-
break;
|
|
1148
|
-
case "methodCall":
|
|
1149
|
-
if (!("appId" in ctxn.data)) transaction = await require_method_call.buildAppCreateMethodCall(ctxn.data, this.appManager, suggestedParams, defaultValidityWindow);
|
|
1150
|
-
else if ("approvalProgram" in ctxn.data && "clearStateProgram" in ctxn.data) transaction = await require_method_call.buildAppUpdateMethodCall(ctxn.data, this.appManager, suggestedParams, defaultValidityWindow);
|
|
1151
|
-
else transaction = await require_method_call.buildAppCallMethodCall(ctxn.data, suggestedParams, defaultValidityWindow);
|
|
1152
|
-
break;
|
|
1153
|
-
default: throw new Error(`Unsupported transaction type: ${ctxn.type}`);
|
|
1154
|
-
}
|
|
1155
|
-
if (transaction.fee === void 0) transaction = require_transaction.assignFee(transaction, {
|
|
1156
|
-
feePerByte: suggestedParams.fee,
|
|
1157
|
-
minFee: suggestedParams.minFee,
|
|
1158
|
-
extraFee: ctxn.data.extraFee?.microAlgos,
|
|
1159
|
-
maxFee: ctxn.data.maxFee?.microAlgos
|
|
1160
|
-
});
|
|
1161
|
-
transactions.push(transaction);
|
|
1162
|
-
if (ctxn.data.signer) {
|
|
1163
|
-
const signer = "signer" in ctxn.data.signer ? ctxn.data.signer.signer : ctxn.data.signer;
|
|
1164
|
-
signers.set(transactionIndex, signer);
|
|
1165
|
-
}
|
|
1166
|
-
transactionIndex++;
|
|
1167
|
-
}
|
|
1168
|
-
if (transactions.length > require_constants.MAX_TRANSACTION_GROUP_SIZE) throw new Error(`Transaction group size ${transactions.length} exceeds the maximum limit of ${require_constants.MAX_TRANSACTION_GROUP_SIZE}`);
|
|
1169
|
-
const methodCalls = /* @__PURE__ */ new Map();
|
|
1170
|
-
this.txns.forEach((txn, index) => {
|
|
1171
|
-
if (txn.type === "methodCall") methodCalls.set(index, txn.data.method);
|
|
1172
|
-
});
|
|
1173
|
-
return {
|
|
1174
|
-
transactions,
|
|
1175
|
-
methodCalls,
|
|
1176
|
-
signers
|
|
1177
|
-
};
|
|
1178
|
-
}
|
|
1179
|
-
/**
|
|
1180
|
-
* Builds all transactions in the composer and returns them along with method calls and signers.
|
|
1181
|
-
*
|
|
1182
|
-
* Note: This method only builds the transactions as-is without resource population or automatic grouping.
|
|
1183
|
-
* Use this when you need the raw transactions.
|
|
1184
|
-
* @returns An object containing the array of built transactions, method calls, and signers
|
|
1185
|
-
* @example
|
|
1186
|
-
* ```typescript
|
|
1187
|
-
* const { transactions, methodCalls, signers } = await composer.buildTransactions()
|
|
1188
|
-
* ```
|
|
1189
|
-
*/
|
|
1190
|
-
async buildTransactions() {
|
|
1191
|
-
const suggestedParams = await this.getSuggestedParams();
|
|
1192
|
-
const buildResult = await this._buildTransactions(suggestedParams);
|
|
1193
|
-
return {
|
|
1194
|
-
...buildResult,
|
|
1195
|
-
transactions: buildResult.transactions
|
|
1196
|
-
};
|
|
1197
|
-
}
|
|
1198
|
-
populateTransactionAndGroupResources(transactions, groupAnalysis) {
|
|
1199
|
-
if (groupAnalysis) {
|
|
1200
|
-
let surplusGroupFees = 0n;
|
|
1201
|
-
const transactionAnalysis = [];
|
|
1202
|
-
groupAnalysis.transactions.forEach((txnAnalysis, groupIndex) => {
|
|
1203
|
-
if (txnAnalysis.requiredFeeDelta && require_fee_coverage.FeeDelta.isSurplus(txnAnalysis.requiredFeeDelta)) surplusGroupFees += require_fee_coverage.FeeDelta.amount(txnAnalysis.requiredFeeDelta);
|
|
1204
|
-
const ctxn = this.txns[groupIndex];
|
|
1205
|
-
const txn = transactions[groupIndex];
|
|
1206
|
-
const logicalMaxFee = getLogicalMaxFee(ctxn);
|
|
1207
|
-
const isImmutableFee = logicalMaxFee !== void 0 && logicalMaxFee === (txn.fee || 0n);
|
|
1208
|
-
let priority = require_fee_coverage.FeePriority.Covered;
|
|
1209
|
-
if (txnAnalysis.requiredFeeDelta && require_fee_coverage.FeeDelta.isDeficit(txnAnalysis.requiredFeeDelta)) {
|
|
1210
|
-
const deficitAmount = require_fee_coverage.FeeDelta.amount(txnAnalysis.requiredFeeDelta);
|
|
1211
|
-
if (isImmutableFee || txn.type !== require_transaction_type.TransactionType.AppCall) priority = require_fee_coverage.FeePriority.ImmutableDeficit(deficitAmount);
|
|
1212
|
-
else priority = require_fee_coverage.FeePriority.ModifiableDeficit(deficitAmount);
|
|
1213
|
-
}
|
|
1214
|
-
transactionAnalysis.push({
|
|
1215
|
-
groupIndex,
|
|
1216
|
-
requiredFeeDelta: txnAnalysis.requiredFeeDelta,
|
|
1217
|
-
priority,
|
|
1218
|
-
unnamedResourcesAccessed: txnAnalysis.unnamedResourcesAccessed
|
|
1219
|
-
});
|
|
1220
|
-
});
|
|
1221
|
-
transactionAnalysis.sort((a, b) => b.priority.compare(a.priority));
|
|
1222
|
-
const indexesWithAccessReferences = [];
|
|
1223
|
-
for (const { groupIndex, requiredFeeDelta, unnamedResourcesAccessed } of transactionAnalysis) {
|
|
1224
|
-
if (requiredFeeDelta && require_fee_coverage.FeeDelta.isDeficit(requiredFeeDelta)) {
|
|
1225
|
-
const deficitAmount = require_fee_coverage.FeeDelta.amount(requiredFeeDelta);
|
|
1226
|
-
let additionalFeeDelta;
|
|
1227
|
-
if (surplusGroupFees === 0n) additionalFeeDelta = requiredFeeDelta;
|
|
1228
|
-
else if (surplusGroupFees >= deficitAmount) surplusGroupFees -= deficitAmount;
|
|
1229
|
-
else {
|
|
1230
|
-
additionalFeeDelta = require_fee_coverage.FeeDelta.fromBigInt(deficitAmount - surplusGroupFees);
|
|
1231
|
-
surplusGroupFees = 0n;
|
|
1232
|
-
}
|
|
1233
|
-
if (additionalFeeDelta && require_fee_coverage.FeeDelta.isDeficit(additionalFeeDelta)) {
|
|
1234
|
-
const additionalDeficitAmount = require_fee_coverage.FeeDelta.amount(additionalFeeDelta);
|
|
1235
|
-
if (transactions[groupIndex].type === require_transaction_type.TransactionType.AppCall) {
|
|
1236
|
-
const transactionFee = (transactions[groupIndex].fee || 0n) + additionalDeficitAmount;
|
|
1237
|
-
const logicalMaxFee = getLogicalMaxFee(this.txns[groupIndex]);
|
|
1238
|
-
if (!logicalMaxFee || transactionFee > logicalMaxFee) throw new Error(`Calculated transaction fee ${transactionFee} µALGO is greater than max of ${logicalMaxFee ?? 0n} for transaction ${groupIndex}`);
|
|
1239
|
-
transactions[groupIndex].fee = transactionFee;
|
|
1240
|
-
} else throw new Error(`An additional fee of ${additionalDeficitAmount} µALGO is required for non app call transaction ${groupIndex}`);
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
if (unnamedResourcesAccessed && transactions[groupIndex].type === require_transaction_type.TransactionType.AppCall) if (!(transactions[groupIndex].appCall?.accessReferences && transactions[groupIndex].appCall?.accessReferences?.length)) require_app_call$1.populateTransactionResources(transactions[groupIndex], unnamedResourcesAccessed, groupIndex);
|
|
1244
|
-
else indexesWithAccessReferences.push(groupIndex);
|
|
1245
|
-
}
|
|
1246
|
-
if (indexesWithAccessReferences.length > 0) require_config.Config.logger.warn(`Resource population will be skipped for transaction indexes ${indexesWithAccessReferences.join(", ")} as they use access references.`);
|
|
1247
|
-
if (groupAnalysis.unnamedResourcesAccessed) require_app_call$1.populateGroupResources(transactions, groupAnalysis.unnamedResourcesAccessed);
|
|
1248
|
-
}
|
|
1249
|
-
if (transactions.length > 1) {
|
|
1250
|
-
const groupedTransactions = require_transaction.groupTransactions(transactions);
|
|
1251
|
-
transactions.forEach((t) => t.group = groupedTransactions[0].group);
|
|
1252
|
-
return transactions;
|
|
1253
|
-
} else return transactions;
|
|
1254
|
-
}
|
|
1255
|
-
async analyzeGroupRequirements(transactions, suggestedParams, analysisParams) {
|
|
1256
|
-
const appCallIndexesWithoutMaxFees = [];
|
|
1257
|
-
let transactionsToSimulate = transactions.map((txn, groupIndex) => {
|
|
1258
|
-
const ctxn = this.txns[groupIndex];
|
|
1259
|
-
const params = { ...txn };
|
|
1260
|
-
delete params.group;
|
|
1261
|
-
if (analysisParams.coverAppCallInnerTransactionFees && txn.type === require_transaction_type.TransactionType.AppCall) {
|
|
1262
|
-
const logicalMaxFee = getLogicalMaxFee(ctxn);
|
|
1263
|
-
if (logicalMaxFee !== void 0) params.fee = logicalMaxFee;
|
|
1264
|
-
else appCallIndexesWithoutMaxFees.push(groupIndex);
|
|
1265
|
-
}
|
|
1266
|
-
return new require_transaction.Transaction(params);
|
|
1267
|
-
});
|
|
1268
|
-
if (transactionsToSimulate.length > 1) transactionsToSimulate = require_transaction.groupTransactions(transactionsToSimulate);
|
|
1269
|
-
if (analysisParams.coverAppCallInnerTransactionFees && appCallIndexesWithoutMaxFees.length > 0) throw new Error(`Please provide a maxFee for each app call transaction when coverAppCallInnerTransactionFees is enabled. Required for transaction ${appCallIndexesWithoutMaxFees.join(", ")}`);
|
|
1270
|
-
const simulateRequest = {
|
|
1271
|
-
txnGroups: [{ txns: transactionsToSimulate.map((txn) => ({
|
|
1272
|
-
txn,
|
|
1273
|
-
sig: require_constants.EMPTY_SIGNATURE
|
|
1274
|
-
})) }],
|
|
1275
|
-
allowUnnamedResources: true,
|
|
1276
|
-
allowEmptySignatures: true,
|
|
1277
|
-
fixSigners: true,
|
|
1278
|
-
allowMoreLogging: true,
|
|
1279
|
-
execTraceConfig: {
|
|
1280
|
-
enable: true,
|
|
1281
|
-
scratchChange: true,
|
|
1282
|
-
stackChange: true,
|
|
1283
|
-
stateChange: true
|
|
1284
|
-
}
|
|
1285
|
-
};
|
|
1286
|
-
const groupResponse = (await this.algod.simulateTransactions(simulateRequest)).txnGroups[0];
|
|
1287
|
-
if (groupResponse.failureMessage) {
|
|
1288
|
-
if (analysisParams.coverAppCallInnerTransactionFees && groupResponse.failureMessage.includes("fee too small")) throw new Error("Fees were too small to resolve execution info via simulate. You may need to increase an app call transaction maxFee.");
|
|
1289
|
-
throw new Error(`Error resolving execution info via simulate in transaction ${groupResponse.failedAt?.join(", ")}: ${groupResponse.failureMessage}`);
|
|
1290
|
-
}
|
|
1291
|
-
const txnAnalysisResults = groupResponse.txnResults.map((simulateTxnResult, groupIndex) => {
|
|
1292
|
-
const btxn = transactions[groupIndex];
|
|
1293
|
-
let requiredFeeDelta;
|
|
1294
|
-
if (analysisParams.coverAppCallInnerTransactionFees) {
|
|
1295
|
-
const minTxnFee = require_transaction.calculateFee(btxn, {
|
|
1296
|
-
feePerByte: suggestedParams.fee,
|
|
1297
|
-
minFee: suggestedParams.minFee
|
|
1298
|
-
});
|
|
1299
|
-
const txnFeeDelta = require_fee_coverage.FeeDelta.fromBigInt(minTxnFee - (btxn.fee ?? 0n));
|
|
1300
|
-
if (btxn.type === require_transaction_type.TransactionType.AppCall) {
|
|
1301
|
-
const innerTxnsFeeDelta = require_fee_coverage.calculateInnerFeeDelta(simulateTxnResult.txnResult.innerTxns, suggestedParams.minFee);
|
|
1302
|
-
requiredFeeDelta = require_fee_coverage.FeeDelta.fromBigInt((innerTxnsFeeDelta ? require_fee_coverage.FeeDelta.toBigInt(innerTxnsFeeDelta) : 0n) + (txnFeeDelta ? require_fee_coverage.FeeDelta.toBigInt(txnFeeDelta) : 0n));
|
|
1303
|
-
} else requiredFeeDelta = txnFeeDelta;
|
|
1304
|
-
}
|
|
1305
|
-
return {
|
|
1306
|
-
requiredFeeDelta,
|
|
1307
|
-
unnamedResourcesAccessed: analysisParams.populateAppCallResources ? simulateTxnResult.unnamedResourcesAccessed : void 0
|
|
1308
|
-
};
|
|
1309
|
-
});
|
|
1310
|
-
const sortedResources = groupResponse.unnamedResourcesAccessed;
|
|
1311
|
-
const compare = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
1312
|
-
if (sortedResources) {
|
|
1313
|
-
sortedResources.accounts?.sort((a, b) => compare(a.toString(), b.toString()));
|
|
1314
|
-
sortedResources.assets?.sort(compare);
|
|
1315
|
-
sortedResources.apps?.sort(compare);
|
|
1316
|
-
sortedResources.boxes?.sort((a, b) => {
|
|
1317
|
-
return compare(`${a.app}-${a.name}`, `${b.app}-${b.name}`);
|
|
1318
|
-
});
|
|
1319
|
-
sortedResources.appLocals?.sort((a, b) => {
|
|
1320
|
-
return compare(`${a.app}-${a.account}`, `${b.app}-${b.account}`);
|
|
1321
|
-
});
|
|
1322
|
-
sortedResources.assetHoldings?.sort((a, b) => {
|
|
1323
|
-
return compare(`${a.asset}-${a.account}`, `${b.asset}-${b.account}`);
|
|
1324
|
-
});
|
|
1325
|
-
}
|
|
1326
|
-
return {
|
|
1327
|
-
transactions: txnAnalysisResults,
|
|
1328
|
-
unnamedResourcesAccessed: analysisParams.populateAppCallResources ? sortedResources : void 0
|
|
1329
|
-
};
|
|
1330
|
-
}
|
|
1331
|
-
/**
|
|
1332
|
-
* Rebuild the group, discarding any previously built transactions.
|
|
1333
|
-
* This will potentially cause new signers and suggested params to be used if the callbacks return a new value compared to the first build.
|
|
1334
|
-
* @returns The newly built transaction composer and the transactions
|
|
1335
|
-
* @example
|
|
1336
|
-
* ```typescript
|
|
1337
|
-
* const { atc, transactions, methodCalls } = await composer.rebuild()
|
|
1338
|
-
* ```
|
|
1339
|
-
*/
|
|
1340
|
-
async rebuild() {
|
|
1341
|
-
this.reset();
|
|
1342
|
-
return await this.build();
|
|
1343
|
-
}
|
|
1344
|
-
reset() {
|
|
1345
|
-
this.signedTransactions = void 0;
|
|
1346
|
-
this.transactionsWithSigners = void 0;
|
|
1347
|
-
}
|
|
1348
|
-
/**
|
|
1349
|
-
* Compose the transaction group and send it to the network.
|
|
1350
|
-
* @param params The parameters to control execution with
|
|
1351
|
-
* @returns The execution result
|
|
1352
|
-
* @example
|
|
1353
|
-
* ```typescript
|
|
1354
|
-
* const result = await composer.send()
|
|
1355
|
-
* ```
|
|
1356
|
-
*/
|
|
1357
|
-
async send(params) {
|
|
1358
|
-
if (this.composerConfig.coverAppCallInnerTransactionFees !== (params?.coverAppCallInnerTransactionFees ?? false) || this.composerConfig.populateAppCallResources !== (params?.populateAppCallResources ?? true)) {
|
|
1359
|
-
this.composerConfig = {
|
|
1360
|
-
coverAppCallInnerTransactionFees: params?.coverAppCallInnerTransactionFees ?? false,
|
|
1361
|
-
populateAppCallResources: params?.populateAppCallResources ?? true
|
|
1362
|
-
};
|
|
1363
|
-
this.reset();
|
|
1364
|
-
}
|
|
1365
|
-
try {
|
|
1366
|
-
await this.gatherSignatures();
|
|
1367
|
-
if (!this.transactionsWithSigners || this.transactionsWithSigners.length === 0 || !this.signedTransactions || this.signedTransactions.length === 0) throw new Error("No transactions available");
|
|
1368
|
-
const transactionsToSend = this.transactionsWithSigners.map((stxn) => stxn.txn);
|
|
1369
|
-
const transactionIds = transactionsToSend.map((txn) => txn.txId());
|
|
1370
|
-
if (transactionsToSend.length > 1) {
|
|
1371
|
-
const groupId = transactionsToSend[0].group ? buffer.Buffer.from(transactionsToSend[0].group).toString("base64") : "";
|
|
1372
|
-
require_config.Config.getLogger(params?.suppressLog).verbose(`Sending group of ${transactionsToSend.length} transactions (${groupId})`, { transactionsToSend });
|
|
1373
|
-
require_config.Config.getLogger(params?.suppressLog).debug(`Transaction IDs (${groupId})`, transactionIds);
|
|
1374
|
-
}
|
|
1375
|
-
if (require_config.Config.debug && require_config.Config.traceAll) await this.simulate({
|
|
1376
|
-
allowEmptySignatures: true,
|
|
1377
|
-
fixSigners: true,
|
|
1378
|
-
allowMoreLogging: true,
|
|
1379
|
-
execTraceConfig: {
|
|
1380
|
-
enable: true,
|
|
1381
|
-
scratchChange: true,
|
|
1382
|
-
stackChange: true,
|
|
1383
|
-
stateChange: true
|
|
1384
|
-
},
|
|
1385
|
-
resultOnFailure: true
|
|
1386
|
-
});
|
|
1387
|
-
const group = this.signedTransactions[0].txn.group;
|
|
1388
|
-
let waitRounds = params?.maxRoundsToWaitForConfirmation;
|
|
1389
|
-
if (waitRounds === void 0) {
|
|
1390
|
-
const firstRound = (await this.getSuggestedParams()).firstValid;
|
|
1391
|
-
const lastRound = this.signedTransactions.reduce((max, txn) => txn.txn.lastValid > max ? txn.txn.lastValid : max, 0n);
|
|
1392
|
-
waitRounds = Number(lastRound - firstRound) + 1;
|
|
1393
|
-
}
|
|
1394
|
-
const encodedTxns = require_signed_transaction.encodeSignedTransactions(this.signedTransactions);
|
|
1395
|
-
await this.algod.sendRawTransaction(encodedTxns);
|
|
1396
|
-
if (transactionsToSend.length > 1 && group) require_config.Config.getLogger(params?.suppressLog).verbose(`Group transaction (${buffer.Buffer.from(group).toString("base64")}) sent with ${transactionsToSend.length} transactions`);
|
|
1397
|
-
else require_config.Config.getLogger(params?.suppressLog).verbose(`Sent transaction ID ${transactionsToSend[0].txId()} ${transactionsToSend[0].type} from ${transactionsToSend[0].sender}`);
|
|
1398
|
-
let confirmations = new Array();
|
|
1399
|
-
if (params?.maxRoundsToWaitForConfirmation !== 0) confirmations = await Promise.all(transactionIds.map(async (id) => await require_transaction$1.waitForConfirmation(id, waitRounds, this.algod)));
|
|
1400
|
-
const abiReturns = this.parseAbiReturnValues(confirmations);
|
|
1401
|
-
return {
|
|
1402
|
-
groupId: group ? buffer.Buffer.from(group).toString("base64") : void 0,
|
|
1403
|
-
transactions: transactionsToSend,
|
|
1404
|
-
txIds: transactionIds,
|
|
1405
|
-
returns: abiReturns,
|
|
1406
|
-
confirmations
|
|
1407
|
-
};
|
|
1408
|
-
} catch (originalError) {
|
|
1409
|
-
const errorMessage = originalError.body?.message ?? originalError.message ?? "Received error executing Transaction Composer";
|
|
1410
|
-
const err = new Error(errorMessage);
|
|
1411
|
-
err.cause = originalError;
|
|
1412
|
-
if (typeof originalError === "object") err.name = originalError.name;
|
|
1413
|
-
let sentTransactions;
|
|
1414
|
-
if (this.transactionsWithSigners) sentTransactions = this.transactionsWithSigners.map((t) => t.txn);
|
|
1415
|
-
else if (this.rawBuildTransactions) sentTransactions = this.rawBuildTransactions.length > 1 ? require_transaction.groupTransactions(this.rawBuildTransactions) : this.rawBuildTransactions;
|
|
1416
|
-
if (require_config.Config.debug && typeof originalError === "object" && sentTransactions) {
|
|
1417
|
-
err.traces = [];
|
|
1418
|
-
require_config.Config.getLogger(params?.suppressLog).error("Received error executing Transaction Composer and debug flag enabled; attempting simulation to get more information", err);
|
|
1419
|
-
const transactionsWithEmptySigners = sentTransactions.map((txn) => ({
|
|
1420
|
-
txn,
|
|
1421
|
-
signer: require_signer.makeEmptyTransactionSigner()
|
|
1422
|
-
}));
|
|
1423
|
-
const signedTransactions = await this.signTransactions(transactionsWithEmptySigners);
|
|
1424
|
-
const simulateResponse = await this.algod.simulateTransactions({
|
|
1425
|
-
txnGroups: [{ txns: signedTransactions }],
|
|
1426
|
-
allowEmptySignatures: true,
|
|
1427
|
-
fixSigners: true,
|
|
1428
|
-
allowMoreLogging: true,
|
|
1429
|
-
execTraceConfig: {
|
|
1430
|
-
enable: true,
|
|
1431
|
-
scratchChange: true,
|
|
1432
|
-
stackChange: true,
|
|
1433
|
-
stateChange: true
|
|
1434
|
-
}
|
|
1435
|
-
});
|
|
1436
|
-
if (require_config.Config.debug && !require_config.Config.traceAll) await require_config.Config.events.emitAsync(require_lifecycle_events.EventType.TxnGroupSimulated, { simulateResponse });
|
|
1437
|
-
if (simulateResponse && simulateResponse.txnGroups[0].failedAt) for (const txn of simulateResponse.txnGroups[0].txnResults) err.traces.push({
|
|
1438
|
-
trace: txn.execTrace,
|
|
1439
|
-
appBudget: txn.appBudgetConsumed,
|
|
1440
|
-
logicSigBudget: txn.logicSigBudgetConsumed,
|
|
1441
|
-
logs: txn.txnResult.logs,
|
|
1442
|
-
message: simulateResponse.txnGroups[0].failureMessage
|
|
1443
|
-
});
|
|
1444
|
-
} else require_config.Config.getLogger(params?.suppressLog).error("Received error executing Transaction Composer, for more information enable the debug flag", err);
|
|
1445
|
-
err.sentTransactions = sentTransactions ?? [];
|
|
1446
|
-
throw await this.transformError(err);
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
async simulate(options) {
|
|
1450
|
-
const { skipSignatures = false, resultOnFailure = false,...rawOptions } = options ?? {};
|
|
1451
|
-
if (skipSignatures) {
|
|
1452
|
-
rawOptions.allowEmptySignatures = true;
|
|
1453
|
-
rawOptions.fixSigners = true;
|
|
1454
|
-
}
|
|
1455
|
-
let transactionsWithSigner;
|
|
1456
|
-
if (!this.transactionsWithSigners) {
|
|
1457
|
-
const builtTransactions = await this.buildTransactions();
|
|
1458
|
-
transactionsWithSigner = (builtTransactions.transactions.length > 0 ? require_transaction.groupTransactions(builtTransactions.transactions) : builtTransactions.transactions).map((txn, index) => ({
|
|
1459
|
-
txn,
|
|
1460
|
-
signer: skipSignatures ? require_signer.makeEmptyTransactionSigner() : builtTransactions.signers.get(index) ?? require_signer.makeEmptyTransactionSigner()
|
|
1461
|
-
}));
|
|
1462
|
-
} else transactionsWithSigner = this.transactionsWithSigners.map((e) => ({
|
|
1463
|
-
txn: e.txn,
|
|
1464
|
-
signer: skipSignatures ? require_signer.makeEmptyTransactionSigner() : e.signer
|
|
1465
|
-
}));
|
|
1466
|
-
const transactions = transactionsWithSigner.map((e) => e.txn);
|
|
1467
|
-
const simulateRequest = {
|
|
1468
|
-
txnGroups: [{ txns: await this.signTransactions(transactionsWithSigner) }],
|
|
1469
|
-
...rawOptions,
|
|
1470
|
-
...require_config.Config.debug ? {
|
|
1471
|
-
allowEmptySignatures: true,
|
|
1472
|
-
fixSigners: true,
|
|
1473
|
-
allowMoreLogging: true,
|
|
1474
|
-
execTraceConfig: {
|
|
1475
|
-
enable: true,
|
|
1476
|
-
scratchChange: true,
|
|
1477
|
-
stackChange: true,
|
|
1478
|
-
stateChange: true
|
|
1479
|
-
}
|
|
1480
|
-
} : void 0
|
|
1481
|
-
};
|
|
1482
|
-
const simulateResponse = await this.algod.simulateTransactions(simulateRequest);
|
|
1483
|
-
const simulateResult = simulateResponse.txnGroups[0];
|
|
1484
|
-
if (simulateResult?.failureMessage && !resultOnFailure) {
|
|
1485
|
-
const errorMessage = `Transaction failed at transaction(s) ${simulateResult.failedAt?.join(", ") || "unknown"} in the group. ${simulateResult.failureMessage}`;
|
|
1486
|
-
const error = new Error(errorMessage);
|
|
1487
|
-
if (require_config.Config.debug) await require_config.Config.events.emitAsync(require_lifecycle_events.EventType.TxnGroupSimulated, { simulateTransaction: simulateResponse });
|
|
1488
|
-
throw await this.transformError(error);
|
|
1489
|
-
}
|
|
1490
|
-
if (require_config.Config.debug && require_config.Config.traceAll) await require_config.Config.events.emitAsync(require_lifecycle_events.EventType.TxnGroupSimulated, { simulateTransaction: simulateResponse });
|
|
1491
|
-
const abiReturns = this.parseAbiReturnValues(simulateResult.txnResults.map((t) => t.txnResult));
|
|
1492
|
-
return {
|
|
1493
|
-
confirmations: simulateResult.txnResults.map((t) => t.txnResult),
|
|
1494
|
-
transactions,
|
|
1495
|
-
txIds: transactions.map((t) => t.txId()),
|
|
1496
|
-
groupId: buffer.Buffer.from(transactions[0].group ?? new Uint8Array()).toString("base64"),
|
|
1497
|
-
simulateResponse,
|
|
1498
|
-
returns: abiReturns
|
|
1499
|
-
};
|
|
1500
|
-
}
|
|
1501
|
-
/**
|
|
1502
|
-
* Create an encoded transaction note that follows the ARC-2 spec.
|
|
1503
|
-
*
|
|
1504
|
-
* https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md
|
|
1505
|
-
* @param note The ARC-2 transaction note data
|
|
1506
|
-
* @returns The binary encoded transaction note
|
|
1507
|
-
*/
|
|
1508
|
-
static arc2Note(note) {
|
|
1509
|
-
const arc2Payload = `${note.dAppName}:${note.format}${typeof note.data === "string" ? note.data : require_util.asJson(note.data)}`;
|
|
1510
|
-
return new TextEncoder().encode(arc2Payload);
|
|
1511
|
-
}
|
|
1512
|
-
async gatherSignatures() {
|
|
1513
|
-
if (this.signedTransactions) return this.signedTransactions;
|
|
1514
|
-
await this.build();
|
|
1515
|
-
if (!this.transactionsWithSigners || this.transactionsWithSigners.length === 0) throw new Error("No transactions available to sign");
|
|
1516
|
-
this.signedTransactions = await this.signTransactions(this.transactionsWithSigners);
|
|
1517
|
-
return this.signedTransactions;
|
|
1518
|
-
}
|
|
1519
|
-
async signTransactions(transactionsWithSigners) {
|
|
1520
|
-
if (transactionsWithSigners.length === 0) throw new Error("No transactions available to sign");
|
|
1521
|
-
const transactions = transactionsWithSigners.map((txnWithSigner) => txnWithSigner.txn);
|
|
1522
|
-
const signerGroups = /* @__PURE__ */ new Map();
|
|
1523
|
-
transactionsWithSigners.forEach(({ signer }, index) => {
|
|
1524
|
-
const indexes = signerGroups.get(signer) ?? [];
|
|
1525
|
-
indexes.push(index);
|
|
1526
|
-
signerGroups.set(signer, indexes);
|
|
1527
|
-
});
|
|
1528
|
-
const signerEntries = Array.from(signerGroups);
|
|
1529
|
-
const signedGroups = await Promise.all(signerEntries.map(([signer, indexes]) => signer(transactions, indexes)));
|
|
1530
|
-
const signedTransactions = new Array(transactionsWithSigners.length);
|
|
1531
|
-
signerEntries.forEach(([, indexes], signerIndex) => {
|
|
1532
|
-
const stxs = signedGroups[signerIndex];
|
|
1533
|
-
indexes.forEach((txIndex, stxIndex) => {
|
|
1534
|
-
signedTransactions[txIndex] = require_signed_transaction.decodeSignedTransaction(stxs[stxIndex]);
|
|
1535
|
-
});
|
|
1536
|
-
});
|
|
1537
|
-
const unsignedIndexes = signedTransactions.map((stxn, index) => stxn === void 0 ? index : null).filter((index) => index !== null);
|
|
1538
|
-
if (unsignedIndexes.length > 0) throw new Error(`Transactions at indexes [${unsignedIndexes.join(", ")}] were not signed`);
|
|
1539
|
-
return signedTransactions;
|
|
1540
|
-
}
|
|
1541
|
-
parseAbiReturnValues(confirmations) {
|
|
1542
|
-
const abiReturns = new Array();
|
|
1543
|
-
for (let i = 0; i < confirmations.length; i++) {
|
|
1544
|
-
const confirmation = confirmations[i];
|
|
1545
|
-
const txn = this.txns[i];
|
|
1546
|
-
if (txn?.type !== "methodCall") continue;
|
|
1547
|
-
const method = txn.data.method;
|
|
1548
|
-
if (method.returns.type !== "void") {
|
|
1549
|
-
const abiReturn = require_app_manager.AppManager.getABIReturn(confirmation, method);
|
|
1550
|
-
if (abiReturn !== void 0) abiReturns.push(abiReturn);
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
return abiReturns;
|
|
1554
|
-
}
|
|
1555
|
-
setMaxFees(maxFees) {
|
|
1556
|
-
maxFees.forEach((_, index) => {
|
|
1557
|
-
if (index > this.txns.length - 1) throw new Error(`Index ${index} is out of range. The composer only contains ${this.txns.length} transactions`);
|
|
1558
|
-
});
|
|
1559
|
-
maxFees.forEach((maxFee, index) => {
|
|
1560
|
-
this.txns[index].data.maxFee = new require_amount.AlgoAmount({ microAlgos: maxFee.microAlgos });
|
|
1561
|
-
});
|
|
1562
|
-
}
|
|
1563
|
-
};
|
|
1564
|
-
/** Get the logical maximum fee based on staticFee and maxFee */
|
|
1565
|
-
function getLogicalMaxFee(ctxn) {
|
|
1566
|
-
if (ctxn.type === "txn" || ctxn.type === "asyncTxn") return;
|
|
1567
|
-
const maxFee = ctxn.data.maxFee;
|
|
1568
|
-
const staticFee = ctxn.data.staticFee;
|
|
1569
|
-
if (maxFee !== void 0 && (staticFee === void 0 || maxFee.microAlgos > staticFee.microAlgos)) return maxFee.microAlgos;
|
|
1570
|
-
return staticFee?.microAlgos;
|
|
1571
|
-
}
|
|
4
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/composer` instead */
|
|
5
|
+
const TransactionComposer = require_composer.TransactionComposer;
|
|
1572
6
|
|
|
1573
7
|
//#endregion
|
|
1574
8
|
exports.TransactionComposer = TransactionComposer;
|