@algorandfoundation/algokit-utils 10.0.0-alpha.2 → 10.0.0-alpha.21
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/algo25/index.d.ts +2 -0
- package/algo25/index.js +9 -0
- package/algo25/index.mjs +3 -0
- 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 +1 -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 -1
- package/packages/abi/src/abi-type.js +4 -2
- package/packages/abi/src/abi-type.js.map +1 -1
- package/packages/abi/src/abi-type.mjs +4 -2
- 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/algo25/src/index.d.ts +40 -0
- package/packages/algo25/src/index.js +45 -1
- package/packages/algo25/src/index.js.map +1 -1
- package/packages/algo25/src/index.mjs +40 -2
- package/packages/algo25/src/index.mjs.map +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/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.js +0 -14
- package/packages/common/src/address.js.map +1 -1
- package/packages/common/src/address.mjs +1 -14
- 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.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.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 +3 -15
- package/packages/transact/src/logicsig.js +16 -36
- package/packages/transact/src/logicsig.js.map +1 -1
- package/packages/transact/src/logicsig.mjs +18 -36
- package/packages/transact/src/logicsig.mjs.map +1 -1
- package/packages/transact/src/multisig.d.ts +7 -115
- package/packages/transact/src/multisig.js +86 -136
- package/packages/transact/src/multisig.js.map +1 -1
- package/packages/transact/src/multisig.mjs +87 -117
- package/packages/transact/src/multisig.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 +2 -3
- package/packages/transact/src/transactions/signed-transaction-meta.js.map +1 -1
- package/packages/transact/src/transactions/signed-transaction-meta.mjs +3 -3
- package/packages/transact/src/transactions/signed-transaction-meta.mjs.map +1 -1
- package/packages/transact/src/transactions/signed-transaction.d.ts +7 -3
- 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/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 -1
- package/packages/transact/src/transactions/transaction.js +1 -1
- package/packages/transact/src/transactions/transaction.js.map +1 -1
- package/packages/transact/src/transactions/transaction.mjs +1 -1
- package/packages/transact/src/transactions/transaction.mjs.map +1 -1
- package/testing/account.js +2 -5
- package/testing/account.js.map +1 -1
- package/testing/account.mjs +2 -5
- 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 -32
- 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 +70 -78
- package/transactions/method-call.js.map +1 -1
- package/transactions/method-call.mjs +70 -78
- package/transactions/method-call.mjs.map +1 -1
- package/types/account-manager.d.ts +1 -1
- package/types/account-manager.js +5 -5
- package/types/account-manager.js.map +1 -1
- package/types/account-manager.mjs +5 -5
- package/types/account-manager.mjs.map +1 -1
- package/types/algorand-client-transaction-creator.d.ts +74 -60
- 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 +79 -65
- 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 +174 -169
- 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 +70 -67
- 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 +9 -1
- package/types/composer.js +49 -37
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +40 -27
- 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 +2 -2
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-call.js","names":["TransactionValidationErrorType","MAX_EXTRA_PROGRAM_PAGES","PROGRAM_PAGE_SIZE","MAX_GLOBAL_STATE_KEYS","MAX_LOCAL_STATE_KEYS","MAX_APP_ARGS","MAX_ARGS_SIZE","MAX_ACCOUNT_REFERENCES","MAX_APP_REFERENCES","MAX_ASSET_REFERENCES","MAX_BOX_REFERENCES","MAX_OVERALL_REFERENCES"],"sources":["../../../../../packages/transact/src/transactions/app-call.ts"],"sourcesContent":["import {\n MAX_ACCOUNT_REFERENCES,\n MAX_APP_ARGS,\n MAX_APP_REFERENCES,\n MAX_ARGS_SIZE,\n MAX_ASSET_REFERENCES,\n MAX_BOX_REFERENCES,\n MAX_EXTRA_PROGRAM_PAGES,\n MAX_GLOBAL_STATE_KEYS,\n MAX_LOCAL_STATE_KEYS,\n MAX_OVERALL_REFERENCES,\n PROGRAM_PAGE_SIZE,\n Address,\n} from '@algorandfoundation/algokit-common'\nimport { TransactionValidationError, TransactionValidationErrorType } from './common'\n\n/**\n * Represents an app call transaction that interacts with Algorand Smart Contracts.\n *\n * App call transactions are used to create, update, delete, opt-in to,\n * close out of, or clear state from Algorand apps (smart contracts).\n */\nexport type AppCallTransactionFields = {\n /**\n * ID of the app being called.\n *\n * Set this to 0 to indicate an app creation call.\n */\n appId: bigint\n\n /**\n * Defines what additional actions occur with the transaction.\n */\n onComplete: OnApplicationComplete\n\n /**\n * Logic executed for every app call transaction, except when\n * on-completion is set to \"clear\".\n *\n * Approval programs may reject the transaction.\n * Only required for app creation and update transactions.\n */\n approvalProgram?: Uint8Array\n\n /**\n * Logic executed for app call transactions with on-completion set to \"clear\".\n *\n * Clear state programs cannot reject the transaction.\n * Only required for app creation and update transactions.\n */\n clearStateProgram?: Uint8Array\n\n /**\n * Holds the maximum number of global state values.\n *\n * Only required for app creation transactions.\n * This cannot be changed after creation.\n */\n globalStateSchema?: StateSchema\n\n /**\n * Holds the maximum number of local state values.\n *\n * Only required for app creation transactions.\n * This cannot be changed after creation.\n */\n localStateSchema?: StateSchema\n\n /**\n * Number of additional pages allocated to the app's approval\n * and clear state programs.\n *\n * Each extra program page is 2048 bytes. The sum of approval program\n * and clear state program may not exceed 2048*(1+extra_program_pages) bytes.\n * Currently, the maximum value is 3.\n * This cannot be changed after creation.\n */\n extraProgramPages?: number\n\n /**\n * Transaction specific arguments available in the app's\n * approval program and clear state program.\n */\n args?: Uint8Array[]\n\n /**\n * List of accounts in addition to the sender that may be accessed\n * from the app's approval program and clear state program.\n */\n accountReferences?: Address[]\n\n /**\n * List of apps in addition to the current app that may be called\n * from the app's approval program and clear state program.\n */\n appReferences?: bigint[]\n\n /**\n * Lists the assets whose parameters may be accessed by this app's\n * approval program and clear state program.\n *\n * The access is read-only.\n */\n assetReferences?: bigint[]\n\n /**\n * The boxes that should be made available for the runtime of the program.\n */\n boxReferences?: BoxReference[]\n\n /**\n * Resources accessed by the application\n */\n accessReferences?: AccessReference[]\n\n /**\n * The lowest application version for which this transaction should immediately fail. 0 indicates that no version check should be performed.\n */\n rejectVersion?: number\n}\n\n/**\n * On-completion actions for application transactions.\n *\n * These values define what additional actions occur with the transaction.\n */\nexport enum OnApplicationComplete {\n /**\n * NoOp indicates that an app transaction will simply call its\n * approval program without any additional action.\n */\n NoOp,\n /**\n * OptIn indicates that an app transaction will allocate some\n * local state for the app in the sender's account.\n */\n OptIn,\n /**\n * CloseOut indicates that an app transaction will deallocate\n * some local state for the app from the user's account.\n */\n CloseOut,\n /**\n * ClearState is similar to CloseOut, but may never fail. This\n * allows users to reclaim their minimum balance from an app\n * they no longer wish to opt in to.\n */\n ClearState,\n /**\n * UpdateApplication indicates that an app transaction will\n * update the approval program and clear state program for the app.\n */\n UpdateApplication,\n /**\n * DeleteApplication indicates that an app transaction will\n * delete the app parameters for the app from the creator's\n * balance record.\n */\n DeleteApplication,\n}\n\n/**\n * Schema for app state storage.\n *\n * Defines the maximum number of values that may be stored in app\n * key/value storage for both global and local state.\n */\nexport type StateSchema = {\n /**\n * Maximum number of integer values that may be stored.\n */\n numUints: number\n\n /**\n * Maximum number of byte slice values that may be stored.\n */\n numByteSlices: number\n}\n\n/**\n * Box reference for app call transactions.\n *\n * References a specific box that should be made available for the runtime\n * of the program.\n */\nexport type BoxReference = {\n /**\n * App ID that owns the box.\n * A value of 0 indicates the current app.\n */\n appId: bigint\n\n /**\n * Name of the box.\n */\n name: Uint8Array\n}\n\n/**\n * Names a single resource reference. Only one of the fields should be set.\n */\nexport interface AccessReference {\n /** Any account addresses whose balance record is accessible by the executing ApprovalProgram or ClearStateProgram. */\n address?: Address\n /** Application ID whose GlobalState may be read by the executing ApprovalProgram or ClearStateProgram. */\n appId?: bigint\n /** Asset ID whose AssetParams may be read by the executing ApprovalProgram or ClearStateProgram. */\n assetId?: bigint\n /** Defines a holding by referring to an Address and Asset it belongs to. */\n holding?: HoldingReference\n /** Defines a local state by referring to an Address and App it belongs to. */\n locals?: LocalsReference\n /** Defines a box by its name and the application ID it belongs to. */\n box?: BoxReference\n}\n\n/**\n * A grouping of the asset index and address of the account\n */\nexport interface HoldingReference {\n /** The asset index of the holding */\n assetId: bigint\n\n /** The address of the account holding the asset */\n address: Address\n}\n\n/** A grouping of the application index and address of the account\n */\nexport interface LocalsReference {\n /** The application index of the local state */\n appId: bigint\n\n /** The address of the account holding the local state */\n address: Address\n}\n\nconst FIELD_ARGS = 'Args'\nconst FIELD_APPROVAL_PROGRAM = 'Approval program'\nconst FIELD_CLEAR_STATE_PROGRAM = 'Clear state program'\nconst FIELD_GLOBAL_STATE_SCHEMA = 'Global state schema'\nconst FIELD_LOCAL_STATE_SCHEMA = 'Local state schema'\nconst FIELD_EXTRA_PROGRAM_PAGES = 'Extra program pages'\n\n/**\n * Validate app call transaction fields\n */\nexport function validateAppCallTransaction(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (appCall.appId === 0n) {\n // App creation\n errors.push(...validateAppCreation(appCall))\n } else {\n // App call, update, or delete\n errors.push(...validateAppOperation(appCall))\n }\n\n // Common validations for all app operations\n errors.push(...validateAppCommonFields(appCall))\n\n return errors\n}\n\n/**\n * Validate app creation fields\n */\nfunction validateAppCreation(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (!appCall.approvalProgram || appCall.approvalProgram.length === 0) {\n errors.push({\n type: TransactionValidationErrorType.RequiredField,\n data: FIELD_APPROVAL_PROGRAM,\n })\n }\n\n if (!appCall.clearStateProgram || appCall.clearStateProgram.length === 0) {\n errors.push({\n type: TransactionValidationErrorType.RequiredField,\n data: FIELD_CLEAR_STATE_PROGRAM,\n })\n }\n\n const extraPages = appCall.extraProgramPages ?? 0\n if (extraPages > MAX_EXTRA_PROGRAM_PAGES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_EXTRA_PROGRAM_PAGES,\n actual: extraPages,\n max: MAX_EXTRA_PROGRAM_PAGES,\n unit: 'pages',\n },\n })\n }\n\n const maxProgramSize = PROGRAM_PAGE_SIZE + extraPages * PROGRAM_PAGE_SIZE\n\n if (appCall.approvalProgram && appCall.approvalProgram.length > maxProgramSize) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_APPROVAL_PROGRAM,\n actual: appCall.approvalProgram.length,\n max: maxProgramSize,\n unit: 'bytes',\n },\n })\n }\n\n if (appCall.clearStateProgram && appCall.clearStateProgram.length > maxProgramSize) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_CLEAR_STATE_PROGRAM,\n actual: appCall.clearStateProgram.length,\n max: maxProgramSize,\n unit: 'bytes',\n },\n })\n }\n\n const totalProgramSize = (appCall.approvalProgram?.length ?? 0) + (appCall.clearStateProgram?.length ?? 0)\n if (totalProgramSize > maxProgramSize) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Combined approval and clear state programs',\n actual: totalProgramSize,\n max: maxProgramSize,\n unit: 'bytes',\n },\n })\n }\n\n if (appCall.globalStateSchema) {\n const totalKeys = appCall.globalStateSchema.numUints + appCall.globalStateSchema.numByteSlices\n if (totalKeys > MAX_GLOBAL_STATE_KEYS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_GLOBAL_STATE_SCHEMA,\n actual: appCall.globalStateSchema.numUints + appCall.globalStateSchema.numByteSlices,\n max: MAX_GLOBAL_STATE_KEYS,\n unit: 'keys',\n },\n })\n }\n }\n\n if (appCall.localStateSchema) {\n const totalKeys = appCall.localStateSchema.numUints + appCall.localStateSchema.numByteSlices\n if (totalKeys > MAX_LOCAL_STATE_KEYS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_LOCAL_STATE_SCHEMA,\n actual: appCall.localStateSchema.numUints + appCall.localStateSchema.numByteSlices,\n max: MAX_LOCAL_STATE_KEYS,\n unit: 'keys',\n },\n })\n }\n }\n\n return errors\n}\n\n/**\n * Validate app operation (update, delete, call) fields\n */\nfunction validateAppOperation(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (appCall.onComplete === OnApplicationComplete.UpdateApplication) {\n if (!appCall.approvalProgram || appCall.approvalProgram.length === 0) {\n errors.push({\n type: TransactionValidationErrorType.RequiredField,\n data: FIELD_APPROVAL_PROGRAM,\n })\n }\n if (!appCall.clearStateProgram || appCall.clearStateProgram.length === 0) {\n errors.push({\n type: TransactionValidationErrorType.RequiredField,\n data: FIELD_CLEAR_STATE_PROGRAM,\n })\n }\n }\n\n // These fields are immutable and cannot be set for existing apps\n if (appCall.globalStateSchema !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: FIELD_GLOBAL_STATE_SCHEMA,\n })\n }\n if (appCall.localStateSchema !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: FIELD_LOCAL_STATE_SCHEMA,\n })\n }\n if (appCall.extraProgramPages !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: FIELD_EXTRA_PROGRAM_PAGES,\n })\n }\n\n return errors\n}\n\n/**\n * Validate common app call fields\n */\nfunction validateAppCommonFields(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (appCall.args) {\n if (appCall.args.length > MAX_APP_ARGS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_ARGS,\n actual: appCall.args.length,\n max: MAX_APP_ARGS,\n unit: 'arguments',\n },\n })\n }\n\n const totalArgsSize = appCall.args.reduce((sum, arg) => sum + arg.length, 0)\n if (totalArgsSize > MAX_ARGS_SIZE) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Args total size',\n actual: totalArgsSize,\n max: MAX_ARGS_SIZE,\n unit: 'bytes',\n },\n })\n }\n }\n\n if (appCall.accountReferences && appCall.accountReferences.length > MAX_ACCOUNT_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Account references',\n actual: appCall.accountReferences.length,\n max: MAX_ACCOUNT_REFERENCES,\n unit: 'refs',\n },\n })\n }\n\n if (appCall.appReferences && appCall.appReferences.length > MAX_APP_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'App references',\n actual: appCall.appReferences.length,\n max: MAX_APP_REFERENCES,\n unit: 'refs',\n },\n })\n }\n\n if (appCall.assetReferences && appCall.assetReferences.length > MAX_ASSET_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Asset references',\n actual: appCall.assetReferences.length,\n max: MAX_ASSET_REFERENCES,\n unit: 'refs',\n },\n })\n }\n\n // Validate box references\n if (appCall.boxReferences) {\n if (appCall.boxReferences.length > MAX_BOX_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Box references',\n actual: appCall.boxReferences.length,\n max: MAX_BOX_REFERENCES,\n unit: 'refs',\n },\n })\n }\n\n // Validate that box reference app IDs are in app references\n const appRefs = appCall.appReferences || []\n for (const boxRef of appCall.boxReferences) {\n if (boxRef.appId !== 0n && boxRef.appId !== appCall.appId && !appRefs.includes(boxRef.appId)) {\n errors.push({\n type: TransactionValidationErrorType.ArbitraryConstraint,\n data: `Box reference for app ID ${boxRef.appId} must be in app references`,\n })\n }\n }\n }\n\n // Validate overall reference count\n const totalReferences =\n (appCall.accountReferences?.length || 0) +\n (appCall.appReferences?.length || 0) +\n (appCall.assetReferences?.length || 0) +\n (appCall.boxReferences?.length || 0)\n\n if (totalReferences > MAX_OVERALL_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Total references',\n actual: totalReferences,\n max: MAX_OVERALL_REFERENCES,\n unit: 'refs',\n },\n })\n }\n\n return errors\n}\n"],"mappings":";;;;;;;;;AA8HA,IAAY,0EAAL;;;;;AAKL;;;;;AAKA;;;;;AAKA;;;;;;AAMA;;;;;AAKA;;;;;;AAMA;;;AA+EF,MAAM,aAAa;AACn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ACL,MAAM;IACP;GACF,CAAC;EAIJ,MAAM,UAAU,QAAQ,iBAAiB,EAAE;AAC3C,OAAK,MAAM,UAAU,QAAQ,cAC3B,KAAI,OAAO,UAAU,MAAM,OAAO,UAAU,QAAQ,SAAS,CAAC,QAAQ,SAAS,OAAO,MAAM,CAC1F,QAAO,KAAK;GACV,MAAMV,8CAA+B;GACrC,MAAM,4BAA4B,OAAO,MAAM;GAChD,CAAC;;CAMR,MAAM,mBACH,QAAQ,mBAAmB,UAAU,MACrC,QAAQ,eAAe,UAAU,MACjC,QAAQ,iBAAiB,UAAU,MACnC,QAAQ,eAAe,UAAU;AAEpC,KAAI,kBAAkBW,yCACpB,QAAO,KAAK;EACV,MAAMX,8CAA+B;EACrC,MAAM;GACJ,OAAO;GACP,QAAQ;GACR,KAAKW;GACL,MAAM;GACP;EACF,CAAC;AAGJ,QAAO"}
|
|
1
|
+
{"version":3,"file":"app-call.js","names":["TransactionValidationErrorType","MAX_EXTRA_PROGRAM_PAGES","PROGRAM_PAGE_SIZE","MAX_GLOBAL_STATE_KEYS","MAX_LOCAL_STATE_KEYS","MAX_APP_ARGS","MAX_ARGS_SIZE","MAX_ACCOUNT_REFERENCES","MAX_APP_REFERENCES","MAX_ASSET_REFERENCES","MAX_BOX_REFERENCES","MAX_OVERALL_REFERENCES"],"sources":["../../../../../packages/transact/src/transactions/app-call.ts"],"sourcesContent":["import {\n Address,\n MAX_ACCOUNT_REFERENCES,\n MAX_APP_ARGS,\n MAX_APP_REFERENCES,\n MAX_ARGS_SIZE,\n MAX_ASSET_REFERENCES,\n MAX_BOX_REFERENCES,\n MAX_EXTRA_PROGRAM_PAGES,\n MAX_GLOBAL_STATE_KEYS,\n MAX_LOCAL_STATE_KEYS,\n MAX_OVERALL_REFERENCES,\n PROGRAM_PAGE_SIZE,\n} from '@algorandfoundation/algokit-common'\nimport { TransactionValidationError, TransactionValidationErrorType } from './common'\n\n/**\n * Represents an app call transaction that interacts with Algorand Smart Contracts.\n *\n * App call transactions are used to create, update, delete, opt-in to,\n * close out of, or clear state from Algorand apps (smart contracts).\n */\nexport type AppCallTransactionFields = {\n /**\n * ID of the app being called.\n *\n * Set this to 0 to indicate an app creation call.\n */\n appId: bigint\n\n /**\n * Defines what additional actions occur with the transaction.\n */\n onComplete: OnApplicationComplete\n\n /**\n * Logic executed for every app call transaction, except when\n * on-completion is set to \"clear\".\n *\n * Approval programs may reject the transaction.\n * Only required for app creation and update transactions.\n */\n approvalProgram?: Uint8Array\n\n /**\n * Logic executed for app call transactions with on-completion set to \"clear\".\n *\n * Clear state programs cannot reject the transaction.\n * Only required for app creation and update transactions.\n */\n clearStateProgram?: Uint8Array\n\n /**\n * Holds the maximum number of global state values.\n *\n * Only required for app creation transactions.\n * This cannot be changed after creation.\n */\n globalStateSchema?: StateSchema\n\n /**\n * Holds the maximum number of local state values.\n *\n * Only required for app creation transactions.\n * This cannot be changed after creation.\n */\n localStateSchema?: StateSchema\n\n /**\n * Number of additional pages allocated to the app's approval\n * and clear state programs.\n *\n * Each extra program page is 2048 bytes. The sum of approval program\n * and clear state program may not exceed 2048*(1+extra_program_pages) bytes.\n * Currently, the maximum value is 3.\n * This cannot be changed after creation.\n */\n extraProgramPages?: number\n\n /**\n * Transaction specific arguments available in the app's\n * approval program and clear state program.\n */\n args?: Uint8Array[]\n\n /**\n * List of accounts in addition to the sender that may be accessed\n * from the app's approval program and clear state program.\n */\n accountReferences?: Address[]\n\n /**\n * List of apps in addition to the current app that may be called\n * from the app's approval program and clear state program.\n */\n appReferences?: bigint[]\n\n /**\n * Lists the assets whose parameters may be accessed by this app's\n * approval program and clear state program.\n *\n * The access is read-only.\n */\n assetReferences?: bigint[]\n\n /**\n * The boxes that should be made available for the runtime of the program.\n */\n boxReferences?: BoxReference[]\n\n /**\n * Resources accessed by the application\n */\n accessReferences?: ResourceReference[]\n\n /**\n * 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.\n * */\n rejectVersion?: number\n}\n\n/**\n * On-completion actions for application transactions.\n *\n * These values define what additional actions occur with the transaction.\n */\nexport enum OnApplicationComplete {\n /**\n * NoOp indicates that an app transaction will simply call its\n * approval program without any additional action.\n */\n NoOp,\n /**\n * OptIn indicates that an app transaction will allocate some\n * local state for the app in the sender's account.\n */\n OptIn,\n /**\n * CloseOut indicates that an app transaction will deallocate\n * some local state for the app from the user's account.\n */\n CloseOut,\n /**\n * ClearState is similar to CloseOut, but may never fail. This\n * allows users to reclaim their minimum balance from an app\n * they no longer wish to opt in to.\n */\n ClearState,\n /**\n * UpdateApplication indicates that an app transaction will\n * update the approval program and clear state program for the app.\n */\n UpdateApplication,\n /**\n * DeleteApplication indicates that an app transaction will\n * delete the app parameters for the app from the creator's\n * balance record.\n */\n DeleteApplication,\n}\n\n/**\n * Schema for app state storage.\n *\n * Defines the maximum number of values that may be stored in app\n * key/value storage for both global and local state.\n */\nexport type StateSchema = {\n /**\n * Maximum number of integer values that may be stored.\n */\n numUints: number\n\n /**\n * Maximum number of byte slice values that may be stored.\n */\n numByteSlices: number\n}\n\n/**\n * Box reference for app call transactions.\n *\n * References a specific box that should be made available for the runtime\n * of the program.\n */\nexport type BoxReference = {\n /**\n * App ID that owns the box.\n * A value of 0 indicates the current app.\n */\n appId: bigint\n\n /**\n * Name of the box.\n */\n name: Uint8Array\n}\n\n/**\n * Names a single resource reference. Only one of the fields should be set.\n */\nexport type ResourceReference = {\n /** Any account addresses whose balance record is accessible by the executing ApprovalProgram or ClearStateProgram. */\n address?: Address\n /** Application ID whose GlobalState may be read by the executing ApprovalProgram or ClearStateProgram. */\n appId?: bigint\n /** Asset ID whose AssetParams may be read by the executing ApprovalProgram or ClearStateProgram. */\n assetId?: bigint\n /** Defines a holding by referring to an Address and Asset it belongs to. */\n holding?: HoldingReference\n /** Defines a local state by referring to an Address and App it belongs to. */\n locals?: LocalsReference\n /** Defines a box by its name and the application ID it belongs to. */\n box?: BoxReference\n}\n\n/**\n * A grouping of the asset index and address of the account\n */\nexport type HoldingReference = {\n /** The asset index of the holding */\n assetId: bigint\n\n /** The address of the account holding the asset */\n address: Address\n}\n\n/** A grouping of the application index and address of the account\n */\nexport type LocalsReference = {\n /** The application index of the local state */\n appId: bigint\n\n /** The address of the account holding the local state */\n address: Address\n}\n\nconst FIELD_ARGS = 'Args'\nconst FIELD_APPROVAL_PROGRAM = 'Approval program'\nconst FIELD_CLEAR_STATE_PROGRAM = 'Clear state program'\nconst FIELD_GLOBAL_STATE_SCHEMA = 'Global state schema'\nconst FIELD_LOCAL_STATE_SCHEMA = 'Local state schema'\nconst FIELD_EXTRA_PROGRAM_PAGES = 'Extra program pages'\n\n/**\n * Validate app call transaction fields\n */\nexport function validateAppCallTransaction(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (appCall.appId === 0n) {\n // App creation\n errors.push(...validateAppCreation(appCall))\n } else {\n // App call, update, or delete\n errors.push(...validateAppOperation(appCall))\n }\n\n // Common validations for all app operations\n errors.push(...validateAppCommonFields(appCall))\n\n return errors\n}\n\n/**\n * Validate app creation fields\n */\nfunction validateAppCreation(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (!appCall.approvalProgram || appCall.approvalProgram.length === 0) {\n errors.push({ type: TransactionValidationErrorType.RequiredField, data: FIELD_APPROVAL_PROGRAM })\n }\n\n if (!appCall.clearStateProgram || appCall.clearStateProgram.length === 0) {\n errors.push({ type: TransactionValidationErrorType.RequiredField, data: FIELD_CLEAR_STATE_PROGRAM })\n }\n\n const extraPages = appCall.extraProgramPages ?? 0\n if (extraPages > MAX_EXTRA_PROGRAM_PAGES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: FIELD_EXTRA_PROGRAM_PAGES, actual: extraPages, max: MAX_EXTRA_PROGRAM_PAGES, unit: 'pages' },\n })\n }\n\n const maxProgramSize = PROGRAM_PAGE_SIZE + extraPages * PROGRAM_PAGE_SIZE\n\n if (appCall.approvalProgram && appCall.approvalProgram.length > maxProgramSize) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: FIELD_APPROVAL_PROGRAM, actual: appCall.approvalProgram.length, max: maxProgramSize, unit: 'bytes' },\n })\n }\n\n if (appCall.clearStateProgram && appCall.clearStateProgram.length > maxProgramSize) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: FIELD_CLEAR_STATE_PROGRAM, actual: appCall.clearStateProgram.length, max: maxProgramSize, unit: 'bytes' },\n })\n }\n\n const totalProgramSize = (appCall.approvalProgram?.length ?? 0) + (appCall.clearStateProgram?.length ?? 0)\n if (totalProgramSize > maxProgramSize) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: 'Combined approval and clear state programs', actual: totalProgramSize, max: maxProgramSize, unit: 'bytes' },\n })\n }\n\n if (appCall.globalStateSchema) {\n const totalKeys = appCall.globalStateSchema.numUints + appCall.globalStateSchema.numByteSlices\n if (totalKeys > MAX_GLOBAL_STATE_KEYS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_GLOBAL_STATE_SCHEMA,\n actual: appCall.globalStateSchema.numUints + appCall.globalStateSchema.numByteSlices,\n max: MAX_GLOBAL_STATE_KEYS,\n unit: 'keys',\n },\n })\n }\n }\n\n if (appCall.localStateSchema) {\n const totalKeys = appCall.localStateSchema.numUints + appCall.localStateSchema.numByteSlices\n if (totalKeys > MAX_LOCAL_STATE_KEYS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_LOCAL_STATE_SCHEMA,\n actual: appCall.localStateSchema.numUints + appCall.localStateSchema.numByteSlices,\n max: MAX_LOCAL_STATE_KEYS,\n unit: 'keys',\n },\n })\n }\n }\n\n return errors\n}\n\n/**\n * Validate app operation (update, delete, call) fields\n */\nfunction validateAppOperation(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (appCall.onComplete === OnApplicationComplete.UpdateApplication) {\n if (!appCall.approvalProgram || appCall.approvalProgram.length === 0) {\n errors.push({ type: TransactionValidationErrorType.RequiredField, data: FIELD_APPROVAL_PROGRAM })\n }\n if (!appCall.clearStateProgram || appCall.clearStateProgram.length === 0) {\n errors.push({ type: TransactionValidationErrorType.RequiredField, data: FIELD_CLEAR_STATE_PROGRAM })\n }\n }\n\n // These fields are immutable and cannot be set for existing apps\n if (appCall.globalStateSchema !== undefined) {\n errors.push({ type: TransactionValidationErrorType.ImmutableField, data: FIELD_GLOBAL_STATE_SCHEMA })\n }\n if (appCall.localStateSchema !== undefined) {\n errors.push({ type: TransactionValidationErrorType.ImmutableField, data: FIELD_LOCAL_STATE_SCHEMA })\n }\n if (appCall.extraProgramPages !== undefined) {\n errors.push({ type: TransactionValidationErrorType.ImmutableField, data: FIELD_EXTRA_PROGRAM_PAGES })\n }\n\n return errors\n}\n\n/**\n * Validate common app call fields\n */\nfunction validateAppCommonFields(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (appCall.args) {\n if (appCall.args.length > MAX_APP_ARGS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: FIELD_ARGS, actual: appCall.args.length, max: MAX_APP_ARGS, unit: 'arguments' },\n })\n }\n\n const totalArgsSize = appCall.args.reduce((sum, arg) => sum + arg.length, 0)\n if (totalArgsSize > MAX_ARGS_SIZE) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: 'Args total size', actual: totalArgsSize, max: MAX_ARGS_SIZE, unit: 'bytes' },\n })\n }\n }\n\n if (appCall.accountReferences && appCall.accountReferences.length > MAX_ACCOUNT_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: 'Account references', actual: appCall.accountReferences.length, max: MAX_ACCOUNT_REFERENCES, unit: 'refs' },\n })\n }\n\n if (appCall.appReferences && appCall.appReferences.length > MAX_APP_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: 'App references', actual: appCall.appReferences.length, max: MAX_APP_REFERENCES, unit: 'refs' },\n })\n }\n\n if (appCall.assetReferences && appCall.assetReferences.length > MAX_ASSET_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: 'Asset references', actual: appCall.assetReferences.length, max: MAX_ASSET_REFERENCES, unit: 'refs' },\n })\n }\n\n // Validate box references\n if (appCall.boxReferences) {\n if (appCall.boxReferences.length > MAX_BOX_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: 'Box references', actual: appCall.boxReferences.length, max: MAX_BOX_REFERENCES, unit: 'refs' },\n })\n }\n\n // Validate that box reference app IDs are in app references\n const appRefs = appCall.appReferences || []\n for (const boxRef of appCall.boxReferences) {\n if (boxRef.appId !== 0n && boxRef.appId !== appCall.appId && !appRefs.includes(boxRef.appId)) {\n errors.push({\n type: TransactionValidationErrorType.ArbitraryConstraint,\n data: `Box reference for app ID ${boxRef.appId} must be in app references`,\n })\n }\n }\n }\n\n // Validate overall reference count\n const totalReferences =\n (appCall.accountReferences?.length || 0) +\n (appCall.appReferences?.length || 0) +\n (appCall.assetReferences?.length || 0) +\n (appCall.boxReferences?.length || 0)\n\n if (totalReferences > MAX_OVERALL_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: 'Total references', actual: totalReferences, max: MAX_OVERALL_REFERENCES, unit: 'refs' },\n })\n }\n\n return errors\n}\n"],"mappings":";;;;;;;;;AA8HA,IAAY,0EAAL;;;;;AAKL;;;;;AAKA;;;;;AAKA;;;;;;AAMA;;;;;AAKA;;;;;;AAMA;;;AA+EF,MAAM,aAAa;AACnB,MAAM,yBAAyB;AAC/B,MAAM,4BAA4B;AAClC,MAAM,4BAA4B;AAClC,MAAM,2BAA2B;AACjC,MAAM,4BAA4B;;;;AAKlC,SAAgB,2BAA2B,SAAiE;C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GAC/G,CAAC;EAIJ,MAAM,UAAU,QAAQ,iBAAiB,EAAE;AAC3C,OAAK,MAAM,UAAU,QAAQ,cAC3B,KAAI,OAAO,UAAU,MAAM,OAAO,UAAU,QAAQ,SAAS,CAAC,QAAQ,SAAS,OAAO,MAAM,CAC1F,QAAO,KAAK;GACV,MAAMV,8CAA+B;GACrC,MAAM,4BAA4B,OAAO,MAAM;GAChD,CAAC;;CAMR,MAAM,mBACH,QAAQ,mBAAmB,UAAU,MACrC,QAAQ,eAAe,UAAU,MACjC,QAAQ,iBAAiB,UAAU,MACnC,QAAQ,eAAe,UAAU;AAEpC,KAAI,kBAAkBW,yCACpB,QAAO,KAAK;EACV,MAAMX,8CAA+B;EACrC,MAAM;GAAE,OAAO;GAAoB,QAAQ;GAAiB,KAAKW;GAAwB,MAAM;GAAQ;EACxG,CAAC;AAGJ,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-call.mjs","names":[],"sources":["../../../../../packages/transact/src/transactions/app-call.ts"],"sourcesContent":["import {\n MAX_ACCOUNT_REFERENCES,\n MAX_APP_ARGS,\n MAX_APP_REFERENCES,\n MAX_ARGS_SIZE,\n MAX_ASSET_REFERENCES,\n MAX_BOX_REFERENCES,\n MAX_EXTRA_PROGRAM_PAGES,\n MAX_GLOBAL_STATE_KEYS,\n MAX_LOCAL_STATE_KEYS,\n MAX_OVERALL_REFERENCES,\n PROGRAM_PAGE_SIZE,\n Address,\n} from '@algorandfoundation/algokit-common'\nimport { TransactionValidationError, TransactionValidationErrorType } from './common'\n\n/**\n * Represents an app call transaction that interacts with Algorand Smart Contracts.\n *\n * App call transactions are used to create, update, delete, opt-in to,\n * close out of, or clear state from Algorand apps (smart contracts).\n */\nexport type AppCallTransactionFields = {\n /**\n * ID of the app being called.\n *\n * Set this to 0 to indicate an app creation call.\n */\n appId: bigint\n\n /**\n * Defines what additional actions occur with the transaction.\n */\n onComplete: OnApplicationComplete\n\n /**\n * Logic executed for every app call transaction, except when\n * on-completion is set to \"clear\".\n *\n * Approval programs may reject the transaction.\n * Only required for app creation and update transactions.\n */\n approvalProgram?: Uint8Array\n\n /**\n * Logic executed for app call transactions with on-completion set to \"clear\".\n *\n * Clear state programs cannot reject the transaction.\n * Only required for app creation and update transactions.\n */\n clearStateProgram?: Uint8Array\n\n /**\n * Holds the maximum number of global state values.\n *\n * Only required for app creation transactions.\n * This cannot be changed after creation.\n */\n globalStateSchema?: StateSchema\n\n /**\n * Holds the maximum number of local state values.\n *\n * Only required for app creation transactions.\n * This cannot be changed after creation.\n */\n localStateSchema?: StateSchema\n\n /**\n * Number of additional pages allocated to the app's approval\n * and clear state programs.\n *\n * Each extra program page is 2048 bytes. The sum of approval program\n * and clear state program may not exceed 2048*(1+extra_program_pages) bytes.\n * Currently, the maximum value is 3.\n * This cannot be changed after creation.\n */\n extraProgramPages?: number\n\n /**\n * Transaction specific arguments available in the app's\n * approval program and clear state program.\n */\n args?: Uint8Array[]\n\n /**\n * List of accounts in addition to the sender that may be accessed\n * from the app's approval program and clear state program.\n */\n accountReferences?: Address[]\n\n /**\n * List of apps in addition to the current app that may be called\n * from the app's approval program and clear state program.\n */\n appReferences?: bigint[]\n\n /**\n * Lists the assets whose parameters may be accessed by this app's\n * approval program and clear state program.\n *\n * The access is read-only.\n */\n assetReferences?: bigint[]\n\n /**\n * The boxes that should be made available for the runtime of the program.\n */\n boxReferences?: BoxReference[]\n\n /**\n * Resources accessed by the application\n */\n accessReferences?: AccessReference[]\n\n /**\n * The lowest application version for which this transaction should immediately fail. 0 indicates that no version check should be performed.\n */\n rejectVersion?: number\n}\n\n/**\n * On-completion actions for application transactions.\n *\n * These values define what additional actions occur with the transaction.\n */\nexport enum OnApplicationComplete {\n /**\n * NoOp indicates that an app transaction will simply call its\n * approval program without any additional action.\n */\n NoOp,\n /**\n * OptIn indicates that an app transaction will allocate some\n * local state for the app in the sender's account.\n */\n OptIn,\n /**\n * CloseOut indicates that an app transaction will deallocate\n * some local state for the app from the user's account.\n */\n CloseOut,\n /**\n * ClearState is similar to CloseOut, but may never fail. This\n * allows users to reclaim their minimum balance from an app\n * they no longer wish to opt in to.\n */\n ClearState,\n /**\n * UpdateApplication indicates that an app transaction will\n * update the approval program and clear state program for the app.\n */\n UpdateApplication,\n /**\n * DeleteApplication indicates that an app transaction will\n * delete the app parameters for the app from the creator's\n * balance record.\n */\n DeleteApplication,\n}\n\n/**\n * Schema for app state storage.\n *\n * Defines the maximum number of values that may be stored in app\n * key/value storage for both global and local state.\n */\nexport type StateSchema = {\n /**\n * Maximum number of integer values that may be stored.\n */\n numUints: number\n\n /**\n * Maximum number of byte slice values that may be stored.\n */\n numByteSlices: number\n}\n\n/**\n * Box reference for app call transactions.\n *\n * References a specific box that should be made available for the runtime\n * of the program.\n */\nexport type BoxReference = {\n /**\n * App ID that owns the box.\n * A value of 0 indicates the current app.\n */\n appId: bigint\n\n /**\n * Name of the box.\n */\n name: Uint8Array\n}\n\n/**\n * Names a single resource reference. Only one of the fields should be set.\n */\nexport interface AccessReference {\n /** Any account addresses whose balance record is accessible by the executing ApprovalProgram or ClearStateProgram. */\n address?: Address\n /** Application ID whose GlobalState may be read by the executing ApprovalProgram or ClearStateProgram. */\n appId?: bigint\n /** Asset ID whose AssetParams may be read by the executing ApprovalProgram or ClearStateProgram. */\n assetId?: bigint\n /** Defines a holding by referring to an Address and Asset it belongs to. */\n holding?: HoldingReference\n /** Defines a local state by referring to an Address and App it belongs to. */\n locals?: LocalsReference\n /** Defines a box by its name and the application ID it belongs to. */\n box?: BoxReference\n}\n\n/**\n * A grouping of the asset index and address of the account\n */\nexport interface HoldingReference {\n /** The asset index of the holding */\n assetId: bigint\n\n /** The address of the account holding the asset */\n address: Address\n}\n\n/** A grouping of the application index and address of the account\n */\nexport interface LocalsReference {\n /** The application index of the local state */\n appId: bigint\n\n /** The address of the account holding the local state */\n address: Address\n}\n\nconst FIELD_ARGS = 'Args'\nconst FIELD_APPROVAL_PROGRAM = 'Approval program'\nconst FIELD_CLEAR_STATE_PROGRAM = 'Clear state program'\nconst FIELD_GLOBAL_STATE_SCHEMA = 'Global state schema'\nconst FIELD_LOCAL_STATE_SCHEMA = 'Local state schema'\nconst FIELD_EXTRA_PROGRAM_PAGES = 'Extra program pages'\n\n/**\n * Validate app call transaction fields\n */\nexport function validateAppCallTransaction(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (appCall.appId === 0n) {\n // App creation\n errors.push(...validateAppCreation(appCall))\n } else {\n // App call, update, or delete\n errors.push(...validateAppOperation(appCall))\n }\n\n // Common validations for all app operations\n errors.push(...validateAppCommonFields(appCall))\n\n return errors\n}\n\n/**\n * Validate app creation fields\n */\nfunction validateAppCreation(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (!appCall.approvalProgram || appCall.approvalProgram.length === 0) {\n errors.push({\n type: TransactionValidationErrorType.RequiredField,\n data: FIELD_APPROVAL_PROGRAM,\n })\n }\n\n if (!appCall.clearStateProgram || appCall.clearStateProgram.length === 0) {\n errors.push({\n type: TransactionValidationErrorType.RequiredField,\n data: FIELD_CLEAR_STATE_PROGRAM,\n })\n }\n\n const extraPages = appCall.extraProgramPages ?? 0\n if (extraPages > MAX_EXTRA_PROGRAM_PAGES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_EXTRA_PROGRAM_PAGES,\n actual: extraPages,\n max: MAX_EXTRA_PROGRAM_PAGES,\n unit: 'pages',\n },\n })\n }\n\n const maxProgramSize = PROGRAM_PAGE_SIZE + extraPages * PROGRAM_PAGE_SIZE\n\n if (appCall.approvalProgram && appCall.approvalProgram.length > maxProgramSize) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_APPROVAL_PROGRAM,\n actual: appCall.approvalProgram.length,\n max: maxProgramSize,\n unit: 'bytes',\n },\n })\n }\n\n if (appCall.clearStateProgram && appCall.clearStateProgram.length > maxProgramSize) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_CLEAR_STATE_PROGRAM,\n actual: appCall.clearStateProgram.length,\n max: maxProgramSize,\n unit: 'bytes',\n },\n })\n }\n\n const totalProgramSize = (appCall.approvalProgram?.length ?? 0) + (appCall.clearStateProgram?.length ?? 0)\n if (totalProgramSize > maxProgramSize) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Combined approval and clear state programs',\n actual: totalProgramSize,\n max: maxProgramSize,\n unit: 'bytes',\n },\n })\n }\n\n if (appCall.globalStateSchema) {\n const totalKeys = appCall.globalStateSchema.numUints + appCall.globalStateSchema.numByteSlices\n if (totalKeys > MAX_GLOBAL_STATE_KEYS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_GLOBAL_STATE_SCHEMA,\n actual: appCall.globalStateSchema.numUints + appCall.globalStateSchema.numByteSlices,\n max: MAX_GLOBAL_STATE_KEYS,\n unit: 'keys',\n },\n })\n }\n }\n\n if (appCall.localStateSchema) {\n const totalKeys = appCall.localStateSchema.numUints + appCall.localStateSchema.numByteSlices\n if (totalKeys > MAX_LOCAL_STATE_KEYS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_LOCAL_STATE_SCHEMA,\n actual: appCall.localStateSchema.numUints + appCall.localStateSchema.numByteSlices,\n max: MAX_LOCAL_STATE_KEYS,\n unit: 'keys',\n },\n })\n }\n }\n\n return errors\n}\n\n/**\n * Validate app operation (update, delete, call) fields\n */\nfunction validateAppOperation(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (appCall.onComplete === OnApplicationComplete.UpdateApplication) {\n if (!appCall.approvalProgram || appCall.approvalProgram.length === 0) {\n errors.push({\n type: TransactionValidationErrorType.RequiredField,\n data: FIELD_APPROVAL_PROGRAM,\n })\n }\n if (!appCall.clearStateProgram || appCall.clearStateProgram.length === 0) {\n errors.push({\n type: TransactionValidationErrorType.RequiredField,\n data: FIELD_CLEAR_STATE_PROGRAM,\n })\n }\n }\n\n // These fields are immutable and cannot be set for existing apps\n if (appCall.globalStateSchema !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: FIELD_GLOBAL_STATE_SCHEMA,\n })\n }\n if (appCall.localStateSchema !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: FIELD_LOCAL_STATE_SCHEMA,\n })\n }\n if (appCall.extraProgramPages !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: FIELD_EXTRA_PROGRAM_PAGES,\n })\n }\n\n return errors\n}\n\n/**\n * Validate common app call fields\n */\nfunction validateAppCommonFields(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (appCall.args) {\n if (appCall.args.length > MAX_APP_ARGS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_ARGS,\n actual: appCall.args.length,\n max: MAX_APP_ARGS,\n unit: 'arguments',\n },\n })\n }\n\n const totalArgsSize = appCall.args.reduce((sum, arg) => sum + arg.length, 0)\n if (totalArgsSize > MAX_ARGS_SIZE) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Args total size',\n actual: totalArgsSize,\n max: MAX_ARGS_SIZE,\n unit: 'bytes',\n },\n })\n }\n }\n\n if (appCall.accountReferences && appCall.accountReferences.length > MAX_ACCOUNT_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Account references',\n actual: appCall.accountReferences.length,\n max: MAX_ACCOUNT_REFERENCES,\n unit: 'refs',\n },\n })\n }\n\n if (appCall.appReferences && appCall.appReferences.length > MAX_APP_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'App references',\n actual: appCall.appReferences.length,\n max: MAX_APP_REFERENCES,\n unit: 'refs',\n },\n })\n }\n\n if (appCall.assetReferences && appCall.assetReferences.length > MAX_ASSET_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Asset references',\n actual: appCall.assetReferences.length,\n max: MAX_ASSET_REFERENCES,\n unit: 'refs',\n },\n })\n }\n\n // Validate box references\n if (appCall.boxReferences) {\n if (appCall.boxReferences.length > MAX_BOX_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Box references',\n actual: appCall.boxReferences.length,\n max: MAX_BOX_REFERENCES,\n unit: 'refs',\n },\n })\n }\n\n // Validate that box reference app IDs are in app references\n const appRefs = appCall.appReferences || []\n for (const boxRef of appCall.boxReferences) {\n if (boxRef.appId !== 0n && boxRef.appId !== appCall.appId && !appRefs.includes(boxRef.appId)) {\n errors.push({\n type: TransactionValidationErrorType.ArbitraryConstraint,\n data: `Box reference for app ID ${boxRef.appId} must be in app references`,\n })\n }\n }\n }\n\n // Validate overall reference count\n const totalReferences =\n (appCall.accountReferences?.length || 0) +\n (appCall.appReferences?.length || 0) +\n (appCall.assetReferences?.length || 0) +\n (appCall.boxReferences?.length || 0)\n\n if (totalReferences > MAX_OVERALL_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Total references',\n actual: totalReferences,\n max: MAX_OVERALL_REFERENCES,\n unit: 'refs',\n },\n })\n }\n\n return errors\n}\n"],"mappings":";;;;;;;;;AA8HA,IAAY,0EAAL;;;;;AAKL;;;;;AAKA;;;;;AAKA;;;;;;AAMA;;;;;AAKA;;;;;;AAMA;;;AA+EF,MAAM,aAAa;AACnB,MAAM,yBAAyB;AAC/B,MAAM,4BAA4B;AAClC,MAAM,4BAA4B;AAClC,MAAM,2BAA2B;AACjC,MAAM,4BAA4B;;;;AAKlC,SAAgB,2BAA2B,SAAiE;CAC1G,MAAM,SAAS,IAAI,OAAmC;AAEtD,KAAI,QAAQ,UAAU,GAEpB,QAAO,KA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AM;GAChD,CAAC;;CAMR,MAAM,mBACH,QAAQ,mBAAmB,UAAU,MACrC,QAAQ,eAAe,UAAU,MACjC,QAAQ,iBAAiB,UAAU,MACnC,QAAQ,eAAe,UAAU;AAEpC,KAAI,kBAAkB,uBACpB,QAAO,KAAK;EACV,MAAM,+BAA+B;EACrC,MAAM;GACJ,OAAO;GACP,QAAQ;GACR,KAAK;GACL,MAAM;GACP;EACF,CAAC;AAGJ,QAAO"}
|
|
1
|
+
{"version":3,"file":"app-call.mjs","names":[],"sources":["../../../../../packages/transact/src/transactions/app-call.ts"],"sourcesContent":["import {\n Address,\n MAX_ACCOUNT_REFERENCES,\n MAX_APP_ARGS,\n MAX_APP_REFERENCES,\n MAX_ARGS_SIZE,\n MAX_ASSET_REFERENCES,\n MAX_BOX_REFERENCES,\n MAX_EXTRA_PROGRAM_PAGES,\n MAX_GLOBAL_STATE_KEYS,\n MAX_LOCAL_STATE_KEYS,\n MAX_OVERALL_REFERENCES,\n PROGRAM_PAGE_SIZE,\n} from '@algorandfoundation/algokit-common'\nimport { TransactionValidationError, TransactionValidationErrorType } from './common'\n\n/**\n * Represents an app call transaction that interacts with Algorand Smart Contracts.\n *\n * App call transactions are used to create, update, delete, opt-in to,\n * close out of, or clear state from Algorand apps (smart contracts).\n */\nexport type AppCallTransactionFields = {\n /**\n * ID of the app being called.\n *\n * Set this to 0 to indicate an app creation call.\n */\n appId: bigint\n\n /**\n * Defines what additional actions occur with the transaction.\n */\n onComplete: OnApplicationComplete\n\n /**\n * Logic executed for every app call transaction, except when\n * on-completion is set to \"clear\".\n *\n * Approval programs may reject the transaction.\n * Only required for app creation and update transactions.\n */\n approvalProgram?: Uint8Array\n\n /**\n * Logic executed for app call transactions with on-completion set to \"clear\".\n *\n * Clear state programs cannot reject the transaction.\n * Only required for app creation and update transactions.\n */\n clearStateProgram?: Uint8Array\n\n /**\n * Holds the maximum number of global state values.\n *\n * Only required for app creation transactions.\n * This cannot be changed after creation.\n */\n globalStateSchema?: StateSchema\n\n /**\n * Holds the maximum number of local state values.\n *\n * Only required for app creation transactions.\n * This cannot be changed after creation.\n */\n localStateSchema?: StateSchema\n\n /**\n * Number of additional pages allocated to the app's approval\n * and clear state programs.\n *\n * Each extra program page is 2048 bytes. The sum of approval program\n * and clear state program may not exceed 2048*(1+extra_program_pages) bytes.\n * Currently, the maximum value is 3.\n * This cannot be changed after creation.\n */\n extraProgramPages?: number\n\n /**\n * Transaction specific arguments available in the app's\n * approval program and clear state program.\n */\n args?: Uint8Array[]\n\n /**\n * List of accounts in addition to the sender that may be accessed\n * from the app's approval program and clear state program.\n */\n accountReferences?: Address[]\n\n /**\n * List of apps in addition to the current app that may be called\n * from the app's approval program and clear state program.\n */\n appReferences?: bigint[]\n\n /**\n * Lists the assets whose parameters may be accessed by this app's\n * approval program and clear state program.\n *\n * The access is read-only.\n */\n assetReferences?: bigint[]\n\n /**\n * The boxes that should be made available for the runtime of the program.\n */\n boxReferences?: BoxReference[]\n\n /**\n * Resources accessed by the application\n */\n accessReferences?: ResourceReference[]\n\n /**\n * 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.\n * */\n rejectVersion?: number\n}\n\n/**\n * On-completion actions for application transactions.\n *\n * These values define what additional actions occur with the transaction.\n */\nexport enum OnApplicationComplete {\n /**\n * NoOp indicates that an app transaction will simply call its\n * approval program without any additional action.\n */\n NoOp,\n /**\n * OptIn indicates that an app transaction will allocate some\n * local state for the app in the sender's account.\n */\n OptIn,\n /**\n * CloseOut indicates that an app transaction will deallocate\n * some local state for the app from the user's account.\n */\n CloseOut,\n /**\n * ClearState is similar to CloseOut, but may never fail. This\n * allows users to reclaim their minimum balance from an app\n * they no longer wish to opt in to.\n */\n ClearState,\n /**\n * UpdateApplication indicates that an app transaction will\n * update the approval program and clear state program for the app.\n */\n UpdateApplication,\n /**\n * DeleteApplication indicates that an app transaction will\n * delete the app parameters for the app from the creator's\n * balance record.\n */\n DeleteApplication,\n}\n\n/**\n * Schema for app state storage.\n *\n * Defines the maximum number of values that may be stored in app\n * key/value storage for both global and local state.\n */\nexport type StateSchema = {\n /**\n * Maximum number of integer values that may be stored.\n */\n numUints: number\n\n /**\n * Maximum number of byte slice values that may be stored.\n */\n numByteSlices: number\n}\n\n/**\n * Box reference for app call transactions.\n *\n * References a specific box that should be made available for the runtime\n * of the program.\n */\nexport type BoxReference = {\n /**\n * App ID that owns the box.\n * A value of 0 indicates the current app.\n */\n appId: bigint\n\n /**\n * Name of the box.\n */\n name: Uint8Array\n}\n\n/**\n * Names a single resource reference. Only one of the fields should be set.\n */\nexport type ResourceReference = {\n /** Any account addresses whose balance record is accessible by the executing ApprovalProgram or ClearStateProgram. */\n address?: Address\n /** Application ID whose GlobalState may be read by the executing ApprovalProgram or ClearStateProgram. */\n appId?: bigint\n /** Asset ID whose AssetParams may be read by the executing ApprovalProgram or ClearStateProgram. */\n assetId?: bigint\n /** Defines a holding by referring to an Address and Asset it belongs to. */\n holding?: HoldingReference\n /** Defines a local state by referring to an Address and App it belongs to. */\n locals?: LocalsReference\n /** Defines a box by its name and the application ID it belongs to. */\n box?: BoxReference\n}\n\n/**\n * A grouping of the asset index and address of the account\n */\nexport type HoldingReference = {\n /** The asset index of the holding */\n assetId: bigint\n\n /** The address of the account holding the asset */\n address: Address\n}\n\n/** A grouping of the application index and address of the account\n */\nexport type LocalsReference = {\n /** The application index of the local state */\n appId: bigint\n\n /** The address of the account holding the local state */\n address: Address\n}\n\nconst FIELD_ARGS = 'Args'\nconst FIELD_APPROVAL_PROGRAM = 'Approval program'\nconst FIELD_CLEAR_STATE_PROGRAM = 'Clear state program'\nconst FIELD_GLOBAL_STATE_SCHEMA = 'Global state schema'\nconst FIELD_LOCAL_STATE_SCHEMA = 'Local state schema'\nconst FIELD_EXTRA_PROGRAM_PAGES = 'Extra program pages'\n\n/**\n * Validate app call transaction fields\n */\nexport function validateAppCallTransaction(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (appCall.appId === 0n) {\n // App creation\n errors.push(...validateAppCreation(appCall))\n } else {\n // App call, update, or delete\n errors.push(...validateAppOperation(appCall))\n }\n\n // Common validations for all app operations\n errors.push(...validateAppCommonFields(appCall))\n\n return errors\n}\n\n/**\n * Validate app creation fields\n */\nfunction validateAppCreation(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (!appCall.approvalProgram || appCall.approvalProgram.length === 0) {\n errors.push({ type: TransactionValidationErrorType.RequiredField, data: FIELD_APPROVAL_PROGRAM })\n }\n\n if (!appCall.clearStateProgram || appCall.clearStateProgram.length === 0) {\n errors.push({ type: TransactionValidationErrorType.RequiredField, data: FIELD_CLEAR_STATE_PROGRAM })\n }\n\n const extraPages = appCall.extraProgramPages ?? 0\n if (extraPages > MAX_EXTRA_PROGRAM_PAGES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: FIELD_EXTRA_PROGRAM_PAGES, actual: extraPages, max: MAX_EXTRA_PROGRAM_PAGES, unit: 'pages' },\n })\n }\n\n const maxProgramSize = PROGRAM_PAGE_SIZE + extraPages * PROGRAM_PAGE_SIZE\n\n if (appCall.approvalProgram && appCall.approvalProgram.length > maxProgramSize) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: FIELD_APPROVAL_PROGRAM, actual: appCall.approvalProgram.length, max: maxProgramSize, unit: 'bytes' },\n })\n }\n\n if (appCall.clearStateProgram && appCall.clearStateProgram.length > maxProgramSize) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: FIELD_CLEAR_STATE_PROGRAM, actual: appCall.clearStateProgram.length, max: maxProgramSize, unit: 'bytes' },\n })\n }\n\n const totalProgramSize = (appCall.approvalProgram?.length ?? 0) + (appCall.clearStateProgram?.length ?? 0)\n if (totalProgramSize > maxProgramSize) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: 'Combined approval and clear state programs', actual: totalProgramSize, max: maxProgramSize, unit: 'bytes' },\n })\n }\n\n if (appCall.globalStateSchema) {\n const totalKeys = appCall.globalStateSchema.numUints + appCall.globalStateSchema.numByteSlices\n if (totalKeys > MAX_GLOBAL_STATE_KEYS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_GLOBAL_STATE_SCHEMA,\n actual: appCall.globalStateSchema.numUints + appCall.globalStateSchema.numByteSlices,\n max: MAX_GLOBAL_STATE_KEYS,\n unit: 'keys',\n },\n })\n }\n }\n\n if (appCall.localStateSchema) {\n const totalKeys = appCall.localStateSchema.numUints + appCall.localStateSchema.numByteSlices\n if (totalKeys > MAX_LOCAL_STATE_KEYS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_LOCAL_STATE_SCHEMA,\n actual: appCall.localStateSchema.numUints + appCall.localStateSchema.numByteSlices,\n max: MAX_LOCAL_STATE_KEYS,\n unit: 'keys',\n },\n })\n }\n }\n\n return errors\n}\n\n/**\n * Validate app operation (update, delete, call) fields\n */\nfunction validateAppOperation(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (appCall.onComplete === OnApplicationComplete.UpdateApplication) {\n if (!appCall.approvalProgram || appCall.approvalProgram.length === 0) {\n errors.push({ type: TransactionValidationErrorType.RequiredField, data: FIELD_APPROVAL_PROGRAM })\n }\n if (!appCall.clearStateProgram || appCall.clearStateProgram.length === 0) {\n errors.push({ type: TransactionValidationErrorType.RequiredField, data: FIELD_CLEAR_STATE_PROGRAM })\n }\n }\n\n // These fields are immutable and cannot be set for existing apps\n if (appCall.globalStateSchema !== undefined) {\n errors.push({ type: TransactionValidationErrorType.ImmutableField, data: FIELD_GLOBAL_STATE_SCHEMA })\n }\n if (appCall.localStateSchema !== undefined) {\n errors.push({ type: TransactionValidationErrorType.ImmutableField, data: FIELD_LOCAL_STATE_SCHEMA })\n }\n if (appCall.extraProgramPages !== undefined) {\n errors.push({ type: TransactionValidationErrorType.ImmutableField, data: FIELD_EXTRA_PROGRAM_PAGES })\n }\n\n return errors\n}\n\n/**\n * Validate common app call fields\n */\nfunction validateAppCommonFields(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (appCall.args) {\n if (appCall.args.length > MAX_APP_ARGS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: FIELD_ARGS, actual: appCall.args.length, max: MAX_APP_ARGS, unit: 'arguments' },\n })\n }\n\n const totalArgsSize = appCall.args.reduce((sum, arg) => sum + arg.length, 0)\n if (totalArgsSize > MAX_ARGS_SIZE) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: 'Args total size', actual: totalArgsSize, max: MAX_ARGS_SIZE, unit: 'bytes' },\n })\n }\n }\n\n if (appCall.accountReferences && appCall.accountReferences.length > MAX_ACCOUNT_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: 'Account references', actual: appCall.accountReferences.length, max: MAX_ACCOUNT_REFERENCES, unit: 'refs' },\n })\n }\n\n if (appCall.appReferences && appCall.appReferences.length > MAX_APP_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: 'App references', actual: appCall.appReferences.length, max: MAX_APP_REFERENCES, unit: 'refs' },\n })\n }\n\n if (appCall.assetReferences && appCall.assetReferences.length > MAX_ASSET_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: 'Asset references', actual: appCall.assetReferences.length, max: MAX_ASSET_REFERENCES, unit: 'refs' },\n })\n }\n\n // Validate box references\n if (appCall.boxReferences) {\n if (appCall.boxReferences.length > MAX_BOX_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: 'Box references', actual: appCall.boxReferences.length, max: MAX_BOX_REFERENCES, unit: 'refs' },\n })\n }\n\n // Validate that box reference app IDs are in app references\n const appRefs = appCall.appReferences || []\n for (const boxRef of appCall.boxReferences) {\n if (boxRef.appId !== 0n && boxRef.appId !== appCall.appId && !appRefs.includes(boxRef.appId)) {\n errors.push({\n type: TransactionValidationErrorType.ArbitraryConstraint,\n data: `Box reference for app ID ${boxRef.appId} must be in app references`,\n })\n }\n }\n }\n\n // Validate overall reference count\n const totalReferences =\n (appCall.accountReferences?.length || 0) +\n (appCall.appReferences?.length || 0) +\n (appCall.assetReferences?.length || 0) +\n (appCall.boxReferences?.length || 0)\n\n if (totalReferences > MAX_OVERALL_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: { field: 'Total references', actual: totalReferences, max: MAX_OVERALL_REFERENCES, unit: 'refs' },\n })\n }\n\n return errors\n}\n"],"mappings":";;;;;;;;;AA8HA,IAAY,0EAAL;;;;;AAKL;;;;;AAKA;;;;;AAKA;;;;;;AAMA;;;;;AAKA;;;;;;AAMA;;;AA+EF,MAAM,aAAa;AACnB,MAAM,yBAAyB;AAC/B,MAAM,4BAA4B;AAClC,MAAM,4BAA4B;AAClC,MAAM,2BAA2B;AACjC,MAAM,4BAA4B;;;;AAKlC,SAAgB,2BAA2B,SAAiE;CAC1G,MAAM,SAAS,IAAI,OAAmC;AAEtD,KAAI,QAAQ,UAAU,GAEpB,QAAO,KAAK,GAAG,oBAAoB,QAAQ,CAAC;KAG5C,QAAO,KAAK,GAAG,qBAAqB,QAAQ,CAAC;AAI/C,QAAO,KAAK,GAAG,wBAAwB,QAAQ,CAAC;AAEhD,QAAO;;;;;AAMT,SAAS,oBAAoB,SAAiE;CAC5F,MAAM,SAAS,IAAI,OAAmC;AAEtD,KAAI,CAAC,QAAQ,mBAAmB,QAAQ,gBAAgB,WAAW,EACjE,QAAO,KAAK;EAAE,MAAM,+BAA+B;EAAe,MAAM;EAAwB,CAAC;AAGnG,KAAI,CAAC,QAAQ,qBAAqB,QAAQ,kBAAkB,WAAW,EACrE,QAAO,KAAK;EAAE,MAAM,+BAA+B;E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|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Address } from "../../../common/src/address.js";
|
|
2
|
-
import { TransactionValidationError } from "./common.js";
|
|
3
2
|
|
|
4
3
|
//#region packages/transact/src/transactions/asset-config.d.ts
|
|
5
4
|
|
|
@@ -122,10 +121,6 @@ type AssetConfigTransactionFields = {
|
|
|
122
121
|
*/
|
|
123
122
|
clawback?: Address;
|
|
124
123
|
};
|
|
125
|
-
/**
|
|
126
|
-
* Validate asset configuration transaction fields
|
|
127
|
-
*/
|
|
128
|
-
declare function validateAssetConfigTransaction(assetConfig: AssetConfigTransactionFields): TransactionValidationError[];
|
|
129
124
|
//#endregion
|
|
130
|
-
export { AssetConfigTransactionFields
|
|
125
|
+
export { AssetConfigTransactionFields };
|
|
131
126
|
//# sourceMappingURL=asset-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-config.js","names":["TransactionValidationErrorType","MAX_ASSET_DECIMALS","MAX_ASSET_UNIT_NAME_LENGTH","MAX_ASSET_NAME_LENGTH","MAX_ASSET_URL_LENGTH"],"sources":["../../../../../packages/transact/src/transactions/asset-config.ts"],"sourcesContent":["import {\n MAX_ASSET_DECIMALS,\n MAX_ASSET_NAME_LENGTH,\n MAX_ASSET_UNIT_NAME_LENGTH,\n MAX_ASSET_URL_LENGTH,\n Address,\n} from '@algorandfoundation/algokit-common'\nimport { TransactionValidationError, TransactionValidationErrorType } from './common'\n\n/**\n * Represents an asset configuration transaction that creates, reconfigures, or destroys assets.\n */\nexport type AssetConfigTransactionFields = {\n /**\n * ID of the asset to operate on.\n *\n * For asset creation, this must be 0.\n * For asset reconfiguration this is the ID of the existing asset to be reconfigured,\n * For asset destroy this is the ID of the existing asset to be destroyed.\n */\n assetId: bigint\n\n /**\n * The total amount of the smallest divisible (decimal) unit to create.\n *\n * Required when creating a new asset.\n * For example, if creating a asset with 2 decimals and wanting a total supply of 100 units, this value should be 10000.\n *\n * This field can only be specified upon asset creation.\n */\n total?: bigint\n\n /**\n * The amount of decimal places the asset should have.\n *\n * If unspecified then the asset will be in whole units (i.e. `0`).\n * * If 0, the asset is not divisible;\n * * If 1, the base unit of the asset is in tenths;\n * * If 2, the base unit of the asset is in hundredths;\n * * If 3, the base unit of the asset is in thousandths;\n *\n * and so on up to 19 decimal places.\n *\n * This field can only be specified upon asset creation.\n */\n decimals?: number\n\n /**\n * Whether the asset is frozen by default for all accounts.\n * Defaults to `false`.\n *\n * If `true` then for anyone apart from the creator to hold the\n * asset it needs to be unfrozen per account using an asset freeze\n * transaction from the `freeze` account, which must be set on creation.\n *\n * This field can only be specified upon asset creation.\n */\n defaultFrozen?: boolean\n\n /**\n * The optional name of the asset.\n *\n * Max size is 32 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n assetName?: string\n\n /**\n * The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n unitName?: string\n\n /**\n * Specifies an optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n url?: string\n\n /**\n * 32-byte hash of some metadata that is relevant to your asset and/or asset holders.\n *\n * The format of this metadata is up to the application.\n *\n * This field can only be specified upon asset creation.\n */\n metadataHash?: Uint8Array\n\n /**\n * The address of the optional account that can manage the configuration of the asset and destroy it.\n *\n * The configuration fields it can change are `manager`, `reserve`, `clawback`, and `freeze`.\n *\n * If not set or set to the Zero address the asset becomes permanently immutable.\n */\n manager?: Address\n\n /**\n * The address of the optional account that holds the reserve (uncirculated supply) units of the asset.\n *\n * This address has no specific authority in the protocol itself and is informational only.\n *\n * Some standards like [ARC-19](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0019.md)\n * rely on this field to hold meaningful data.\n *\n * It can be used in the case where you want to signal to holders of your asset that the uncirculated units\n * of the asset reside in an account that is different from the default creator account.\n *\n * If not set or set to the Zero address the field is permanently empty.\n */\n reserve?: Address\n\n /**\n * The address of the optional account that can be used to freeze or unfreeze holdings of this asset for any account.\n *\n * If empty, freezing is not permitted.\n *\n * If not set or set to the Zero address the field is permanently empty.\n */\n freeze?: Address\n\n /**\n * The address of the optional account that can clawback holdings of this asset from any account.\n *\n * **This field should be used with caution** as the clawback account has the ability to **unconditionally take assets from any account**.\n *\n * If empty, clawback is not permitted.\n *\n * If not set or set to the Zero address the field is permanently empty.\n */\n clawback?: Address\n}\n\n/**\n * Validate asset configuration transaction fields\n */\nexport function validateAssetConfigTransaction(assetConfig: AssetConfigTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (assetConfig.assetId === 0n) {\n // Asset creation\n errors.push(...validateAssetCreation(assetConfig))\n } else {\n // Asset configuration or destruction\n errors.push(...validateAssetConfiguration(assetConfig))\n }\n\n return errors\n}\n\n/**\n * Validate asset creation fields\n */\nfunction validateAssetCreation(assetConfig: AssetConfigTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (assetConfig.total === undefined) {\n errors.push({\n type: TransactionValidationErrorType.RequiredField,\n data: 'Total',\n })\n }\n\n if (assetConfig.decimals !== undefined && assetConfig.decimals > MAX_ASSET_DECIMALS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Decimals',\n actual: assetConfig.decimals,\n max: MAX_ASSET_DECIMALS,\n unit: 'decimal places',\n },\n })\n }\n\n if (assetConfig.unitName && assetConfig.unitName.length > MAX_ASSET_UNIT_NAME_LENGTH) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Unit name',\n actual: assetConfig.unitName.length,\n max: MAX_ASSET_UNIT_NAME_LENGTH,\n unit: 'bytes',\n },\n })\n }\n\n if (assetConfig.assetName && assetConfig.assetName.length > MAX_ASSET_NAME_LENGTH) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Asset name',\n actual: assetConfig.assetName.length,\n max: MAX_ASSET_NAME_LENGTH,\n unit: 'bytes',\n },\n })\n }\n\n if (assetConfig.url && assetConfig.url.length > MAX_ASSET_URL_LENGTH) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Url',\n actual: assetConfig.url.length,\n max: MAX_ASSET_URL_LENGTH,\n unit: 'bytes',\n },\n })\n }\n\n return errors\n}\n\n/**\n * Validate asset configuration fields\n */\nfunction validateAssetConfiguration(assetConfig: AssetConfigTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n const hasAssetParams =\n assetConfig.total !== undefined ||\n assetConfig.decimals !== undefined ||\n assetConfig.defaultFrozen !== undefined ||\n assetConfig.assetName !== undefined ||\n assetConfig.unitName !== undefined ||\n assetConfig.url !== undefined ||\n assetConfig.metadataHash !== undefined ||\n assetConfig.manager !== undefined ||\n assetConfig.reserve !== undefined ||\n assetConfig.freeze !== undefined ||\n assetConfig.clawback !== undefined\n\n if (hasAssetParams) {\n // These fields are immutable after creation\n if (assetConfig.total !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Total',\n })\n }\n if (assetConfig.decimals !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Decimals',\n })\n }\n if (assetConfig.defaultFrozen !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Default frozen',\n })\n }\n if (assetConfig.assetName !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Asset name',\n })\n }\n if (assetConfig.unitName !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Unit name',\n })\n }\n if (assetConfig.url !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Url',\n })\n }\n if (assetConfig.metadataHash !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Metadata hash',\n })\n }\n }\n\n return errors\n}\n"],"mappings":";;;;;;;AA+IA,SAAgB,+BAA+B,aAAyE;CACtH,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xB,YAAY,YAAY,UACxB,YAAY,WAAW,UACvB,YAAY,aAAa,QAEP;AAElB,MAAI,YAAY,UAAU,OACxB,QAAO,KAAK;GACV,MAAMJ,8CAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,aAAa,OAC3B,QAAO,KAAK;GACV,MAAMA,8CAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,kBAAkB,OAChC,QAAO,KAAK;GACV,MAAMA,8CAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,cAAc,OAC5B,QAAO,KAAK;GACV,MAAMA,8CAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,aAAa,OAC3B,QAAO,KAAK;GACV,MAAMA,8CAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,QAAQ,OACtB,QAAO,KAAK;GACV,MAAMA,8CAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,iBAAiB,OAC/B,QAAO,KAAK;GACV,MAAMA,8CAA+B;GACrC,MAAM;GACP,CAAC;;AAIN,QAAO"}
|
|
1
|
+
{"version":3,"file":"asset-config.js","names":["TransactionValidationErrorType","MAX_ASSET_DECIMALS","MAX_ASSET_UNIT_NAME_LENGTH","MAX_ASSET_NAME_LENGTH","MAX_ASSET_URL_LENGTH"],"sources":["../../../../../packages/transact/src/transactions/asset-config.ts"],"sourcesContent":["import {\n Address,\n MAX_ASSET_DECIMALS,\n MAX_ASSET_NAME_LENGTH,\n MAX_ASSET_UNIT_NAME_LENGTH,\n MAX_ASSET_URL_LENGTH,\n} from '@algorandfoundation/algokit-common'\nimport { TransactionValidationError, TransactionValidationErrorType } from './common'\n\n/**\n * Represents an asset configuration transaction that creates, reconfigures, or destroys assets.\n */\nexport type AssetConfigTransactionFields = {\n /**\n * ID of the asset to operate on.\n *\n * For asset creation, this must be 0.\n * For asset reconfiguration this is the ID of the existing asset to be reconfigured,\n * For asset destroy this is the ID of the existing asset to be destroyed.\n */\n assetId: bigint\n\n /**\n * The total amount of the smallest divisible (decimal) unit to create.\n *\n * Required when creating a new asset.\n * For example, if creating a asset with 2 decimals and wanting a total supply of 100 units, this value should be 10000.\n *\n * This field can only be specified upon asset creation.\n */\n total?: bigint\n\n /**\n * The amount of decimal places the asset should have.\n *\n * If unspecified then the asset will be in whole units (i.e. `0`).\n * * If 0, the asset is not divisible;\n * * If 1, the base unit of the asset is in tenths;\n * * If 2, the base unit of the asset is in hundredths;\n * * If 3, the base unit of the asset is in thousandths;\n *\n * and so on up to 19 decimal places.\n *\n * This field can only be specified upon asset creation.\n */\n decimals?: number\n\n /**\n * Whether the asset is frozen by default for all accounts.\n * Defaults to `false`.\n *\n * If `true` then for anyone apart from the creator to hold the\n * asset it needs to be unfrozen per account using an asset freeze\n * transaction from the `freeze` account, which must be set on creation.\n *\n * This field can only be specified upon asset creation.\n */\n defaultFrozen?: boolean\n\n /**\n * The optional name of the asset.\n *\n * Max size is 32 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n assetName?: string\n\n /**\n * The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n unitName?: string\n\n /**\n * Specifies an optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n url?: string\n\n /**\n * 32-byte hash of some metadata that is relevant to your asset and/or asset holders.\n *\n * The format of this metadata is up to the application.\n *\n * This field can only be specified upon asset creation.\n */\n metadataHash?: Uint8Array\n\n /**\n * The address of the optional account that can manage the configuration of the asset and destroy it.\n *\n * The configuration fields it can change are `manager`, `reserve`, `clawback`, and `freeze`.\n *\n * If not set or set to the Zero address the asset becomes permanently immutable.\n */\n manager?: Address\n\n /**\n * The address of the optional account that holds the reserve (uncirculated supply) units of the asset.\n *\n * This address has no specific authority in the protocol itself and is informational only.\n *\n * Some standards like [ARC-19](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0019.md)\n * rely on this field to hold meaningful data.\n *\n * It can be used in the case where you want to signal to holders of your asset that the uncirculated units\n * of the asset reside in an account that is different from the default creator account.\n *\n * If not set or set to the Zero address the field is permanently empty.\n */\n reserve?: Address\n\n /**\n * The address of the optional account that can be used to freeze or unfreeze holdings of this asset for any account.\n *\n * If empty, freezing is not permitted.\n *\n * If not set or set to the Zero address the field is permanently empty.\n */\n freeze?: Address\n\n /**\n * The address of the optional account that can clawback holdings of this asset from any account.\n *\n * **This field should be used with caution** as the clawback account has the ability to **unconditionally take assets from any account**.\n *\n * If empty, clawback is not permitted.\n *\n * If not set or set to the Zero address the field is permanently empty.\n */\n clawback?: Address\n}\n\n/**\n * Validate asset configuration transaction fields\n */\nexport function validateAssetConfigTransaction(assetConfig: AssetConfigTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (assetConfig.assetId === 0n) {\n // Asset creation\n errors.push(...validateAssetCreation(assetConfig))\n } else {\n // Asset configuration or destruction\n errors.push(...validateAssetConfiguration(assetConfig))\n }\n\n return errors\n}\n\n/**\n * Validate asset creation fields\n */\nfunction validateAssetCreation(assetConfig: AssetConfigTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (assetConfig.total === undefined) {\n errors.push({\n type: TransactionValidationErrorType.RequiredField,\n data: 'Total',\n })\n }\n\n if (assetConfig.decimals !== undefined && assetConfig.decimals > MAX_ASSET_DECIMALS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Decimals',\n actual: assetConfig.decimals,\n max: MAX_ASSET_DECIMALS,\n unit: 'decimal places',\n },\n })\n }\n\n if (assetConfig.unitName && assetConfig.unitName.length > MAX_ASSET_UNIT_NAME_LENGTH) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Unit name',\n actual: assetConfig.unitName.length,\n max: MAX_ASSET_UNIT_NAME_LENGTH,\n unit: 'bytes',\n },\n })\n }\n\n if (assetConfig.assetName && assetConfig.assetName.length > MAX_ASSET_NAME_LENGTH) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Asset name',\n actual: assetConfig.assetName.length,\n max: MAX_ASSET_NAME_LENGTH,\n unit: 'bytes',\n },\n })\n }\n\n if (assetConfig.url && assetConfig.url.length > MAX_ASSET_URL_LENGTH) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Url',\n actual: assetConfig.url.length,\n max: MAX_ASSET_URL_LENGTH,\n unit: 'bytes',\n },\n })\n }\n\n return errors\n}\n\n/**\n * Validate asset configuration fields\n */\nfunction validateAssetConfiguration(assetConfig: AssetConfigTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n const hasAssetParams =\n assetConfig.total !== undefined ||\n assetConfig.decimals !== undefined ||\n assetConfig.defaultFrozen !== undefined ||\n assetConfig.assetName !== undefined ||\n assetConfig.unitName !== undefined ||\n assetConfig.url !== undefined ||\n assetConfig.metadataHash !== undefined ||\n assetConfig.manager !== undefined ||\n assetConfig.reserve !== undefined ||\n assetConfig.freeze !== undefined ||\n assetConfig.clawback !== undefined\n\n if (hasAssetParams) {\n // These fields are immutable after creation\n if (assetConfig.total !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Total',\n })\n }\n if (assetConfig.decimals !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Decimals',\n })\n }\n if (assetConfig.defaultFrozen !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Default frozen',\n })\n }\n if (assetConfig.assetName !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Asset name',\n })\n }\n if (assetConfig.unitName !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Unit name',\n })\n }\n if (assetConfig.url !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Url',\n })\n }\n if (assetConfig.metadataHash !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Metadata hash',\n })\n }\n }\n\n return errors\n}\n"],"mappings":";;;;;;;AA+IA,SAAgB,+BAA+B,aAAyE;CACtH,MAAM,SAAS,IAAI,OAAmC;AAEtD,KAAI,YAAY,YAAY,GAE1B,QAAO,KAAK,GAAG,sBAAsB,YAAY,CAAC;KAGlD,QAAO,KAAK,GAAG,2BAA2B,YAAY,CAAC;AAGzD,QAAO;;;;;AAMT,SAAS,sBAAsB,aAAyE;CACtG,MAAM,SAAS,IAAI,OAAmC;AAEtD,KAAI,YAAY,UAAU,OACxB,QAAO,KAAK;EACV,MAAMA,8CAA+B;EACrC,MAAM;EACP,CAAC;AAGJ,KAAI,YAAY,aAAa,UAAa,YAAY,WAAWC,qCAC/D,QAAO,KAAK;EACV,MAAMD,8CAA+B;EACrC,MAAM;GACJ,OAAO;GACP,QAAQ,YAAY;GACpB,KAAKC;GACL,MAAM;GACP;EACF,CAAC;AAGJ,KAAI,YAAY,YAAY,YAAY,SAAS,SAASC,6CACxD,QAAO,KAAK;EACV,MAAMF,8CAA+B;EACrC,MAAM;GACJ,OAAO;GACP,QAAQ,YAAY,SAAS;GAC7B,KAAKE;GACL,MAAM;GACP;EACF,CAAC;AAGJ,KAAI,YAAY,aAAa,YAAY,UAAU,SAASC,wCAC1D,QAAO,KAAK;EACV,MAAMH,8CAA+B;EACrC,MAAM;GACJ,OAAO;GACP,QAAQ,YAAY,UAAU;GAC9B,KAAKG;GACL,MAAM;GACP;EACF,CAAC;AAGJ,KAAI,YAAY,OAAO,YAAY,IAAI,SAASC,uCAC9C,QAAO,KAAK;EACV,MAAMJ,8CAA+B;EACrC,MAAM;GACJ,OAAO;GACP,QAAQ,YAAY,IAAI;GACxB,KAAKI;GACL,MAAM;GACP;EACF,CAAC;AAGJ,QAAO;;;;;AAMT,SAAS,2BAA2B,aAAyE;CAC3G,MAAM,SAAS,IAAI,OAAmC;AAetD,KAZE,YAAY,UAAU,UACtB,YAAY,aAAa,UACzB,YAAY,kBAAkB,UAC9B,YAAY,cAAc,UAC1B,YAAY,aAAa,UACzB,YAAY,QAAQ,UACpB,YAAY,iBAAiB,UAC7B,YAAY,YAAY,UACxB,YAAY,YAAY,UACxB,YAAY,WAAW,UACvB,YAAY,aAAa,QAEP;AAElB,MAAI,YAAY,UAAU,OACxB,QAAO,KAAK;GACV,MAAMJ,8CAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,aAAa,OAC3B,QAAO,KAAK;GACV,MAAMA,8CAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,kBAAkB,OAChC,QAAO,KAAK;GACV,MAAMA,8CAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,cAAc,OAC5B,QAAO,KAAK;GACV,MAAMA,8CAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,aAAa,OAC3B,QAAO,KAAK;GACV,MAAMA,8CAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,QAAQ,OACtB,QAAO,KAAK;GACV,MAAMA,8CAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,iBAAiB,OAC/B,QAAO,KAAK;GACV,MAAMA,8CAA+B;GACrC,MAAM;GACP,CAAC;;AAIN,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-config.mjs","names":[],"sources":["../../../../../packages/transact/src/transactions/asset-config.ts"],"sourcesContent":["import {\n MAX_ASSET_DECIMALS,\n MAX_ASSET_NAME_LENGTH,\n MAX_ASSET_UNIT_NAME_LENGTH,\n MAX_ASSET_URL_LENGTH,\n Address,\n} from '@algorandfoundation/algokit-common'\nimport { TransactionValidationError, TransactionValidationErrorType } from './common'\n\n/**\n * Represents an asset configuration transaction that creates, reconfigures, or destroys assets.\n */\nexport type AssetConfigTransactionFields = {\n /**\n * ID of the asset to operate on.\n *\n * For asset creation, this must be 0.\n * For asset reconfiguration this is the ID of the existing asset to be reconfigured,\n * For asset destroy this is the ID of the existing asset to be destroyed.\n */\n assetId: bigint\n\n /**\n * The total amount of the smallest divisible (decimal) unit to create.\n *\n * Required when creating a new asset.\n * For example, if creating a asset with 2 decimals and wanting a total supply of 100 units, this value should be 10000.\n *\n * This field can only be specified upon asset creation.\n */\n total?: bigint\n\n /**\n * The amount of decimal places the asset should have.\n *\n * If unspecified then the asset will be in whole units (i.e. `0`).\n * * If 0, the asset is not divisible;\n * * If 1, the base unit of the asset is in tenths;\n * * If 2, the base unit of the asset is in hundredths;\n * * If 3, the base unit of the asset is in thousandths;\n *\n * and so on up to 19 decimal places.\n *\n * This field can only be specified upon asset creation.\n */\n decimals?: number\n\n /**\n * Whether the asset is frozen by default for all accounts.\n * Defaults to `false`.\n *\n * If `true` then for anyone apart from the creator to hold the\n * asset it needs to be unfrozen per account using an asset freeze\n * transaction from the `freeze` account, which must be set on creation.\n *\n * This field can only be specified upon asset creation.\n */\n defaultFrozen?: boolean\n\n /**\n * The optional name of the asset.\n *\n * Max size is 32 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n assetName?: string\n\n /**\n * The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n unitName?: string\n\n /**\n * Specifies an optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n url?: string\n\n /**\n * 32-byte hash of some metadata that is relevant to your asset and/or asset holders.\n *\n * The format of this metadata is up to the application.\n *\n * This field can only be specified upon asset creation.\n */\n metadataHash?: Uint8Array\n\n /**\n * The address of the optional account that can manage the configuration of the asset and destroy it.\n *\n * The configuration fields it can change are `manager`, `reserve`, `clawback`, and `freeze`.\n *\n * If not set or set to the Zero address the asset becomes permanently immutable.\n */\n manager?: Address\n\n /**\n * The address of the optional account that holds the reserve (uncirculated supply) units of the asset.\n *\n * This address has no specific authority in the protocol itself and is informational only.\n *\n * Some standards like [ARC-19](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0019.md)\n * rely on this field to hold meaningful data.\n *\n * It can be used in the case where you want to signal to holders of your asset that the uncirculated units\n * of the asset reside in an account that is different from the default creator account.\n *\n * If not set or set to the Zero address the field is permanently empty.\n */\n reserve?: Address\n\n /**\n * The address of the optional account that can be used to freeze or unfreeze holdings of this asset for any account.\n *\n * If empty, freezing is not permitted.\n *\n * If not set or set to the Zero address the field is permanently empty.\n */\n freeze?: Address\n\n /**\n * The address of the optional account that can clawback holdings of this asset from any account.\n *\n * **This field should be used with caution** as the clawback account has the ability to **unconditionally take assets from any account**.\n *\n * If empty, clawback is not permitted.\n *\n * If not set or set to the Zero address the field is permanently empty.\n */\n clawback?: Address\n}\n\n/**\n * Validate asset configuration transaction fields\n */\nexport function validateAssetConfigTransaction(assetConfig: AssetConfigTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (assetConfig.assetId === 0n) {\n // Asset creation\n errors.push(...validateAssetCreation(assetConfig))\n } else {\n // Asset configuration or destruction\n errors.push(...validateAssetConfiguration(assetConfig))\n }\n\n return errors\n}\n\n/**\n * Validate asset creation fields\n */\nfunction validateAssetCreation(assetConfig: AssetConfigTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (assetConfig.total === undefined) {\n errors.push({\n type: TransactionValidationErrorType.RequiredField,\n data: 'Total',\n })\n }\n\n if (assetConfig.decimals !== undefined && assetConfig.decimals > MAX_ASSET_DECIMALS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Decimals',\n actual: assetConfig.decimals,\n max: MAX_ASSET_DECIMALS,\n unit: 'decimal places',\n },\n })\n }\n\n if (assetConfig.unitName && assetConfig.unitName.length > MAX_ASSET_UNIT_NAME_LENGTH) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Unit name',\n actual: assetConfig.unitName.length,\n max: MAX_ASSET_UNIT_NAME_LENGTH,\n unit: 'bytes',\n },\n })\n }\n\n if (assetConfig.assetName && assetConfig.assetName.length > MAX_ASSET_NAME_LENGTH) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Asset name',\n actual: assetConfig.assetName.length,\n max: MAX_ASSET_NAME_LENGTH,\n unit: 'bytes',\n },\n })\n }\n\n if (assetConfig.url && assetConfig.url.length > MAX_ASSET_URL_LENGTH) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Url',\n actual: assetConfig.url.length,\n max: MAX_ASSET_URL_LENGTH,\n unit: 'bytes',\n },\n })\n }\n\n return errors\n}\n\n/**\n * Validate asset configuration fields\n */\nfunction validateAssetConfiguration(assetConfig: AssetConfigTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n const hasAssetParams =\n assetConfig.total !== undefined ||\n assetConfig.decimals !== undefined ||\n assetConfig.defaultFrozen !== undefined ||\n assetConfig.assetName !== undefined ||\n assetConfig.unitName !== undefined ||\n assetConfig.url !== undefined ||\n assetConfig.metadataHash !== undefined ||\n assetConfig.manager !== undefined ||\n assetConfig.reserve !== undefined ||\n assetConfig.freeze !== undefined ||\n assetConfig.clawback !== undefined\n\n if (hasAssetParams) {\n // These fields are immutable after creation\n if (assetConfig.total !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Total',\n })\n }\n if (assetConfig.decimals !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Decimals',\n })\n }\n if (assetConfig.defaultFrozen !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Default frozen',\n })\n }\n if (assetConfig.assetName !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Asset name',\n })\n }\n if (assetConfig.unitName !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Unit name',\n })\n }\n if (assetConfig.url !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Url',\n })\n }\n if (assetConfig.metadataHash !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Metadata hash',\n })\n }\n }\n\n return errors\n}\n"],"mappings":";;;;;;;AA+IA,SAAgB,+BAA+B,aAAyE;CACtH,MAAM,SAAS,IAAI,OAAmC;AAEtD,KAAI,YAAY,YAAY,GAE1B,QAAO,KAAK,GAAG,sBAAsB,YAAY,CAAC;KAGlD,QAAO,KAAK,GAAG,2BAA2B,YAAY,CAAC;AAGzD,QAAO;;;;;AAMT,SAAS,sBAAsB,aAAyE;CACtG,MAAM,SAAS,IAAI,OAAmC;AAEtD,KAAI,YAAY,UAAU,OACxB,QAAO,KAAK;EACV,MAAM,+BAA+B;EACrC,MAAM;EACP,CAAC;AAGJ,KAAI,YAAY,aAAa,UAAa,YAAY,WAAW,mBAC/D,QAAO,KAAK;EACV,MAAM,+BAA+B;EACrC,MAAM;GACJ,OAAO;GACP,QAAQ,YAAY;GACpB,KAAK;GACL,MAAM;GACP;EACF,CAAC;AAGJ,KAAI,YAAY,YAAY,YAAY,SAAS,SAAS,2BACxD,QAAO,KAAK;EACV,MAAM,+BAA+B;EACrC,MAAM;GACJ,OAAO;GACP,QAAQ,YAAY,SAAS;GAC7B,KAAK;GACL,MAAM;GACP;EACF,CAAC;AAGJ,KAAI,YAAY,aAAa,YAAY,UAAU,SAAS,sBAC1D,QAAO,KAAK;EACV,MAAM,+BAA+B;EACrC,MAAM;GACJ,OAAO;GACP,QAAQ,YAAY,UAAU;GAC9B,KAAK;GACL,MAAM;GACP;EACF,CAAC;AAGJ,KAAI,YAAY,OAAO,YAAY,IAAI,SAAS,qBAC9C,QAAO,KAAK;EACV,MAAM,+BAA+B;EACrC,MAAM;GACJ,OAAO;GACP,QAAQ,YAAY,IAAI;GACxB,KAAK;GACL,MAAM;GACP;EACF,CAAC;AAGJ,QAAO;;;;;AAMT,SAAS,2BAA2B,aAAyE;CAC3G,MAAM,SAAS,IAAI,OAAmC;AAetD,KAZE,YAAY,UAAU,UACtB,YAAY,aAAa,UACzB,YAAY,kBAAkB,UAC9B,YAAY,cAAc,UAC1B,YAAY,aAAa,UACzB,YAAY,QAAQ,UACpB,YAAY,iBAAiB,UAC7B,YAAY,YAAY,UACxB,YAAY,YAAY,UACxB,YAAY,WAAW,UACvB,YAAY,aAAa,QAEP;AAElB,MAAI,YAAY,UAAU,OACxB,QAAO,KAAK;GACV,MAAM,+BAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,aAAa,OAC3B,QAAO,KAAK;GACV,MAAM,+BAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,kBAAkB,OAChC,QAAO,KAAK;GACV,MAAM,+BAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,cAAc,OAC5B,QAAO,KAAK;GACV,MAAM,+BAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,aAAa,OAC3B,QAAO,KAAK;GACV,MAAM,+BAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,QAAQ,OACtB,QAAO,KAAK;GACV,MAAM,+BAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,iBAAiB,OAC/B,QAAO,KAAK;GACV,MAAM,+BAA+B;GACrC,MAAM;GACP,CAAC;;AAIN,QAAO"}
|
|
1
|
+
{"version":3,"file":"asset-config.mjs","names":[],"sources":["../../../../../packages/transact/src/transactions/asset-config.ts"],"sourcesContent":["import {\n Address,\n MAX_ASSET_DECIMALS,\n MAX_ASSET_NAME_LENGTH,\n MAX_ASSET_UNIT_NAME_LENGTH,\n MAX_ASSET_URL_LENGTH,\n} from '@algorandfoundation/algokit-common'\nimport { TransactionValidationError, TransactionValidationErrorType } from './common'\n\n/**\n * Represents an asset configuration transaction that creates, reconfigures, or destroys assets.\n */\nexport type AssetConfigTransactionFields = {\n /**\n * ID of the asset to operate on.\n *\n * For asset creation, this must be 0.\n * For asset reconfiguration this is the ID of the existing asset to be reconfigured,\n * For asset destroy this is the ID of the existing asset to be destroyed.\n */\n assetId: bigint\n\n /**\n * The total amount of the smallest divisible (decimal) unit to create.\n *\n * Required when creating a new asset.\n * For example, if creating a asset with 2 decimals and wanting a total supply of 100 units, this value should be 10000.\n *\n * This field can only be specified upon asset creation.\n */\n total?: bigint\n\n /**\n * The amount of decimal places the asset should have.\n *\n * If unspecified then the asset will be in whole units (i.e. `0`).\n * * If 0, the asset is not divisible;\n * * If 1, the base unit of the asset is in tenths;\n * * If 2, the base unit of the asset is in hundredths;\n * * If 3, the base unit of the asset is in thousandths;\n *\n * and so on up to 19 decimal places.\n *\n * This field can only be specified upon asset creation.\n */\n decimals?: number\n\n /**\n * Whether the asset is frozen by default for all accounts.\n * Defaults to `false`.\n *\n * If `true` then for anyone apart from the creator to hold the\n * asset it needs to be unfrozen per account using an asset freeze\n * transaction from the `freeze` account, which must be set on creation.\n *\n * This field can only be specified upon asset creation.\n */\n defaultFrozen?: boolean\n\n /**\n * The optional name of the asset.\n *\n * Max size is 32 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n assetName?: string\n\n /**\n * The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n unitName?: string\n\n /**\n * Specifies an optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n url?: string\n\n /**\n * 32-byte hash of some metadata that is relevant to your asset and/or asset holders.\n *\n * The format of this metadata is up to the application.\n *\n * This field can only be specified upon asset creation.\n */\n metadataHash?: Uint8Array\n\n /**\n * The address of the optional account that can manage the configuration of the asset and destroy it.\n *\n * The configuration fields it can change are `manager`, `reserve`, `clawback`, and `freeze`.\n *\n * If not set or set to the Zero address the asset becomes permanently immutable.\n */\n manager?: Address\n\n /**\n * The address of the optional account that holds the reserve (uncirculated supply) units of the asset.\n *\n * This address has no specific authority in the protocol itself and is informational only.\n *\n * Some standards like [ARC-19](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0019.md)\n * rely on this field to hold meaningful data.\n *\n * It can be used in the case where you want to signal to holders of your asset that the uncirculated units\n * of the asset reside in an account that is different from the default creator account.\n *\n * If not set or set to the Zero address the field is permanently empty.\n */\n reserve?: Address\n\n /**\n * The address of the optional account that can be used to freeze or unfreeze holdings of this asset for any account.\n *\n * If empty, freezing is not permitted.\n *\n * If not set or set to the Zero address the field is permanently empty.\n */\n freeze?: Address\n\n /**\n * The address of the optional account that can clawback holdings of this asset from any account.\n *\n * **This field should be used with caution** as the clawback account has the ability to **unconditionally take assets from any account**.\n *\n * If empty, clawback is not permitted.\n *\n * If not set or set to the Zero address the field is permanently empty.\n */\n clawback?: Address\n}\n\n/**\n * Validate asset configuration transaction fields\n */\nexport function validateAssetConfigTransaction(assetConfig: AssetConfigTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (assetConfig.assetId === 0n) {\n // Asset creation\n errors.push(...validateAssetCreation(assetConfig))\n } else {\n // Asset configuration or destruction\n errors.push(...validateAssetConfiguration(assetConfig))\n }\n\n return errors\n}\n\n/**\n * Validate asset creation fields\n */\nfunction validateAssetCreation(assetConfig: AssetConfigTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (assetConfig.total === undefined) {\n errors.push({\n type: TransactionValidationErrorType.RequiredField,\n data: 'Total',\n })\n }\n\n if (assetConfig.decimals !== undefined && assetConfig.decimals > MAX_ASSET_DECIMALS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Decimals',\n actual: assetConfig.decimals,\n max: MAX_ASSET_DECIMALS,\n unit: 'decimal places',\n },\n })\n }\n\n if (assetConfig.unitName && assetConfig.unitName.length > MAX_ASSET_UNIT_NAME_LENGTH) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Unit name',\n actual: assetConfig.unitName.length,\n max: MAX_ASSET_UNIT_NAME_LENGTH,\n unit: 'bytes',\n },\n })\n }\n\n if (assetConfig.assetName && assetConfig.assetName.length > MAX_ASSET_NAME_LENGTH) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Asset name',\n actual: assetConfig.assetName.length,\n max: MAX_ASSET_NAME_LENGTH,\n unit: 'bytes',\n },\n })\n }\n\n if (assetConfig.url && assetConfig.url.length > MAX_ASSET_URL_LENGTH) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Url',\n actual: assetConfig.url.length,\n max: MAX_ASSET_URL_LENGTH,\n unit: 'bytes',\n },\n })\n }\n\n return errors\n}\n\n/**\n * Validate asset configuration fields\n */\nfunction validateAssetConfiguration(assetConfig: AssetConfigTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n const hasAssetParams =\n assetConfig.total !== undefined ||\n assetConfig.decimals !== undefined ||\n assetConfig.defaultFrozen !== undefined ||\n assetConfig.assetName !== undefined ||\n assetConfig.unitName !== undefined ||\n assetConfig.url !== undefined ||\n assetConfig.metadataHash !== undefined ||\n assetConfig.manager !== undefined ||\n assetConfig.reserve !== undefined ||\n assetConfig.freeze !== undefined ||\n assetConfig.clawback !== undefined\n\n if (hasAssetParams) {\n // These fields are immutable after creation\n if (assetConfig.total !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Total',\n })\n }\n if (assetConfig.decimals !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Decimals',\n })\n }\n if (assetConfig.defaultFrozen !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Default frozen',\n })\n }\n if (assetConfig.assetName !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Asset name',\n })\n }\n if (assetConfig.unitName !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Unit name',\n })\n }\n if (assetConfig.url !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Url',\n })\n }\n if (assetConfig.metadataHash !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: 'Metadata hash',\n })\n }\n }\n\n return errors\n}\n"],"mappings":";;;;;;;AA+IA,SAAgB,+BAA+B,aAAyE;CACtH,MAAM,SAAS,IAAI,OAAmC;AAEtD,KAAI,YAAY,YAAY,GAE1B,QAAO,KAAK,GAAG,sBAAsB,YAAY,CAAC;KAGlD,QAAO,KAAK,GAAG,2BAA2B,YAAY,CAAC;AAGzD,QAAO;;;;;AAMT,SAAS,sBAAsB,aAAyE;CACtG,MAAM,SAAS,IAAI,OAAmC;AAEtD,KAAI,YAAY,UAAU,OACxB,QAAO,KAAK;EACV,MAAM,+BAA+B;EACrC,MAAM;EACP,CAAC;AAGJ,KAAI,YAAY,aAAa,UAAa,YAAY,WAAW,mBAC/D,QAAO,KAAK;EACV,MAAM,+BAA+B;EACrC,MAAM;GACJ,OAAO;GACP,QAAQ,YAAY;GACpB,KAAK;GACL,MAAM;GACP;EACF,CAAC;AAGJ,KAAI,YAAY,YAAY,YAAY,SAAS,SAAS,2BACxD,QAAO,KAAK;EACV,MAAM,+BAA+B;EACrC,MAAM;GACJ,OAAO;GACP,QAAQ,YAAY,SAAS;GAC7B,KAAK;GACL,MAAM;GACP;EACF,CAAC;AAGJ,KAAI,YAAY,aAAa,YAAY,UAAU,SAAS,sBAC1D,QAAO,KAAK;EACV,MAAM,+BAA+B;EACrC,MAAM;GACJ,OAAO;GACP,QAAQ,YAAY,UAAU;GAC9B,KAAK;GACL,MAAM;GACP;EACF,CAAC;AAGJ,KAAI,YAAY,OAAO,YAAY,IAAI,SAAS,qBAC9C,QAAO,KAAK;EACV,MAAM,+BAA+B;EACrC,MAAM;GACJ,OAAO;GACP,QAAQ,YAAY,IAAI;GACxB,KAAK;GACL,MAAM;GACP;EACF,CAAC;AAGJ,QAAO;;;;;AAMT,SAAS,2BAA2B,aAAyE;CAC3G,MAAM,SAAS,IAAI,OAAmC;AAetD,KAZE,YAAY,UAAU,UACtB,YAAY,aAAa,UACzB,YAAY,kBAAkB,UAC9B,YAAY,cAAc,UAC1B,YAAY,aAAa,UACzB,YAAY,QAAQ,UACpB,YAAY,iBAAiB,UAC7B,YAAY,YAAY,UACxB,YAAY,YAAY,UACxB,YAAY,WAAW,UACvB,YAAY,aAAa,QAEP;AAElB,MAAI,YAAY,UAAU,OACxB,QAAO,KAAK;GACV,MAAM,+BAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,aAAa,OAC3B,QAAO,KAAK;GACV,MAAM,+BAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,kBAAkB,OAChC,QAAO,KAAK;GACV,MAAM,+BAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,cAAc,OAC5B,QAAO,KAAK;GACV,MAAM,+BAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,aAAa,OAC3B,QAAO,KAAK;GACV,MAAM,+BAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,QAAQ,OACtB,QAAO,KAAK;GACV,MAAM,+BAA+B;GACrC,MAAM;GACP,CAAC;AAEJ,MAAI,YAAY,iBAAiB,OAC/B,QAAO,KAAK;GACV,MAAM,+BAA+B;GACrC,MAAM;GACP,CAAC;;AAIN,QAAO"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Address } from "../../../common/src/address.js";
|
|
2
|
-
import { TransactionValidationError } from "./common.js";
|
|
3
2
|
|
|
4
3
|
//#region packages/transact/src/transactions/asset-freeze.d.ts
|
|
5
4
|
|
|
@@ -26,10 +25,6 @@ type AssetFreezeTransactionFields = {
|
|
|
26
25
|
*/
|
|
27
26
|
frozen: boolean;
|
|
28
27
|
};
|
|
29
|
-
/**
|
|
30
|
-
* Validate asset freeze transaction fields
|
|
31
|
-
*/
|
|
32
|
-
declare function validateAssetFreezeTransaction(assetFreeze: AssetFreezeTransactionFields): TransactionValidationError[];
|
|
33
28
|
//#endregion
|
|
34
|
-
export { AssetFreezeTransactionFields
|
|
29
|
+
export { AssetFreezeTransactionFields };
|
|
35
30
|
//# sourceMappingURL=asset-freeze.d.ts.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Address } from "../../../common/src/address.js";
|
|
2
|
-
import { TransactionValidationError } from "./common.js";
|
|
3
2
|
|
|
4
3
|
//#region packages/transact/src/transactions/asset-transfer.d.ts
|
|
5
4
|
|
|
@@ -47,10 +46,6 @@ type AssetTransferTransactionFields = {
|
|
|
47
46
|
*/
|
|
48
47
|
closeRemainderTo?: Address;
|
|
49
48
|
};
|
|
50
|
-
/**
|
|
51
|
-
* Validate asset transfer transaction fields
|
|
52
|
-
*/
|
|
53
|
-
declare function validateAssetTransferTransaction(assetTransfer: AssetTransferTransactionFields): TransactionValidationError[];
|
|
54
49
|
//#endregion
|
|
55
|
-
export { AssetTransferTransactionFields
|
|
50
|
+
export { AssetTransferTransactionFields };
|
|
56
51
|
//# sourceMappingURL=asset-transfer.d.ts.map
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { TransactionValidationError } from "./common.js";
|
|
2
|
-
|
|
3
1
|
//#region packages/transact/src/transactions/key-registration.d.ts
|
|
4
|
-
|
|
5
2
|
/**
|
|
6
3
|
* Represents a key registration transaction that registers an account online or offline
|
|
7
4
|
* for participation in Algorand consensus.
|
|
@@ -36,10 +33,6 @@ type KeyRegistrationTransactionFields = {
|
|
|
36
33
|
*/
|
|
37
34
|
nonParticipation?: boolean;
|
|
38
35
|
};
|
|
39
|
-
/**
|
|
40
|
-
* Validate key registration transaction fields
|
|
41
|
-
*/
|
|
42
|
-
declare function validateKeyRegistrationTransaction(keyReg: KeyRegistrationTransactionFields): TransactionValidationError[];
|
|
43
36
|
//#endregion
|
|
44
|
-
export { KeyRegistrationTransactionFields
|
|
37
|
+
export { KeyRegistrationTransactionFields };
|
|
45
38
|
//# sourceMappingURL=key-registration.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ObjectModelMetadata } from "../../../common/src/codecs/types.js";
|
|
2
|
+
import { BoxReference, HoldingReference, LocalsReference } from "./app-call.js";
|
|
3
|
+
|
|
4
|
+
//#region packages/transact/src/transactions/reference-types-meta.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Metadata for BoxReference
|
|
8
|
+
*
|
|
9
|
+
* Maps wire format (app, name) to BoxReference (appId, name)
|
|
10
|
+
*/
|
|
11
|
+
declare const BoxReferenceMeta: ObjectModelMetadata<BoxReference>;
|
|
12
|
+
/**
|
|
13
|
+
* Metadata for HoldingReference
|
|
14
|
+
*
|
|
15
|
+
* Maps wire format (account, asset) to HoldingReference (address, assetId)
|
|
16
|
+
*/
|
|
17
|
+
declare const HoldingReferenceMeta: ObjectModelMetadata<HoldingReference>;
|
|
18
|
+
/**
|
|
19
|
+
* Metadata for LocalsReference
|
|
20
|
+
*
|
|
21
|
+
* Maps wire format (account, app) to LocalsReference (address, appId)
|
|
22
|
+
*/
|
|
23
|
+
declare const LocalsReferenceMeta: ObjectModelMetadata<LocalsReference>;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { BoxReferenceMeta, HoldingReferenceMeta, LocalsReferenceMeta };
|
|
26
|
+
//# sourceMappingURL=reference-types-meta.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const require_address = require('../../../common/src/codecs/primitives/address.js');
|
|
2
|
+
const require_bigint = require('../../../common/src/codecs/primitives/bigint.js');
|
|
3
|
+
const require_bytes = require('../../../common/src/codecs/primitives/bytes.js');
|
|
4
|
+
|
|
5
|
+
//#region packages/transact/src/transactions/reference-types-meta.ts
|
|
6
|
+
/**
|
|
7
|
+
* Metadata for BoxReference
|
|
8
|
+
*
|
|
9
|
+
* Maps wire format (app, name) to BoxReference (appId, name)
|
|
10
|
+
*/
|
|
11
|
+
const BoxReferenceMeta = {
|
|
12
|
+
name: "BoxReference",
|
|
13
|
+
kind: "object",
|
|
14
|
+
fields: [{
|
|
15
|
+
name: "appId",
|
|
16
|
+
wireKey: "app",
|
|
17
|
+
optional: false,
|
|
18
|
+
codec: require_bigint.bigIntCodec
|
|
19
|
+
}, {
|
|
20
|
+
name: "name",
|
|
21
|
+
wireKey: "name",
|
|
22
|
+
optional: false,
|
|
23
|
+
codec: require_bytes.bytesCodec
|
|
24
|
+
}]
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Metadata for HoldingReference
|
|
28
|
+
*
|
|
29
|
+
* Maps wire format (account, asset) to HoldingReference (address, assetId)
|
|
30
|
+
*/
|
|
31
|
+
const HoldingReferenceMeta = {
|
|
32
|
+
name: "HoldingReference",
|
|
33
|
+
kind: "object",
|
|
34
|
+
fields: [{
|
|
35
|
+
name: "address",
|
|
36
|
+
wireKey: "account",
|
|
37
|
+
optional: false,
|
|
38
|
+
codec: require_address.addressCodec
|
|
39
|
+
}, {
|
|
40
|
+
name: "assetId",
|
|
41
|
+
wireKey: "asset",
|
|
42
|
+
optional: false,
|
|
43
|
+
codec: require_bigint.bigIntCodec
|
|
44
|
+
}]
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Metadata for LocalsReference
|
|
48
|
+
*
|
|
49
|
+
* Maps wire format (account, app) to LocalsReference (address, appId)
|
|
50
|
+
*/
|
|
51
|
+
const LocalsReferenceMeta = {
|
|
52
|
+
name: "LocalsReference",
|
|
53
|
+
kind: "object",
|
|
54
|
+
fields: [{
|
|
55
|
+
name: "address",
|
|
56
|
+
wireKey: "account",
|
|
57
|
+
optional: false,
|
|
58
|
+
codec: require_address.addressCodec
|
|
59
|
+
}, {
|
|
60
|
+
name: "appId",
|
|
61
|
+
wireKey: "app",
|
|
62
|
+
optional: false,
|
|
63
|
+
codec: require_bigint.bigIntCodec
|
|
64
|
+
}]
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
exports.BoxReferenceMeta = BoxReferenceMeta;
|
|
69
|
+
exports.HoldingReferenceMeta = HoldingReferenceMeta;
|
|
70
|
+
exports.LocalsReferenceMeta = LocalsReferenceMeta;
|
|
71
|
+
//# sourceMappingURL=reference-types-meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference-types-meta.js","names":["BoxReferenceMeta: ObjectModelMetadata<BoxReference>","bigIntCodec","bytesCodec","HoldingReferenceMeta: ObjectModelMetadata<HoldingReference>","addressCodec","LocalsReferenceMeta: ObjectModelMetadata<LocalsReference>"],"sources":["../../../../../packages/transact/src/transactions/reference-types-meta.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { addressCodec, bigIntCodec, bytesCodec } from '@algorandfoundation/algokit-common'\nimport type { BoxReference, HoldingReference, LocalsReference } from './app-call'\n\n/**\n * Metadata for BoxReference\n *\n * Maps wire format (app, name) to BoxReference (appId, name)\n */\nexport const BoxReferenceMeta: ObjectModelMetadata<BoxReference> = {\n name: 'BoxReference',\n kind: 'object',\n fields: [\n { name: 'appId', wireKey: 'app', optional: false, codec: bigIntCodec },\n { name: 'name', wireKey: 'name', optional: false, codec: bytesCodec },\n ],\n}\n\n/**\n * Metadata for HoldingReference\n *\n * Maps wire format (account, asset) to HoldingReference (address, assetId)\n */\nexport const HoldingReferenceMeta: ObjectModelMetadata<HoldingReference> = {\n name: 'HoldingReference',\n kind: 'object',\n fields: [\n { name: 'address', wireKey: 'account', optional: false, codec: addressCodec },\n { name: 'assetId', wireKey: 'asset', optional: false, codec: bigIntCodec },\n ],\n}\n\n/**\n * Metadata for LocalsReference\n *\n * Maps wire format (account, app) to LocalsReference (address, appId)\n */\nexport const LocalsReferenceMeta: ObjectModelMetadata<LocalsReference> = {\n name: 'LocalsReference',\n kind: 'object',\n fields: [\n { name: 'address', wireKey: 'account', optional: false, codec: addressCodec },\n { name: 'appId', wireKey: 'app', optional: false, codec: bigIntCodec },\n ],\n}\n"],"mappings":";;;;;;;;;;AASA,MAAaA,mBAAsD;CACjE,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EAAE,MAAM;EAAS,SAAS;EAAO,UAAU;EAAO,OAAOC;EAAa,EACtE;EAAE,MAAM;EAAQ,SAAS;EAAQ,UAAU;EAAO,OAAOC;EAAY,CACtE;CACF;;;;;;AAOD,MAAaC,uBAA8D;CACzE,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EAAE,MAAM;EAAW,SAAS;EAAW,UAAU;EAAO,OAAOC;EAAc,EAC7E;EAAE,MAAM;EAAW,SAAS;EAAS,UAAU;EAAO,OAAOH;EAAa,CAC3E;CACF;;;;;;AAOD,MAAaI,sBAA4D;CACvE,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EAAE,MAAM;EAAW,SAAS;EAAW,UAAU;EAAO,OAAOD;EAAc,EAC7E;EAAE,MAAM;EAAS,SAAS;EAAO,UAAU;EAAO,OAAOH;EAAa,CACvE;CACF"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { addressCodec } from "../../../common/src/codecs/primitives/address.mjs";
|
|
2
|
+
import { bigIntCodec } from "../../../common/src/codecs/primitives/bigint.mjs";
|
|
3
|
+
import { bytesCodec } from "../../../common/src/codecs/primitives/bytes.mjs";
|
|
4
|
+
|
|
5
|
+
//#region packages/transact/src/transactions/reference-types-meta.ts
|
|
6
|
+
/**
|
|
7
|
+
* Metadata for BoxReference
|
|
8
|
+
*
|
|
9
|
+
* Maps wire format (app, name) to BoxReference (appId, name)
|
|
10
|
+
*/
|
|
11
|
+
const BoxReferenceMeta = {
|
|
12
|
+
name: "BoxReference",
|
|
13
|
+
kind: "object",
|
|
14
|
+
fields: [{
|
|
15
|
+
name: "appId",
|
|
16
|
+
wireKey: "app",
|
|
17
|
+
optional: false,
|
|
18
|
+
codec: bigIntCodec
|
|
19
|
+
}, {
|
|
20
|
+
name: "name",
|
|
21
|
+
wireKey: "name",
|
|
22
|
+
optional: false,
|
|
23
|
+
codec: bytesCodec
|
|
24
|
+
}]
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Metadata for HoldingReference
|
|
28
|
+
*
|
|
29
|
+
* Maps wire format (account, asset) to HoldingReference (address, assetId)
|
|
30
|
+
*/
|
|
31
|
+
const HoldingReferenceMeta = {
|
|
32
|
+
name: "HoldingReference",
|
|
33
|
+
kind: "object",
|
|
34
|
+
fields: [{
|
|
35
|
+
name: "address",
|
|
36
|
+
wireKey: "account",
|
|
37
|
+
optional: false,
|
|
38
|
+
codec: addressCodec
|
|
39
|
+
}, {
|
|
40
|
+
name: "assetId",
|
|
41
|
+
wireKey: "asset",
|
|
42
|
+
optional: false,
|
|
43
|
+
codec: bigIntCodec
|
|
44
|
+
}]
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Metadata for LocalsReference
|
|
48
|
+
*
|
|
49
|
+
* Maps wire format (account, app) to LocalsReference (address, appId)
|
|
50
|
+
*/
|
|
51
|
+
const LocalsReferenceMeta = {
|
|
52
|
+
name: "LocalsReference",
|
|
53
|
+
kind: "object",
|
|
54
|
+
fields: [{
|
|
55
|
+
name: "address",
|
|
56
|
+
wireKey: "account",
|
|
57
|
+
optional: false,
|
|
58
|
+
codec: addressCodec
|
|
59
|
+
}, {
|
|
60
|
+
name: "appId",
|
|
61
|
+
wireKey: "app",
|
|
62
|
+
optional: false,
|
|
63
|
+
codec: bigIntCodec
|
|
64
|
+
}]
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
export { BoxReferenceMeta, HoldingReferenceMeta, LocalsReferenceMeta };
|
|
69
|
+
//# sourceMappingURL=reference-types-meta.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference-types-meta.mjs","names":["BoxReferenceMeta: ObjectModelMetadata<BoxReference>","HoldingReferenceMeta: ObjectModelMetadata<HoldingReference>","LocalsReferenceMeta: ObjectModelMetadata<LocalsReference>"],"sources":["../../../../../packages/transact/src/transactions/reference-types-meta.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { addressCodec, bigIntCodec, bytesCodec } from '@algorandfoundation/algokit-common'\nimport type { BoxReference, HoldingReference, LocalsReference } from './app-call'\n\n/**\n * Metadata for BoxReference\n *\n * Maps wire format (app, name) to BoxReference (appId, name)\n */\nexport const BoxReferenceMeta: ObjectModelMetadata<BoxReference> = {\n name: 'BoxReference',\n kind: 'object',\n fields: [\n { name: 'appId', wireKey: 'app', optional: false, codec: bigIntCodec },\n { name: 'name', wireKey: 'name', optional: false, codec: bytesCodec },\n ],\n}\n\n/**\n * Metadata for HoldingReference\n *\n * Maps wire format (account, asset) to HoldingReference (address, assetId)\n */\nexport const HoldingReferenceMeta: ObjectModelMetadata<HoldingReference> = {\n name: 'HoldingReference',\n kind: 'object',\n fields: [\n { name: 'address', wireKey: 'account', optional: false, codec: addressCodec },\n { name: 'assetId', wireKey: 'asset', optional: false, codec: bigIntCodec },\n ],\n}\n\n/**\n * Metadata for LocalsReference\n *\n * Maps wire format (account, app) to LocalsReference (address, appId)\n */\nexport const LocalsReferenceMeta: ObjectModelMetadata<LocalsReference> = {\n name: 'LocalsReference',\n kind: 'object',\n fields: [\n { name: 'address', wireKey: 'account', optional: false, codec: addressCodec },\n { name: 'appId', wireKey: 'app', optional: false, codec: bigIntCodec },\n ],\n}\n"],"mappings":";;;;;;;;;;AASA,MAAaA,mBAAsD;CACjE,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EAAE,MAAM;EAAS,SAAS;EAAO,UAAU;EAAO,OAAO;EAAa,EACtE;EAAE,MAAM;EAAQ,SAAS;EAAQ,UAAU;EAAO,OAAO;EAAY,CACtE;CACF;;;;;;AAOD,MAAaC,uBAA8D;CACzE,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EAAE,MAAM;EAAW,SAAS;EAAW,UAAU;EAAO,OAAO;EAAc,EAC7E;EAAE,MAAM;EAAW,SAAS;EAAS,UAAU;EAAO,OAAO;EAAa,CAC3E;CACF;;;;;;AAOD,MAAaC,sBAA4D;CACvE,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EAAE,MAAM;EAAW,SAAS;EAAW,UAAU;EAAO,OAAO;EAAc,EAC7E;EAAE,MAAM;EAAS,SAAS;EAAO,UAAU;EAAO,OAAO;EAAa,CACvE;CACF"}
|
|
@@ -24,7 +24,7 @@ const MultisigSignatureMeta = {
|
|
|
24
24
|
codec: require_number.numberCodec
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
|
-
name: "
|
|
27
|
+
name: "subsigs",
|
|
28
28
|
wireKey: "subsig",
|
|
29
29
|
optional: false,
|
|
30
30
|
codec: new require_array.ArrayCodec(new require_object_model.ObjectModelCodec({
|
|
@@ -36,7 +36,7 @@ const MultisigSignatureMeta = {
|
|
|
36
36
|
optional: false,
|
|
37
37
|
codec: require_fixed_bytes.fixedBytes32Codec
|
|
38
38
|
}, {
|
|
39
|
-
name: "
|
|
39
|
+
name: "sig",
|
|
40
40
|
wireKey: "s",
|
|
41
41
|
optional: true,
|
|
42
42
|
codec: require_fixed_bytes.fixedBytes64Codec
|
|
@@ -127,6 +127,5 @@ const signedTransactionCodec = new require_object_model.ObjectModelCodec(SignedT
|
|
|
127
127
|
//#endregion
|
|
128
128
|
exports.SignedTransactionMeta = SignedTransactionMeta;
|
|
129
129
|
exports.logicSignatureCodec = logicSignatureCodec;
|
|
130
|
-
exports.multiSignatureCodec = multiSignatureCodec;
|
|
131
130
|
exports.signedTransactionCodec = signedTransactionCodec;
|
|
132
131
|
//# sourceMappingURL=signed-transaction-meta.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signed-transaction-meta.js","names":["MultisigSignatureMeta: ObjectModelMetadata<MultisigSignature>","numberCodec","ArrayCodec","ObjectModelCodec","fixedBytes32Codec","fixedBytes64Codec","LogicSignatureMeta: ObjectModelMetadata<LogicSignature>","bytesCodec","bytesArrayCodec","SignedTransactionMeta: ObjectModelMetadata<SignedTransaction>","transactionCodec","addressCodec"],"sources":["../../../../../packages/transact/src/transactions/signed-transaction-meta.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport {\n ArrayCodec,\n ObjectModelCodec,\n addressCodec,\n bytesArrayCodec,\n bytesCodec,\n fixedBytes32Codec,\n fixedBytes64Codec,\n numberCodec,\n} from '@algorandfoundation/algokit-common'\nimport { LogicSignature, MultisigSignature, MultisigSubsignature, SignedTransaction } from './signed-transaction'\nimport { transactionCodec } from './transaction'\n\nconst MultisigSubsignatureMeta: ObjectModelMetadata<MultisigSubsignature> = {\n name: 'MultisigSubsignature',\n kind: 'object',\n fields: [\n { name: 'publicKey', wireKey: 'pk', optional: false, codec: fixedBytes32Codec },\n { name: '
|
|
1
|
+
{"version":3,"file":"signed-transaction-meta.js","names":["MultisigSignatureMeta: ObjectModelMetadata<MultisigSignature>","numberCodec","ArrayCodec","ObjectModelCodec","fixedBytes32Codec","fixedBytes64Codec","LogicSignatureMeta: ObjectModelMetadata<LogicSignature>","bytesCodec","bytesArrayCodec","SignedTransactionMeta: ObjectModelMetadata<SignedTransaction>","transactionCodec","addressCodec"],"sources":["../../../../../packages/transact/src/transactions/signed-transaction-meta.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport {\n ArrayCodec,\n ObjectModelCodec,\n addressCodec,\n bytesArrayCodec,\n bytesCodec,\n fixedBytes32Codec,\n fixedBytes64Codec,\n numberCodec,\n} from '@algorandfoundation/algokit-common'\nimport { LogicSignature, MultisigSignature, MultisigSubsignature, SignedTransaction } from './signed-transaction'\nimport { transactionCodec } from './transaction'\n\nconst MultisigSubsignatureMeta: ObjectModelMetadata<MultisigSubsignature> = {\n name: 'MultisigSubsignature',\n kind: 'object',\n fields: [\n { name: 'publicKey', wireKey: 'pk', optional: false, codec: fixedBytes32Codec },\n { name: 'sig', wireKey: 's', optional: true, codec: fixedBytes64Codec },\n ],\n}\n\nconst MultisigSignatureMeta: ObjectModelMetadata<MultisigSignature> = {\n name: 'MultisigSignature',\n kind: 'object',\n fields: [\n { name: 'version', wireKey: 'v', optional: false, codec: numberCodec },\n { name: 'threshold', wireKey: 'thr', optional: false, codec: numberCodec },\n {\n name: 'subsigs',\n wireKey: 'subsig',\n optional: false,\n codec: new ArrayCodec(new ObjectModelCodec(MultisigSubsignatureMeta)),\n },\n ],\n}\n\nconst LogicSignatureMeta: ObjectModelMetadata<LogicSignature> = {\n name: 'LogicSignature',\n kind: 'object',\n fields: [\n { name: 'logic', wireKey: 'l', optional: false, codec: bytesCodec },\n { name: 'args', wireKey: 'arg', optional: true, codec: bytesArrayCodec },\n { name: 'sig', wireKey: 'sig', optional: true, codec: fixedBytes64Codec },\n {\n name: 'msig',\n wireKey: 'msig',\n optional: true,\n codec: new ObjectModelCodec(MultisigSignatureMeta),\n },\n {\n name: 'lmsig',\n wireKey: 'lmsig',\n optional: true,\n codec: new ObjectModelCodec(MultisigSignatureMeta),\n },\n ],\n}\n\nexport const multiSignatureCodec = new ObjectModelCodec<MultisigSignature>(MultisigSignatureMeta)\nexport const logicSignatureCodec = new ObjectModelCodec<LogicSignature>(LogicSignatureMeta)\n\n/**\n * Metadata for SignedTransaction\n */\nexport const SignedTransactionMeta: ObjectModelMetadata<SignedTransaction> = {\n name: 'SignedTransaction',\n kind: 'object',\n fields: [\n {\n name: 'txn',\n wireKey: 'txn',\n optional: false,\n codec: transactionCodec,\n },\n { name: 'sig', wireKey: 'sig', optional: true, codec: fixedBytes64Codec },\n {\n name: 'msig',\n wireKey: 'msig',\n optional: true,\n codec: multiSignatureCodec,\n },\n {\n name: 'lsig',\n wireKey: 'lsig',\n optional: true,\n codec: logicSignatureCodec,\n },\n { name: 'authAddress', wireKey: 'sgnr', optional: true, codec: addressCodec },\n ],\n}\n\nexport const signedTransactionCodec = new ObjectModelCodec<SignedTransaction>(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