@algorandfoundation/algokit-utils 10.0.0-alpha.3 → 10.0.0-alpha.31
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/algod-client/index.d.ts +3 -7
- package/algod-client/index.js +2 -5
- package/algod-client/index.mjs +2 -2
- package/index.d.ts +1 -2
- package/index.js +0 -7
- package/index.mjs +1 -2
- 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/kmd-client/index.d.ts +1 -2
- package/kmd-client/index.js +0 -5
- package/kmd-client/index.mjs +1 -2
- package/package.json +5 -6
- 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.js +1 -2
- package/testing/account.js.map +1 -1
- package/testing/account.mjs +1 -2
- package/testing/account.mjs.map +1 -1
- package/testing/fixtures/algorand-fixture.d.ts +3 -3
- package/testing/fixtures/algorand-fixture.js.map +1 -1
- package/testing/fixtures/algorand-fixture.mjs.map +1 -1
- package/testing/transaction-logger.js +1 -1
- package/testing/transaction-logger.mjs +1 -1
- package/transact/index.d.ts +11 -10
- package/transact/index.js +7 -31
- package/transact/index.mjs +7 -10
- 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/transactions/app-call.d.ts +5 -4
- package/transactions/app-call.js +16 -16
- package/transactions/app-call.js.map +1 -1
- package/transactions/app-call.mjs +16 -16
- 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/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 +1 -1
- package/transactions/method-call.js +77 -84
- package/transactions/method-call.js.map +1 -1
- package/transactions/method-call.mjs +77 -84
- package/transactions/method-call.mjs.map +1 -1
- package/types/account-manager.d.ts +7 -9
- package/types/account-manager.js +17 -7
- package/types/account-manager.js.map +1 -1
- package/types/account-manager.mjs +17 -7
- package/types/account-manager.mjs.map +1 -1
- package/types/algorand-client-transaction-creator.d.ts +53 -39
- package/types/algorand-client-transaction-creator.js +8 -0
- package/types/algorand-client-transaction-creator.js.map +1 -1
- package/types/algorand-client-transaction-creator.mjs +8 -0
- package/types/algorand-client-transaction-creator.mjs.map +1 -1
- package/types/algorand-client-transaction-sender.d.ts +58 -44
- package/types/algorand-client-transaction-sender.js +8 -1
- package/types/algorand-client-transaction-sender.js.map +1 -1
- package/types/algorand-client-transaction-sender.mjs +8 -0
- package/types/algorand-client-transaction-sender.mjs.map +1 -1
- package/types/amount.js +23 -4
- package/types/amount.js.map +1 -1
- package/types/amount.mjs +20 -2
- package/types/amount.mjs.map +1 -1
- package/types/app-client.d.ts +111 -106
- package/types/app-client.js +2 -3
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +2 -2
- package/types/app-client.mjs.map +1 -1
- package/types/app-deployer.d.ts +1 -1
- package/types/app-deployer.js +3 -3
- package/types/app-deployer.js.map +1 -1
- package/types/app-deployer.mjs +3 -3
- package/types/app-deployer.mjs.map +1 -1
- package/types/app-factory.d.ts +44 -41
- package/types/app-factory.js +2 -2
- package/types/app-factory.js.map +1 -1
- package/types/app-factory.mjs +2 -2
- package/types/app-factory.mjs.map +1 -1
- package/types/app-manager.d.ts +3 -1
- package/types/app-manager.js +17 -11
- package/types/app-manager.js.map +1 -1
- package/types/app-manager.mjs +17 -11
- package/types/app-manager.mjs.map +1 -1
- package/types/app-spec.js +12 -5
- package/types/app-spec.js.map +1 -1
- package/types/app-spec.mjs +12 -5
- package/types/app-spec.mjs.map +1 -1
- package/types/app.d.ts +2 -2
- package/types/app.js.map +1 -1
- package/types/app.mjs.map +1 -1
- package/types/asset-manager.js +1 -1
- package/types/asset-manager.js.map +1 -1
- package/types/asset-manager.mjs +1 -1
- package/types/asset-manager.mjs.map +1 -1
- package/types/async-event-emitter.d.ts +3 -6
- package/types/async-event-emitter.js.map +1 -1
- package/types/async-event-emitter.mjs.map +1 -1
- package/types/client-manager.d.ts +1 -1
- package/types/client-manager.js.map +1 -1
- package/types/client-manager.mjs.map +1 -1
- package/types/composer.d.ts +11 -3
- package/types/composer.js +55 -46
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +46 -36
- package/types/composer.mjs.map +1 -1
- package/types/debugging.d.ts +13 -9
- package/types/debugging.js.map +1 -1
- package/types/debugging.mjs.map +1 -1
- package/types/expand.d.ts +2 -9
- package/types/kmd-account-manager.d.ts +1 -0
- package/types/kmd-account-manager.js +22 -11
- package/types/kmd-account-manager.js.map +1 -1
- package/types/kmd-account-manager.mjs +23 -12
- package/types/kmd-account-manager.mjs.map +1 -1
- package/types/lifecycle-events.d.ts +0 -1
- package/types/lifecycle-events.js.map +1 -1
- package/types/lifecycle-events.mjs.map +1 -1
- package/types/testing.d.ts +4 -4
- package/types/transaction.d.ts +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/testing/account.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.mjs","names":[],"sources":["../../src/testing/account.ts"],"sourcesContent":["import { AlgodClient } from '@algorandfoundation/algokit-algod-client'\nimport { Address } from '@algorandfoundation/algokit-common'\nimport {
|
|
1
|
+
{"version":3,"file":"account.mjs","names":[],"sources":["../../src/testing/account.ts"],"sourcesContent":["import { AlgodClient } from '@algorandfoundation/algokit-algod-client'\nimport { Address } from '@algorandfoundation/algokit-common'\nimport { KmdClient } from '@algorandfoundation/algokit-kmd-client'\nimport { AddressWithSigners, AddressWithTransactionSigner } from '@algorandfoundation/algokit-transact'\nimport { AlgorandClient, Config } from '../'\nimport { GetTestAccountParams } from '../types/testing'\n\n/**\n * @deprecated Use `getTestAccount(params, algorandClient)` instead. The `algorandClient` object can be created using `AlgorandClient.fromClients({ algod, kmd })`.\n *\n * Creates an ephemeral Algorand account for the purposes of testing.\n * Returns a newly created random test account that is funded from the dispenser\n * DO NOT USE THIS TO CREATE A MAINNET ACCOUNT!\n * Note: By default this will log the mnemonic of the account.\n * @param params The config for the test account to generate\n * @param algod An algod client\n * @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables and if not found fallback to the default LocalNet KMD client\n * @returns The account, with private key loaded\n */\nexport async function getTestAccount(\n params: GetTestAccountParams,\n algod: AlgodClient,\n kmd?: KmdClient,\n): Promise<Address & AddressWithTransactionSigner>\n/**\n * Creates an ephemeral Algorand account for the purposes of testing.\n * Returns a newly created random test account that is funded from the dispenser\n * DO NOT USE THIS TO CREATE A MAINNET ACCOUNT!\n * Note: By default this will log the mnemonic of the account.\n * @param params The config for the test account to generate\n * @param algorand An AlgorandClient client\n * @returns The account, with private key loaded\n */\nexport async function getTestAccount(params: GetTestAccountParams, algorand: AlgorandClient): Promise<Address & AddressWithSigners>\nexport async function getTestAccount(\n { suppressLog, initialFunds, accountGetter }: GetTestAccountParams,\n algodOrAlgorandClient: AlgodClient | AlgorandClient,\n kmd?: KmdClient,\n): Promise<Address & AddressWithSigners> {\n const algorand =\n algodOrAlgorandClient instanceof AlgorandClient\n ? algodOrAlgorandClient\n : AlgorandClient.fromClients({\n algod: algodOrAlgorandClient,\n kmd,\n })\n\n const account = accountGetter ? await accountGetter(algorand) : algorand.account.random()\n\n Config.getLogger(suppressLog).info(`New test account created with address '${account.addr}'.`)\n\n const dispenser = await algorand.account.dispenserFromEnvironment()\n\n await algorand.send.payment({\n sender: dispenser,\n receiver: account.addr,\n amount: initialFunds,\n note: 'Funding test account',\n suppressLog,\n })\n\n const accountInfo = await algorand.account.getInformation(account.addr)\n\n Config.getLogger(suppressLog).info('Test account funded; account balance: %d µALGO', accountInfo.balance.microAlgo)\n\n algorand.setSignerFromAccount(account)\n\n const address = Address.fromString(account.addr.toString()) as Address & AddressWithSigners\n for (const key of Object.keys(account as AddressWithSigners)) {\n if (!(key in address)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(address as any)[key] = (account as any)[key]\n }\n }\n\n return address\n}\n"],"mappings":";;;;;AAkCA,eAAsB,eACpB,EAAE,aAAa,cAAc,iBAC7B,uBACA,KACuC;CACvC,MAAM,WACJ,iCAAiC,iBAC7B,wBACA,eAAe,YAAY;EACzB,OAAO;EACP;EACD,CAAC;CAER,MAAM,UAAU,gBAAgB,MAAM,cAAc,SAAS,GAAG,SAAS,QAAQ,QAAQ;AAEzF,QAAO,UAAU,YAAY,CAAC,KAAK,0CAA0C,QAAQ,KAAK,IAAI;CAE9F,MAAM,YAAY,MAAM,SAAS,QAAQ,0BAA0B;AAEnE,OAAM,SAAS,KAAK,QAAQ;EAC1B,QAAQ;EACR,UAAU,QAAQ;EAClB,QAAQ;EACR,MAAM;EACN;EACD,CAAC;CAEF,MAAM,cAAc,MAAM,SAAS,QAAQ,eAAe,QAAQ,KAAK;AAEvE,QAAO,UAAU,YAAY,CAAC,KAAK,kDAAkD,YAAY,QAAQ,UAAU;AAEnH,UAAS,qBAAqB,QAAQ;CAEtC,MAAM,UAAU,QAAQ,WAAW,QAAQ,KAAK,UAAU,CAAC;AAC3D,MAAK,MAAM,OAAO,OAAO,KAAK,QAA8B,CAC1D,KAAI,EAAE,OAAO,SAEV,CAAC,QAAgB,OAAQ,QAAgB;AAI9C,QAAO"}
|
|
@@ -15,7 +15,7 @@ import { AlgorandFixture, AlgorandFixtureConfig } from "../../types/testing.js";
|
|
|
15
15
|
* ```typescript
|
|
16
16
|
* const fixture = algorandFixture()
|
|
17
17
|
*
|
|
18
|
-
* beforeEach(fixture.newScope
|
|
18
|
+
* beforeEach(fixture.newScope)
|
|
19
19
|
*
|
|
20
20
|
* test('My test', async () => {
|
|
21
21
|
* const {algod, indexer, testAccount, ...} = fixture.context
|
|
@@ -27,7 +27,7 @@ import { AlgorandFixture, AlgorandFixtureConfig } from "../../types/testing.js";
|
|
|
27
27
|
* ```typescript
|
|
28
28
|
* const fixture = algorandFixture()
|
|
29
29
|
*
|
|
30
|
-
* beforeAll(fixture.newScope
|
|
30
|
+
* beforeAll(fixture.newScope)
|
|
31
31
|
*
|
|
32
32
|
* test('My test', async () => {
|
|
33
33
|
* const {algod, indexer, testAccount, ...} = fixture.context
|
|
@@ -42,7 +42,7 @@ import { AlgorandFixture, AlgorandFixtureConfig } from "../../types/testing.js";
|
|
|
42
42
|
* // ...
|
|
43
43
|
* })
|
|
44
44
|
*
|
|
45
|
-
* beforeEach(fixture.newScope
|
|
45
|
+
* beforeEach(fixture.newScope)
|
|
46
46
|
*
|
|
47
47
|
* test('My test', async () => {
|
|
48
48
|
* const {algod, indexer, testAccount, ...} = fixture.context
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algorand-fixture.js","names":["ClientManager","context: AlgorandTestAutomationContext","algorand: AlgorandClient","TransactionLogger","AlgorandClient","getTestAccount","algos","runWhenIndexerCaughtUp"],"sources":["../../../src/testing/fixtures/algorand-fixture.ts"],"sourcesContent":["import { algos, Config } from '../../'\nimport { AlgorandClient } from '../../types/algorand-client'\nimport { ClientManager } from '../../types/client-manager'\nimport { AlgoConfig } from '../../types/network-client'\nimport { AlgorandFixture, AlgorandFixtureConfig, AlgorandTestAutomationContext, GetTestAccountParams } from '../../types/testing'\nimport { getTestAccount } from '../account'\nimport { runWhenIndexerCaughtUp } from '../indexer'\nimport { TransactionLogger } from '../transaction-logger'\n\n/**\n * Creates a test fixture for automated testing against Algorand.\n * By default it tests against an environment variable specified client\n * if the standard environment variables are specified, otherwise against\n * a default LocalNet instance, but you can pass in an algod, indexer\n * and/or kmd (or their respective config) if you want to test against\n * an explicitly defined network.\n *\n * @example No config (per-test isolation)\n * ```typescript\n * const fixture = algorandFixture()\n *\n * beforeEach(fixture.newScope
|
|
1
|
+
{"version":3,"file":"algorand-fixture.js","names":["ClientManager","context: AlgorandTestAutomationContext","algorand: AlgorandClient","TransactionLogger","AlgorandClient","getTestAccount","algos","runWhenIndexerCaughtUp"],"sources":["../../../src/testing/fixtures/algorand-fixture.ts"],"sourcesContent":["import { algos, Config } from '../../'\nimport { AlgorandClient } from '../../types/algorand-client'\nimport { ClientManager } from '../../types/client-manager'\nimport { AlgoConfig } from '../../types/network-client'\nimport { AlgorandFixture, AlgorandFixtureConfig, AlgorandTestAutomationContext, GetTestAccountParams } from '../../types/testing'\nimport { getTestAccount } from '../account'\nimport { runWhenIndexerCaughtUp } from '../indexer'\nimport { TransactionLogger } from '../transaction-logger'\n\n/**\n * Creates a test fixture for automated testing against Algorand.\n * By default it tests against an environment variable specified client\n * if the standard environment variables are specified, otherwise against\n * a default LocalNet instance, but you can pass in an algod, indexer\n * and/or kmd (or their respective config) if you want to test against\n * an explicitly defined network.\n *\n * @example No config (per-test isolation)\n * ```typescript\n * const fixture = algorandFixture()\n *\n * beforeEach(fixture.newScope)\n *\n * test('My test', async () => {\n * const {algod, indexer, testAccount, ...} = fixture.context\n * // test things...\n * })\n * ```\n *\n * @example No config (test suite isolation)\n * ```typescript\n * const fixture = algorandFixture()\n *\n * beforeAll(fixture.newScope)\n *\n * test('My test', async () => {\n * const {algod, indexer, testAccount, ...} = fixture.context\n * // test things...\n * })\n * ```\n *\n * @example With config\n * ```typescript\n * const fixture = algorandFixture({\n * algod: new AlgodClient({ baseUrl: 'http://localhost:12345', headers: { 'X-Algo-API-Token': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' } }),\n * // ...\n * })\n *\n * beforeEach(fixture.newScope)\n *\n * test('My test', async () => {\n * const {algod, indexer, testAccount, ...} = fixture.context\n * // test things...\n * })\n * ```\n *\n * @param fixtureConfig The fixture configuration\n * @returns The fixture\n */\nexport function algorandFixture(fixtureConfig?: AlgorandFixtureConfig): AlgorandFixture\n\n/**\n * @deprecated Config can be passed in directly to fixture config now.\n *\n * Creates a test fixture for automated testing against Algorand.\n * By default it tests against an environment variable specified client\n * if the standard environment variables are specified, otherwise against\n * a default LocalNet instance, but you can pass in an algod, indexer\n * and/or kmd if you want to test against an explicitly defined network.\n *\n * @param fixtureConfig The fixture configuration\n * @param config The fixture configuration\n * @returns The fixture\n */\nexport function algorandFixture(fixtureConfig: AlgorandFixtureConfig | undefined, config: AlgoConfig): AlgorandFixture\n\nexport function algorandFixture(fixtureConfig?: AlgorandFixtureConfig, config?: AlgoConfig): AlgorandFixture {\n fixtureConfig = { ...fixtureConfig, ...config }\n if (!fixtureConfig.algod || !fixtureConfig.indexer || !fixtureConfig.kmd) {\n fixtureConfig = { ...ClientManager.getConfigFromEnvironmentOrLocalNet(), ...fixtureConfig }\n }\n\n const algod = fixtureConfig.algod ?? ClientManager.getAlgodClient(fixtureConfig.algodConfig!)\n const indexer = fixtureConfig.indexer ?? ClientManager.getIndexerClient(fixtureConfig.indexerConfig!)\n const kmd = fixtureConfig.kmd ?? ClientManager.getKmdClient(fixtureConfig.kmdConfig!)\n let context: AlgorandTestAutomationContext\n let algorand: AlgorandClient\n\n const newScope = async () => {\n Config.configure({ debug: true })\n const transactionLogger = new TransactionLogger()\n const transactionLoggerAlgod = transactionLogger.capture(algod)\n\n algorand = AlgorandClient.fromClients({ algod: transactionLoggerAlgod, indexer, kmd }).setSuggestedParamsCacheTimeout(0)\n\n const testAccount = await getTestAccount({ initialFunds: fixtureConfig?.testAccountFunding ?? algos(10), suppressLog: true }, algorand)\n algorand.setSignerFromAccount(testAccount)\n\n // If running against LocalNet we are likely in dev mode and we need to set a much higher validity window\n // otherwise we are more likely to get invalid transactions.\n if (await algorand.client.isLocalNet()) {\n algorand.setDefaultValidityWindow(1000)\n }\n context = {\n algorand,\n algod: transactionLoggerAlgod,\n indexer: indexer,\n kmd: kmd,\n testAccount,\n generateAccount: async (params: GetTestAccountParams) => {\n const account = await getTestAccount(params, algorand)\n algorand.setSignerFromAccount(account)\n return account\n },\n transactionLogger: transactionLogger,\n waitForIndexer: () => transactionLogger.waitForIndexer(indexer),\n waitForIndexerTransaction: (transactionId: string) => runWhenIndexerCaughtUp(() => indexer.lookupTransactionById(transactionId)),\n }\n }\n\n return {\n get context() {\n if (!context) throw new Error('Context not initialised; make sure to call fixture.newScope() before accessing context.')\n return context\n },\n get algorand() {\n return algorand\n },\n beforeEach: newScope,\n newScope,\n }\n}\n"],"mappings":";;;;;;;;;AA4EA,SAAgB,gBAAgB,eAAuC,QAAsC;AAC3G,iBAAgB;EAAE,GAAG;EAAe,GAAG;EAAQ;AAC/C,KAAI,CAAC,cAAc,SAAS,CAAC,cAAc,WAAW,CAAC,cAAc,IACnE,iBAAgB;EAAE,GAAGA,qCAAc,oCAAoC;EAAE,GAAG;EAAe;CAG7F,MAAM,QAAQ,cAAc,SAASA,qCAAc,eAAe,cAAc,YAAa;CAC7F,MAAM,UAAU,cAAc,WAAWA,qCAAc,iBAAiB,cAAc,cAAe;CACrG,MAAM,MAAM,cAAc,OAAOA,qCAAc,aAAa,cAAc,UAAW;CACrF,IAAIC;CACJ,IAAIC;CAEJ,MAAM,WAAW,YAAY;AAC3B,wBAAO,UAAU,EAAE,OAAO,MAAM,CAAC;EACjC,MAAM,oBAAoB,IAAIC,8CAAmB;EACjD,MAAM,yBAAyB,kBAAkB,QAAQ,MAAM;AAE/D,aAAWC,uCAAe,YAAY;GAAE,OAAO;GAAwB;GAAS;GAAK,CAAC,CAAC,+BAA+B,EAAE;EAExH,MAAM,cAAc,MAAMC,+BAAe;GAAE,cAAc,eAAe,sBAAsBC,qBAAM,GAAG;GAAE,aAAa;GAAM,EAAE,SAAS;AACvI,WAAS,qBAAqB,YAAY;AAI1C,MAAI,MAAM,SAAS,OAAO,YAAY,CACpC,UAAS,yBAAyB,IAAK;AAEzC,YAAU;GACR;GACA,OAAO;GACE;GACJ;GACL;GACA,iBAAiB,OAAO,WAAiC;IACvD,MAAM,UAAU,MAAMD,+BAAe,QAAQ,SAAS;AACtD,aAAS,qBAAqB,QAAQ;AACtC,WAAO;;GAEU;GACnB,sBAAsB,kBAAkB,eAAe,QAAQ;GAC/D,4BAA4B,kBAA0BE,6CAA6B,QAAQ,sBAAsB,cAAc,CAAC;GACjI;;AAGH,QAAO;EACL,IAAI,UAAU;AACZ,OAAI,CAAC,QAAS,OAAM,IAAI,MAAM,0FAA0F;AACxH,UAAO;;EAET,IAAI,WAAW;AACb,UAAO;;EAET,YAAY;EACZ;EACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algorand-fixture.mjs","names":["context: AlgorandTestAutomationContext","algorand: AlgorandClient"],"sources":["../../../src/testing/fixtures/algorand-fixture.ts"],"sourcesContent":["import { algos, Config } from '../../'\nimport { AlgorandClient } from '../../types/algorand-client'\nimport { ClientManager } from '../../types/client-manager'\nimport { AlgoConfig } from '../../types/network-client'\nimport { AlgorandFixture, AlgorandFixtureConfig, AlgorandTestAutomationContext, GetTestAccountParams } from '../../types/testing'\nimport { getTestAccount } from '../account'\nimport { runWhenIndexerCaughtUp } from '../indexer'\nimport { TransactionLogger } from '../transaction-logger'\n\n/**\n * Creates a test fixture for automated testing against Algorand.\n * By default it tests against an environment variable specified client\n * if the standard environment variables are specified, otherwise against\n * a default LocalNet instance, but you can pass in an algod, indexer\n * and/or kmd (or their respective config) if you want to test against\n * an explicitly defined network.\n *\n * @example No config (per-test isolation)\n * ```typescript\n * const fixture = algorandFixture()\n *\n * beforeEach(fixture.newScope
|
|
1
|
+
{"version":3,"file":"algorand-fixture.mjs","names":["context: AlgorandTestAutomationContext","algorand: AlgorandClient"],"sources":["../../../src/testing/fixtures/algorand-fixture.ts"],"sourcesContent":["import { algos, Config } from '../../'\nimport { AlgorandClient } from '../../types/algorand-client'\nimport { ClientManager } from '../../types/client-manager'\nimport { AlgoConfig } from '../../types/network-client'\nimport { AlgorandFixture, AlgorandFixtureConfig, AlgorandTestAutomationContext, GetTestAccountParams } from '../../types/testing'\nimport { getTestAccount } from '../account'\nimport { runWhenIndexerCaughtUp } from '../indexer'\nimport { TransactionLogger } from '../transaction-logger'\n\n/**\n * Creates a test fixture for automated testing against Algorand.\n * By default it tests against an environment variable specified client\n * if the standard environment variables are specified, otherwise against\n * a default LocalNet instance, but you can pass in an algod, indexer\n * and/or kmd (or their respective config) if you want to test against\n * an explicitly defined network.\n *\n * @example No config (per-test isolation)\n * ```typescript\n * const fixture = algorandFixture()\n *\n * beforeEach(fixture.newScope)\n *\n * test('My test', async () => {\n * const {algod, indexer, testAccount, ...} = fixture.context\n * // test things...\n * })\n * ```\n *\n * @example No config (test suite isolation)\n * ```typescript\n * const fixture = algorandFixture()\n *\n * beforeAll(fixture.newScope)\n *\n * test('My test', async () => {\n * const {algod, indexer, testAccount, ...} = fixture.context\n * // test things...\n * })\n * ```\n *\n * @example With config\n * ```typescript\n * const fixture = algorandFixture({\n * algod: new AlgodClient({ baseUrl: 'http://localhost:12345', headers: { 'X-Algo-API-Token': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' } }),\n * // ...\n * })\n *\n * beforeEach(fixture.newScope)\n *\n * test('My test', async () => {\n * const {algod, indexer, testAccount, ...} = fixture.context\n * // test things...\n * })\n * ```\n *\n * @param fixtureConfig The fixture configuration\n * @returns The fixture\n */\nexport function algorandFixture(fixtureConfig?: AlgorandFixtureConfig): AlgorandFixture\n\n/**\n * @deprecated Config can be passed in directly to fixture config now.\n *\n * Creates a test fixture for automated testing against Algorand.\n * By default it tests against an environment variable specified client\n * if the standard environment variables are specified, otherwise against\n * a default LocalNet instance, but you can pass in an algod, indexer\n * and/or kmd if you want to test against an explicitly defined network.\n *\n * @param fixtureConfig The fixture configuration\n * @param config The fixture configuration\n * @returns The fixture\n */\nexport function algorandFixture(fixtureConfig: AlgorandFixtureConfig | undefined, config: AlgoConfig): AlgorandFixture\n\nexport function algorandFixture(fixtureConfig?: AlgorandFixtureConfig, config?: AlgoConfig): AlgorandFixture {\n fixtureConfig = { ...fixtureConfig, ...config }\n if (!fixtureConfig.algod || !fixtureConfig.indexer || !fixtureConfig.kmd) {\n fixtureConfig = { ...ClientManager.getConfigFromEnvironmentOrLocalNet(), ...fixtureConfig }\n }\n\n const algod = fixtureConfig.algod ?? ClientManager.getAlgodClient(fixtureConfig.algodConfig!)\n const indexer = fixtureConfig.indexer ?? ClientManager.getIndexerClient(fixtureConfig.indexerConfig!)\n const kmd = fixtureConfig.kmd ?? ClientManager.getKmdClient(fixtureConfig.kmdConfig!)\n let context: AlgorandTestAutomationContext\n let algorand: AlgorandClient\n\n const newScope = async () => {\n Config.configure({ debug: true })\n const transactionLogger = new TransactionLogger()\n const transactionLoggerAlgod = transactionLogger.capture(algod)\n\n algorand = AlgorandClient.fromClients({ algod: transactionLoggerAlgod, indexer, kmd }).setSuggestedParamsCacheTimeout(0)\n\n const testAccount = await getTestAccount({ initialFunds: fixtureConfig?.testAccountFunding ?? algos(10), suppressLog: true }, algorand)\n algorand.setSignerFromAccount(testAccount)\n\n // If running against LocalNet we are likely in dev mode and we need to set a much higher validity window\n // otherwise we are more likely to get invalid transactions.\n if (await algorand.client.isLocalNet()) {\n algorand.setDefaultValidityWindow(1000)\n }\n context = {\n algorand,\n algod: transactionLoggerAlgod,\n indexer: indexer,\n kmd: kmd,\n testAccount,\n generateAccount: async (params: GetTestAccountParams) => {\n const account = await getTestAccount(params, algorand)\n algorand.setSignerFromAccount(account)\n return account\n },\n transactionLogger: transactionLogger,\n waitForIndexer: () => transactionLogger.waitForIndexer(indexer),\n waitForIndexerTransaction: (transactionId: string) => runWhenIndexerCaughtUp(() => indexer.lookupTransactionById(transactionId)),\n }\n }\n\n return {\n get context() {\n if (!context) throw new Error('Context not initialised; make sure to call fixture.newScope() before accessing context.')\n return context\n },\n get algorand() {\n return algorand\n },\n beforeEach: newScope,\n newScope,\n }\n}\n"],"mappings":";;;;;;;;;AA4EA,SAAgB,gBAAgB,eAAuC,QAAsC;AAC3G,iBAAgB;EAAE,GAAG;EAAe,GAAG;EAAQ;AAC/C,KAAI,CAAC,cAAc,SAAS,CAAC,cAAc,WAAW,CAAC,cAAc,IACnE,iBAAgB;EAAE,GAAG,cAAc,oCAAoC;EAAE,GAAG;EAAe;CAG7F,MAAM,QAAQ,cAAc,SAAS,cAAc,eAAe,cAAc,YAAa;CAC7F,MAAM,UAAU,cAAc,WAAW,cAAc,iBAAiB,cAAc,cAAe;CACrG,MAAM,MAAM,cAAc,OAAO,cAAc,aAAa,cAAc,UAAW;CACrF,IAAIA;CACJ,IAAIC;CAEJ,MAAM,WAAW,YAAY;AAC3B,SAAO,UAAU,EAAE,OAAO,MAAM,CAAC;EACjC,MAAM,oBAAoB,IAAI,mBAAmB;EACjD,MAAM,yBAAyB,kBAAkB,QAAQ,MAAM;AAE/D,aAAW,eAAe,YAAY;GAAE,OAAO;GAAwB;GAAS;GAAK,CAAC,CAAC,+BAA+B,EAAE;EAExH,MAAM,cAAc,MAAM,eAAe;GAAE,cAAc,eAAe,sBAAsB,MAAM,GAAG;GAAE,aAAa;GAAM,EAAE,SAAS;AACvI,WAAS,qBAAqB,YAAY;AAI1C,MAAI,MAAM,SAAS,OAAO,YAAY,CACpC,UAAS,yBAAyB,IAAK;AAEzC,YAAU;GACR;GACA,OAAO;GACE;GACJ;GACL;GACA,iBAAiB,OAAO,WAAiC;IACvD,MAAM,UAAU,MAAM,eAAe,QAAQ,SAAS;AACtD,aAAS,qBAAqB,QAAQ;AACtC,WAAO;;GAEU;GACnB,sBAAsB,kBAAkB,eAAe,QAAQ;GAC/D,4BAA4B,kBAA0B,6BAA6B,QAAQ,sBAAsB,cAAc,CAAC;GACjI;;AAGH,QAAO;EACL,IAAI,UAAU;AACZ,OAAI,CAAC,QAAS,OAAM,IAAI,MAAM,0FAA0F;AACxH,UAAO;;EAET,IAAI,WAAW;AACb,UAAO;;EAET,YAAY;EACZ;EACD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_signed_transaction = require('../packages/transact/src/transactions/signed-transaction.js');
|
|
2
1
|
const require_config = require('../config.js');
|
|
2
|
+
const require_signed_transaction = require('../packages/transact/src/transactions/signed-transaction.js');
|
|
3
3
|
const require_indexer = require('./indexer.js');
|
|
4
4
|
|
|
5
5
|
//#region src/testing/transaction-logger.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { decodeSignedTransaction } from "../packages/transact/src/transactions/signed-transaction.mjs";
|
|
2
1
|
import { Config } from "../config.mjs";
|
|
2
|
+
import { decodeSignedTransaction } from "../packages/transact/src/transactions/signed-transaction.mjs";
|
|
3
3
|
import { runWhenIndexerCaughtUp } from "./indexer.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/testing/transaction-logger.ts
|
package/transact/index.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AssetConfigTransactionFields
|
|
3
|
-
import { AssetFreezeTransactionFields
|
|
4
|
-
import { AssetTransferTransactionFields
|
|
1
|
+
import { AppCallTransactionFields, BoxReference, HoldingReference, LocalsReference, OnApplicationComplete, ResourceReference, StateSchema } from "../packages/transact/src/transactions/app-call.js";
|
|
2
|
+
import { AssetConfigTransactionFields } from "../packages/transact/src/transactions/asset-config.js";
|
|
3
|
+
import { AssetFreezeTransactionFields } from "../packages/transact/src/transactions/asset-freeze.js";
|
|
4
|
+
import { AssetTransferTransactionFields } from "../packages/transact/src/transactions/asset-transfer.js";
|
|
5
5
|
import { HeartbeatProof, HeartbeatTransactionFields } from "../packages/transact/src/transactions/heartbeat.js";
|
|
6
|
-
import { KeyRegistrationTransactionFields
|
|
6
|
+
import { KeyRegistrationTransactionFields } from "../packages/transact/src/transactions/key-registration.js";
|
|
7
7
|
import { PaymentTransactionFields } from "../packages/transact/src/transactions/payment.js";
|
|
8
8
|
import { FalconSignatureStruct, FalconVerifier, HashFactory, MerkleArrayProof, MerkleSignatureVerifier, Participant, Reveal, SigslotCommit, StateProof, StateProofMessage, StateProofTransactionFields } from "../packages/transact/src/transactions/state-proof.js";
|
|
9
9
|
import { TransactionType } from "../packages/transact/src/transactions/transaction-type.js";
|
|
10
|
-
import { Transaction, TransactionParams, assignFee, calculateFee, decodeTransaction, decodeTransactions, encodeTransaction, encodeTransactionRaw, encodeTransactions, estimateTransactionSize, getEncodedTransactionType, groupTransactions, transactionCodec } from "../packages/transact/src/transactions/transaction.js";
|
|
11
|
-
import {
|
|
10
|
+
import { Transaction, TransactionParams, assignFee, calculateFee, decodeTransaction, decodeTransactions, encodeTransaction, encodeTransactionRaw, encodeTransactions, estimateTransactionSize, getEncodedTransactionType, groupTransactions, transactionCodec, validateTransaction } from "../packages/transact/src/transactions/transaction.js";
|
|
11
|
+
import { LogicSigSignature, MultisigSignature, MultisigSubsignature, SignedTransaction, decodeSignedTransaction, decodeSignedTransactions, encodeSignedTransaction, encodeSignedTransactions, validateSignedTransaction } from "../packages/transact/src/transactions/signed-transaction.js";
|
|
12
|
+
import { BoxReferenceMeta, HoldingReferenceMeta, LocalsReferenceMeta } from "../packages/transact/src/transactions/reference-types-meta.js";
|
|
12
13
|
import { SignedTransactionMeta } from "../packages/transact/src/transactions/signed-transaction-meta.js";
|
|
13
14
|
import { TransactionParamsMeta, transactionParamsCodec } from "../packages/transact/src/transactions/transaction-meta.js";
|
|
14
|
-
import {
|
|
15
|
-
import { DelegatedLsigSigner, LogicSigAccount, ProgramDataSigner
|
|
15
|
+
import { MultisigAccount, MultisigMetadata } from "../packages/transact/src/multisig.js";
|
|
16
|
+
import { DelegatedLsigSigner, LogicSig, LogicSigAccount, ProgramDataSigner } from "../packages/transact/src/logicsig.js";
|
|
16
17
|
import { AddressWithDelegatedLsigSigner, AddressWithMxBytesSigner, AddressWithProgramDataSigner, AddressWithSigners, AddressWithTransactionSigner, MxBytesSigner, SendingAddress, TransactionSigner, generateAddressWithSigners, makeEmptyTransactionSigner } from "../packages/transact/src/signer.js";
|
|
17
|
-
export {
|
|
18
|
+
export { AddressWithDelegatedLsigSigner, AddressWithMxBytesSigner, AddressWithProgramDataSigner, AddressWithSigners, AddressWithTransactionSigner, AppCallTransactionFields, AssetConfigTransactionFields, AssetFreezeTransactionFields, AssetTransferTransactionFields, BoxReference, BoxReferenceMeta, DelegatedLsigSigner, FalconSignatureStruct, FalconVerifier, HashFactory, HeartbeatProof, HeartbeatTransactionFields, HoldingReference, HoldingReferenceMeta, KeyRegistrationTransactionFields, LocalsReference, LocalsReferenceMeta, LogicSig, LogicSigAccount, LogicSigSignature, MerkleArrayProof, MerkleSignatureVerifier, MultisigAccount, MultisigMetadata, MultisigSignature, MultisigSubsignature, MxBytesSigner, OnApplicationComplete, Participant, PaymentTransactionFields, ProgramDataSigner, ResourceReference, Reveal, SendingAddress, SignedTransaction, SignedTransactionMeta, SigslotCommit, StateProof, StateProofMessage, StateProofTransactionFields, StateSchema, Transaction, TransactionParams, TransactionParamsMeta, TransactionSigner, TransactionType, assignFee, calculateFee, decodeSignedTransaction, decodeSignedTransactions, decodeTransaction, decodeTransactions, encodeSignedTransaction, encodeSignedTransactions, encodeTransaction, encodeTransactionRaw, encodeTransactions, estimateTransactionSize, generateAddressWithSigners, getEncodedTransactionType, groupTransactions, makeEmptyTransactionSigner, transactionCodec, transactionParamsCodec, validateSignedTransaction, validateTransaction };
|
package/transact/index.js
CHANGED
|
@@ -1,42 +1,27 @@
|
|
|
1
1
|
const require_app_call = require('../packages/transact/src/transactions/app-call.js');
|
|
2
|
-
const require_asset_config = require('../packages/transact/src/transactions/asset-config.js');
|
|
3
|
-
const require_asset_freeze = require('../packages/transact/src/transactions/asset-freeze.js');
|
|
4
|
-
const require_asset_transfer = require('../packages/transact/src/transactions/asset-transfer.js');
|
|
5
|
-
const require_key_registration = require('../packages/transact/src/transactions/key-registration.js');
|
|
6
2
|
const require_transaction_type = require('../packages/transact/src/transactions/transaction-type.js');
|
|
7
3
|
const require_transaction_meta = require('../packages/transact/src/transactions/transaction-meta.js');
|
|
8
4
|
const require_transaction = require('../packages/transact/src/transactions/transaction.js');
|
|
9
5
|
const require_signed_transaction_meta = require('../packages/transact/src/transactions/signed-transaction-meta.js');
|
|
10
6
|
const require_signed_transaction = require('../packages/transact/src/transactions/signed-transaction.js');
|
|
7
|
+
const require_reference_types_meta = require('../packages/transact/src/transactions/reference-types-meta.js');
|
|
11
8
|
const require_signer = require('../packages/transact/src/signer.js');
|
|
12
9
|
const require_multisig = require('../packages/transact/src/multisig.js');
|
|
13
10
|
const require_logicsig = require('../packages/transact/src/logicsig.js');
|
|
14
11
|
|
|
12
|
+
exports.BoxReferenceMeta = require_reference_types_meta.BoxReferenceMeta;
|
|
13
|
+
exports.HoldingReferenceMeta = require_reference_types_meta.HoldingReferenceMeta;
|
|
14
|
+
exports.LocalsReferenceMeta = require_reference_types_meta.LocalsReferenceMeta;
|
|
15
|
+
exports.LogicSig = require_logicsig.LogicSig;
|
|
15
16
|
exports.LogicSigAccount = require_logicsig.LogicSigAccount;
|
|
16
|
-
exports.MULTISIG_MERGE_LESSTHANTWO_ERROR_MSG = require_multisig.MULTISIG_MERGE_LESSTHANTWO_ERROR_MSG;
|
|
17
|
-
exports.MULTISIG_MERGE_MISMATCH_AUTH_ADDR_MSG = require_multisig.MULTISIG_MERGE_MISMATCH_AUTH_ADDR_MSG;
|
|
18
|
-
exports.MULTISIG_MERGE_MISMATCH_ERROR_MSG = require_multisig.MULTISIG_MERGE_MISMATCH_ERROR_MSG;
|
|
19
|
-
exports.MULTISIG_MERGE_SIG_MISMATCH_ERROR_MSG = require_multisig.MULTISIG_MERGE_SIG_MISMATCH_ERROR_MSG;
|
|
20
|
-
exports.MULTISIG_MERGE_WRONG_PREIMAGE_ERROR_MSG = require_multisig.MULTISIG_MERGE_WRONG_PREIMAGE_ERROR_MSG;
|
|
21
|
-
exports.MULTISIG_NO_MUTATE_ERROR_MSG = require_multisig.MULTISIG_NO_MUTATE_ERROR_MSG;
|
|
22
|
-
exports.MULTISIG_SIGNATURE_LENGTH_ERROR_MSG = require_multisig.MULTISIG_SIGNATURE_LENGTH_ERROR_MSG;
|
|
23
|
-
exports.MULTISIG_USE_PARTIAL_SIGN_ERROR_MSG = require_multisig.MULTISIG_USE_PARTIAL_SIGN_ERROR_MSG;
|
|
24
17
|
exports.MultisigAccount = require_multisig.MultisigAccount;
|
|
25
18
|
exports.OnApplicationComplete = require_app_call.OnApplicationComplete;
|
|
26
19
|
exports.SignedTransactionMeta = require_signed_transaction_meta.SignedTransactionMeta;
|
|
27
20
|
exports.Transaction = require_transaction.Transaction;
|
|
28
21
|
exports.TransactionParamsMeta = require_transaction_meta.TransactionParamsMeta;
|
|
29
22
|
exports.TransactionType = require_transaction_type.TransactionType;
|
|
30
|
-
exports.addressFromMultisigPreImg = require_multisig.addressFromMultisigPreImg;
|
|
31
|
-
exports.addressFromMultisigPreImgAddrs = require_multisig.addressFromMultisigPreImgAddrs;
|
|
32
|
-
exports.addressFromMultisigSignature = require_multisig.addressFromMultisigSignature;
|
|
33
|
-
exports.appendSignRawMultisigSignature = require_multisig.appendSignRawMultisigSignature;
|
|
34
|
-
exports.applyMultisigSubsignature = require_multisig.applyMultisigSubsignature;
|
|
35
23
|
exports.assignFee = require_transaction.assignFee;
|
|
36
24
|
exports.calculateFee = require_transaction.calculateFee;
|
|
37
|
-
exports.createMultisigTransaction = require_multisig.createMultisigTransaction;
|
|
38
|
-
exports.decodeLogicSignature = require_logicsig.decodeLogicSignature;
|
|
39
|
-
exports.decodeMultiSignature = require_multisig.decodeMultiSignature;
|
|
40
25
|
exports.decodeSignedTransaction = require_signed_transaction.decodeSignedTransaction;
|
|
41
26
|
exports.decodeSignedTransactions = require_signed_transaction.decodeSignedTransactions;
|
|
42
27
|
exports.decodeTransaction = require_transaction.decodeTransaction;
|
|
@@ -51,16 +36,7 @@ exports.generateAddressWithSigners = require_signer.generateAddressWithSigners;
|
|
|
51
36
|
exports.getEncodedTransactionType = require_transaction.getEncodedTransactionType;
|
|
52
37
|
exports.groupTransactions = require_transaction.groupTransactions;
|
|
53
38
|
exports.makeEmptyTransactionSigner = require_signer.makeEmptyTransactionSigner;
|
|
54
|
-
exports.mergeMultisigTransactions = require_multisig.mergeMultisigTransactions;
|
|
55
|
-
exports.mergeMultisignatures = require_multisig.mergeMultisignatures;
|
|
56
|
-
exports.multisigAddress = require_multisig.multisigAddress;
|
|
57
|
-
exports.newMultisigSignature = require_multisig.newMultisigSignature;
|
|
58
|
-
exports.participantsFromMultisigSignature = require_multisig.participantsFromMultisigSignature;
|
|
59
|
-
exports.sanityCheckProgram = require_logicsig.sanityCheckProgram;
|
|
60
39
|
exports.transactionCodec = require_transaction.transactionCodec;
|
|
61
40
|
exports.transactionParamsCodec = require_transaction_meta.transactionParamsCodec;
|
|
62
|
-
exports.
|
|
63
|
-
exports.
|
|
64
|
-
exports.validateAssetFreezeTransaction = require_asset_freeze.validateAssetFreezeTransaction;
|
|
65
|
-
exports.validateAssetTransferTransaction = require_asset_transfer.validateAssetTransferTransaction;
|
|
66
|
-
exports.validateKeyRegistrationTransaction = require_key_registration.validateKeyRegistrationTransaction;
|
|
41
|
+
exports.validateSignedTransaction = require_signed_transaction.validateSignedTransaction;
|
|
42
|
+
exports.validateTransaction = require_transaction.validateTransaction;
|
package/transact/index.mjs
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { OnApplicationComplete
|
|
2
|
-
import { validateAssetConfigTransaction } from "../packages/transact/src/transactions/asset-config.mjs";
|
|
3
|
-
import { validateAssetFreezeTransaction } from "../packages/transact/src/transactions/asset-freeze.mjs";
|
|
4
|
-
import { validateAssetTransferTransaction } from "../packages/transact/src/transactions/asset-transfer.mjs";
|
|
5
|
-
import { validateKeyRegistrationTransaction } from "../packages/transact/src/transactions/key-registration.mjs";
|
|
1
|
+
import { OnApplicationComplete } from "../packages/transact/src/transactions/app-call.mjs";
|
|
6
2
|
import { TransactionType } from "../packages/transact/src/transactions/transaction-type.mjs";
|
|
7
3
|
import { TransactionParamsMeta, transactionParamsCodec } from "../packages/transact/src/transactions/transaction-meta.mjs";
|
|
8
|
-
import { Transaction, assignFee, calculateFee, decodeTransaction, decodeTransactions, encodeTransaction, encodeTransactionRaw, encodeTransactions, estimateTransactionSize, getEncodedTransactionType, groupTransactions, transactionCodec } from "../packages/transact/src/transactions/transaction.mjs";
|
|
4
|
+
import { Transaction, assignFee, calculateFee, decodeTransaction, decodeTransactions, encodeTransaction, encodeTransactionRaw, encodeTransactions, estimateTransactionSize, getEncodedTransactionType, groupTransactions, transactionCodec, validateTransaction } from "../packages/transact/src/transactions/transaction.mjs";
|
|
9
5
|
import { SignedTransactionMeta } from "../packages/transact/src/transactions/signed-transaction-meta.mjs";
|
|
10
|
-
import { decodeSignedTransaction, decodeSignedTransactions, encodeSignedTransaction, encodeSignedTransactions } from "../packages/transact/src/transactions/signed-transaction.mjs";
|
|
6
|
+
import { decodeSignedTransaction, decodeSignedTransactions, encodeSignedTransaction, encodeSignedTransactions, validateSignedTransaction } from "../packages/transact/src/transactions/signed-transaction.mjs";
|
|
7
|
+
import { BoxReferenceMeta, HoldingReferenceMeta, LocalsReferenceMeta } from "../packages/transact/src/transactions/reference-types-meta.mjs";
|
|
11
8
|
import { generateAddressWithSigners, makeEmptyTransactionSigner } from "../packages/transact/src/signer.mjs";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
9
|
+
import { MultisigAccount } from "../packages/transact/src/multisig.mjs";
|
|
10
|
+
import { LogicSig, LogicSigAccount } from "../packages/transact/src/logicsig.mjs";
|
|
14
11
|
|
|
15
|
-
export {
|
|
12
|
+
export { BoxReferenceMeta, HoldingReferenceMeta, LocalsReferenceMeta, LogicSig, LogicSigAccount, MultisigAccount, OnApplicationComplete, SignedTransactionMeta, Transaction, TransactionParamsMeta, TransactionType, assignFee, calculateFee, decodeSignedTransaction, decodeSignedTransactions, decodeTransaction, decodeTransactions, encodeSignedTransaction, encodeSignedTransactions, encodeTransaction, encodeTransactionRaw, encodeTransactions, estimateTransactionSize, generateAddressWithSigners, getEncodedTransactionType, groupTransactions, makeEmptyTransactionSigner, transactionCodec, transactionParamsCodec, validateSignedTransaction, validateTransaction };
|
|
@@ -80,7 +80,7 @@ async function prepareGroupForSending(composer, sendParams, additionalContext) {
|
|
|
80
80
|
* @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)
|
|
81
81
|
*/
|
|
82
82
|
const sendTransactionComposer = async function(atcSend) {
|
|
83
|
-
const { transactionComposer: givenComposer
|
|
83
|
+
const { transactionComposer: givenComposer, ...executeParams } = atcSend;
|
|
84
84
|
return atcSend.transactionComposer.send({ ...executeParams });
|
|
85
85
|
};
|
|
86
86
|
/**
|
|
@@ -96,7 +96,7 @@ const sendTransactionComposer = async function(atcSend) {
|
|
|
96
96
|
*/
|
|
97
97
|
const waitForConfirmation = async function(transactionId, maxRoundsToWait, algod) {
|
|
98
98
|
if (maxRoundsToWait < 0) throw new Error(`Invalid timeout, received ${maxRoundsToWait}, expected > 0`);
|
|
99
|
-
const status = await algod.
|
|
99
|
+
const status = await algod.status();
|
|
100
100
|
if (status === void 0) throw new Error("Unable to get node status");
|
|
101
101
|
const startRound = BigInt(status.lastRound) + 1n;
|
|
102
102
|
let currentRound = startRound;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","names":["e: any","toNumber"],"sources":["../../src/transaction/transaction.ts"],"sourcesContent":["import { AlgodClient, PendingTransactionResponse } from '@algorandfoundation/algokit-algod-client'\nimport { Transaction, TransactionSigner } from '@algorandfoundation/algokit-transact'\nimport { TransactionComposer } from '../types/composer'\nimport {\n AdditionalTransactionComposerContext,\n SendParams,\n SendTransactionComposerResults,\n TransactionComposerToSend,\n} from '../types/transaction'\nimport { toNumber } from '../util'\n\n/** Represents an unsigned transactions and a signer that can authorize that transaction. */\nexport interface TransactionWithSigner {\n /** An unsigned transaction */\n txn: Transaction\n /** A transaction signer that can authorize txn */\n signer: TransactionSigner\n}\n\n/** Encodes a transaction lease into a 32-byte array ready to be included in an Algorand transaction.\n *\n * @param lease The transaction lease as a string or binary array or null/undefined if there is no lease\n * @returns the transaction lease ready for inclusion in a transaction or `undefined` if there is no lease\n * @throws if the length of the data is > 32 bytes or empty\n * @example algokit.encodeLease('UNIQUE_ID')\n * @example algokit.encodeLease(new Uint8Array([1, 2, 3]))\n */\nexport function encodeLease(lease?: string | Uint8Array): Uint8Array | undefined {\n if (lease === null || typeof lease === 'undefined') {\n return undefined\n } else if (typeof lease === 'object' && lease.constructor === Uint8Array) {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received bytes with length ${lease.length}`,\n )\n }\n if (lease.length === 32) return lease\n const lease32 = new Uint8Array(32)\n lease32.set(lease, 0)\n return lease32\n } else if (typeof lease === 'string') {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received '${lease}' with length ${lease.length}`,\n )\n }\n const encoder = new TextEncoder()\n const lease32 = new Uint8Array(32)\n lease32.set(encoder.encode(lease), 0)\n return lease32\n } else {\n throw new Error(`Unknown lease type received of ${typeof lease}`)\n }\n}\n\n/**\n * @deprecated Use `composer.build()` directly\n * Take an existing Transaction Composer and return a new one with the required\n * app call resources populated into it\n *\n * @param algod The algod client to use for the simulation\n * @param composer The composer containing the txn group\n * @returns A new composer with the resources populated into the transactions\n *\n * @privateRemarks\n *\n * This entire function will eventually be implemented in simulate upstream in algod. The simulate endpoint will return\n * an array of refference arrays for each transaction, so this eventually will eventually just call simulate and set the\n * reference arrays in the transactions to the reference arrays returned by simulate.\n *\n * See https://github.com/algorand/go-algorand/pull/5684\n *\n */\nexport async function populateAppCallResources(composer: TransactionComposer) {\n await composer.build()\n return composer\n}\n\n/**\n * @deprecated Use `composer.setMaxFees()` instead if you need to set max fees for transactions.\n * Use `composer.build()` instead if you need to build transactions with resource population.\n *\n * Take an existing Transaction Composer and return a new one with changes applied to the transactions\n * based on the supplied sendParams to prepare it for sending.\n *\n * @param composer The Transaction Composer containing the txn group\n * @param sendParams The send params for the transaction group\n * @param additionalContext Additional context used to determine how best to change the transactions in the group\n * @returns A new Transaction Composer with the changes applied\n *\n * @privateRemarks\n * Parts of this function will eventually be implemented in algod. Namely:\n * - Simulate will return information on how to populate reference arrays, see https://github.com/algorand/go-algorand/pull/6015\n */\nexport async function prepareGroupForSending(\n composer: TransactionComposer,\n sendParams: SendParams,\n additionalContext?: AdditionalTransactionComposerContext,\n) {\n const newComposer = composer.clone({\n coverAppCallInnerTransactionFees: sendParams.coverAppCallInnerTransactionFees ?? false,\n populateAppCallResources: sendParams.populateAppCallResources ?? true,\n })\n\n if (additionalContext?.maxFees) {\n newComposer.setMaxFees(additionalContext?.maxFees)\n }\n\n await newComposer.build()\n\n return newComposer\n}\n\n/**\n * @deprecated Use `composer.send()` directly\n * Signs and sends transactions that have been collected by an `TransactionComposer`.\n * @param atcSend The parameters controlling the send, including `atc` The `TransactionComposer` and params to control send behaviour\n * @param algod An algod client\n * @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)\n */\nexport const sendTransactionComposer = async function (atcSend: TransactionComposerToSend): Promise<SendTransactionComposerResults> {\n const { transactionComposer: givenComposer, ...executeParams } = atcSend\n\n return atcSend.transactionComposer.send({\n ...executeParams,\n })\n}\n\n/**\n * Wait until the transaction is confirmed or rejected, or until `timeout`\n * number of rounds have passed.\n *\n * @param algod An algod client\n * @param transactionId The transaction ID to wait for\n * @param maxRoundsToWait Maximum number of rounds to wait\n *\n * @return Pending transaction information\n * @throws Throws an error if the transaction is not confirmed or rejected in the next `timeout` rounds\n */\nexport const waitForConfirmation = async function (\n transactionId: string,\n maxRoundsToWait: number | bigint,\n algod: AlgodClient,\n): Promise<PendingTransactionResponse> {\n if (maxRoundsToWait < 0) {\n throw new Error(`Invalid timeout, received ${maxRoundsToWait}, expected > 0`)\n }\n\n // Get current round\n const status = await algod.
|
|
1
|
+
{"version":3,"file":"transaction.js","names":["e: any","toNumber"],"sources":["../../src/transaction/transaction.ts"],"sourcesContent":["import { AlgodClient, PendingTransactionResponse } from '@algorandfoundation/algokit-algod-client'\nimport { Transaction, TransactionSigner } from '@algorandfoundation/algokit-transact'\nimport { TransactionComposer } from '../types/composer'\nimport {\n AdditionalTransactionComposerContext,\n SendParams,\n SendTransactionComposerResults,\n TransactionComposerToSend,\n} from '../types/transaction'\nimport { toNumber } from '../util'\n\n/** Represents an unsigned transactions and a signer that can authorize that transaction. */\nexport interface TransactionWithSigner {\n /** An unsigned transaction */\n txn: Transaction\n /** A transaction signer that can authorize txn */\n signer: TransactionSigner\n}\n\n/** Encodes a transaction lease into a 32-byte array ready to be included in an Algorand transaction.\n *\n * @param lease The transaction lease as a string or binary array or null/undefined if there is no lease\n * @returns the transaction lease ready for inclusion in a transaction or `undefined` if there is no lease\n * @throws if the length of the data is > 32 bytes or empty\n * @example algokit.encodeLease('UNIQUE_ID')\n * @example algokit.encodeLease(new Uint8Array([1, 2, 3]))\n */\nexport function encodeLease(lease?: string | Uint8Array): Uint8Array | undefined {\n if (lease === null || typeof lease === 'undefined') {\n return undefined\n } else if (typeof lease === 'object' && lease.constructor === Uint8Array) {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received bytes with length ${lease.length}`,\n )\n }\n if (lease.length === 32) return lease\n const lease32 = new Uint8Array(32)\n lease32.set(lease, 0)\n return lease32\n } else if (typeof lease === 'string') {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received '${lease}' with length ${lease.length}`,\n )\n }\n const encoder = new TextEncoder()\n const lease32 = new Uint8Array(32)\n lease32.set(encoder.encode(lease), 0)\n return lease32\n } else {\n throw new Error(`Unknown lease type received of ${typeof lease}`)\n }\n}\n\n/**\n * @deprecated Use `composer.build()` directly\n * Take an existing Transaction Composer and return a new one with the required\n * app call resources populated into it\n *\n * @param algod The algod client to use for the simulation\n * @param composer The composer containing the txn group\n * @returns A new composer with the resources populated into the transactions\n *\n * @privateRemarks\n *\n * This entire function will eventually be implemented in simulate upstream in algod. The simulate endpoint will return\n * an array of refference arrays for each transaction, so this eventually will eventually just call simulate and set the\n * reference arrays in the transactions to the reference arrays returned by simulate.\n *\n * See https://github.com/algorand/go-algorand/pull/5684\n *\n */\nexport async function populateAppCallResources(composer: TransactionComposer) {\n await composer.build()\n return composer\n}\n\n/**\n * @deprecated Use `composer.setMaxFees()` instead if you need to set max fees for transactions.\n * Use `composer.build()` instead if you need to build transactions with resource population.\n *\n * Take an existing Transaction Composer and return a new one with changes applied to the transactions\n * based on the supplied sendParams to prepare it for sending.\n *\n * @param composer The Transaction Composer containing the txn group\n * @param sendParams The send params for the transaction group\n * @param additionalContext Additional context used to determine how best to change the transactions in the group\n * @returns A new Transaction Composer with the changes applied\n *\n * @privateRemarks\n * Parts of this function will eventually be implemented in algod. Namely:\n * - Simulate will return information on how to populate reference arrays, see https://github.com/algorand/go-algorand/pull/6015\n */\nexport async function prepareGroupForSending(\n composer: TransactionComposer,\n sendParams: SendParams,\n additionalContext?: AdditionalTransactionComposerContext,\n) {\n const newComposer = composer.clone({\n coverAppCallInnerTransactionFees: sendParams.coverAppCallInnerTransactionFees ?? false,\n populateAppCallResources: sendParams.populateAppCallResources ?? true,\n })\n\n if (additionalContext?.maxFees) {\n newComposer.setMaxFees(additionalContext?.maxFees)\n }\n\n await newComposer.build()\n\n return newComposer\n}\n\n/**\n * @deprecated Use `composer.send()` directly\n * Signs and sends transactions that have been collected by an `TransactionComposer`.\n * @param atcSend The parameters controlling the send, including `atc` The `TransactionComposer` and params to control send behaviour\n * @param algod An algod client\n * @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)\n */\nexport const sendTransactionComposer = async function (atcSend: TransactionComposerToSend): Promise<SendTransactionComposerResults> {\n const { transactionComposer: givenComposer, ...executeParams } = atcSend\n\n return atcSend.transactionComposer.send({\n ...executeParams,\n })\n}\n\n/**\n * Wait until the transaction is confirmed or rejected, or until `timeout`\n * number of rounds have passed.\n *\n * @param algod An algod client\n * @param transactionId The transaction ID to wait for\n * @param maxRoundsToWait Maximum number of rounds to wait\n *\n * @return Pending transaction information\n * @throws Throws an error if the transaction is not confirmed or rejected in the next `timeout` rounds\n */\nexport const waitForConfirmation = async function (\n transactionId: string,\n maxRoundsToWait: number | bigint,\n algod: AlgodClient,\n): Promise<PendingTransactionResponse> {\n if (maxRoundsToWait < 0) {\n throw new Error(`Invalid timeout, received ${maxRoundsToWait}, expected > 0`)\n }\n\n // Get current round\n const status = await algod.status()\n if (status === undefined) {\n throw new Error('Unable to get node status')\n }\n\n // Loop for up to `timeout` rounds looking for a confirmed transaction\n const startRound = BigInt(status.lastRound) + 1n\n let currentRound = startRound\n while (currentRound < startRound + BigInt(maxRoundsToWait)) {\n try {\n const pendingInfo = await algod.pendingTransactionInformation(transactionId)\n\n if (pendingInfo !== undefined) {\n const confirmedRound = pendingInfo.confirmedRound\n if (confirmedRound && confirmedRound > 0) {\n return pendingInfo\n } else {\n const poolError = pendingInfo.poolError\n if (poolError != null && poolError.length > 0) {\n // If there was a pool error, then the transaction has been rejected!\n throw new Error(`Transaction ${transactionId} was rejected; pool error: ${poolError}`)\n }\n }\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (e: any) {\n if ('status' in e && e.status === 404) {\n currentRound++\n continue\n }\n }\n\n await algod.statusAfterBlock(toNumber(currentRound))\n currentRound++\n }\n\n throw new Error(`Transaction ${transactionId} not confirmed after ${maxRoundsToWait} rounds`)\n}\n"],"mappings":";;;;;;;;;;;AA2BA,SAAgB,YAAY,OAAqD;AAC/E,KAAI,UAAU,QAAQ,OAAO,UAAU,YACrC;UACS,OAAO,UAAU,YAAY,MAAM,gBAAgB,YAAY;AACxE,MAAI,MAAM,WAAW,KAAK,MAAM,SAAS,GACvC,OAAM,IAAI,MACR,2GAA2G,MAAM,SAClH;AAEH,MAAI,MAAM,WAAW,GAAI,QAAO;EAChC,MAAM,UAAU,IAAI,WAAW,GAAG;AAClC,UAAQ,IAAI,OAAO,EAAE;AACrB,SAAO;YACE,OAAO,UAAU,UAAU;AACpC,MAAI,MAAM,WAAW,KAAK,MAAM,SAAS,GACvC,OAAM,IAAI,MACR,0FAA0F,MAAM,gBAAgB,MAAM,SACvH;EAEH,MAAM,UAAU,IAAI,aAAa;EACjC,MAAM,UAAU,IAAI,WAAW,GAAG;AAClC,UAAQ,IAAI,QAAQ,OAAO,MAAM,EAAE,EAAE;AACrC,SAAO;OAEP,OAAM,IAAI,MAAM,kCAAkC,OAAO,QAAQ;;;;;;;;;;;;;;;;;;;;AAsBrE,eAAsB,yBAAyB,UAA+B;AAC5E,OAAM,SAAS,OAAO;AACtB,QAAO;;;;;;;;;;;;;;;;;;AAmBT,eAAsB,uBACpB,UACA,YACA,mBACA;CACA,MAAM,cAAc,SAAS,MAAM;EACjC,kCAAkC,WAAW,oCAAoC;EACjF,0BAA0B,WAAW,4BAA4B;EAClE,CAAC;AAEF,KAAI,mBAAmB,QACrB,aAAY,WAAW,mBAAmB,QAAQ;AAGpD,OAAM,YAAY,OAAO;AAEzB,QAAO;;;;;;;;;AAUT,MAAa,0BAA0B,eAAgB,SAA6E;CAClI,MAAM,EAAE,qBAAqB,eAAe,GAAG,kBAAkB;AAEjE,QAAO,QAAQ,oBAAoB,KAAK,EACtC,GAAG,eACJ,CAAC;;;;;;;;;;;;;AAcJ,MAAa,sBAAsB,eACjC,eACA,iBACA,OACqC;AACrC,KAAI,kBAAkB,EACpB,OAAM,IAAI,MAAM,6BAA6B,gBAAgB,gBAAgB;CAI/E,MAAM,SAAS,MAAM,MAAM,QAAQ;AACnC,KAAI,WAAW,OACb,OAAM,IAAI,MAAM,4BAA4B;CAI9C,MAAM,aAAa,OAAO,OAAO,UAAU,GAAG;CAC9C,IAAI,eAAe;AACnB,QAAO,eAAe,aAAa,OAAO,gBAAgB,EAAE;AAC1D,MAAI;GACF,MAAM,cAAc,MAAM,MAAM,8BAA8B,cAAc;AAE5E,OAAI,gBAAgB,QAAW;IAC7B,MAAM,iBAAiB,YAAY;AACnC,QAAI,kBAAkB,iBAAiB,EACrC,QAAO;SACF;KACL,MAAM,YAAY,YAAY;AAC9B,SAAI,aAAa,QAAQ,UAAU,SAAS,EAE1C,OAAM,IAAI,MAAM,eAAe,cAAc,6BAA6B,YAAY;;;WAKrFA,GAAQ;AACf,OAAI,YAAY,KAAK,EAAE,WAAW,KAAK;AACrC;AACA;;;AAIJ,QAAM,MAAM,iBAAiBC,sBAAS,aAAa,CAAC;AACpD;;AAGF,OAAM,IAAI,MAAM,eAAe,cAAc,uBAAuB,gBAAgB,SAAS"}
|
|
@@ -80,7 +80,7 @@ async function prepareGroupForSending(composer, sendParams, additionalContext) {
|
|
|
80
80
|
* @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)
|
|
81
81
|
*/
|
|
82
82
|
const sendTransactionComposer = async function(atcSend) {
|
|
83
|
-
const { transactionComposer: givenComposer
|
|
83
|
+
const { transactionComposer: givenComposer, ...executeParams } = atcSend;
|
|
84
84
|
return atcSend.transactionComposer.send({ ...executeParams });
|
|
85
85
|
};
|
|
86
86
|
/**
|
|
@@ -96,7 +96,7 @@ const sendTransactionComposer = async function(atcSend) {
|
|
|
96
96
|
*/
|
|
97
97
|
const waitForConfirmation = async function(transactionId, maxRoundsToWait, algod) {
|
|
98
98
|
if (maxRoundsToWait < 0) throw new Error(`Invalid timeout, received ${maxRoundsToWait}, expected > 0`);
|
|
99
|
-
const status = await algod.
|
|
99
|
+
const status = await algod.status();
|
|
100
100
|
if (status === void 0) throw new Error("Unable to get node status");
|
|
101
101
|
const startRound = BigInt(status.lastRound) + 1n;
|
|
102
102
|
let currentRound = startRound;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.mjs","names":["e: any"],"sources":["../../src/transaction/transaction.ts"],"sourcesContent":["import { AlgodClient, PendingTransactionResponse } from '@algorandfoundation/algokit-algod-client'\nimport { Transaction, TransactionSigner } from '@algorandfoundation/algokit-transact'\nimport { TransactionComposer } from '../types/composer'\nimport {\n AdditionalTransactionComposerContext,\n SendParams,\n SendTransactionComposerResults,\n TransactionComposerToSend,\n} from '../types/transaction'\nimport { toNumber } from '../util'\n\n/** Represents an unsigned transactions and a signer that can authorize that transaction. */\nexport interface TransactionWithSigner {\n /** An unsigned transaction */\n txn: Transaction\n /** A transaction signer that can authorize txn */\n signer: TransactionSigner\n}\n\n/** Encodes a transaction lease into a 32-byte array ready to be included in an Algorand transaction.\n *\n * @param lease The transaction lease as a string or binary array or null/undefined if there is no lease\n * @returns the transaction lease ready for inclusion in a transaction or `undefined` if there is no lease\n * @throws if the length of the data is > 32 bytes or empty\n * @example algokit.encodeLease('UNIQUE_ID')\n * @example algokit.encodeLease(new Uint8Array([1, 2, 3]))\n */\nexport function encodeLease(lease?: string | Uint8Array): Uint8Array | undefined {\n if (lease === null || typeof lease === 'undefined') {\n return undefined\n } else if (typeof lease === 'object' && lease.constructor === Uint8Array) {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received bytes with length ${lease.length}`,\n )\n }\n if (lease.length === 32) return lease\n const lease32 = new Uint8Array(32)\n lease32.set(lease, 0)\n return lease32\n } else if (typeof lease === 'string') {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received '${lease}' with length ${lease.length}`,\n )\n }\n const encoder = new TextEncoder()\n const lease32 = new Uint8Array(32)\n lease32.set(encoder.encode(lease), 0)\n return lease32\n } else {\n throw new Error(`Unknown lease type received of ${typeof lease}`)\n }\n}\n\n/**\n * @deprecated Use `composer.build()` directly\n * Take an existing Transaction Composer and return a new one with the required\n * app call resources populated into it\n *\n * @param algod The algod client to use for the simulation\n * @param composer The composer containing the txn group\n * @returns A new composer with the resources populated into the transactions\n *\n * @privateRemarks\n *\n * This entire function will eventually be implemented in simulate upstream in algod. The simulate endpoint will return\n * an array of refference arrays for each transaction, so this eventually will eventually just call simulate and set the\n * reference arrays in the transactions to the reference arrays returned by simulate.\n *\n * See https://github.com/algorand/go-algorand/pull/5684\n *\n */\nexport async function populateAppCallResources(composer: TransactionComposer) {\n await composer.build()\n return composer\n}\n\n/**\n * @deprecated Use `composer.setMaxFees()` instead if you need to set max fees for transactions.\n * Use `composer.build()` instead if you need to build transactions with resource population.\n *\n * Take an existing Transaction Composer and return a new one with changes applied to the transactions\n * based on the supplied sendParams to prepare it for sending.\n *\n * @param composer The Transaction Composer containing the txn group\n * @param sendParams The send params for the transaction group\n * @param additionalContext Additional context used to determine how best to change the transactions in the group\n * @returns A new Transaction Composer with the changes applied\n *\n * @privateRemarks\n * Parts of this function will eventually be implemented in algod. Namely:\n * - Simulate will return information on how to populate reference arrays, see https://github.com/algorand/go-algorand/pull/6015\n */\nexport async function prepareGroupForSending(\n composer: TransactionComposer,\n sendParams: SendParams,\n additionalContext?: AdditionalTransactionComposerContext,\n) {\n const newComposer = composer.clone({\n coverAppCallInnerTransactionFees: sendParams.coverAppCallInnerTransactionFees ?? false,\n populateAppCallResources: sendParams.populateAppCallResources ?? true,\n })\n\n if (additionalContext?.maxFees) {\n newComposer.setMaxFees(additionalContext?.maxFees)\n }\n\n await newComposer.build()\n\n return newComposer\n}\n\n/**\n * @deprecated Use `composer.send()` directly\n * Signs and sends transactions that have been collected by an `TransactionComposer`.\n * @param atcSend The parameters controlling the send, including `atc` The `TransactionComposer` and params to control send behaviour\n * @param algod An algod client\n * @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)\n */\nexport const sendTransactionComposer = async function (atcSend: TransactionComposerToSend): Promise<SendTransactionComposerResults> {\n const { transactionComposer: givenComposer, ...executeParams } = atcSend\n\n return atcSend.transactionComposer.send({\n ...executeParams,\n })\n}\n\n/**\n * Wait until the transaction is confirmed or rejected, or until `timeout`\n * number of rounds have passed.\n *\n * @param algod An algod client\n * @param transactionId The transaction ID to wait for\n * @param maxRoundsToWait Maximum number of rounds to wait\n *\n * @return Pending transaction information\n * @throws Throws an error if the transaction is not confirmed or rejected in the next `timeout` rounds\n */\nexport const waitForConfirmation = async function (\n transactionId: string,\n maxRoundsToWait: number | bigint,\n algod: AlgodClient,\n): Promise<PendingTransactionResponse> {\n if (maxRoundsToWait < 0) {\n throw new Error(`Invalid timeout, received ${maxRoundsToWait}, expected > 0`)\n }\n\n // Get current round\n const status = await algod.
|
|
1
|
+
{"version":3,"file":"transaction.mjs","names":["e: any"],"sources":["../../src/transaction/transaction.ts"],"sourcesContent":["import { AlgodClient, PendingTransactionResponse } from '@algorandfoundation/algokit-algod-client'\nimport { Transaction, TransactionSigner } from '@algorandfoundation/algokit-transact'\nimport { TransactionComposer } from '../types/composer'\nimport {\n AdditionalTransactionComposerContext,\n SendParams,\n SendTransactionComposerResults,\n TransactionComposerToSend,\n} from '../types/transaction'\nimport { toNumber } from '../util'\n\n/** Represents an unsigned transactions and a signer that can authorize that transaction. */\nexport interface TransactionWithSigner {\n /** An unsigned transaction */\n txn: Transaction\n /** A transaction signer that can authorize txn */\n signer: TransactionSigner\n}\n\n/** Encodes a transaction lease into a 32-byte array ready to be included in an Algorand transaction.\n *\n * @param lease The transaction lease as a string or binary array or null/undefined if there is no lease\n * @returns the transaction lease ready for inclusion in a transaction or `undefined` if there is no lease\n * @throws if the length of the data is > 32 bytes or empty\n * @example algokit.encodeLease('UNIQUE_ID')\n * @example algokit.encodeLease(new Uint8Array([1, 2, 3]))\n */\nexport function encodeLease(lease?: string | Uint8Array): Uint8Array | undefined {\n if (lease === null || typeof lease === 'undefined') {\n return undefined\n } else if (typeof lease === 'object' && lease.constructor === Uint8Array) {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received bytes with length ${lease.length}`,\n )\n }\n if (lease.length === 32) return lease\n const lease32 = new Uint8Array(32)\n lease32.set(lease, 0)\n return lease32\n } else if (typeof lease === 'string') {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received '${lease}' with length ${lease.length}`,\n )\n }\n const encoder = new TextEncoder()\n const lease32 = new Uint8Array(32)\n lease32.set(encoder.encode(lease), 0)\n return lease32\n } else {\n throw new Error(`Unknown lease type received of ${typeof lease}`)\n }\n}\n\n/**\n * @deprecated Use `composer.build()` directly\n * Take an existing Transaction Composer and return a new one with the required\n * app call resources populated into it\n *\n * @param algod The algod client to use for the simulation\n * @param composer The composer containing the txn group\n * @returns A new composer with the resources populated into the transactions\n *\n * @privateRemarks\n *\n * This entire function will eventually be implemented in simulate upstream in algod. The simulate endpoint will return\n * an array of refference arrays for each transaction, so this eventually will eventually just call simulate and set the\n * reference arrays in the transactions to the reference arrays returned by simulate.\n *\n * See https://github.com/algorand/go-algorand/pull/5684\n *\n */\nexport async function populateAppCallResources(composer: TransactionComposer) {\n await composer.build()\n return composer\n}\n\n/**\n * @deprecated Use `composer.setMaxFees()` instead if you need to set max fees for transactions.\n * Use `composer.build()` instead if you need to build transactions with resource population.\n *\n * Take an existing Transaction Composer and return a new one with changes applied to the transactions\n * based on the supplied sendParams to prepare it for sending.\n *\n * @param composer The Transaction Composer containing the txn group\n * @param sendParams The send params for the transaction group\n * @param additionalContext Additional context used to determine how best to change the transactions in the group\n * @returns A new Transaction Composer with the changes applied\n *\n * @privateRemarks\n * Parts of this function will eventually be implemented in algod. Namely:\n * - Simulate will return information on how to populate reference arrays, see https://github.com/algorand/go-algorand/pull/6015\n */\nexport async function prepareGroupForSending(\n composer: TransactionComposer,\n sendParams: SendParams,\n additionalContext?: AdditionalTransactionComposerContext,\n) {\n const newComposer = composer.clone({\n coverAppCallInnerTransactionFees: sendParams.coverAppCallInnerTransactionFees ?? false,\n populateAppCallResources: sendParams.populateAppCallResources ?? true,\n })\n\n if (additionalContext?.maxFees) {\n newComposer.setMaxFees(additionalContext?.maxFees)\n }\n\n await newComposer.build()\n\n return newComposer\n}\n\n/**\n * @deprecated Use `composer.send()` directly\n * Signs and sends transactions that have been collected by an `TransactionComposer`.\n * @param atcSend The parameters controlling the send, including `atc` The `TransactionComposer` and params to control send behaviour\n * @param algod An algod client\n * @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)\n */\nexport const sendTransactionComposer = async function (atcSend: TransactionComposerToSend): Promise<SendTransactionComposerResults> {\n const { transactionComposer: givenComposer, ...executeParams } = atcSend\n\n return atcSend.transactionComposer.send({\n ...executeParams,\n })\n}\n\n/**\n * Wait until the transaction is confirmed or rejected, or until `timeout`\n * number of rounds have passed.\n *\n * @param algod An algod client\n * @param transactionId The transaction ID to wait for\n * @param maxRoundsToWait Maximum number of rounds to wait\n *\n * @return Pending transaction information\n * @throws Throws an error if the transaction is not confirmed or rejected in the next `timeout` rounds\n */\nexport const waitForConfirmation = async function (\n transactionId: string,\n maxRoundsToWait: number | bigint,\n algod: AlgodClient,\n): Promise<PendingTransactionResponse> {\n if (maxRoundsToWait < 0) {\n throw new Error(`Invalid timeout, received ${maxRoundsToWait}, expected > 0`)\n }\n\n // Get current round\n const status = await algod.status()\n if (status === undefined) {\n throw new Error('Unable to get node status')\n }\n\n // Loop for up to `timeout` rounds looking for a confirmed transaction\n const startRound = BigInt(status.lastRound) + 1n\n let currentRound = startRound\n while (currentRound < startRound + BigInt(maxRoundsToWait)) {\n try {\n const pendingInfo = await algod.pendingTransactionInformation(transactionId)\n\n if (pendingInfo !== undefined) {\n const confirmedRound = pendingInfo.confirmedRound\n if (confirmedRound && confirmedRound > 0) {\n return pendingInfo\n } else {\n const poolError = pendingInfo.poolError\n if (poolError != null && poolError.length > 0) {\n // If there was a pool error, then the transaction has been rejected!\n throw new Error(`Transaction ${transactionId} was rejected; pool error: ${poolError}`)\n }\n }\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (e: any) {\n if ('status' in e && e.status === 404) {\n currentRound++\n continue\n }\n }\n\n await algod.statusAfterBlock(toNumber(currentRound))\n currentRound++\n }\n\n throw new Error(`Transaction ${transactionId} not confirmed after ${maxRoundsToWait} rounds`)\n}\n"],"mappings":";;;;;;;;;;;AA2BA,SAAgB,YAAY,OAAqD;AAC/E,KAAI,UAAU,QAAQ,OAAO,UAAU,YACrC;UACS,OAAO,UAAU,YAAY,MAAM,gBAAgB,YAAY;AACxE,MAAI,MAAM,WAAW,KAAK,MAAM,SAAS,GACvC,OAAM,IAAI,MACR,2GAA2G,MAAM,SAClH;AAEH,MAAI,MAAM,WAAW,GAAI,QAAO;EAChC,MAAM,UAAU,IAAI,WAAW,GAAG;AAClC,UAAQ,IAAI,OAAO,EAAE;AACrB,SAAO;YACE,OAAO,UAAU,UAAU;AACpC,MAAI,MAAM,WAAW,KAAK,MAAM,SAAS,GACvC,OAAM,IAAI,MACR,0FAA0F,MAAM,gBAAgB,MAAM,SACvH;EAEH,MAAM,UAAU,IAAI,aAAa;EACjC,MAAM,UAAU,IAAI,WAAW,GAAG;AAClC,UAAQ,IAAI,QAAQ,OAAO,MAAM,EAAE,EAAE;AACrC,SAAO;OAEP,OAAM,IAAI,MAAM,kCAAkC,OAAO,QAAQ;;;;;;;;;;;;;;;;;;;;AAsBrE,eAAsB,yBAAyB,UAA+B;AAC5E,OAAM,SAAS,OAAO;AACtB,QAAO;;;;;;;;;;;;;;;;;;AAmBT,eAAsB,uBACpB,UACA,YACA,mBACA;CACA,MAAM,cAAc,SAAS,MAAM;EACjC,kCAAkC,WAAW,oCAAoC;EACjF,0BAA0B,WAAW,4BAA4B;EAClE,CAAC;AAEF,KAAI,mBAAmB,QACrB,aAAY,WAAW,mBAAmB,QAAQ;AAGpD,OAAM,YAAY,OAAO;AAEzB,QAAO;;;;;;;;;AAUT,MAAa,0BAA0B,eAAgB,SAA6E;CAClI,MAAM,EAAE,qBAAqB,eAAe,GAAG,kBAAkB;AAEjE,QAAO,QAAQ,oBAAoB,KAAK,EACtC,GAAG,eACJ,CAAC;;;;;;;;;;;;;AAcJ,MAAa,sBAAsB,eACjC,eACA,iBACA,OACqC;AACrC,KAAI,kBAAkB,EACpB,OAAM,IAAI,MAAM,6BAA6B,gBAAgB,gBAAgB;CAI/E,MAAM,SAAS,MAAM,MAAM,QAAQ;AACnC,KAAI,WAAW,OACb,OAAM,IAAI,MAAM,4BAA4B;CAI9C,MAAM,aAAa,OAAO,OAAO,UAAU,GAAG;CAC9C,IAAI,eAAe;AACnB,QAAO,eAAe,aAAa,OAAO,gBAAgB,EAAE;AAC1D,MAAI;GACF,MAAM,cAAc,MAAM,MAAM,8BAA8B,cAAc;AAE5E,OAAI,gBAAgB,QAAW;IAC7B,MAAM,iBAAiB,YAAY;AACnC,QAAI,kBAAkB,iBAAiB,EACrC,QAAO;SACF;KACL,MAAM,YAAY,YAAY;AAC9B,SAAI,aAAa,QAAQ,UAAU,SAAS,EAE1C,OAAM,IAAI,MAAM,eAAe,cAAc,6BAA6B,YAAY;;;WAKrFA,GAAQ;AACf,OAAI,YAAY,KAAK,EAAE,WAAW,KAAK;AACrC;AACA;;;AAIJ,QAAM,MAAM,iBAAiB,SAAS,aAAa,CAAC;AACpD;;AAGF,OAAM,IAAI,MAAM,eAAe,cAAc,uBAAuB,gBAAgB,SAAS"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReadableAddress } from "../packages/common/src/address.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Expand } from "../packages/common/src/expand.js";
|
|
3
|
+
import { OnApplicationComplete, ResourceReference } from "../packages/transact/src/transactions/app-call.js";
|
|
3
4
|
import { BoxIdentifier, BoxReference } from "../types/app-manager.js";
|
|
4
|
-
import { Expand } from "../types/expand.js";
|
|
5
5
|
import { CommonTransactionParams } from "./common.js";
|
|
6
6
|
|
|
7
7
|
//#region src/transactions/app-call.d.ts
|
|
@@ -26,12 +26,13 @@ type CommonAppCallParams = CommonTransactionParams & {
|
|
|
26
26
|
*/
|
|
27
27
|
boxReferences?: (BoxReference | BoxIdentifier)[];
|
|
28
28
|
/** Access references unifies `accountReferences`, `appReferences`, `assetReferences`, and `boxReferences` under a single list. If non-empty, these other reference lists must be empty. If access is empty, those other reference lists may be non-empty. */
|
|
29
|
-
accessReferences?:
|
|
30
|
-
/**
|
|
29
|
+
accessReferences?: ResourceReference[];
|
|
30
|
+
/** If set, the transaction will be rejected when the app's version is greater than or equal to this value. This can be used to prevent calling an app after it has been updated. Set to 0 or leave undefined to skip the version check. */
|
|
31
31
|
rejectVersion?: number;
|
|
32
32
|
};
|
|
33
33
|
/** Parameters to define an app create transaction */
|
|
34
34
|
type AppCreateParams = Expand<Omit<CommonAppCallParams, 'appId'> & {
|
|
35
|
+
appId?: 0;
|
|
35
36
|
onComplete?: Exclude<OnApplicationComplete, OnApplicationComplete.ClearState>;
|
|
36
37
|
/** The program to execute for all OnCompletes other than ClearState as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). */
|
|
37
38
|
approvalProgram: string | Uint8Array;
|
package/transactions/app-call.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_constants = require('../packages/common/src/constants.js');
|
|
2
2
|
const require_address = require('../packages/common/src/address.js');
|
|
3
|
+
const require_util = require('../util.js');
|
|
3
4
|
const require_app_call = require('../packages/transact/src/transactions/app-call.js');
|
|
4
5
|
const require_transaction_type = require('../packages/transact/src/transactions/transaction-type.js');
|
|
5
6
|
const require_transaction = require('../packages/transact/src/transactions/transaction.js');
|
|
6
|
-
const require_util = require('../util.js');
|
|
7
7
|
const require_app_manager = require('../types/app-manager.js');
|
|
8
8
|
const require_common = require('./common.js');
|
|
9
9
|
|
|
@@ -143,16 +143,16 @@ function populateGroupResources(transactions, groupResources) {
|
|
|
143
143
|
type: GroupResourceType.AppLocal,
|
|
144
144
|
data: appLocal
|
|
145
145
|
});
|
|
146
|
-
remainingAccounts = remainingAccounts.filter((acc) => acc !== appLocal.
|
|
147
|
-
remainingApps = remainingApps.filter((app) => app !== appLocal.
|
|
146
|
+
remainingAccounts = remainingAccounts.filter((acc) => acc !== appLocal.address);
|
|
147
|
+
remainingApps = remainingApps.filter((app) => app !== appLocal.appId);
|
|
148
148
|
});
|
|
149
149
|
if (groupResources.assetHoldings) groupResources.assetHoldings.forEach((assetHolding) => {
|
|
150
150
|
populateGroupResource(transactions, {
|
|
151
151
|
type: GroupResourceType.AssetHolding,
|
|
152
152
|
data: assetHolding
|
|
153
153
|
});
|
|
154
|
-
remainingAccounts = remainingAccounts.filter((acc) => acc !== assetHolding.
|
|
155
|
-
remainingAssets = remainingAssets.filter((asset) => asset !== assetHolding.
|
|
154
|
+
remainingAccounts = remainingAccounts.filter((acc) => acc !== assetHolding.address);
|
|
155
|
+
remainingAssets = remainingAssets.filter((asset) => asset !== assetHolding.assetId);
|
|
156
156
|
});
|
|
157
157
|
remainingAccounts.forEach((account) => {
|
|
158
158
|
populateGroupResource(transactions, {
|
|
@@ -164,11 +164,11 @@ function populateGroupResources(transactions, groupResources) {
|
|
|
164
164
|
populateGroupResource(transactions, {
|
|
165
165
|
type: GroupResourceType.Box,
|
|
166
166
|
data: {
|
|
167
|
-
appId: boxRef.
|
|
167
|
+
appId: boxRef.appId,
|
|
168
168
|
name: boxRef.name
|
|
169
169
|
}
|
|
170
170
|
});
|
|
171
|
-
remainingApps = remainingApps.filter((app) => app !== boxRef.
|
|
171
|
+
remainingApps = remainingApps.filter((app) => app !== boxRef.appId);
|
|
172
172
|
});
|
|
173
173
|
remainingAssets.forEach((asset) => {
|
|
174
174
|
populateGroupResource(transactions, {
|
|
@@ -201,7 +201,7 @@ function isAppCallBelowResourceLimit(txn) {
|
|
|
201
201
|
*/
|
|
202
202
|
function populateGroupResource(transactions, resource) {
|
|
203
203
|
if (resource.type === GroupResourceType.AssetHolding || resource.type === GroupResourceType.AppLocal) {
|
|
204
|
-
const address = resource.data.
|
|
204
|
+
const address = resource.data.address;
|
|
205
205
|
const groupIndex1 = transactions.findIndex((txn) => {
|
|
206
206
|
if (!isAppCallBelowResourceLimit(txn)) return false;
|
|
207
207
|
const appCall$1 = txn.appCall;
|
|
@@ -216,10 +216,10 @@ function populateGroupResource(transactions, resource) {
|
|
|
216
216
|
const appCall$1 = transactions[groupIndex1].appCall;
|
|
217
217
|
if (resource.type === GroupResourceType.AssetHolding) {
|
|
218
218
|
appCall$1.assetReferences = appCall$1.assetReferences ?? [];
|
|
219
|
-
if (!appCall$1.assetReferences.includes(resource.data.
|
|
219
|
+
if (!appCall$1.assetReferences.includes(resource.data.assetId)) appCall$1.assetReferences.push(resource.data.assetId);
|
|
220
220
|
} else {
|
|
221
221
|
appCall$1.appReferences = appCall$1.appReferences ?? [];
|
|
222
|
-
if (!appCall$1.appReferences.includes(resource.data.
|
|
222
|
+
if (!appCall$1.appReferences.includes(resource.data.appId)) appCall$1.appReferences.push(resource.data.appId);
|
|
223
223
|
}
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
@@ -227,8 +227,8 @@ function populateGroupResource(transactions, resource) {
|
|
|
227
227
|
if (!isAppCallBelowResourceLimit(txn)) return false;
|
|
228
228
|
const appCall$1 = txn.appCall;
|
|
229
229
|
if ((appCall$1.accountReferences?.length ?? 0) >= require_constants.MAX_ACCOUNT_REFERENCES) return false;
|
|
230
|
-
if (resource.type === GroupResourceType.AssetHolding) return appCall$1.assetReferences?.includes(resource.data.
|
|
231
|
-
else return appCall$1.appReferences?.includes(resource.data.
|
|
230
|
+
if (resource.type === GroupResourceType.AssetHolding) return appCall$1.assetReferences?.includes(resource.data.assetId) || false;
|
|
231
|
+
else return appCall$1.appReferences?.includes(resource.data.appId) || appCall$1.appId === resource.data.appId;
|
|
232
232
|
});
|
|
233
233
|
if (groupIndex2 !== -1) {
|
|
234
234
|
const appCall$1 = transactions[groupIndex2].appCall;
|
|
@@ -303,16 +303,16 @@ function populateGroupResource(transactions, resource) {
|
|
|
303
303
|
break;
|
|
304
304
|
case GroupResourceType.AssetHolding: {
|
|
305
305
|
appCall.assetReferences = appCall.assetReferences ?? [];
|
|
306
|
-
if (!appCall.assetReferences.includes(resource.data.
|
|
307
|
-
const address = resource.data.
|
|
306
|
+
if (!appCall.assetReferences.includes(resource.data.assetId)) appCall.assetReferences.push(resource.data.assetId);
|
|
307
|
+
const address = resource.data.address;
|
|
308
308
|
appCall.accountReferences = appCall.accountReferences ?? [];
|
|
309
309
|
if (!appCall.accountReferences.some((a) => a.equals(address))) appCall.accountReferences.push(address);
|
|
310
310
|
break;
|
|
311
311
|
}
|
|
312
312
|
case GroupResourceType.AppLocal: {
|
|
313
313
|
appCall.appReferences = appCall.appReferences ?? [];
|
|
314
|
-
if (!appCall.appReferences.includes(resource.data.
|
|
315
|
-
const address = resource.data.
|
|
314
|
+
if (!appCall.appReferences.includes(resource.data.appId)) appCall.appReferences.push(resource.data.appId);
|
|
315
|
+
const address = resource.data.address;
|
|
316
316
|
appCall.accountReferences = appCall.accountReferences ?? [];
|
|
317
317
|
if (!appCall.accountReferences.some((a) => a.equals(address))) appCall.accountReferences.push(address);
|
|
318
318
|
break;
|