@algorandfoundation/algokit-utils 10.0.0-alpha.3 → 10.0.0-alpha.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_virtual/rolldown_runtime.js +10 -15
- package/abi/index.d.ts +2 -1
- package/abi/index.js +3 -0
- package/abi/index.mjs +2 -1
- package/algod-client/index.d.ts +3 -7
- package/algod-client/index.js +2 -5
- package/algod-client/index.mjs +2 -2
- package/index.d.ts +1 -2
- package/index.js +0 -7
- package/index.mjs +1 -2
- package/indexer-client/index.d.ts +2 -2
- package/indexer-client/index.js +6 -6
- package/indexer-client/index.mjs +2 -2
- package/{indexer-lookup.d.ts → indexer-client/indexer-lookup.d.ts} +8 -11
- package/{indexer-lookup.mjs → indexer-client/indexer-lookup.js} +6 -10
- package/indexer-client/indexer-lookup.js.map +1 -0
- package/{indexer-lookup.js → indexer-client/indexer-lookup.mjs} +3 -18
- package/indexer-client/indexer-lookup.mjs.map +1 -0
- package/kmd-client/index.d.ts +1 -2
- package/kmd-client/index.js +0 -5
- package/kmd-client/index.mjs +1 -2
- package/package.json +5 -6
- package/packages/abi/src/abi-method.d.ts +1 -1
- package/packages/abi/src/abi-method.js +1 -1
- package/packages/abi/src/abi-method.js.map +1 -1
- package/packages/abi/src/abi-method.mjs +1 -1
- package/packages/abi/src/abi-method.mjs.map +1 -1
- package/packages/abi/src/abi-type.d.ts +1 -3
- package/packages/abi/src/abi-type.js +7 -36
- package/packages/abi/src/abi-type.js.map +1 -1
- package/packages/abi/src/abi-type.mjs +7 -36
- package/packages/abi/src/abi-type.mjs.map +1 -1
- package/packages/abi/src/arc56-contract.js +1 -0
- package/packages/abi/src/arc56-contract.js.map +1 -1
- package/packages/abi/src/arc56-contract.mjs +1 -0
- package/packages/abi/src/arc56-contract.mjs.map +1 -1
- package/packages/abi/src/utils.d.ts +22 -0
- package/packages/abi/src/utils.js +57 -0
- package/packages/abi/src/utils.js.map +1 -0
- package/packages/abi/src/utils.mjs +55 -0
- package/packages/abi/src/utils.mjs.map +1 -0
- package/packages/algo25/src/index.js +1 -1
- package/packages/algo25/src/index.mjs +1 -1
- package/packages/algod_client/src/apis/api-service.d.ts +44 -44
- package/packages/algod_client/src/apis/api-service.js +155 -155
- package/packages/algod_client/src/apis/api-service.js.map +1 -1
- package/packages/algod_client/src/apis/api-service.mjs +155 -155
- package/packages/algod_client/src/apis/api-service.mjs.map +1 -1
- package/packages/algod_client/src/core/api-error.js +3 -1
- package/packages/algod_client/src/core/api-error.js.map +1 -1
- package/packages/algod_client/src/core/api-error.mjs +3 -1
- package/packages/algod_client/src/core/api-error.mjs.map +1 -1
- package/packages/algod_client/src/core/model-runtime.js +6 -6
- package/packages/algod_client/src/core/model-runtime.js.map +1 -1
- package/packages/algod_client/src/core/model-runtime.mjs +8 -8
- package/packages/algod_client/src/core/model-runtime.mjs.map +1 -1
- package/packages/algod_client/src/models/account-participation.js +4 -4
- package/packages/algod_client/src/models/account-participation.js.map +1 -1
- package/packages/algod_client/src/models/account-participation.mjs +4 -4
- package/packages/algod_client/src/models/account-participation.mjs.map +1 -1
- package/packages/algod_client/src/models/application-state-schema.d.ts +2 -2
- package/packages/algod_client/src/models/application-state-schema.js +2 -2
- package/packages/algod_client/src/models/application-state-schema.js.map +1 -1
- package/packages/algod_client/src/models/application-state-schema.mjs +2 -2
- package/packages/algod_client/src/models/application-state-schema.mjs.map +1 -1
- package/packages/algod_client/src/models/asset-params.js +2 -1
- package/packages/algod_client/src/models/asset-params.js.map +1 -1
- package/packages/algod_client/src/models/asset-params.mjs +2 -1
- package/packages/algod_client/src/models/asset-params.mjs.map +1 -1
- package/packages/algod_client/src/models/block-response.js +1 -2
- package/packages/algod_client/src/models/block-response.js.map +1 -1
- package/packages/algod_client/src/models/block-response.mjs +2 -3
- package/packages/algod_client/src/models/block-response.mjs.map +1 -1
- package/packages/algod_client/src/models/block.d.ts +60 -40
- package/packages/algod_client/src/models/block.js +184 -108
- package/packages/algod_client/src/models/block.js.map +1 -1
- package/packages/algod_client/src/models/block.mjs +184 -108
- package/packages/algod_client/src/models/block.mjs.map +1 -1
- package/packages/algod_client/src/models/eval-delta-key-value.js +2 -2
- package/packages/algod_client/src/models/eval-delta-key-value.js.map +1 -1
- package/packages/algod_client/src/models/eval-delta-key-value.mjs +2 -2
- package/packages/algod_client/src/models/eval-delta-key-value.mjs.map +1 -1
- package/packages/algod_client/src/models/eval-delta.js +2 -2
- package/packages/algod_client/src/models/eval-delta.js.map +1 -1
- package/packages/algod_client/src/models/eval-delta.mjs +2 -2
- package/packages/algod_client/src/models/eval-delta.mjs.map +1 -1
- package/packages/algod_client/src/models/ledger-state-delta.js +1 -1
- package/packages/algod_client/src/models/ledger-state-delta.js.map +1 -1
- package/packages/algod_client/src/models/ledger-state-delta.mjs +2 -2
- package/packages/algod_client/src/models/ledger-state-delta.mjs.map +1 -1
- package/packages/algod_client/src/models/simulate-request.js +1 -1
- package/packages/algod_client/src/models/simulate-request.mjs +1 -1
- package/packages/algod_client/src/models/simulate-response.d.ts +2 -1
- package/packages/algod_client/src/models/simulate-response.js +6 -1
- package/packages/algod_client/src/models/simulate-response.js.map +1 -1
- package/packages/algod_client/src/models/simulate-response.mjs +6 -2
- package/packages/algod_client/src/models/simulate-response.mjs.map +1 -1
- package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.d.ts +3 -5
- package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.js +4 -6
- package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.js.map +1 -1
- package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.mjs +3 -5
- package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.mjs.map +1 -1
- package/packages/algod_client/src/models/transaction-parameters-response.js +2 -2
- package/packages/algod_client/src/models/transaction-parameters-response.js.map +1 -1
- package/packages/algod_client/src/models/transaction-parameters-response.mjs +2 -2
- package/packages/algod_client/src/models/transaction-parameters-response.mjs.map +1 -1
- package/packages/common/src/address.d.ts +0 -1
- package/packages/common/src/address.js +4 -17
- package/packages/common/src/address.js.map +1 -1
- package/packages/common/src/address.mjs +5 -17
- package/packages/common/src/address.mjs.map +1 -1
- package/packages/common/src/codecs/composite/map.js +7 -4
- package/packages/common/src/codecs/composite/map.js.map +1 -1
- package/packages/common/src/codecs/composite/map.mjs +7 -4
- package/packages/common/src/codecs/composite/map.mjs.map +1 -1
- package/packages/common/src/codecs/composite/record.js +0 -1
- package/packages/common/src/codecs/composite/record.js.map +1 -1
- package/packages/common/src/codecs/primitives/address.js +0 -1
- package/packages/common/src/codecs/primitives/address.js.map +1 -1
- package/packages/common/src/codecs/primitives/bytes-base64.js +26 -0
- package/packages/common/src/codecs/primitives/bytes-base64.js.map +1 -0
- package/packages/common/src/codecs/primitives/bytes-base64.mjs +25 -0
- package/packages/common/src/codecs/primitives/bytes-base64.mjs.map +1 -0
- package/packages/common/src/codecs/primitives/bytes.js +0 -1
- package/packages/common/src/codecs/primitives/bytes.js.map +1 -1
- package/packages/common/src/codecs/primitives/fixed-bytes.js +0 -1
- package/packages/common/src/codecs/primitives/fixed-bytes.js.map +1 -1
- package/packages/common/src/codecs/wire.js +0 -1
- package/packages/common/src/codecs/wire.js.map +1 -1
- package/packages/common/src/json.mjs +2 -2
- package/packages/common/src/json.mjs.map +1 -1
- package/packages/common/src/msgpack.js +0 -1
- package/packages/common/src/msgpack.js.map +1 -1
- package/packages/{sdk/src/logic → common/src}/sourcemap.d.ts +2 -2
- package/packages/{sdk/src/logic → common/src}/sourcemap.js +2 -2
- package/packages/{sdk/src/logic → common/src}/sourcemap.js.map +1 -1
- package/packages/{sdk/src/logic → common/src}/sourcemap.mjs +1 -1
- package/packages/{sdk/src/logic → common/src}/sourcemap.mjs.map +1 -1
- package/packages/indexer_client/src/apis/api-service.d.ts +1 -1
- package/packages/indexer_client/src/apis/api-service.js +12 -12
- package/packages/indexer_client/src/apis/api-service.js.map +1 -1
- package/packages/indexer_client/src/apis/api-service.mjs +12 -12
- package/packages/indexer_client/src/apis/api-service.mjs.map +1 -1
- package/packages/indexer_client/src/core/api-error.js +3 -1
- package/packages/indexer_client/src/core/api-error.js.map +1 -1
- package/packages/indexer_client/src/core/api-error.mjs +3 -1
- package/packages/indexer_client/src/core/api-error.mjs.map +1 -1
- package/packages/indexer_client/src/core/model-runtime.js +0 -15
- package/packages/indexer_client/src/core/model-runtime.js.map +1 -1
- package/packages/indexer_client/src/core/model-runtime.mjs +1 -13
- package/packages/indexer_client/src/core/model-runtime.mjs.map +1 -1
- package/packages/indexer_client/src/models/account-participation.js +4 -4
- package/packages/indexer_client/src/models/account-participation.js.map +1 -1
- package/packages/indexer_client/src/models/account-participation.mjs +4 -4
- package/packages/indexer_client/src/models/account-participation.mjs.map +1 -1
- package/packages/indexer_client/src/models/application-state-schema.d.ts +2 -2
- package/packages/indexer_client/src/models/application-state-schema.js +2 -2
- package/packages/indexer_client/src/models/application-state-schema.js.map +1 -1
- package/packages/indexer_client/src/models/application-state-schema.mjs +2 -2
- package/packages/indexer_client/src/models/application-state-schema.mjs.map +1 -1
- package/packages/indexer_client/src/models/asset-params.js +2 -1
- package/packages/indexer_client/src/models/asset-params.js.map +1 -1
- package/packages/indexer_client/src/models/asset-params.mjs +2 -1
- package/packages/indexer_client/src/models/asset-params.mjs.map +1 -1
- package/packages/indexer_client/src/models/block.d.ts +5 -5
- package/packages/indexer_client/src/models/block.js +13 -13
- package/packages/indexer_client/src/models/block.js.map +1 -1
- package/packages/indexer_client/src/models/block.mjs +13 -13
- package/packages/indexer_client/src/models/block.mjs.map +1 -1
- package/packages/indexer_client/src/models/eval-delta-key-value.d.ts +1 -1
- package/packages/indexer_client/src/models/eval-delta-key-value.js +2 -2
- package/packages/indexer_client/src/models/eval-delta-key-value.js.map +1 -1
- package/packages/indexer_client/src/models/eval-delta-key-value.mjs +2 -2
- package/packages/indexer_client/src/models/eval-delta-key-value.mjs.map +1 -1
- package/packages/indexer_client/src/models/eval-delta.d.ts +1 -1
- package/packages/indexer_client/src/models/eval-delta.js +2 -2
- package/packages/indexer_client/src/models/eval-delta.js.map +1 -1
- package/packages/indexer_client/src/models/eval-delta.mjs +2 -2
- package/packages/indexer_client/src/models/eval-delta.mjs.map +1 -1
- package/packages/indexer_client/src/models/hb-proof-fields.js +6 -6
- package/packages/indexer_client/src/models/hb-proof-fields.js.map +1 -1
- package/packages/indexer_client/src/models/hb-proof-fields.mjs +6 -6
- package/packages/indexer_client/src/models/hb-proof-fields.mjs.map +1 -1
- package/packages/indexer_client/src/models/participation-updates.d.ts +2 -2
- package/packages/indexer_client/src/models/participation-updates.js +2 -2
- package/packages/indexer_client/src/models/participation-updates.js.map +1 -1
- package/packages/indexer_client/src/models/participation-updates.mjs +2 -2
- package/packages/indexer_client/src/models/participation-updates.mjs.map +1 -1
- package/packages/indexer_client/src/models/state-proof-verifier.js +2 -2
- package/packages/indexer_client/src/models/state-proof-verifier.js.map +1 -1
- package/packages/indexer_client/src/models/state-proof-verifier.mjs +2 -2
- package/packages/indexer_client/src/models/state-proof-verifier.mjs.map +1 -1
- package/packages/indexer_client/src/models/state-schema.d.ts +2 -2
- package/packages/indexer_client/src/models/state-schema.js +2 -2
- package/packages/indexer_client/src/models/state-schema.js.map +1 -1
- package/packages/indexer_client/src/models/state-schema.mjs +2 -2
- package/packages/indexer_client/src/models/state-schema.mjs.map +1 -1
- package/packages/indexer_client/src/models/teal-key-value.d.ts +1 -1
- package/packages/indexer_client/src/models/teal-key-value.js +2 -2
- package/packages/indexer_client/src/models/teal-key-value.js.map +1 -1
- package/packages/indexer_client/src/models/teal-key-value.mjs +2 -2
- package/packages/indexer_client/src/models/teal-key-value.mjs.map +1 -1
- package/packages/indexer_client/src/models/transaction-heartbeat.js +2 -1
- package/packages/indexer_client/src/models/transaction-heartbeat.js.map +1 -1
- package/packages/indexer_client/src/models/transaction-heartbeat.mjs +2 -1
- package/packages/indexer_client/src/models/transaction-heartbeat.mjs.map +1 -1
- package/packages/indexer_client/src/models/transaction-keyreg.js +4 -4
- package/packages/indexer_client/src/models/transaction-keyreg.js.map +1 -1
- package/packages/indexer_client/src/models/transaction-keyreg.mjs +4 -4
- package/packages/indexer_client/src/models/transaction-keyreg.mjs.map +1 -1
- package/packages/indexer_client/src/models/transaction-signature-logicsig.js +2 -1
- package/packages/indexer_client/src/models/transaction-signature-logicsig.js.map +1 -1
- package/packages/indexer_client/src/models/transaction-signature-logicsig.mjs +2 -1
- package/packages/indexer_client/src/models/transaction-signature-logicsig.mjs.map +1 -1
- package/packages/indexer_client/src/models/transaction-signature-multisig-subsignature.js +3 -3
- package/packages/indexer_client/src/models/transaction-signature-multisig-subsignature.js.map +1 -1
- package/packages/indexer_client/src/models/transaction-signature-multisig-subsignature.mjs +3 -3
- package/packages/indexer_client/src/models/transaction-signature-multisig-subsignature.mjs.map +1 -1
- package/packages/indexer_client/src/models/transaction-state-proof.d.ts +1 -1
- package/packages/indexer_client/src/models/transaction-state-proof.js +2 -2
- package/packages/indexer_client/src/models/transaction-state-proof.js.map +1 -1
- package/packages/indexer_client/src/models/transaction-state-proof.mjs +2 -2
- package/packages/indexer_client/src/models/transaction-state-proof.mjs.map +1 -1
- package/packages/indexer_client/src/models/transaction.d.ts +2 -2
- package/packages/indexer_client/src/models/transaction.js +6 -5
- package/packages/indexer_client/src/models/transaction.js.map +1 -1
- package/packages/indexer_client/src/models/transaction.mjs +6 -5
- package/packages/indexer_client/src/models/transaction.mjs.map +1 -1
- package/packages/kmd_client/src/apis/api-service.d.ts +5 -5
- package/packages/kmd_client/src/apis/api-service.js +32 -32
- package/packages/kmd_client/src/apis/api-service.js.map +1 -1
- package/packages/kmd_client/src/apis/api-service.mjs +32 -32
- package/packages/kmd_client/src/apis/api-service.mjs.map +1 -1
- package/packages/kmd_client/src/core/api-error.js +3 -1
- package/packages/kmd_client/src/core/api-error.js.map +1 -1
- package/packages/kmd_client/src/core/api-error.mjs +3 -1
- package/packages/kmd_client/src/core/api-error.mjs.map +1 -1
- package/packages/kmd_client/src/core/model-runtime.js +2 -12
- package/packages/kmd_client/src/core/model-runtime.js.map +1 -1
- package/packages/kmd_client/src/core/model-runtime.mjs +3 -11
- package/packages/kmd_client/src/core/model-runtime.mjs.map +1 -1
- package/packages/transact/src/logicsig.d.ts +35 -33
- package/packages/transact/src/logicsig.js +74 -76
- package/packages/transact/src/logicsig.js.map +1 -1
- package/packages/transact/src/logicsig.mjs +77 -78
- package/packages/transact/src/logicsig.mjs.map +1 -1
- package/packages/transact/src/multisig.d.ts +11 -116
- package/packages/transact/src/multisig.js +106 -136
- package/packages/transact/src/multisig.js.map +1 -1
- package/packages/transact/src/multisig.mjs +108 -118
- package/packages/transact/src/multisig.mjs.map +1 -1
- package/packages/transact/src/signer.js +9 -2
- package/packages/transact/src/signer.js.map +1 -1
- package/packages/transact/src/signer.mjs +10 -3
- package/packages/transact/src/signer.mjs.map +1 -1
- package/packages/transact/src/transactions/app-call.d.ts +10 -15
- package/packages/transact/src/transactions/app-call.js.map +1 -1
- package/packages/transact/src/transactions/app-call.mjs.map +1 -1
- package/packages/transact/src/transactions/asset-config.d.ts +1 -6
- package/packages/transact/src/transactions/asset-config.js.map +1 -1
- package/packages/transact/src/transactions/asset-config.mjs.map +1 -1
- package/packages/transact/src/transactions/asset-freeze.d.ts +1 -6
- package/packages/transact/src/transactions/asset-transfer.d.ts +1 -6
- package/packages/transact/src/transactions/key-registration.d.ts +1 -8
- package/packages/transact/src/transactions/reference-types-meta.d.ts +26 -0
- package/packages/transact/src/transactions/reference-types-meta.js +71 -0
- package/packages/transact/src/transactions/reference-types-meta.js.map +1 -0
- package/packages/transact/src/transactions/reference-types-meta.mjs +69 -0
- package/packages/transact/src/transactions/reference-types-meta.mjs.map +1 -0
- package/packages/transact/src/transactions/signed-transaction-meta.js +8 -9
- package/packages/transact/src/transactions/signed-transaction-meta.js.map +1 -1
- package/packages/transact/src/transactions/signed-transaction-meta.mjs +8 -8
- package/packages/transact/src/transactions/signed-transaction-meta.mjs.map +1 -1
- package/packages/transact/src/transactions/signed-transaction.d.ts +10 -6
- package/packages/transact/src/transactions/signed-transaction.js +1 -1
- package/packages/transact/src/transactions/signed-transaction.js.map +1 -1
- package/packages/transact/src/transactions/signed-transaction.mjs +1 -2
- package/packages/transact/src/transactions/signed-transaction.mjs.map +1 -1
- package/packages/transact/src/transactions/state-proof.d.ts +1 -1
- package/packages/transact/src/transactions/transaction-meta.js +29 -23
- package/packages/transact/src/transactions/transaction-meta.js.map +1 -1
- package/packages/transact/src/transactions/transaction-meta.mjs +29 -23
- package/packages/transact/src/transactions/transaction-meta.mjs.map +1 -1
- package/packages/transact/src/transactions/transaction.d.ts +5 -2
- package/packages/transact/src/transactions/transaction.js +5 -4
- package/packages/transact/src/transactions/transaction.js.map +1 -1
- package/packages/transact/src/transactions/transaction.mjs +5 -4
- package/packages/transact/src/transactions/transaction.mjs.map +1 -1
- package/testing/account.js +1 -2
- package/testing/account.js.map +1 -1
- package/testing/account.mjs +1 -2
- package/testing/account.mjs.map +1 -1
- package/testing/fixtures/algorand-fixture.d.ts +3 -3
- package/testing/fixtures/algorand-fixture.js.map +1 -1
- package/testing/fixtures/algorand-fixture.mjs.map +1 -1
- package/testing/transaction-logger.js +1 -1
- package/testing/transaction-logger.mjs +1 -1
- package/transact/index.d.ts +11 -10
- package/transact/index.js +7 -31
- package/transact/index.mjs +7 -10
- package/transaction/transaction.js +2 -2
- package/transaction/transaction.js.map +1 -1
- package/transaction/transaction.mjs +2 -2
- package/transaction/transaction.mjs.map +1 -1
- package/transactions/app-call.d.ts +5 -4
- package/transactions/app-call.js +16 -16
- package/transactions/app-call.js.map +1 -1
- package/transactions/app-call.mjs +16 -16
- package/transactions/app-call.mjs.map +1 -1
- package/transactions/asset-config.d.ts +1 -1
- package/transactions/asset-config.js +1 -1
- package/transactions/asset-config.js.map +1 -1
- package/transactions/asset-config.mjs +1 -1
- package/transactions/asset-config.mjs.map +1 -1
- package/transactions/key-registration.d.ts +1 -1
- package/transactions/key-registration.js.map +1 -1
- package/transactions/key-registration.mjs.map +1 -1
- package/transactions/method-call.d.ts +1 -1
- package/transactions/method-call.js +77 -84
- package/transactions/method-call.js.map +1 -1
- package/transactions/method-call.mjs +77 -84
- package/transactions/method-call.mjs.map +1 -1
- package/types/account-manager.d.ts +7 -9
- package/types/account-manager.js +17 -7
- package/types/account-manager.js.map +1 -1
- package/types/account-manager.mjs +17 -7
- package/types/account-manager.mjs.map +1 -1
- package/types/algorand-client-transaction-creator.d.ts +53 -39
- package/types/algorand-client-transaction-creator.js +8 -0
- package/types/algorand-client-transaction-creator.js.map +1 -1
- package/types/algorand-client-transaction-creator.mjs +8 -0
- package/types/algorand-client-transaction-creator.mjs.map +1 -1
- package/types/algorand-client-transaction-sender.d.ts +58 -44
- package/types/algorand-client-transaction-sender.js +8 -1
- package/types/algorand-client-transaction-sender.js.map +1 -1
- package/types/algorand-client-transaction-sender.mjs +8 -0
- package/types/algorand-client-transaction-sender.mjs.map +1 -1
- package/types/amount.js +23 -4
- package/types/amount.js.map +1 -1
- package/types/amount.mjs +20 -2
- package/types/amount.mjs.map +1 -1
- package/types/app-client.d.ts +111 -106
- package/types/app-client.js +2 -3
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +2 -2
- package/types/app-client.mjs.map +1 -1
- package/types/app-deployer.d.ts +1 -1
- package/types/app-deployer.js +3 -3
- package/types/app-deployer.js.map +1 -1
- package/types/app-deployer.mjs +3 -3
- package/types/app-deployer.mjs.map +1 -1
- package/types/app-factory.d.ts +44 -41
- package/types/app-factory.js +2 -2
- package/types/app-factory.js.map +1 -1
- package/types/app-factory.mjs +2 -2
- package/types/app-factory.mjs.map +1 -1
- package/types/app-manager.d.ts +3 -1
- package/types/app-manager.js +17 -11
- package/types/app-manager.js.map +1 -1
- package/types/app-manager.mjs +17 -11
- package/types/app-manager.mjs.map +1 -1
- package/types/app-spec.js +12 -5
- package/types/app-spec.js.map +1 -1
- package/types/app-spec.mjs +12 -5
- package/types/app-spec.mjs.map +1 -1
- package/types/app.d.ts +2 -2
- package/types/app.js.map +1 -1
- package/types/app.mjs.map +1 -1
- package/types/asset-manager.js +1 -1
- package/types/asset-manager.js.map +1 -1
- package/types/asset-manager.mjs +1 -1
- package/types/asset-manager.mjs.map +1 -1
- package/types/async-event-emitter.d.ts +3 -6
- package/types/async-event-emitter.js.map +1 -1
- package/types/async-event-emitter.mjs.map +1 -1
- package/types/client-manager.d.ts +1 -1
- package/types/client-manager.js.map +1 -1
- package/types/client-manager.mjs.map +1 -1
- package/types/composer.d.ts +11 -3
- package/types/composer.js +55 -46
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +46 -36
- package/types/composer.mjs.map +1 -1
- package/types/debugging.d.ts +13 -9
- package/types/debugging.js.map +1 -1
- package/types/debugging.mjs.map +1 -1
- package/types/expand.d.ts +2 -9
- package/types/kmd-account-manager.d.ts +1 -0
- package/types/kmd-account-manager.js +22 -11
- package/types/kmd-account-manager.js.map +1 -1
- package/types/kmd-account-manager.mjs +23 -12
- package/types/kmd-account-manager.mjs.map +1 -1
- package/types/lifecycle-events.d.ts +0 -1
- package/types/lifecycle-events.js.map +1 -1
- package/types/lifecycle-events.mjs.map +1 -1
- package/types/testing.d.ts +4 -4
- package/types/transaction.d.ts +1 -1
- package/_virtual/rolldown_runtime.mjs +0 -13
- package/indexer-lookup.js.map +0 -1
- package/indexer-lookup.mjs.map +0 -1
- package/packages/algod_client/src/core/model-runtime.d.ts +0 -10
- package/packages/algod_client/src/models/application-local-reference.d.ts +0 -20
- package/packages/algod_client/src/models/application-local-reference.js +0 -23
- package/packages/algod_client/src/models/application-local-reference.js.map +0 -1
- package/packages/algod_client/src/models/application-local-reference.mjs +0 -23
- package/packages/algod_client/src/models/application-local-reference.mjs.map +0 -1
- package/packages/algod_client/src/models/asset-holding-reference.d.ts +0 -20
- package/packages/algod_client/src/models/asset-holding-reference.js +0 -23
- package/packages/algod_client/src/models/asset-holding-reference.js.map +0 -1
- package/packages/algod_client/src/models/asset-holding-reference.mjs +0 -23
- package/packages/algod_client/src/models/asset-holding-reference.mjs.map +0 -1
- package/packages/algod_client/src/models/box-reference.d.ts +0 -17
- package/packages/algod_client/src/models/box-reference.js +0 -23
- package/packages/algod_client/src/models/box-reference.js.map +0 -1
- package/packages/algod_client/src/models/box-reference.mjs +0 -23
- package/packages/algod_client/src/models/box-reference.mjs.map +0 -1
- package/packages/indexer_client/src/core/model-runtime.d.ts +0 -10
- package/packages/kmd_client/src/core/model-runtime.d.ts +0 -10
- package/packages/sdk/src/convert.d.ts +0 -17
- package/packages/sdk/src/convert.js +0 -28
- package/packages/sdk/src/convert.js.map +0 -1
- package/packages/sdk/src/convert.mjs +0 -25
- package/packages/sdk/src/convert.mjs.map +0 -1
- package/packages/sdk/src/encoding/binarydata.d.ts +0 -34
- package/packages/sdk/src/encoding/binarydata.js +0 -65
- package/packages/sdk/src/encoding/binarydata.js.map +0 -1
- package/packages/sdk/src/encoding/binarydata.mjs +0 -60
- package/packages/sdk/src/encoding/binarydata.mjs.map +0 -1
- package/packages/sdk/src/encoding/encoding.d.ts +0 -237
- package/packages/sdk/src/encoding/encoding.js +0 -302
- package/packages/sdk/src/encoding/encoding.js.map +0 -1
- package/packages/sdk/src/encoding/encoding.mjs +0 -287
- package/packages/sdk/src/encoding/encoding.mjs.map +0 -1
- package/packages/sdk/src/encoding/schema/array.js +0 -35
- package/packages/sdk/src/encoding/schema/array.js.map +0 -1
- package/packages/sdk/src/encoding/schema/array.mjs +0 -35
- package/packages/sdk/src/encoding/schema/array.mjs.map +0 -1
- package/packages/sdk/src/encoding/schema/bytearray.js +0 -49
- package/packages/sdk/src/encoding/schema/bytearray.js.map +0 -1
- package/packages/sdk/src/encoding/schema/bytearray.mjs +0 -49
- package/packages/sdk/src/encoding/schema/bytearray.mjs.map +0 -1
- package/packages/sdk/src/encoding/schema/map.d.ts +0 -58
- package/packages/sdk/src/encoding/schema/map.js +0 -110
- package/packages/sdk/src/encoding/schema/map.js.map +0 -1
- package/packages/sdk/src/encoding/schema/map.mjs +0 -107
- package/packages/sdk/src/encoding/schema/map.mjs.map +0 -1
- package/packages/sdk/src/encoding/schema/optional.js +0 -46
- package/packages/sdk/src/encoding/schema/optional.js.map +0 -1
- package/packages/sdk/src/encoding/schema/optional.mjs +0 -46
- package/packages/sdk/src/encoding/schema/optional.mjs.map +0 -1
- package/packages/sdk/src/encoding/schema/uint64.js +0 -30
- package/packages/sdk/src/encoding/schema/uint64.js.map +0 -1
- package/packages/sdk/src/encoding/schema/uint64.mjs +0 -30
- package/packages/sdk/src/encoding/schema/uint64.mjs.map +0 -1
- package/packages/sdk/src/encoding/uint64.d.ts +0 -34
- package/packages/sdk/src/encoding/uint64.js +0 -34
- package/packages/sdk/src/encoding/uint64.js.map +0 -1
- package/packages/sdk/src/encoding/uint64.mjs +0 -33
- package/packages/sdk/src/encoding/uint64.mjs.map +0 -1
- package/packages/sdk/src/index.d.ts +0 -44
- package/packages/sdk/src/index.js +0 -62
- package/packages/sdk/src/index.js.map +0 -1
- package/packages/sdk/src/index.mjs +0 -58
- package/packages/sdk/src/index.mjs.map +0 -1
- package/packages/sdk/src/nacl/naclWrappers.js +0 -14
- package/packages/sdk/src/nacl/naclWrappers.js.map +0 -1
- package/packages/sdk/src/nacl/naclWrappers.mjs +0 -11
- package/packages/sdk/src/nacl/naclWrappers.mjs.map +0 -1
- package/packages/sdk/src/types/intDecoding.d.ts +0 -28
- package/packages/sdk/src/types/intDecoding.js +0 -32
- package/packages/sdk/src/types/intDecoding.js.map +0 -1
- package/packages/sdk/src/types/intDecoding.mjs +0 -31
- package/packages/sdk/src/types/intDecoding.mjs.map +0 -1
- package/packages/sdk/src/types/transactions/encoded.d.ts +0 -40
- package/packages/sdk/src/types/transactions/encoded.js +0 -64
- package/packages/sdk/src/types/transactions/encoded.js.map +0 -1
- package/packages/sdk/src/types/transactions/encoded.mjs +0 -59
- package/packages/sdk/src/types/transactions/encoded.mjs.map +0 -1
- package/packages/sdk/src/utils/utils.d.ts +0 -64
- package/packages/sdk/src/utils/utils.js +0 -140
- package/packages/sdk/src/utils/utils.js.map +0 -1
- package/packages/sdk/src/utils/utils.mjs +0 -128
- package/packages/sdk/src/utils/utils.mjs.map +0 -1
- package/packages/transact/src/transactions/common.d.ts +0 -37
- package/sdk/index.d.ts +0 -10
- package/sdk/index.js +0 -59
- package/sdk/index.mjs +0 -11
package/types/app-spec.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-spec.mjs","names":["hint","actions: ('NoOp' | 'OptIn' | 'CloseOut' | 'ClearState' | 'UpdateApplication' | 'DeleteApplication')[]","actions","ABITypeClass"],"sources":["../../src/types/app-spec.ts"],"sourcesContent":["import {\n ABIMethod,\n ABIType as ABITypeClass,\n ARC28Event,\n Arc56Contract,\n Arc56Method,\n StorageKey,\n StructField,\n} from '@algorandfoundation/algokit-abi'\n\n/**\n * Converts an ARC-32 Application Specification to an ARC-56 Contract\n * @param appSpec The ARC-32 Application Specification\n * @returns The ARC-56 Contract\n * @example\n * ```typescript\n * const arc56AppSpec = arc32ToArc56(arc32AppSpec)\n * ```\n */\nexport function arc32ToArc56(appSpec: AppSpec): Arc56Contract {\n const arc32Structs = Object.values(appSpec.hints).flatMap((hint) => Object.entries(hint.structs ?? {}))\n const structs = Object.fromEntries(\n arc32Structs.map(([_, struct]) => {\n const fields = struct.elements.map((e) => ({ name: e[0], type: e[1] }))\n return [struct.name, fields]\n }),\n ) satisfies { [structName: string]: StructField[] }\n const hint = (m: ABIMethodParams) => appSpec.hints[getABIMethodParamsSignature(m)] as Hint | undefined\n const actions = (m: ABIMethodParams, type: 'CREATE' | 'CALL') => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain\n return hint(m)?.call_config !== undefined ? callConfigToActions(hint(m)?.call_config!, type) : []\n }\n const bareActions = (type: 'CREATE' | 'CALL') => {\n return callConfigToActions(appSpec.bare_call_config, type)\n }\n const callConfigToActions = (c: CallConfig, type: 'CREATE' | 'CALL') => {\n const actions: ('NoOp' | 'OptIn' | 'CloseOut' | 'ClearState' | 'UpdateApplication' | 'DeleteApplication')[] = []\n if (c.close_out && ['ALL', type].includes(c.close_out)) actions.push('CloseOut')\n if (c.delete_application && ['ALL', type].includes(c.delete_application)) actions.push('DeleteApplication')\n if (c.no_op && ['ALL', type].includes(c.no_op)) actions.push('NoOp')\n if (c.opt_in && ['ALL', type].includes(c.opt_in)) actions.push('OptIn')\n if (c.update_application && ['ALL', type].includes(c.update_application)) actions.push('UpdateApplication')\n return actions\n }\n const getDefaultArgValue = (\n type: string,\n defaultArg: DefaultArgument | undefined,\n ): Arc56Contract['methods'][0]['args'][0]['defaultValue'] => {\n if (!defaultArg) return undefined\n\n if (defaultArg.source === 'abi-method') {\n return {\n source: 'method',\n data: defaultArg.data.name,\n }\n }\n\n return {\n source: defaultArg.source === 'constant' ? 'literal' : defaultArg.source === 'global-state' ? 'global' : 'local',\n data: Buffer.from(\n typeof defaultArg.data === 'number' ? ABITypeClass.from('uint64').encode(defaultArg.data) : defaultArg.data,\n ).toString('base64'),\n type: type === 'string' ? 'AVMString' : type,\n }\n }\n\n return {\n arcs: [],\n name: appSpec.contract.name,\n desc: appSpec.contract.desc,\n structs: structs,\n methods: appSpec.contract.methods.map(\n (m) =>\n ({\n name: m.name,\n desc: m.desc,\n args: m.args.map((a) => ({\n name: a.name,\n type: a.type,\n desc: a.desc,\n struct: a.name ? hint(m)?.structs?.[a.name]?.name : undefined,\n defaultValue: getDefaultArgValue(a.type, !a.name ? undefined : hint(m)?.default_arguments?.[a.name]),\n })),\n returns: {\n type: m.returns.type,\n desc: m.returns.desc,\n struct: hint(m)?.structs?.output?.name,\n },\n events: [],\n readonly: hint(m)?.read_only,\n actions: {\n create: actions(m, 'CREATE') as Arc56Method['actions']['create'],\n call: actions(m, 'CALL'),\n },\n }) satisfies Arc56Method,\n ),\n state: {\n schema: {\n global: {\n ints: appSpec.state.global.num_uints,\n bytes: appSpec.state.global.num_byte_slices,\n },\n local: {\n ints: appSpec.state.local.num_uints,\n bytes: appSpec.state.local.num_byte_slices,\n },\n },\n keys: {\n global: Object.fromEntries(\n Object.entries(appSpec.schema.global.declared).map((s) => [\n s[0],\n {\n key: Buffer.from(s[1].key, 'utf-8').toString('base64'),\n keyType: 'AVMString',\n valueType: s[1].type === 'uint64' ? 'AVMUint64' : 'AVMBytes',\n desc: s[1].descr,\n } satisfies StorageKey,\n ]),\n ),\n local: Object.fromEntries(\n Object.entries(appSpec.schema.local.declared).map((s) => [\n s[0],\n {\n key: Buffer.from(s[1].key, 'utf-8').toString('base64'),\n keyType: 'AVMString',\n valueType: s[1].type === 'uint64' ? 'AVMUint64' : 'AVMBytes',\n desc: s[1].descr,\n } satisfies StorageKey,\n ]),\n ),\n box: {},\n },\n maps: {\n global: {},\n local: {},\n box: {},\n },\n },\n source: appSpec.source,\n bareActions: {\n create: bareActions('CREATE') as unknown as Arc56Contract['bareActions']['create'],\n call: bareActions('CALL'),\n },\n byteCode: undefined,\n compilerInfo: undefined,\n events: undefined,\n networks: undefined,\n scratchVariables: undefined,\n sourceInfo: undefined,\n templateVariables: undefined,\n } satisfies Arc56Contract\n}\n\nfunction getABIMethodParamsSignature(params: ABIMethodParams) {\n const args = params.args.map((a) => a.type).join(',')\n return `${params.name}(${args})${params.returns.type}`\n}\n\n/** An ARC-0032 Application Specification see https://github.com/algorandfoundation/ARCs/pull/150 */\nexport interface AppSpec {\n /** Method call hints */\n hints: HintSpec\n /** The TEAL source */\n source: AppSources\n /** The ABI-0004 contract definition see https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0004.md */\n contract: ABIContractParams\n /** The values that make up the local and global state */\n schema: SchemaSpec\n /** The rolled-up schema allocation values for local and global state */\n state: StateSchemaSpec\n /** The config of all BARE calls (i.e. non ABI calls with no args) */\n bare_call_config: CallConfig\n}\n\ninterface ABIContractParams {\n name: string\n desc?: string\n networks?: ABIContractNetworks\n methods: ABIMethodParams[]\n events?: ARC28Event[]\n}\n\ninterface ABIContractNetworks {\n [network: string]: ABIContractNetworkInfo\n}\n\ninterface ABIContractNetworkInfo {\n appID: number\n}\n\ninterface ABIMethodParams {\n name: string\n desc?: string\n args: ABIMethodArgParams[]\n returns: ABIMethodReturnParams\n /** Optional, is it a read-only method (according to [ARC-22](https://arc.algorand.foundation/ARCs/arc-0022)) */\n readonly?: boolean\n /** [ARC-28](https://arc.algorand.foundation/ARCs/arc-0028) events that MAY be emitted by this method */\n events?: ARC28Event[]\n}\n\ninterface ABIMethodArgParams {\n type: string\n name?: string\n desc?: string\n}\n\ninterface ABIMethodReturnParams {\n type: string\n desc?: string\n}\n\n/** A lookup of encoded method call spec to hint */\nexport type HintSpec = Record<string, Hint>\n\n/** The TEAL source of a contract */\nexport interface AppSources {\n /** The TEAL source of the approval program */\n approval: string\n /** The TEAL source of the clear program */\n clear: string\n}\n\n/** The various call configs:\n * * `NEVER`: Will not be called\n * * `CALL`: Can be called during a non-create call i.e. app id != 0\n * * `CREATE`: Can be called during a create call i.e. app id = 0\n * * `ALL`: Can be during a create OR non-create call\n **/\nexport type CallConfigValue = 'NEVER' | 'CALL' | 'CREATE' | 'ALL'\n\n/** Call configuration for a method */\nexport interface CallConfig {\n /** NoOp call config */\n no_op?: CallConfigValue\n /** Opt-in call config */\n opt_in?: CallConfigValue\n /** Close out call config */\n close_out?: CallConfigValue\n /** Update call config */\n update_application?: CallConfigValue\n /** Delete call config */\n delete_application?: CallConfigValue\n}\n\n/** Hint information for a given method call to allow client generation */\nexport interface Hint {\n /** Any user-defined struct/tuple types used in the method call, keyed by parameter name or `output` for return type */\n structs?: Record<string, Struct>\n read_only?: boolean\n default_arguments?: Record<string, DefaultArgument>\n call_config: CallConfig\n}\n\n/** The name of a field */\nexport type FieldName = string\n\n/** The string name of an ABI type */\nexport type ABIType = string\n\n/** The elements of the struct/tuple: `FieldName`, `ABIType` */\nexport type StructElement = [FieldName, ABIType]\n\n/** A user-defined struct/tuple type */\nexport interface Struct {\n /** The name of the type */\n name: string\n /** The elements (in order) that make up the struct/tuple */\n elements: StructElement[]\n}\n\n/**\n * Defines a strategy for obtaining a default value for a given ABI arg.\n */\nexport type DefaultArgument =\n | {\n /**\n * The default value should be fetched by invoking an ABI method\n */\n source: 'abi-method'\n data: ABIMethod\n }\n | {\n /**\n * The default value should be fetched from global state\n */\n source: 'global-state'\n /**\n * The key of the state variable\n */\n data: string\n }\n | {\n /**\n * The default value should be fetched from the local state of the sender user\n */\n source: 'local-state'\n /**\n * The key of the state variable\n */\n data: string\n }\n | {\n /**\n * The default value is a constant.\n */\n source: 'constant'\n /**\n * The static default value to use.\n */\n data: string | number\n }\n\n/** AVM data type */\nexport type AVMType = 'uint64' | 'bytes'\n\n/** Declared schema value specification */\nexport interface DeclaredSchemaValueSpec {\n /** The type of value */\n type: AVMType\n /** The name of the key */\n key: string\n /** A description of the variable */\n descr?: string\n /** Whether or not the value is set statically (at create time only) or dynamically */\n static?: boolean\n}\n\n/** Reserved schema value specification */\nexport interface ReservedSchemaValueSpec {\n /** The type of value */\n type: AVMType\n /** The description of the reserved storage space */\n descr: string\n /** The maximum number of slots to reserve */\n max_keys: number\n}\n\n/** The schema for global and local storage */\nexport interface SchemaSpec {\n /** The local storage schema */\n local: Schema\n /** The global storage schema */\n global: Schema\n}\n\n/** The storage schema definition */\nexport interface Schema {\n /** Declared storage schema */\n declared: Record<string, DeclaredSchemaValueSpec>\n /** Reserved storage schema */\n reserved: Record<string, ReservedSchemaValueSpec>\n}\n\n/** The rolled-up schema allocation specification for local and global state */\nexport interface StateSchemaSpec {\n /** Global storage spec */\n global: StateSchema\n /** Local storage spec */\n local: StateSchema\n}\n\n/** Schema spec summary for global or local storage */\nexport type StateSchema = {\n /** Number of uint slots */\n num_uints: number\n /** Number of byte slots */\n num_byte_slices: number\n}\n"],"mappings":";;;;;;;;;;;;AAmBA,SAAgB,aAAa,SAAiC;CAC5D,MAAM,eAAe,OAAO,OAAO,QAAQ,MAAM,CAAC,SAAS,WAAS,OAAO,QAAQA,OAAK,WAAW,EAAE,CAAC,CAAC;CACvG,MAAM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AAM,EAAE,GAAG;KACZ,CACF,CAAC,CACH;IACD,OAAO,OAAO,YACZ,OAAO,QAAQ,QAAQ,OAAO,MAAM,SAAS,CAAC,KAAK,MAAM,CACvD,EAAE,IACF;KACE,KAAK,OAAO,KAAK,EAAE,GAAG,KAAK,QAAQ,CAAC,SAAS,SAAS;KACtD,SAAS;KACT,WAAW,EAAE,GAAG,SAAS,WAAW,cAAc;KAClD,MAAM,EAAE,GAAG;KACZ,CACF,CAAC,CACH;IACD,KAAK,EAAE;IACR;GACD,MAAM;IACJ,QAAQ,EAAE;IACV,OAAO,EAAE;IACT,KAAK,EAAE;IACR;GACF;EACD,QAAQ,QAAQ;EAChB,aAAa;GACX,QAAQ,YAAY,SAAS;GAC7B,MAAM,YAAY,OAAO;GAC1B;EACD,UAAU;EACV,cAAc;EACd,QAAQ;EACR,UAAU;EACV,kBAAkB;EAClB,YAAY;EACZ,mBAAmB;EACpB;;AAGH,SAAS,4BAA4B,QAAyB;CAC5D,MAAM,OAAO,OAAO,KAAK,KAAK,MAAM,EAAE,KAAK,CAAC,KAAK,IAAI;AACrD,QAAO,GAAG,OAAO,KAAK,GAAG,KAAK,GAAG,OAAO,QAAQ"}
|
|
1
|
+
{"version":3,"file":"app-spec.mjs","names":["hint","actions: ('NoOp' | 'OptIn' | 'CloseOut' | 'ClearState' | 'UpdateApplication' | 'DeleteApplication')[]","actions","defaultValueType: string | undefined","ABITypeClass"],"sources":["../../src/types/app-spec.ts"],"sourcesContent":["import {\n ABIMethod,\n ABIType as ABITypeClass,\n ARC28Event,\n Arc56Contract,\n Arc56Method,\n StorageKey,\n StructField,\n} from '@algorandfoundation/algokit-abi'\n\n/**\n * Converts an ARC-32 Application Specification to an ARC-56 Contract\n * @param appSpec The ARC-32 Application Specification\n * @returns The ARC-56 Contract\n * @example\n * ```typescript\n * const arc56AppSpec = arc32ToArc56(arc32AppSpec)\n * ```\n */\nexport function arc32ToArc56(appSpec: AppSpec): Arc56Contract {\n const arc32Structs = Object.values(appSpec.hints).flatMap((hint) => Object.entries(hint.structs ?? {}))\n const structs = Object.fromEntries(\n arc32Structs.map(([_, struct]) => {\n const fields = struct.elements.map((e) => ({ name: e[0], type: e[1] }))\n return [struct.name, fields]\n }),\n ) satisfies { [structName: string]: StructField[] }\n const hint = (m: ABIMethodParams) => appSpec.hints[getABIMethodParamsSignature(m)] as Hint | undefined\n const actions = (m: ABIMethodParams, type: 'CREATE' | 'CALL') => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain\n return hint(m)?.call_config !== undefined ? callConfigToActions(hint(m)?.call_config!, type) : []\n }\n const bareActions = (type: 'CREATE' | 'CALL') => {\n return callConfigToActions(appSpec.bare_call_config, type)\n }\n const callConfigToActions = (c: CallConfig, type: 'CREATE' | 'CALL') => {\n const actions: ('NoOp' | 'OptIn' | 'CloseOut' | 'ClearState' | 'UpdateApplication' | 'DeleteApplication')[] = []\n if (c.close_out && ['ALL', type].includes(c.close_out)) actions.push('CloseOut')\n if (c.delete_application && ['ALL', type].includes(c.delete_application)) actions.push('DeleteApplication')\n if (c.no_op && ['ALL', type].includes(c.no_op)) actions.push('NoOp')\n if (c.opt_in && ['ALL', type].includes(c.opt_in)) actions.push('OptIn')\n if (c.update_application && ['ALL', type].includes(c.update_application)) actions.push('UpdateApplication')\n return actions\n }\n const getDefaultArgValue = (defaultArg: DefaultArgument | undefined): Arc56Contract['methods'][0]['args'][0]['defaultValue'] => {\n if (!defaultArg) return undefined\n\n if (defaultArg.source === 'abi-method') {\n return {\n source: 'method',\n data: defaultArg.data.name,\n }\n }\n\n const mappedSource = defaultArg.source === 'constant' ? 'literal' : defaultArg.source === 'global-state' ? 'global' : 'local'\n\n // type is only set for literal source\n let defaultValueType: string | undefined = undefined\n if (mappedSource === 'literal') {\n if (typeof defaultArg.data === 'number') {\n defaultValueType = 'uint64'\n } else if (typeof defaultArg.data === 'string') {\n defaultValueType = 'AVMString'\n }\n }\n\n const argData =\n typeof defaultArg.data === 'number'\n ? ABITypeClass.from('uint64').encode(defaultArg.data)\n : typeof defaultArg.data === 'string'\n ? new TextEncoder().encode(defaultArg.data)\n : defaultArg.data\n\n return {\n source: mappedSource,\n data: Buffer.from(argData).toString('base64'),\n type: defaultValueType,\n }\n }\n\n return {\n arcs: [],\n name: appSpec.contract.name,\n desc: appSpec.contract.desc,\n structs: structs,\n methods: appSpec.contract.methods.map(\n (m) =>\n ({\n name: m.name,\n desc: m.desc,\n args: m.args.map((a) => ({\n name: a.name,\n type: a.type,\n desc: a.desc,\n struct: a.name ? hint(m)?.structs?.[a.name]?.name : undefined,\n defaultValue: getDefaultArgValue(!a.name ? undefined : hint(m)?.default_arguments?.[a.name]),\n })),\n returns: {\n type: m.returns.type,\n desc: m.returns.desc,\n struct: hint(m)?.structs?.output?.name,\n },\n events: [],\n readonly: hint(m)?.read_only,\n actions: {\n create: actions(m, 'CREATE') as Arc56Method['actions']['create'],\n call: actions(m, 'CALL'),\n },\n }) satisfies Arc56Method,\n ),\n state: {\n schema: {\n global: {\n ints: appSpec.state.global.num_uints,\n bytes: appSpec.state.global.num_byte_slices,\n },\n local: {\n ints: appSpec.state.local.num_uints,\n bytes: appSpec.state.local.num_byte_slices,\n },\n },\n keys: {\n global: Object.fromEntries(\n Object.entries(appSpec.schema.global.declared).map((s) => [\n s[0],\n {\n key: Buffer.from(s[1].key, 'utf-8').toString('base64'),\n keyType: 'AVMString',\n valueType: s[1].type === 'uint64' ? 'AVMUint64' : 'AVMBytes',\n desc: s[1].descr,\n } satisfies StorageKey,\n ]),\n ),\n local: Object.fromEntries(\n Object.entries(appSpec.schema.local.declared).map((s) => [\n s[0],\n {\n key: Buffer.from(s[1].key, 'utf-8').toString('base64'),\n keyType: 'AVMString',\n valueType: s[1].type === 'uint64' ? 'AVMUint64' : 'AVMBytes',\n desc: s[1].descr,\n } satisfies StorageKey,\n ]),\n ),\n box: {},\n },\n maps: {\n global: {},\n local: {},\n box: {},\n },\n },\n source: appSpec.source,\n bareActions: {\n create: bareActions('CREATE') as unknown as Arc56Contract['bareActions']['create'],\n call: bareActions('CALL'),\n },\n byteCode: undefined,\n compilerInfo: undefined,\n events: undefined,\n networks: undefined,\n scratchVariables: undefined,\n sourceInfo: undefined,\n templateVariables: undefined,\n } satisfies Arc56Contract\n}\n\nfunction getABIMethodParamsSignature(params: ABIMethodParams) {\n const args = params.args.map((a) => a.type).join(',')\n return `${params.name}(${args})${params.returns.type}`\n}\n\n/** An ARC-0032 Application Specification see https://github.com/algorandfoundation/ARCs/pull/150 */\nexport interface AppSpec {\n /** Method call hints */\n hints: HintSpec\n /** The TEAL source */\n source: AppSources\n /** The ABI-0004 contract definition see https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0004.md */\n contract: ABIContractParams\n /** The values that make up the local and global state */\n schema: SchemaSpec\n /** The rolled-up schema allocation values for local and global state */\n state: StateSchemaSpec\n /** The config of all BARE calls (i.e. non ABI calls with no args) */\n bare_call_config: CallConfig\n}\n\ninterface ABIContractParams {\n name: string\n desc?: string\n networks?: ABIContractNetworks\n methods: ABIMethodParams[]\n events?: ARC28Event[]\n}\n\ninterface ABIContractNetworks {\n [network: string]: ABIContractNetworkInfo\n}\n\ninterface ABIContractNetworkInfo {\n appID: number\n}\n\ninterface ABIMethodParams {\n name: string\n desc?: string\n args: ABIMethodArgParams[]\n returns: ABIMethodReturnParams\n /** Optional, is it a read-only method (according to [ARC-22](https://arc.algorand.foundation/ARCs/arc-0022)) */\n readonly?: boolean\n /** [ARC-28](https://arc.algorand.foundation/ARCs/arc-0028) events that MAY be emitted by this method */\n events?: ARC28Event[]\n}\n\ninterface ABIMethodArgParams {\n type: string\n name?: string\n desc?: string\n}\n\ninterface ABIMethodReturnParams {\n type: string\n desc?: string\n}\n\n/** A lookup of encoded method call spec to hint */\nexport type HintSpec = Record<string, Hint>\n\n/** The TEAL source of a contract */\nexport interface AppSources {\n /** The TEAL source of the approval program */\n approval: string\n /** The TEAL source of the clear program */\n clear: string\n}\n\n/** The various call configs:\n * * `NEVER`: Will not be called\n * * `CALL`: Can be called during a non-create call i.e. app id != 0\n * * `CREATE`: Can be called during a create call i.e. app id = 0\n * * `ALL`: Can be during a create OR non-create call\n **/\nexport type CallConfigValue = 'NEVER' | 'CALL' | 'CREATE' | 'ALL'\n\n/** Call configuration for a method */\nexport interface CallConfig {\n /** NoOp call config */\n no_op?: CallConfigValue\n /** Opt-in call config */\n opt_in?: CallConfigValue\n /** Close out call config */\n close_out?: CallConfigValue\n /** Update call config */\n update_application?: CallConfigValue\n /** Delete call config */\n delete_application?: CallConfigValue\n}\n\n/** Hint information for a given method call to allow client generation */\nexport interface Hint {\n /** Any user-defined struct/tuple types used in the method call, keyed by parameter name or `output` for return type */\n structs?: Record<string, Struct>\n read_only?: boolean\n default_arguments?: Record<string, DefaultArgument>\n call_config: CallConfig\n}\n\n/** The name of a field */\nexport type FieldName = string\n\n/** The string name of an ABI type */\nexport type ABIType = string\n\n/** The elements of the struct/tuple: `FieldName`, `ABIType` */\nexport type StructElement = [FieldName, ABIType]\n\n/** A user-defined struct/tuple type */\nexport interface Struct {\n /** The name of the type */\n name: string\n /** The elements (in order) that make up the struct/tuple */\n elements: StructElement[]\n}\n\n/**\n * Defines a strategy for obtaining a default value for a given ABI arg.\n */\nexport type DefaultArgument =\n | {\n /**\n * The default value should be fetched by invoking an ABI method\n */\n source: 'abi-method'\n data: ABIMethod\n }\n | {\n /**\n * The default value should be fetched from global state\n */\n source: 'global-state'\n /**\n * The key of the state variable\n */\n data: string\n }\n | {\n /**\n * The default value should be fetched from the local state of the sender user\n */\n source: 'local-state'\n /**\n * The key of the state variable\n */\n data: string\n }\n | {\n /**\n * The default value is a constant.\n */\n source: 'constant'\n /**\n * The static default value to use.\n */\n data: string | number\n }\n\n/** AVM data type */\nexport type AVMType = 'uint64' | 'bytes'\n\n/** Declared schema value specification */\nexport interface DeclaredSchemaValueSpec {\n /** The type of value */\n type: AVMType\n /** The name of the key */\n key: string\n /** A description of the variable */\n descr?: string\n /** Whether or not the value is set statically (at create time only) or dynamically */\n static?: boolean\n}\n\n/** Reserved schema value specification */\nexport interface ReservedSchemaValueSpec {\n /** The type of value */\n type: AVMType\n /** The description of the reserved storage space */\n descr: string\n /** The maximum number of slots to reserve */\n max_keys: number\n}\n\n/** The schema for global and local storage */\nexport interface SchemaSpec {\n /** The local storage schema */\n local: Schema\n /** The global storage schema */\n global: Schema\n}\n\n/** The storage schema definition */\nexport interface Schema {\n /** Declared storage schema */\n declared: Record<string, DeclaredSchemaValueSpec>\n /** Reserved storage schema */\n reserved: Record<string, ReservedSchemaValueSpec>\n}\n\n/** The rolled-up schema allocation specification for local and global state */\nexport interface StateSchemaSpec {\n /** Global storage spec */\n global: StateSchema\n /** Local storage spec */\n local: StateSchema\n}\n\n/** Schema spec summary for global or local storage */\nexport type StateSchema = {\n /** Number of uint slots */\n num_uints: number\n /** Number of byte slots */\n num_byte_slices: number\n}\n"],"mappings":";;;;;;;;;;;;AAmBA,SAAgB,aAAa,SAAiC;CAC5D,MAAM,eAAe,OAAO,OAAO,QAAQ,MAAM,CAAC,SAAS,WAAS,OAAO,QAAQA,OAAK,WAAW,EAAE,CAAC,CAAC;CACvG,MAAM,UAAU,OAAO,YACrB,aAAa,KAAK,CAAC,GAAG,YAAY;EAChC,MAAM,SAAS,OAAO,SAAS,KAAK,OAAO;GAAE,MAAM,EAAE;GAAI,MAAM,EAAE;GAAI,EAAE;AACvE,SAAO,CAAC,OAAO,MAAM,OAAO;GAC5B,CACH;CACD,MAAM,QAAQ,MAAuB,QAAQ,MAAM,4BAA4B,EAAE;CACjF,MAAM,WAAW,GAAoB,SAA4B;AAE/D,SAAO,KAAK,EAAE,EAAE,gBAAgB,SAAY,oBAAoB,KAAK,EAAE,EAAE,aAAc,KAAK,GAAG,EAAE;;CAEnG,MAAM,eAAe,SAA4B;AAC/C,SAAO,oBAAoB,QAAQ,kBAAkB,KAAK;;CAE5D,MAAM,uBAAuB,GAAe,SAA4B;EACtE,MAAMC,YAAwG,EAAE;AA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,KAAK,EAAE;IACR;GACD,MAAM;IACJ,QAAQ,EAAE;IACV,OAAO,EAAE;IACT,KAAK,EAAE;IACR;GACF;EACD,QAAQ,QAAQ;EAChB,aAAa;GACX,QAAQ,YAAY,SAAS;GAC7B,MAAM,YAAY,OAAO;GAC1B;EACD,UAAU;EACV,cAAc;EACd,QAAQ;EACR,UAAU;EACV,kBAAkB;EAClB,YAAY;EACZ,mBAAmB;EACpB;;AAGH,SAAS,4BAA4B,QAAyB;CAC5D,MAAM,OAAO,OAAO,KAAK,KAAK,MAAM,EAAE,KAAK,CAAC,KAAK,IAAI;AACrD,QAAO,GAAG,OAAO,KAAK,GAAG,KAAK,GAAG,OAAO,QAAQ"}
|
package/types/app.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Address } from "../packages/common/src/address.js";
|
|
2
|
+
import { Expand } from "../packages/common/src/expand.js";
|
|
3
|
+
import { ProgramSourceMap } from "../packages/common/src/sourcemap.js";
|
|
2
4
|
import { ABIValue } from "../packages/abi/src/abi-value.js";
|
|
3
5
|
import { ABIType } from "../packages/abi/src/abi-type.js";
|
|
4
6
|
import { ABIMethod, ABIReturn } from "../packages/abi/src/abi-method.js";
|
|
5
7
|
import { BoxReference, OnApplicationComplete } from "../packages/transact/src/transactions/app-call.js";
|
|
6
8
|
import { Transaction } from "../packages/transact/src/transactions/transaction.js";
|
|
7
9
|
import { SuggestedParams } from "../packages/algod_client/src/models/suggested-params.js";
|
|
8
|
-
import { ProgramSourceMap } from "../packages/sdk/src/logic/sourcemap.js";
|
|
9
10
|
import { BoxIdentifier, BoxReference as BoxReference$1 } from "./app-manager.js";
|
|
10
|
-
import { Expand } from "./expand.js";
|
|
11
11
|
import { SendSingleTransactionResult, SendTransactionFrom, SendTransactionParams, SendTransactionResult, SendTransactionResults, TransactionNote, TransactionToSign } from "./transaction.js";
|
|
12
12
|
import { TransactionWithSigner } from "../transaction/transaction.js";
|
|
13
13
|
|
package/types/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","names":[],"sources":["../../src/types/app.ts"],"sourcesContent":["import { ABIMethod, ABIReturn, ABIType, ABIValue } from '@algorandfoundation/algokit-abi'\nimport { SuggestedParams } from '@algorandfoundation/algokit-algod-client'\nimport { Address } from '@algorandfoundation/algokit-common'\nimport { OnApplicationComplete, BoxReference as TransactBoxReference, Transaction } from '@algorandfoundation/algokit-transact'\nimport { ProgramSourceMap } from '@algorandfoundation/sdk'\nimport { TransactionWithSigner } from '../transaction'\nimport { BoxIdentifier, BoxReference } from './app-manager'\nimport { Expand } from './expand'\nimport {\n SendSingleTransactionResult,\n SendTransactionFrom,\n SendTransactionParams,\n SendTransactionResult,\n SendTransactionResults,\n TransactionNote,\n TransactionToSign,\n} from './transaction'\ntype SourceMap = ProgramSourceMap\n\n/** The name of the TEAL template variable for deploy-time immutability control */\nexport const UPDATABLE_TEMPLATE_NAME = 'TMPL_UPDATABLE'\n\n/** The name of the TEAL template variable for deploy-time permanence control */\nexport const DELETABLE_TEMPLATE_NAME = 'TMPL_DELETABLE'\n\n/** The app create/update [ARC-2](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md) transaction note prefix */\nexport const APP_DEPLOY_NOTE_DAPP = 'ALGOKIT_DEPLOYER'\n\n/** The maximum number of bytes in a single app code page */\nexport const APP_PAGE_MAX_SIZE = 2048\n\n/** First 4 bytes of SHA-512/256 hash of \"return\" for retrieving ABI return values */\nexport const ABI_RETURN_PREFIX = new Uint8Array([21, 31, 124, 117])\n\n/** Information about an Algorand app */\nexport interface AppReference {\n /** The id of the app */\n appId: number | bigint\n /** The Algorand address of the account associated with the app */\n appAddress: string\n}\n\n/** Common app call arguments for ABI and non-ABI (raw) calls */\nexport interface CoreAppCallArgs {\n /** The optional lease for the transaction */\n lease?: string | Uint8Array\n /** Any box references to load */\n boxes?: (TransactBoxReference | BoxReference | BoxIdentifier)[]\n /** The address of any accounts to load in */\n accounts?: (string | Address)[]\n /** IDs of any apps to load into the foreignApps array */\n apps?: number[]\n /** IDs of any assets to load into the foreignAssets array */\n assets?: number[]\n /** Optional account / account address that should be authorised to transact on behalf of the from account the app call is sent from after this transaction.\n *\n * **Note:** Use with extreme caution and review the [official rekey guidance](https://dev.algorand.co/concepts/accounts/rekeying) first.\n */\n rekeyTo?: SendTransactionFrom | string\n}\n\n/**\n * App call args with non-ABI (raw) values (minus some processing like encoding strings as binary)\n */\nexport interface RawAppCallArgs extends CoreAppCallArgs {\n /** Any application arguments to pass through */\n appArgs?: (Uint8Array | string)[]\n /** Property to aid intellisense */\n method?: undefined\n}\n\n/** An argument for an ABI method, either a primitive value, or a transaction with or without signer, or the unawaited async return value of an algokit method that returns a `SendTransactionResult` */\nexport type ABIAppCallArg =\n | ABIValue\n | TransactionWithSigner\n | TransactionToSign\n | Transaction\n | Promise<SendTransactionResult>\n | SendTransactionResult\n | undefined\n\n/**\n * App call args for an ABI call\n */\nexport type ABIAppCallArgs = CoreAppCallArgs & {\n /** The ABI method to call */\n method: ABIMethod\n /** The ABI method args to pass in */\n methodArgs: ABIAppCallArg[]\n}\n\n/** Arguments to pass to an app call either:\n * * The raw app call values to pass through into the transaction (after processing); or\n * * An ABI method definition (method and args)\n **/\nexport type AppCallArgs = RawAppCallArgs | ABIAppCallArgs\n\n/** Parameters representing a call to an app. */\nexport interface AppCallParams extends SendTransactionParams {\n /** The id of the app to call */\n appId: number | bigint\n /** The type of call, everything except create (see `createApp`) and update (see `updateApp`) */\n callType: Exclude<OnApplicationComplete, OnApplicationComplete.UpdateApplication>\n /** The account to make the call from */\n from: SendTransactionFrom\n /** Optional transaction parameters */\n transactionParams?: SuggestedParams\n /** The (optional) transaction note */\n note?: TransactionNote\n /** The arguments passed in to the app call */\n args?: AppCallArgs\n}\n\n/** Parameters representing the storage schema of an app. */\nexport interface AppStorageSchema {\n /** Restricts number of ints in per-user local state */\n localInts: number\n /** Restricts number of byte slices in per-user local state */\n localByteSlices: number\n /** Restricts number of ints in global state */\n globalInts: number\n /** Restricts number of byte slices in global state */\n globalByteSlices: number\n /** Any extra pages that are needed for the smart contract; if left blank then the right number of pages will be calculated based on the teal code size */\n extraPages?: number\n}\n\n/** Information about a compiled teal program */\nexport interface CompiledTeal {\n /** Original TEAL code */\n teal: string\n /** The compiled code */\n compiled: string\n /** The hash returned by the compiler */\n compiledHash: string\n /** The base64 encoded code as a byte array */\n compiledBase64ToBytes: Uint8Array\n /** Source map from the compilation */\n sourceMap: SourceMap\n}\n\nexport interface AppCallTransactionResultOfType<T> extends SendTransactionResults, SendTransactionResult {\n /** If an ABI method was called the processed return value */\n return?: T\n}\n\n/** Result from calling an app */\nexport type AppCallTransactionResult = AppCallTransactionResultOfType<ABIReturn>\n\n/**\n * The payload of the metadata to add to the transaction note when deploying an app, noting it will be prefixed with `APP_DEPLOY_NOTE_PREFIX`.\n */\nexport interface AppDeployMetadata {\n /** The unique name identifier of the app within the creator account */\n name: string\n /** The version of app that is / will be deployed */\n version: string\n /** Whether or not the app is deletable / permanent / unspecified */\n deletable?: boolean\n /** Whether or not the app is updatable / immutable / unspecified */\n updatable?: boolean\n}\n\n/** The metadata that can be collected about a deployed app */\nexport interface AppMetadata extends AppReference, AppDeployMetadata {\n /** The round the app was created */\n createdRound: number\n /** The last round that the app was updated */\n updatedRound: number\n /** The metadata when the app was created */\n createdMetadata: AppDeployMetadata\n /** Whether or not the app is deleted */\n deleted: boolean\n}\n\n/** A lookup of name -> Algorand app for a creator */\nexport interface AppLookup {\n creator: Readonly<string>\n apps: Readonly<{\n [name: string]: AppMetadata\n }>\n}\n\n/** Dictionary of deploy-time parameters to replace in a teal template.\n *\n * Note: Looks for `TMPL_{parameter}` for template replacements i.e. you can leave out the `TMPL_`.\n *\n */\nexport interface TealTemplateParams {\n [key: string]: string | bigint | number | Uint8Array\n}\n\n/** What action to perform when deploying an app and an update is detected in the TEAL code */\nexport enum OnUpdate {\n /** Fail the deployment */\n Fail,\n /** Update the app */\n UpdateApp,\n /** Delete the app and create a new one in its place */\n ReplaceApp,\n /** Create a new app */\n AppendApp,\n}\n\n/** What action to perform when deploying an app and a breaking schema change is detected */\nexport enum OnSchemaBreak {\n /** Fail the deployment */\n Fail,\n /** Delete the app and create a new one in its place */\n ReplaceApp,\n /** Create a new app */\n AppendApp,\n}\n\n/** The result of compiling the approval and clear state TEAL programs for an app */\nexport interface AppCompilationResult {\n /** The result of compiling the approval program */\n compiledApproval: CompiledTeal\n /** The result of compiling the clear state program */\n compiledClear: CompiledTeal\n}\n\nexport type AppReturn<TReturn> = {\n /** The ABI method call return value */\n return?: TReturn\n}\n\n/** Result from sending a single app transaction. */\nexport type SendAppTransactionResult = Expand<\n SendSingleTransactionResult & {\n /** If an ABI method was called the processed return value */\n return?: ABIReturn\n }\n>\n\n/** Result from sending a single app transaction. */\nexport type SendAppUpdateTransactionResult = Expand<SendAppTransactionResult & Partial<AppCompilationResult>>\n\n/** Result from sending a single app transaction. */\nexport type SendAppCreateTransactionResult = Expand<\n SendAppUpdateTransactionResult & {\n /** The id of the created app */\n appId: bigint\n /** The Algorand address of the account associated with the app */\n appAddress: Address\n }\n>\n\n/** Object holding app state values */\nexport interface AppState {\n [key: string]:\n | {\n value: bigint\n keyRaw: Uint8Array\n keyBase64: string\n }\n | {\n value: string\n valueRaw: Uint8Array\n valueBase64: string\n keyRaw: Uint8Array\n keyBase64: string\n }\n}\n\n/**\n * The name of a box storage box */\nexport interface BoxName {\n /** Name in UTF-8 */\n name: string\n /** Name in binary bytes */\n nameRaw: Uint8Array\n /** Name in Base64 */\n nameBase64: string\n}\n\n/**\n * @deprecated Use `types/app-manager/BoxValueRequestParams` instead.\n * Parameters to get and decode a box value as an ABI type.\n */\nexport interface BoxValueRequestParams {\n /** The ID of the app return box names for */\n appId: number | bigint\n /** The name of the box to return either as a string, binary array or `BoxName` */\n boxName: string | Uint8Array | BoxName\n /** The ABI type to decode the value using */\n type: ABIType\n}\n\n/**\n * @deprecated Use `types/app-manager/BoxValuesRequestParams` instead.\n * Parameters to get and decode a box value as an ABI type.\n */\nexport interface BoxValuesRequestParams {\n /** The ID of the app return box names for */\n appId: number\n /** The names of the boxes to return either as a string, binary array or BoxName` */\n boxNames: (string | Uint8Array | BoxName)[]\n /** The ABI type to decode the value using */\n type: ABIType\n}\n"],"mappings":";;;AAoBA,MAAa,0BAA0B;;AAGvC,MAAa,0BAA0B;;AAGvC,MAAa,uBAAuB;;AAGpC,MAAa,oBAAoB;;AAGjC,MAAa,oBAAoB,IAAI,WAAW;CAAC;CAAI;CAAI;CAAK;CAAI,CAAC;;AAiKnE,IAAY,gDAAL;;AAEL;;AAEA;;AAEA;;AAEA;;;;AAIF,IAAY,0DAAL;;AAEL;;AAEA;;AAEA"}
|
|
1
|
+
{"version":3,"file":"app.js","names":[],"sources":["../../src/types/app.ts"],"sourcesContent":["import { ABIMethod, ABIReturn, ABIType, ABIValue } from '@algorandfoundation/algokit-abi'\nimport { SuggestedParams } from '@algorandfoundation/algokit-algod-client'\nimport { Address, Expand, ProgramSourceMap } from '@algorandfoundation/algokit-common'\nimport { OnApplicationComplete, BoxReference as TransactBoxReference, Transaction } from '@algorandfoundation/algokit-transact'\nimport { TransactionWithSigner } from '../transaction'\nimport { BoxIdentifier, BoxReference } from './app-manager'\nimport {\n SendSingleTransactionResult,\n SendTransactionFrom,\n SendTransactionParams,\n SendTransactionResult,\n SendTransactionResults,\n TransactionNote,\n TransactionToSign,\n} from './transaction'\ntype SourceMap = ProgramSourceMap\n\n/** The name of the TEAL template variable for deploy-time immutability control */\nexport const UPDATABLE_TEMPLATE_NAME = 'TMPL_UPDATABLE'\n\n/** The name of the TEAL template variable for deploy-time permanence control */\nexport const DELETABLE_TEMPLATE_NAME = 'TMPL_DELETABLE'\n\n/** The app create/update [ARC-2](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md) transaction note prefix */\nexport const APP_DEPLOY_NOTE_DAPP = 'ALGOKIT_DEPLOYER'\n\n/** The maximum number of bytes in a single app code page */\nexport const APP_PAGE_MAX_SIZE = 2048\n\n/** First 4 bytes of SHA-512/256 hash of \"return\" for retrieving ABI return values */\nexport const ABI_RETURN_PREFIX = new Uint8Array([21, 31, 124, 117])\n\n/** Information about an Algorand app */\nexport interface AppReference {\n /** The id of the app */\n appId: number | bigint\n /** The Algorand address of the account associated with the app */\n appAddress: string\n}\n\n/** Common app call arguments for ABI and non-ABI (raw) calls */\nexport interface CoreAppCallArgs {\n /** The optional lease for the transaction */\n lease?: string | Uint8Array\n /** Any box references to load */\n boxes?: (TransactBoxReference | BoxReference | BoxIdentifier)[]\n /** The address of any accounts to load in */\n accounts?: (string | Address)[]\n /** IDs of any apps to load into the foreignApps array */\n apps?: number[]\n /** IDs of any assets to load into the foreignAssets array */\n assets?: number[]\n /** Optional account / account address that should be authorised to transact on behalf of the from account the app call is sent from after this transaction.\n *\n * **Note:** Use with extreme caution and review the [official rekey guidance](https://dev.algorand.co/concepts/accounts/rekeying) first.\n */\n rekeyTo?: SendTransactionFrom | string\n}\n\n/**\n * App call args with non-ABI (raw) values (minus some processing like encoding strings as binary)\n */\nexport interface RawAppCallArgs extends CoreAppCallArgs {\n /** Any application arguments to pass through */\n appArgs?: (Uint8Array | string)[]\n /** Property to aid intellisense */\n method?: undefined\n}\n\n/** An argument for an ABI method, either a primitive value, or a transaction with or without signer, or the unawaited async return value of an algokit method that returns a `SendTransactionResult` */\nexport type ABIAppCallArg =\n | ABIValue\n | TransactionWithSigner\n | TransactionToSign\n | Transaction\n | Promise<SendTransactionResult>\n | SendTransactionResult\n | undefined\n\n/**\n * App call args for an ABI call\n */\nexport type ABIAppCallArgs = CoreAppCallArgs & {\n /** The ABI method to call */\n method: ABIMethod\n /** The ABI method args to pass in */\n methodArgs: ABIAppCallArg[]\n}\n\n/** Arguments to pass to an app call either:\n * * The raw app call values to pass through into the transaction (after processing); or\n * * An ABI method definition (method and args)\n **/\nexport type AppCallArgs = RawAppCallArgs | ABIAppCallArgs\n\n/** Parameters representing a call to an app. */\nexport interface AppCallParams extends SendTransactionParams {\n /** The id of the app to call */\n appId: number | bigint\n /** The type of call, everything except create (see `createApp`) and update (see `updateApp`) */\n callType: Exclude<OnApplicationComplete, OnApplicationComplete.UpdateApplication>\n /** The account to make the call from */\n from: SendTransactionFrom\n /** Optional transaction parameters */\n transactionParams?: SuggestedParams\n /** The (optional) transaction note */\n note?: TransactionNote\n /** The arguments passed in to the app call */\n args?: AppCallArgs\n}\n\n/** Parameters representing the storage schema of an app. */\nexport interface AppStorageSchema {\n /** Restricts number of ints in per-user local state */\n localInts: number\n /** Restricts number of byte slices in per-user local state */\n localByteSlices: number\n /** Restricts number of ints in global state */\n globalInts: number\n /** Restricts number of byte slices in global state */\n globalByteSlices: number\n /** Any extra pages that are needed for the smart contract; if left blank then the right number of pages will be calculated based on the teal code size */\n extraPages?: number\n}\n\n/** Information about a compiled teal program */\nexport interface CompiledTeal {\n /** Original TEAL code */\n teal: string\n /** The compiled code */\n compiled: string\n /** The hash returned by the compiler */\n compiledHash: string\n /** The base64 encoded code as a byte array */\n compiledBase64ToBytes: Uint8Array\n /** Source map from the compilation */\n sourceMap: SourceMap\n}\n\nexport interface AppCallTransactionResultOfType<T> extends SendTransactionResults, SendTransactionResult {\n /** If an ABI method was called the processed return value */\n return?: T\n}\n\n/** Result from calling an app */\nexport type AppCallTransactionResult = AppCallTransactionResultOfType<ABIReturn>\n\n/**\n * The payload of the metadata to add to the transaction note when deploying an app, noting it will be prefixed with `APP_DEPLOY_NOTE_PREFIX`.\n */\nexport interface AppDeployMetadata {\n /** The unique name identifier of the app within the creator account */\n name: string\n /** The version of app that is / will be deployed */\n version: string\n /** Whether or not the app is deletable / permanent / unspecified */\n deletable?: boolean\n /** Whether or not the app is updatable / immutable / unspecified */\n updatable?: boolean\n}\n\n/** The metadata that can be collected about a deployed app */\nexport interface AppMetadata extends AppReference, AppDeployMetadata {\n /** The round the app was created */\n createdRound: number\n /** The last round that the app was updated */\n updatedRound: number\n /** The metadata when the app was created */\n createdMetadata: AppDeployMetadata\n /** Whether or not the app is deleted */\n deleted: boolean\n}\n\n/** A lookup of name -> Algorand app for a creator */\nexport interface AppLookup {\n creator: Readonly<string>\n apps: Readonly<{\n [name: string]: AppMetadata\n }>\n}\n\n/** Dictionary of deploy-time parameters to replace in a teal template.\n *\n * Note: Looks for `TMPL_{parameter}` for template replacements i.e. you can leave out the `TMPL_`.\n *\n */\nexport interface TealTemplateParams {\n [key: string]: string | bigint | number | Uint8Array\n}\n\n/** What action to perform when deploying an app and an update is detected in the TEAL code */\nexport enum OnUpdate {\n /** Fail the deployment */\n Fail,\n /** Update the app */\n UpdateApp,\n /** Delete the app and create a new one in its place */\n ReplaceApp,\n /** Create a new app */\n AppendApp,\n}\n\n/** What action to perform when deploying an app and a breaking schema change is detected */\nexport enum OnSchemaBreak {\n /** Fail the deployment */\n Fail,\n /** Delete the app and create a new one in its place */\n ReplaceApp,\n /** Create a new app */\n AppendApp,\n}\n\n/** The result of compiling the approval and clear state TEAL programs for an app */\nexport interface AppCompilationResult {\n /** The result of compiling the approval program */\n compiledApproval: CompiledTeal\n /** The result of compiling the clear state program */\n compiledClear: CompiledTeal\n}\n\nexport type AppReturn<TReturn> = {\n /** The ABI method call return value */\n return?: TReturn\n}\n\n/** Result from sending a single app transaction. */\nexport type SendAppTransactionResult = Expand<\n SendSingleTransactionResult & {\n /** If an ABI method was called the processed return value */\n return?: ABIReturn\n }\n>\n\n/** Result from sending a single app transaction. */\nexport type SendAppUpdateTransactionResult = Expand<SendAppTransactionResult & Partial<AppCompilationResult>>\n\n/** Result from sending a single app transaction. */\nexport type SendAppCreateTransactionResult = Expand<\n SendAppUpdateTransactionResult & {\n /** The id of the created app */\n appId: bigint\n /** The Algorand address of the account associated with the app */\n appAddress: Address\n }\n>\n\n/** Object holding app state values */\nexport interface AppState {\n [key: string]:\n | {\n value: bigint\n keyRaw: Uint8Array\n keyBase64: string\n }\n | {\n value: string\n valueRaw: Uint8Array\n valueBase64: string\n keyRaw: Uint8Array\n keyBase64: string\n }\n}\n\n/**\n * The name of a box storage box */\nexport interface BoxName {\n /** Name in UTF-8 */\n name: string\n /** Name in binary bytes */\n nameRaw: Uint8Array\n /** Name in Base64 */\n nameBase64: string\n}\n\n/**\n * @deprecated Use `types/app-manager/BoxValueRequestParams` instead.\n * Parameters to get and decode a box value as an ABI type.\n */\nexport interface BoxValueRequestParams {\n /** The ID of the app return box names for */\n appId: number | bigint\n /** The name of the box to return either as a string, binary array or `BoxName` */\n boxName: string | Uint8Array | BoxName\n /** The ABI type to decode the value using */\n type: ABIType\n}\n\n/**\n * @deprecated Use `types/app-manager/BoxValuesRequestParams` instead.\n * Parameters to get and decode a box value as an ABI type.\n */\nexport interface BoxValuesRequestParams {\n /** The ID of the app return box names for */\n appId: number\n /** The names of the boxes to return either as a string, binary array or BoxName` */\n boxNames: (string | Uint8Array | BoxName)[]\n /** The ABI type to decode the value using */\n type: ABIType\n}\n"],"mappings":";;;AAkBA,MAAa,0BAA0B;;AAGvC,MAAa,0BAA0B;;AAGvC,MAAa,uBAAuB;;AAGpC,MAAa,oBAAoB;;AAGjC,MAAa,oBAAoB,IAAI,WAAW;CAAC;CAAI;CAAI;CAAK;CAAI,CAAC;;AAiKnE,IAAY,gDAAL;;AAEL;;AAEA;;AAEA;;AAEA;;;;AAIF,IAAY,0DAAL;;AAEL;;AAEA;;AAEA"}
|
package/types/app.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.mjs","names":[],"sources":["../../src/types/app.ts"],"sourcesContent":["import { ABIMethod, ABIReturn, ABIType, ABIValue } from '@algorandfoundation/algokit-abi'\nimport { SuggestedParams } from '@algorandfoundation/algokit-algod-client'\nimport { Address } from '@algorandfoundation/algokit-common'\nimport { OnApplicationComplete, BoxReference as TransactBoxReference, Transaction } from '@algorandfoundation/algokit-transact'\nimport { ProgramSourceMap } from '@algorandfoundation/sdk'\nimport { TransactionWithSigner } from '../transaction'\nimport { BoxIdentifier, BoxReference } from './app-manager'\nimport { Expand } from './expand'\nimport {\n SendSingleTransactionResult,\n SendTransactionFrom,\n SendTransactionParams,\n SendTransactionResult,\n SendTransactionResults,\n TransactionNote,\n TransactionToSign,\n} from './transaction'\ntype SourceMap = ProgramSourceMap\n\n/** The name of the TEAL template variable for deploy-time immutability control */\nexport const UPDATABLE_TEMPLATE_NAME = 'TMPL_UPDATABLE'\n\n/** The name of the TEAL template variable for deploy-time permanence control */\nexport const DELETABLE_TEMPLATE_NAME = 'TMPL_DELETABLE'\n\n/** The app create/update [ARC-2](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md) transaction note prefix */\nexport const APP_DEPLOY_NOTE_DAPP = 'ALGOKIT_DEPLOYER'\n\n/** The maximum number of bytes in a single app code page */\nexport const APP_PAGE_MAX_SIZE = 2048\n\n/** First 4 bytes of SHA-512/256 hash of \"return\" for retrieving ABI return values */\nexport const ABI_RETURN_PREFIX = new Uint8Array([21, 31, 124, 117])\n\n/** Information about an Algorand app */\nexport interface AppReference {\n /** The id of the app */\n appId: number | bigint\n /** The Algorand address of the account associated with the app */\n appAddress: string\n}\n\n/** Common app call arguments for ABI and non-ABI (raw) calls */\nexport interface CoreAppCallArgs {\n /** The optional lease for the transaction */\n lease?: string | Uint8Array\n /** Any box references to load */\n boxes?: (TransactBoxReference | BoxReference | BoxIdentifier)[]\n /** The address of any accounts to load in */\n accounts?: (string | Address)[]\n /** IDs of any apps to load into the foreignApps array */\n apps?: number[]\n /** IDs of any assets to load into the foreignAssets array */\n assets?: number[]\n /** Optional account / account address that should be authorised to transact on behalf of the from account the app call is sent from after this transaction.\n *\n * **Note:** Use with extreme caution and review the [official rekey guidance](https://dev.algorand.co/concepts/accounts/rekeying) first.\n */\n rekeyTo?: SendTransactionFrom | string\n}\n\n/**\n * App call args with non-ABI (raw) values (minus some processing like encoding strings as binary)\n */\nexport interface RawAppCallArgs extends CoreAppCallArgs {\n /** Any application arguments to pass through */\n appArgs?: (Uint8Array | string)[]\n /** Property to aid intellisense */\n method?: undefined\n}\n\n/** An argument for an ABI method, either a primitive value, or a transaction with or without signer, or the unawaited async return value of an algokit method that returns a `SendTransactionResult` */\nexport type ABIAppCallArg =\n | ABIValue\n | TransactionWithSigner\n | TransactionToSign\n | Transaction\n | Promise<SendTransactionResult>\n | SendTransactionResult\n | undefined\n\n/**\n * App call args for an ABI call\n */\nexport type ABIAppCallArgs = CoreAppCallArgs & {\n /** The ABI method to call */\n method: ABIMethod\n /** The ABI method args to pass in */\n methodArgs: ABIAppCallArg[]\n}\n\n/** Arguments to pass to an app call either:\n * * The raw app call values to pass through into the transaction (after processing); or\n * * An ABI method definition (method and args)\n **/\nexport type AppCallArgs = RawAppCallArgs | ABIAppCallArgs\n\n/** Parameters representing a call to an app. */\nexport interface AppCallParams extends SendTransactionParams {\n /** The id of the app to call */\n appId: number | bigint\n /** The type of call, everything except create (see `createApp`) and update (see `updateApp`) */\n callType: Exclude<OnApplicationComplete, OnApplicationComplete.UpdateApplication>\n /** The account to make the call from */\n from: SendTransactionFrom\n /** Optional transaction parameters */\n transactionParams?: SuggestedParams\n /** The (optional) transaction note */\n note?: TransactionNote\n /** The arguments passed in to the app call */\n args?: AppCallArgs\n}\n\n/** Parameters representing the storage schema of an app. */\nexport interface AppStorageSchema {\n /** Restricts number of ints in per-user local state */\n localInts: number\n /** Restricts number of byte slices in per-user local state */\n localByteSlices: number\n /** Restricts number of ints in global state */\n globalInts: number\n /** Restricts number of byte slices in global state */\n globalByteSlices: number\n /** Any extra pages that are needed for the smart contract; if left blank then the right number of pages will be calculated based on the teal code size */\n extraPages?: number\n}\n\n/** Information about a compiled teal program */\nexport interface CompiledTeal {\n /** Original TEAL code */\n teal: string\n /** The compiled code */\n compiled: string\n /** The hash returned by the compiler */\n compiledHash: string\n /** The base64 encoded code as a byte array */\n compiledBase64ToBytes: Uint8Array\n /** Source map from the compilation */\n sourceMap: SourceMap\n}\n\nexport interface AppCallTransactionResultOfType<T> extends SendTransactionResults, SendTransactionResult {\n /** If an ABI method was called the processed return value */\n return?: T\n}\n\n/** Result from calling an app */\nexport type AppCallTransactionResult = AppCallTransactionResultOfType<ABIReturn>\n\n/**\n * The payload of the metadata to add to the transaction note when deploying an app, noting it will be prefixed with `APP_DEPLOY_NOTE_PREFIX`.\n */\nexport interface AppDeployMetadata {\n /** The unique name identifier of the app within the creator account */\n name: string\n /** The version of app that is / will be deployed */\n version: string\n /** Whether or not the app is deletable / permanent / unspecified */\n deletable?: boolean\n /** Whether or not the app is updatable / immutable / unspecified */\n updatable?: boolean\n}\n\n/** The metadata that can be collected about a deployed app */\nexport interface AppMetadata extends AppReference, AppDeployMetadata {\n /** The round the app was created */\n createdRound: number\n /** The last round that the app was updated */\n updatedRound: number\n /** The metadata when the app was created */\n createdMetadata: AppDeployMetadata\n /** Whether or not the app is deleted */\n deleted: boolean\n}\n\n/** A lookup of name -> Algorand app for a creator */\nexport interface AppLookup {\n creator: Readonly<string>\n apps: Readonly<{\n [name: string]: AppMetadata\n }>\n}\n\n/** Dictionary of deploy-time parameters to replace in a teal template.\n *\n * Note: Looks for `TMPL_{parameter}` for template replacements i.e. you can leave out the `TMPL_`.\n *\n */\nexport interface TealTemplateParams {\n [key: string]: string | bigint | number | Uint8Array\n}\n\n/** What action to perform when deploying an app and an update is detected in the TEAL code */\nexport enum OnUpdate {\n /** Fail the deployment */\n Fail,\n /** Update the app */\n UpdateApp,\n /** Delete the app and create a new one in its place */\n ReplaceApp,\n /** Create a new app */\n AppendApp,\n}\n\n/** What action to perform when deploying an app and a breaking schema change is detected */\nexport enum OnSchemaBreak {\n /** Fail the deployment */\n Fail,\n /** Delete the app and create a new one in its place */\n ReplaceApp,\n /** Create a new app */\n AppendApp,\n}\n\n/** The result of compiling the approval and clear state TEAL programs for an app */\nexport interface AppCompilationResult {\n /** The result of compiling the approval program */\n compiledApproval: CompiledTeal\n /** The result of compiling the clear state program */\n compiledClear: CompiledTeal\n}\n\nexport type AppReturn<TReturn> = {\n /** The ABI method call return value */\n return?: TReturn\n}\n\n/** Result from sending a single app transaction. */\nexport type SendAppTransactionResult = Expand<\n SendSingleTransactionResult & {\n /** If an ABI method was called the processed return value */\n return?: ABIReturn\n }\n>\n\n/** Result from sending a single app transaction. */\nexport type SendAppUpdateTransactionResult = Expand<SendAppTransactionResult & Partial<AppCompilationResult>>\n\n/** Result from sending a single app transaction. */\nexport type SendAppCreateTransactionResult = Expand<\n SendAppUpdateTransactionResult & {\n /** The id of the created app */\n appId: bigint\n /** The Algorand address of the account associated with the app */\n appAddress: Address\n }\n>\n\n/** Object holding app state values */\nexport interface AppState {\n [key: string]:\n | {\n value: bigint\n keyRaw: Uint8Array\n keyBase64: string\n }\n | {\n value: string\n valueRaw: Uint8Array\n valueBase64: string\n keyRaw: Uint8Array\n keyBase64: string\n }\n}\n\n/**\n * The name of a box storage box */\nexport interface BoxName {\n /** Name in UTF-8 */\n name: string\n /** Name in binary bytes */\n nameRaw: Uint8Array\n /** Name in Base64 */\n nameBase64: string\n}\n\n/**\n * @deprecated Use `types/app-manager/BoxValueRequestParams` instead.\n * Parameters to get and decode a box value as an ABI type.\n */\nexport interface BoxValueRequestParams {\n /** The ID of the app return box names for */\n appId: number | bigint\n /** The name of the box to return either as a string, binary array or `BoxName` */\n boxName: string | Uint8Array | BoxName\n /** The ABI type to decode the value using */\n type: ABIType\n}\n\n/**\n * @deprecated Use `types/app-manager/BoxValuesRequestParams` instead.\n * Parameters to get and decode a box value as an ABI type.\n */\nexport interface BoxValuesRequestParams {\n /** The ID of the app return box names for */\n appId: number\n /** The names of the boxes to return either as a string, binary array or BoxName` */\n boxNames: (string | Uint8Array | BoxName)[]\n /** The ABI type to decode the value using */\n type: ABIType\n}\n"],"mappings":";;AAoBA,MAAa,0BAA0B;;AAGvC,MAAa,0BAA0B;;AAGvC,MAAa,uBAAuB;;AAGpC,MAAa,oBAAoB;;AAGjC,MAAa,oBAAoB,IAAI,WAAW;CAAC;CAAI;CAAI;CAAK;CAAI,CAAC;;AAiKnE,IAAY,gDAAL;;AAEL;;AAEA;;AAEA;;AAEA;;;;AAIF,IAAY,0DAAL;;AAEL;;AAEA;;AAEA"}
|
|
1
|
+
{"version":3,"file":"app.mjs","names":[],"sources":["../../src/types/app.ts"],"sourcesContent":["import { ABIMethod, ABIReturn, ABIType, ABIValue } from '@algorandfoundation/algokit-abi'\nimport { SuggestedParams } from '@algorandfoundation/algokit-algod-client'\nimport { Address, Expand, ProgramSourceMap } from '@algorandfoundation/algokit-common'\nimport { OnApplicationComplete, BoxReference as TransactBoxReference, Transaction } from '@algorandfoundation/algokit-transact'\nimport { TransactionWithSigner } from '../transaction'\nimport { BoxIdentifier, BoxReference } from './app-manager'\nimport {\n SendSingleTransactionResult,\n SendTransactionFrom,\n SendTransactionParams,\n SendTransactionResult,\n SendTransactionResults,\n TransactionNote,\n TransactionToSign,\n} from './transaction'\ntype SourceMap = ProgramSourceMap\n\n/** The name of the TEAL template variable for deploy-time immutability control */\nexport const UPDATABLE_TEMPLATE_NAME = 'TMPL_UPDATABLE'\n\n/** The name of the TEAL template variable for deploy-time permanence control */\nexport const DELETABLE_TEMPLATE_NAME = 'TMPL_DELETABLE'\n\n/** The app create/update [ARC-2](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md) transaction note prefix */\nexport const APP_DEPLOY_NOTE_DAPP = 'ALGOKIT_DEPLOYER'\n\n/** The maximum number of bytes in a single app code page */\nexport const APP_PAGE_MAX_SIZE = 2048\n\n/** First 4 bytes of SHA-512/256 hash of \"return\" for retrieving ABI return values */\nexport const ABI_RETURN_PREFIX = new Uint8Array([21, 31, 124, 117])\n\n/** Information about an Algorand app */\nexport interface AppReference {\n /** The id of the app */\n appId: number | bigint\n /** The Algorand address of the account associated with the app */\n appAddress: string\n}\n\n/** Common app call arguments for ABI and non-ABI (raw) calls */\nexport interface CoreAppCallArgs {\n /** The optional lease for the transaction */\n lease?: string | Uint8Array\n /** Any box references to load */\n boxes?: (TransactBoxReference | BoxReference | BoxIdentifier)[]\n /** The address of any accounts to load in */\n accounts?: (string | Address)[]\n /** IDs of any apps to load into the foreignApps array */\n apps?: number[]\n /** IDs of any assets to load into the foreignAssets array */\n assets?: number[]\n /** Optional account / account address that should be authorised to transact on behalf of the from account the app call is sent from after this transaction.\n *\n * **Note:** Use with extreme caution and review the [official rekey guidance](https://dev.algorand.co/concepts/accounts/rekeying) first.\n */\n rekeyTo?: SendTransactionFrom | string\n}\n\n/**\n * App call args with non-ABI (raw) values (minus some processing like encoding strings as binary)\n */\nexport interface RawAppCallArgs extends CoreAppCallArgs {\n /** Any application arguments to pass through */\n appArgs?: (Uint8Array | string)[]\n /** Property to aid intellisense */\n method?: undefined\n}\n\n/** An argument for an ABI method, either a primitive value, or a transaction with or without signer, or the unawaited async return value of an algokit method that returns a `SendTransactionResult` */\nexport type ABIAppCallArg =\n | ABIValue\n | TransactionWithSigner\n | TransactionToSign\n | Transaction\n | Promise<SendTransactionResult>\n | SendTransactionResult\n | undefined\n\n/**\n * App call args for an ABI call\n */\nexport type ABIAppCallArgs = CoreAppCallArgs & {\n /** The ABI method to call */\n method: ABIMethod\n /** The ABI method args to pass in */\n methodArgs: ABIAppCallArg[]\n}\n\n/** Arguments to pass to an app call either:\n * * The raw app call values to pass through into the transaction (after processing); or\n * * An ABI method definition (method and args)\n **/\nexport type AppCallArgs = RawAppCallArgs | ABIAppCallArgs\n\n/** Parameters representing a call to an app. */\nexport interface AppCallParams extends SendTransactionParams {\n /** The id of the app to call */\n appId: number | bigint\n /** The type of call, everything except create (see `createApp`) and update (see `updateApp`) */\n callType: Exclude<OnApplicationComplete, OnApplicationComplete.UpdateApplication>\n /** The account to make the call from */\n from: SendTransactionFrom\n /** Optional transaction parameters */\n transactionParams?: SuggestedParams\n /** The (optional) transaction note */\n note?: TransactionNote\n /** The arguments passed in to the app call */\n args?: AppCallArgs\n}\n\n/** Parameters representing the storage schema of an app. */\nexport interface AppStorageSchema {\n /** Restricts number of ints in per-user local state */\n localInts: number\n /** Restricts number of byte slices in per-user local state */\n localByteSlices: number\n /** Restricts number of ints in global state */\n globalInts: number\n /** Restricts number of byte slices in global state */\n globalByteSlices: number\n /** Any extra pages that are needed for the smart contract; if left blank then the right number of pages will be calculated based on the teal code size */\n extraPages?: number\n}\n\n/** Information about a compiled teal program */\nexport interface CompiledTeal {\n /** Original TEAL code */\n teal: string\n /** The compiled code */\n compiled: string\n /** The hash returned by the compiler */\n compiledHash: string\n /** The base64 encoded code as a byte array */\n compiledBase64ToBytes: Uint8Array\n /** Source map from the compilation */\n sourceMap: SourceMap\n}\n\nexport interface AppCallTransactionResultOfType<T> extends SendTransactionResults, SendTransactionResult {\n /** If an ABI method was called the processed return value */\n return?: T\n}\n\n/** Result from calling an app */\nexport type AppCallTransactionResult = AppCallTransactionResultOfType<ABIReturn>\n\n/**\n * The payload of the metadata to add to the transaction note when deploying an app, noting it will be prefixed with `APP_DEPLOY_NOTE_PREFIX`.\n */\nexport interface AppDeployMetadata {\n /** The unique name identifier of the app within the creator account */\n name: string\n /** The version of app that is / will be deployed */\n version: string\n /** Whether or not the app is deletable / permanent / unspecified */\n deletable?: boolean\n /** Whether or not the app is updatable / immutable / unspecified */\n updatable?: boolean\n}\n\n/** The metadata that can be collected about a deployed app */\nexport interface AppMetadata extends AppReference, AppDeployMetadata {\n /** The round the app was created */\n createdRound: number\n /** The last round that the app was updated */\n updatedRound: number\n /** The metadata when the app was created */\n createdMetadata: AppDeployMetadata\n /** Whether or not the app is deleted */\n deleted: boolean\n}\n\n/** A lookup of name -> Algorand app for a creator */\nexport interface AppLookup {\n creator: Readonly<string>\n apps: Readonly<{\n [name: string]: AppMetadata\n }>\n}\n\n/** Dictionary of deploy-time parameters to replace in a teal template.\n *\n * Note: Looks for `TMPL_{parameter}` for template replacements i.e. you can leave out the `TMPL_`.\n *\n */\nexport interface TealTemplateParams {\n [key: string]: string | bigint | number | Uint8Array\n}\n\n/** What action to perform when deploying an app and an update is detected in the TEAL code */\nexport enum OnUpdate {\n /** Fail the deployment */\n Fail,\n /** Update the app */\n UpdateApp,\n /** Delete the app and create a new one in its place */\n ReplaceApp,\n /** Create a new app */\n AppendApp,\n}\n\n/** What action to perform when deploying an app and a breaking schema change is detected */\nexport enum OnSchemaBreak {\n /** Fail the deployment */\n Fail,\n /** Delete the app and create a new one in its place */\n ReplaceApp,\n /** Create a new app */\n AppendApp,\n}\n\n/** The result of compiling the approval and clear state TEAL programs for an app */\nexport interface AppCompilationResult {\n /** The result of compiling the approval program */\n compiledApproval: CompiledTeal\n /** The result of compiling the clear state program */\n compiledClear: CompiledTeal\n}\n\nexport type AppReturn<TReturn> = {\n /** The ABI method call return value */\n return?: TReturn\n}\n\n/** Result from sending a single app transaction. */\nexport type SendAppTransactionResult = Expand<\n SendSingleTransactionResult & {\n /** If an ABI method was called the processed return value */\n return?: ABIReturn\n }\n>\n\n/** Result from sending a single app transaction. */\nexport type SendAppUpdateTransactionResult = Expand<SendAppTransactionResult & Partial<AppCompilationResult>>\n\n/** Result from sending a single app transaction. */\nexport type SendAppCreateTransactionResult = Expand<\n SendAppUpdateTransactionResult & {\n /** The id of the created app */\n appId: bigint\n /** The Algorand address of the account associated with the app */\n appAddress: Address\n }\n>\n\n/** Object holding app state values */\nexport interface AppState {\n [key: string]:\n | {\n value: bigint\n keyRaw: Uint8Array\n keyBase64: string\n }\n | {\n value: string\n valueRaw: Uint8Array\n valueBase64: string\n keyRaw: Uint8Array\n keyBase64: string\n }\n}\n\n/**\n * The name of a box storage box */\nexport interface BoxName {\n /** Name in UTF-8 */\n name: string\n /** Name in binary bytes */\n nameRaw: Uint8Array\n /** Name in Base64 */\n nameBase64: string\n}\n\n/**\n * @deprecated Use `types/app-manager/BoxValueRequestParams` instead.\n * Parameters to get and decode a box value as an ABI type.\n */\nexport interface BoxValueRequestParams {\n /** The ID of the app return box names for */\n appId: number | bigint\n /** The name of the box to return either as a string, binary array or `BoxName` */\n boxName: string | Uint8Array | BoxName\n /** The ABI type to decode the value using */\n type: ABIType\n}\n\n/**\n * @deprecated Use `types/app-manager/BoxValuesRequestParams` instead.\n * Parameters to get and decode a box value as an ABI type.\n */\nexport interface BoxValuesRequestParams {\n /** The ID of the app return box names for */\n appId: number\n /** The names of the boxes to return either as a string, binary array or BoxName` */\n boxNames: (string | Uint8Array | BoxName)[]\n /** The ABI type to decode the value using */\n type: ABIType\n}\n"],"mappings":";;AAkBA,MAAa,0BAA0B;;AAGvC,MAAa,0BAA0B;;AAGvC,MAAa,uBAAuB;;AAGpC,MAAa,oBAAoB;;AAGjC,MAAa,oBAAoB,IAAI,WAAW;CAAC;CAAI;CAAI;CAAK;CAAI,CAAC;;AAiKnE,IAAY,gDAAL;;AAEL;;AAEA;;AAEA;;AAEA;;;;AAIF,IAAY,0DAAL;;AAEL;;AAEA;;AAEA"}
|
package/types/asset-manager.js
CHANGED
|
@@ -32,7 +32,7 @@ var AssetManager = class {
|
|
|
32
32
|
* @returns The asset information
|
|
33
33
|
*/
|
|
34
34
|
async getById(assetId) {
|
|
35
|
-
const asset = await this._algod.
|
|
35
|
+
const asset = await this._algod.assetById(assetId);
|
|
36
36
|
return {
|
|
37
37
|
assetId: BigInt(asset.id),
|
|
38
38
|
total: BigInt(asset.params.total),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-manager.js","names":["results: BulkAssetOptInOutResult[]","chunkArray","MAX_TRANSACTION_GROUP_SIZE","notOptedInAssetIds: bigint[]","nonZeroBalanceAssetIds: bigint[]"],"sources":["../../src/types/asset-manager.ts"],"sourcesContent":["import { AlgodClient } from '@algorandfoundation/algokit-algod-client'\nimport { Address, MAX_TRANSACTION_GROUP_SIZE } from '@algorandfoundation/algokit-common'\nimport { Config } from '../config'\nimport { chunkArray } from '../util'\nimport { AccountAssetInformation } from './account'\nimport { CommonTransactionParams, TransactionComposer, TransactionComposerConfig } from './composer'\nimport { SendParams } from './transaction'\n\n/** Individual result from performing a bulk opt-in or bulk opt-out for an account against a series of assets. */\nexport interface BulkAssetOptInOutResult {\n /** The ID of the asset opted into / out of */\n assetId: bigint\n /** The transaction ID of the resulting opt in / out */\n transactionId: string\n}\n\n/** Information about an asset. */\nexport interface AssetInformation {\n /** The ID of the asset. */\n assetId: bigint\n\n /** The address of the account that created the asset.\n *\n * This is the address where the parameters for this asset can be found,\n * and also the address where unwanted asset units can be sent when\n * closing out an asset position and opting-out of the asset.\n */\n creator: string\n\n /** The total amount of the smallest divisible (decimal) units that were created of the asset.\n *\n * For example, if `decimals` is, say, 2, then for every 100 `total` there is 1 whole unit.\n */\n total: bigint\n\n /** The amount of decimal places the asset was created with.\n *\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 * * and so on up to 19 decimal places.\n */\n decimals: number\n\n /** Whether the asset was frozen by default for all accounts.\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.\n */\n defaultFrozen?: boolean\n\n /** The address of the optional account that can manage the configuration of the asset and destroy it.\n *\n * If not set the asset is permanently immutable.\n */\n manager?: string\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 the field is permanently empty.\n */\n reserve?: string\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 the field is permanently empty.\n */\n freeze?: string\n\n /**\n * The address of the optional account that can clawback holdings of this asset from any account.\n *\n * 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 the field is permanently empty.\n */\n clawback?: string\n\n /** The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n */\n unitName?: string\n\n /** The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n */\n unitNameAsBytes?: Uint8Array\n\n /** The optional name of the asset.\n *\n * Max size is 32 bytes.\n */\n assetName?: string\n\n /** The optional name of the asset.\n *\n * Max size is 32 bytes.\n */\n assetNameAsBytes?: Uint8Array\n\n /** Optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n */\n url?: string\n\n /** Optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n */\n urlAsBytes?: Uint8Array\n\n /** 32-byte hash of some metadata that is relevant to the asset and/or asset holders.\n *\n * The format of this metadata is up to the application.\n */\n metadataHash?: Uint8Array\n}\n\n/** Allows management of asset information. */\nexport class AssetManager {\n private _algod: AlgodClient\n private _newGroup: () => TransactionComposer\n\n /**\n * Create a new asset manager.\n * @param algod An algod client\n * @param newGroup A function that creates a new `TransactionComposer` transaction group\n * @example Create a new asset manager\n * ```typescript\n * const assetManager = new AssetManager(algod, () => new TransactionComposer({algod, () => signer, () => suggestedParams}))\n * ```\n */\n constructor(algod: AlgodClient, newGroup: (config?: TransactionComposerConfig) => TransactionComposer) {\n this._algod = algod\n this._newGroup = newGroup\n }\n\n /**\n * Returns the current asset information for the asset with the given ID.\n *\n * @example\n * ```typescript\n * const assetInfo = await assetManager.getById(12353n);\n * ```\n *\n * @param assetId The ID of the asset\n * @returns The asset information\n */\n public async getById(assetId: bigint): Promise<AssetInformation> {\n const asset = await this._algod.getAssetById(assetId)\n\n return {\n assetId: BigInt(asset.id),\n total: BigInt(asset.params.total),\n decimals: Number(asset.params.decimals),\n assetName: asset.params.name,\n assetNameAsBytes: asset.params.nameB64,\n unitName: asset.params.unitName,\n unitNameAsBytes: asset.params.unitNameB64,\n url: asset.params.url,\n urlAsBytes: asset.params.urlB64,\n creator: asset.params.creator,\n manager: asset.params.manager,\n clawback: asset.params.clawback,\n freeze: asset.params.freeze,\n reserve: asset.params.reserve,\n defaultFrozen: asset.params.defaultFrozen,\n metadataHash: asset.params.metadataHash,\n }\n }\n\n /**\n * Returns the given sender account's asset holding for a given asset.\n *\n * @example\n * ```typescript\n * const address = \"XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA\";\n * const assetId = 123345n;\n * const accountInfo = await assetManager.getAccountInformation(address, assetId);\n * ```\n *\n * [Response data schema details](https://dev.algorand.co/reference/rest-apis/algod/#accountassetinformation)\n * @param sender The address of the sender/account to look up\n * @param assetId The ID of the asset to return a holding for\n * @returns The account asset holding information\n */\n public async getAccountInformation(sender: string | Address, assetId: bigint): Promise<AccountAssetInformation> {\n const info = await this._algod.accountAssetInformation(sender.toString(), assetId)\n\n return {\n assetId: BigInt(assetId),\n balance: BigInt(info.assetHolding?.amount ?? 0),\n frozen: info.assetHolding?.isFrozen === true,\n round: BigInt(info['round']),\n }\n }\n\n /**\n * Opt an account in to a list of Algorand Standard Assets.\n *\n * Transactions will be sent in batches of 16 as transaction groups.\n *\n * @param account The account to opt-in\n * @param assetIds The list of asset IDs to opt-in to\n * @param options Any parameters to control the transaction or execution of the transaction\n * @example Example using AlgorandClient\n * ```typescript\n * // Basic example\n * assetManager.bulkOptIn(\"ACCOUNTADDRESS\", [12345n, 67890n])\n * // With configuration\n * assetManager.bulkOptIn(\"ACCOUNTADDRESS\", [12345n, 67890n], { maxFee: (1000).microAlgo(), suppressLog: true })\n * ```\n * @returns An array of records matching asset ID to transaction ID of the opt in\n */\n async bulkOptIn(\n account: string | Address,\n assetIds: bigint[],\n options?: Omit<CommonTransactionParams, 'sender'> & SendParams,\n ): Promise<BulkAssetOptInOutResult[]> {\n const results: BulkAssetOptInOutResult[] = []\n\n for (const assetGroup of chunkArray(assetIds, MAX_TRANSACTION_GROUP_SIZE)) {\n const composer = this._newGroup()\n\n for (const assetId of assetGroup) {\n composer.addAssetOptIn({\n ...options,\n sender: account,\n assetId: BigInt(assetId),\n })\n }\n\n const result = await composer.send(options)\n\n Config.getLogger(options?.suppressLog).info(\n `Successfully opted in ${account} for assets ${assetGroup.join(', ')} with transaction IDs ${result.txIds.join(', ')}` +\n `\\n Grouped under ${result.groupId} in round ${result.confirmations?.[0]?.confirmedRound}.`,\n )\n\n assetGroup.forEach((assetId, index) => {\n results.push({ assetId: BigInt(assetId), transactionId: result.txIds[index] })\n })\n }\n\n return results\n }\n\n /**\n * Opt an account out of a list of Algorand Standard Assets.\n *\n * Transactions will be sent in batches of 16 as transaction groups.\n *\n * @param account The account to opt-in\n * @param assetIds The list of asset IDs to opt-out of\n * @param options Any parameters to control the transaction or execution of the transaction\n * @example Example using AlgorandClient\n * ```typescript\n * // Basic example\n * assetManager.bulkOptOut(\"ACCOUNTADDRESS\", [12345n, 67890n])\n * // With configuration\n * assetManager.bulkOptOut(\"ACCOUNTADDRESS\", [12345n, 67890n], { ensureZeroBalance: true, maxFee: (1000).microAlgo(), suppressLog: true })\n * ```\n * @returns An array of records matching asset ID to transaction ID of the opt in\n */\n async bulkOptOut(\n account: string | Address,\n assetIds: bigint[],\n options?: Omit<CommonTransactionParams, 'sender'> &\n SendParams & {\n /** Whether or not to check if the account has a zero balance for each asset first or not.\n *\n * Defaults to `true`.\n *\n * If this is set to `true` and the account has an asset balance it will throw an error.\n *\n * If this is set to `false` and the account has an asset balance it will lose those assets to the asset creator.\n */\n ensureZeroBalance?: boolean\n },\n ): Promise<BulkAssetOptInOutResult[]> {\n const results: BulkAssetOptInOutResult[] = []\n\n for (const assetGroup of chunkArray(assetIds, MAX_TRANSACTION_GROUP_SIZE)) {\n const composer = this._newGroup()\n\n const notOptedInAssetIds: bigint[] = []\n const nonZeroBalanceAssetIds: bigint[] = []\n for (const assetId of assetGroup) {\n if (options?.ensureZeroBalance !== false) {\n try {\n const accountAssetInfo = await this.getAccountInformation(account, assetId)\n if (accountAssetInfo.balance !== 0n) {\n nonZeroBalanceAssetIds.push(BigInt(assetId))\n }\n } catch {\n notOptedInAssetIds.push(BigInt(assetId))\n }\n }\n }\n\n if (notOptedInAssetIds.length > 0 || nonZeroBalanceAssetIds.length > 0) {\n throw new Error(\n `Account ${account}${notOptedInAssetIds.length > 0 ? ` is not opted-in to Asset${notOptedInAssetIds.length > 1 ? 's' : ''} ${notOptedInAssetIds.join(', ')}` : ''}${\n nonZeroBalanceAssetIds.length > 0\n ? ` has non-zero balance for Asset${nonZeroBalanceAssetIds.length > 1 ? 's' : ''} ${nonZeroBalanceAssetIds.join(', ')}`\n : ''\n }; can't opt-out.`,\n )\n }\n\n for (const assetId of assetGroup) {\n composer.addAssetOptOut({\n ...options,\n creator: (await this.getById(BigInt(assetId))).creator,\n sender: account,\n assetId: BigInt(assetId),\n })\n }\n\n const result = await composer.send(options)\n\n Config.getLogger(options?.suppressLog).info(\n `Successfully opted ${account} out of assets ${assetGroup.join(', ')} with transaction IDs ${result.txIds.join(', ')}` +\n `\\n Grouped under ${result.groupId} in round ${result.confirmations?.[0]?.confirmedRound}.`,\n )\n\n assetGroup.forEach((assetId, index) => {\n results.push({ assetId: BigInt(assetId), transactionId: result.txIds[index] })\n })\n }\n\n return results\n }\n}\n"],"mappings":";;;;;;AA0IA,IAAa,eAAb,MAA0B;CACxB,AAAQ;CACR,AAAQ;;;;;;;;;;CAWR,YAAY,OAAoB,UAAuE;AACrG,OAAK,SAAS;AACd,OAAK,YAAY;;;;;;;;;;;;;CAcnB,MAAa,QAAQ,SAA4C;EAC/D,MAAM,QAAQ,MAAM,KAAK,OAAO,aAAa,QAAQ;AAErD,SAAO;GACL,SAAS,OAAO,MAAM,GAAG;GACzB,OAAO,OAAO,MAAM,OAAO,MAAM;GACjC,UAAU,OAAO,MAAM,OAAO,SAAS;GACvC,WAAW,MAAM,OAAO;GACxB,kBAAkB,MAAM,OAAO;GAC/B,UAAU,MAAM,OAAO;GACvB,iBAAiB,MAAM,OAAO;GAC9B,KAAK,MAAM,OAAO;GAClB,YAAY,MAAM,OAAO;GACzB,SAAS,MAAM,OA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W;GAEjC,MAAMC,qBAA+B,EAAE;GACvC,MAAMC,yBAAmC,EAAE;AAC3C,QAAK,MAAM,WAAW,WACpB,KAAI,SAAS,sBAAsB,MACjC,KAAI;AAEF,SADyB,MAAM,KAAK,sBAAsB,SAAS,QAAQ,EACtD,YAAY,GAC/B,wBAAuB,KAAK,OAAO,QAAQ,CAAC;WAExC;AACN,uBAAmB,KAAK,OAAO,QAAQ,CAAC;;AAK9C,OAAI,mBAAmB,SAAS,KAAK,uBAAuB,SAAS,EACnE,OAAM,IAAI,MACR,WAAW,UAAU,mBAAmB,SAAS,IAAI,4BAA4B,mBAAmB,SAAS,IAAI,MAAM,GAAG,GAAG,mBAAmB,KAAK,KAAK,KAAK,KAC7J,uBAAuB,SAAS,IAC5B,kCAAkC,uBAAuB,SAAS,IAAI,MAAM,GAAG,GAAG,uBAAuB,KAAK,KAAK,KACnH,GACL,kBACF;AAGH,QAAK,MAAM,WAAW,WACpB,UAAS,eAAe;IACtB,GAAG;IACH,UAAU,MAAM,KAAK,QAAQ,OAAO,QAAQ,CAAC,EAAE;IAC/C,QAAQ;IACR,SAAS,OAAO,QAAQ;IACzB,CAAC;GAGJ,MAAM,SAAS,MAAM,SAAS,KAAK,QAAQ;AAE3C,yBAAO,UAAU,SAAS,YAAY,CAAC,KACrC,sBAAsB,QAAQ,iBAAiB,WAAW,KAAK,KAAK,CAAC,wBAAwB,OAAO,MAAM,KAAK,KAAK,qBAC7F,OAAO,QAAQ,YAAY,OAAO,gBAAgB,IAAI,eAAe,GAC7F;AAED,cAAW,SAAS,SAAS,UAAU;AACrC,YAAQ,KAAK;KAAE,SAAS,OAAO,QAAQ;KAAE,eAAe,OAAO,MAAM;KAAQ,CAAC;KAC9E;;AAGJ,SAAO"}
|
|
1
|
+
{"version":3,"file":"asset-manager.js","names":["results: BulkAssetOptInOutResult[]","chunkArray","MAX_TRANSACTION_GROUP_SIZE","notOptedInAssetIds: bigint[]","nonZeroBalanceAssetIds: bigint[]"],"sources":["../../src/types/asset-manager.ts"],"sourcesContent":["import { AlgodClient } from '@algorandfoundation/algokit-algod-client'\nimport { Address, MAX_TRANSACTION_GROUP_SIZE } from '@algorandfoundation/algokit-common'\nimport { Config } from '../config'\nimport { chunkArray } from '../util'\nimport { AccountAssetInformation } from './account'\nimport { CommonTransactionParams, TransactionComposer, TransactionComposerConfig } from './composer'\nimport { SendParams } from './transaction'\n\n/** Individual result from performing a bulk opt-in or bulk opt-out for an account against a series of assets. */\nexport interface BulkAssetOptInOutResult {\n /** The ID of the asset opted into / out of */\n assetId: bigint\n /** The transaction ID of the resulting opt in / out */\n transactionId: string\n}\n\n/** Information about an asset. */\nexport interface AssetInformation {\n /** The ID of the asset. */\n assetId: bigint\n\n /** The address of the account that created the asset.\n *\n * This is the address where the parameters for this asset can be found,\n * and also the address where unwanted asset units can be sent when\n * closing out an asset position and opting-out of the asset.\n */\n creator: string\n\n /** The total amount of the smallest divisible (decimal) units that were created of the asset.\n *\n * For example, if `decimals` is, say, 2, then for every 100 `total` there is 1 whole unit.\n */\n total: bigint\n\n /** The amount of decimal places the asset was created with.\n *\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 * * and so on up to 19 decimal places.\n */\n decimals: number\n\n /** Whether the asset was frozen by default for all accounts.\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.\n */\n defaultFrozen?: boolean\n\n /** The address of the optional account that can manage the configuration of the asset and destroy it.\n *\n * If not set the asset is permanently immutable.\n */\n manager?: string\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 the field is permanently empty.\n */\n reserve?: string\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 the field is permanently empty.\n */\n freeze?: string\n\n /**\n * The address of the optional account that can clawback holdings of this asset from any account.\n *\n * 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 the field is permanently empty.\n */\n clawback?: string\n\n /** The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n */\n unitName?: string\n\n /** The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n */\n unitNameAsBytes?: Uint8Array\n\n /** The optional name of the asset.\n *\n * Max size is 32 bytes.\n */\n assetName?: string\n\n /** The optional name of the asset.\n *\n * Max size is 32 bytes.\n */\n assetNameAsBytes?: Uint8Array\n\n /** Optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n */\n url?: string\n\n /** Optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n */\n urlAsBytes?: Uint8Array\n\n /** 32-byte hash of some metadata that is relevant to the asset and/or asset holders.\n *\n * The format of this metadata is up to the application.\n */\n metadataHash?: Uint8Array\n}\n\n/** Allows management of asset information. */\nexport class AssetManager {\n private _algod: AlgodClient\n private _newGroup: () => TransactionComposer\n\n /**\n * Create a new asset manager.\n * @param algod An algod client\n * @param newGroup A function that creates a new `TransactionComposer` transaction group\n * @example Create a new asset manager\n * ```typescript\n * const assetManager = new AssetManager(algod, () => new TransactionComposer({algod, () => signer, () => suggestedParams}))\n * ```\n */\n constructor(algod: AlgodClient, newGroup: (config?: TransactionComposerConfig) => TransactionComposer) {\n this._algod = algod\n this._newGroup = newGroup\n }\n\n /**\n * Returns the current asset information for the asset with the given ID.\n *\n * @example\n * ```typescript\n * const assetInfo = await assetManager.getById(12353n);\n * ```\n *\n * @param assetId The ID of the asset\n * @returns The asset information\n */\n public async getById(assetId: bigint): Promise<AssetInformation> {\n const asset = await this._algod.assetById(assetId)\n\n return {\n assetId: BigInt(asset.id),\n total: BigInt(asset.params.total),\n decimals: Number(asset.params.decimals),\n assetName: asset.params.name,\n assetNameAsBytes: asset.params.nameB64,\n unitName: asset.params.unitName,\n unitNameAsBytes: asset.params.unitNameB64,\n url: asset.params.url,\n urlAsBytes: asset.params.urlB64,\n creator: asset.params.creator,\n manager: asset.params.manager,\n clawback: asset.params.clawback,\n freeze: asset.params.freeze,\n reserve: asset.params.reserve,\n defaultFrozen: asset.params.defaultFrozen,\n metadataHash: asset.params.metadataHash,\n }\n }\n\n /**\n * Returns the given sender account's asset holding for a given asset.\n *\n * @example\n * ```typescript\n * const address = \"XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA\";\n * const assetId = 123345n;\n * const accountInfo = await assetManager.getAccountInformation(address, assetId);\n * ```\n *\n * [Response data schema details](https://dev.algorand.co/reference/rest-apis/algod/#accountassetinformation)\n * @param sender The address of the sender/account to look up\n * @param assetId The ID of the asset to return a holding for\n * @returns The account asset holding information\n */\n public async getAccountInformation(sender: string | Address, assetId: bigint): Promise<AccountAssetInformation> {\n const info = await this._algod.accountAssetInformation(sender.toString(), assetId)\n\n return {\n assetId: BigInt(assetId),\n balance: BigInt(info.assetHolding?.amount ?? 0),\n frozen: info.assetHolding?.isFrozen === true,\n round: BigInt(info['round']),\n }\n }\n\n /**\n * Opt an account in to a list of Algorand Standard Assets.\n *\n * Transactions will be sent in batches of 16 as transaction groups.\n *\n * @param account The account to opt-in\n * @param assetIds The list of asset IDs to opt-in to\n * @param options Any parameters to control the transaction or execution of the transaction\n * @example Example using AlgorandClient\n * ```typescript\n * // Basic example\n * assetManager.bulkOptIn(\"ACCOUNTADDRESS\", [12345n, 67890n])\n * // With configuration\n * assetManager.bulkOptIn(\"ACCOUNTADDRESS\", [12345n, 67890n], { maxFee: (1000).microAlgo(), suppressLog: true })\n * ```\n * @returns An array of records matching asset ID to transaction ID of the opt in\n */\n async bulkOptIn(\n account: string | Address,\n assetIds: bigint[],\n options?: Omit<CommonTransactionParams, 'sender'> & SendParams,\n ): Promise<BulkAssetOptInOutResult[]> {\n const results: BulkAssetOptInOutResult[] = []\n\n for (const assetGroup of chunkArray(assetIds, MAX_TRANSACTION_GROUP_SIZE)) {\n const composer = this._newGroup()\n\n for (const assetId of assetGroup) {\n composer.addAssetOptIn({\n ...options,\n sender: account,\n assetId: BigInt(assetId),\n })\n }\n\n const result = await composer.send(options)\n\n Config.getLogger(options?.suppressLog).info(\n `Successfully opted in ${account} for assets ${assetGroup.join(', ')} with transaction IDs ${result.txIds.join(', ')}` +\n `\\n Grouped under ${result.groupId} in round ${result.confirmations?.[0]?.confirmedRound}.`,\n )\n\n assetGroup.forEach((assetId, index) => {\n results.push({ assetId: BigInt(assetId), transactionId: result.txIds[index] })\n })\n }\n\n return results\n }\n\n /**\n * Opt an account out of a list of Algorand Standard Assets.\n *\n * Transactions will be sent in batches of 16 as transaction groups.\n *\n * @param account The account to opt-in\n * @param assetIds The list of asset IDs to opt-out of\n * @param options Any parameters to control the transaction or execution of the transaction\n * @example Example using AlgorandClient\n * ```typescript\n * // Basic example\n * assetManager.bulkOptOut(\"ACCOUNTADDRESS\", [12345n, 67890n])\n * // With configuration\n * assetManager.bulkOptOut(\"ACCOUNTADDRESS\", [12345n, 67890n], { ensureZeroBalance: true, maxFee: (1000).microAlgo(), suppressLog: true })\n * ```\n * @returns An array of records matching asset ID to transaction ID of the opt in\n */\n async bulkOptOut(\n account: string | Address,\n assetIds: bigint[],\n options?: Omit<CommonTransactionParams, 'sender'> &\n SendParams & {\n /** Whether or not to check if the account has a zero balance for each asset first or not.\n *\n * Defaults to `true`.\n *\n * If this is set to `true` and the account has an asset balance it will throw an error.\n *\n * If this is set to `false` and the account has an asset balance it will lose those assets to the asset creator.\n */\n ensureZeroBalance?: boolean\n },\n ): Promise<BulkAssetOptInOutResult[]> {\n const results: BulkAssetOptInOutResult[] = []\n\n for (const assetGroup of chunkArray(assetIds, MAX_TRANSACTION_GROUP_SIZE)) {\n const composer = this._newGroup()\n\n const notOptedInAssetIds: bigint[] = []\n const nonZeroBalanceAssetIds: bigint[] = []\n for (const assetId of assetGroup) {\n if (options?.ensureZeroBalance !== false) {\n try {\n const accountAssetInfo = await this.getAccountInformation(account, assetId)\n if (accountAssetInfo.balance !== 0n) {\n nonZeroBalanceAssetIds.push(BigInt(assetId))\n }\n } catch {\n notOptedInAssetIds.push(BigInt(assetId))\n }\n }\n }\n\n if (notOptedInAssetIds.length > 0 || nonZeroBalanceAssetIds.length > 0) {\n throw new Error(\n `Account ${account}${notOptedInAssetIds.length > 0 ? ` is not opted-in to Asset${notOptedInAssetIds.length > 1 ? 's' : ''} ${notOptedInAssetIds.join(', ')}` : ''}${\n nonZeroBalanceAssetIds.length > 0\n ? ` has non-zero balance for Asset${nonZeroBalanceAssetIds.length > 1 ? 's' : ''} ${nonZeroBalanceAssetIds.join(', ')}`\n : ''\n }; can't opt-out.`,\n )\n }\n\n for (const assetId of assetGroup) {\n composer.addAssetOptOut({\n ...options,\n creator: (await this.getById(BigInt(assetId))).creator,\n sender: account,\n assetId: BigInt(assetId),\n })\n }\n\n const result = await composer.send(options)\n\n Config.getLogger(options?.suppressLog).info(\n `Successfully opted ${account} out of assets ${assetGroup.join(', ')} with transaction IDs ${result.txIds.join(', ')}` +\n `\\n Grouped under ${result.groupId} in round ${result.confirmations?.[0]?.confirmedRound}.`,\n )\n\n assetGroup.forEach((assetId, index) => {\n results.push({ assetId: BigInt(assetId), transactionId: result.txIds[index] })\n })\n }\n\n return results\n }\n}\n"],"mappings":";;;;;;AA0IA,IAAa,eAAb,MAA0B;CACxB,AAAQ;CACR,AAAQ;;;;;;;;;;CAWR,YAAY,OAAoB,UAAuE;AACrG,OAAK,SAAS;AACd,OAAK,YAAY;;;;;;;;;;;;;CAcnB,MAAa,QAAQ,SAA4C;EAC/D,MA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Q,YAAY,OAAO,gBAAgB,IAAI,eAAe,GAC7F;AAED,cAAW,SAAS,SAAS,UAAU;AACrC,YAAQ,KAAK;KAAE,SAAS,OAAO,QAAQ;KAAE,eAAe,OAAO,MAAM;KAAQ,CAAC;KAC9E;;AAGJ,SAAO"}
|
package/types/asset-manager.mjs
CHANGED
|
@@ -32,7 +32,7 @@ var AssetManager = class {
|
|
|
32
32
|
* @returns The asset information
|
|
33
33
|
*/
|
|
34
34
|
async getById(assetId) {
|
|
35
|
-
const asset = await this._algod.
|
|
35
|
+
const asset = await this._algod.assetById(assetId);
|
|
36
36
|
return {
|
|
37
37
|
assetId: BigInt(asset.id),
|
|
38
38
|
total: BigInt(asset.params.total),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-manager.mjs","names":["results: BulkAssetOptInOutResult[]","notOptedInAssetIds: bigint[]","nonZeroBalanceAssetIds: bigint[]"],"sources":["../../src/types/asset-manager.ts"],"sourcesContent":["import { AlgodClient } from '@algorandfoundation/algokit-algod-client'\nimport { Address, MAX_TRANSACTION_GROUP_SIZE } from '@algorandfoundation/algokit-common'\nimport { Config } from '../config'\nimport { chunkArray } from '../util'\nimport { AccountAssetInformation } from './account'\nimport { CommonTransactionParams, TransactionComposer, TransactionComposerConfig } from './composer'\nimport { SendParams } from './transaction'\n\n/** Individual result from performing a bulk opt-in or bulk opt-out for an account against a series of assets. */\nexport interface BulkAssetOptInOutResult {\n /** The ID of the asset opted into / out of */\n assetId: bigint\n /** The transaction ID of the resulting opt in / out */\n transactionId: string\n}\n\n/** Information about an asset. */\nexport interface AssetInformation {\n /** The ID of the asset. */\n assetId: bigint\n\n /** The address of the account that created the asset.\n *\n * This is the address where the parameters for this asset can be found,\n * and also the address where unwanted asset units can be sent when\n * closing out an asset position and opting-out of the asset.\n */\n creator: string\n\n /** The total amount of the smallest divisible (decimal) units that were created of the asset.\n *\n * For example, if `decimals` is, say, 2, then for every 100 `total` there is 1 whole unit.\n */\n total: bigint\n\n /** The amount of decimal places the asset was created with.\n *\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 * * and so on up to 19 decimal places.\n */\n decimals: number\n\n /** Whether the asset was frozen by default for all accounts.\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.\n */\n defaultFrozen?: boolean\n\n /** The address of the optional account that can manage the configuration of the asset and destroy it.\n *\n * If not set the asset is permanently immutable.\n */\n manager?: string\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 the field is permanently empty.\n */\n reserve?: string\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 the field is permanently empty.\n */\n freeze?: string\n\n /**\n * The address of the optional account that can clawback holdings of this asset from any account.\n *\n * 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 the field is permanently empty.\n */\n clawback?: string\n\n /** The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n */\n unitName?: string\n\n /** The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n */\n unitNameAsBytes?: Uint8Array\n\n /** The optional name of the asset.\n *\n * Max size is 32 bytes.\n */\n assetName?: string\n\n /** The optional name of the asset.\n *\n * Max size is 32 bytes.\n */\n assetNameAsBytes?: Uint8Array\n\n /** Optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n */\n url?: string\n\n /** Optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n */\n urlAsBytes?: Uint8Array\n\n /** 32-byte hash of some metadata that is relevant to the asset and/or asset holders.\n *\n * The format of this metadata is up to the application.\n */\n metadataHash?: Uint8Array\n}\n\n/** Allows management of asset information. */\nexport class AssetManager {\n private _algod: AlgodClient\n private _newGroup: () => TransactionComposer\n\n /**\n * Create a new asset manager.\n * @param algod An algod client\n * @param newGroup A function that creates a new `TransactionComposer` transaction group\n * @example Create a new asset manager\n * ```typescript\n * const assetManager = new AssetManager(algod, () => new TransactionComposer({algod, () => signer, () => suggestedParams}))\n * ```\n */\n constructor(algod: AlgodClient, newGroup: (config?: TransactionComposerConfig) => TransactionComposer) {\n this._algod = algod\n this._newGroup = newGroup\n }\n\n /**\n * Returns the current asset information for the asset with the given ID.\n *\n * @example\n * ```typescript\n * const assetInfo = await assetManager.getById(12353n);\n * ```\n *\n * @param assetId The ID of the asset\n * @returns The asset information\n */\n public async getById(assetId: bigint): Promise<AssetInformation> {\n const asset = await this._algod.getAssetById(assetId)\n\n return {\n assetId: BigInt(asset.id),\n total: BigInt(asset.params.total),\n decimals: Number(asset.params.decimals),\n assetName: asset.params.name,\n assetNameAsBytes: asset.params.nameB64,\n unitName: asset.params.unitName,\n unitNameAsBytes: asset.params.unitNameB64,\n url: asset.params.url,\n urlAsBytes: asset.params.urlB64,\n creator: asset.params.creator,\n manager: asset.params.manager,\n clawback: asset.params.clawback,\n freeze: asset.params.freeze,\n reserve: asset.params.reserve,\n defaultFrozen: asset.params.defaultFrozen,\n metadataHash: asset.params.metadataHash,\n }\n }\n\n /**\n * Returns the given sender account's asset holding for a given asset.\n *\n * @example\n * ```typescript\n * const address = \"XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA\";\n * const assetId = 123345n;\n * const accountInfo = await assetManager.getAccountInformation(address, assetId);\n * ```\n *\n * [Response data schema details](https://dev.algorand.co/reference/rest-apis/algod/#accountassetinformation)\n * @param sender The address of the sender/account to look up\n * @param assetId The ID of the asset to return a holding for\n * @returns The account asset holding information\n */\n public async getAccountInformation(sender: string | Address, assetId: bigint): Promise<AccountAssetInformation> {\n const info = await this._algod.accountAssetInformation(sender.toString(), assetId)\n\n return {\n assetId: BigInt(assetId),\n balance: BigInt(info.assetHolding?.amount ?? 0),\n frozen: info.assetHolding?.isFrozen === true,\n round: BigInt(info['round']),\n }\n }\n\n /**\n * Opt an account in to a list of Algorand Standard Assets.\n *\n * Transactions will be sent in batches of 16 as transaction groups.\n *\n * @param account The account to opt-in\n * @param assetIds The list of asset IDs to opt-in to\n * @param options Any parameters to control the transaction or execution of the transaction\n * @example Example using AlgorandClient\n * ```typescript\n * // Basic example\n * assetManager.bulkOptIn(\"ACCOUNTADDRESS\", [12345n, 67890n])\n * // With configuration\n * assetManager.bulkOptIn(\"ACCOUNTADDRESS\", [12345n, 67890n], { maxFee: (1000).microAlgo(), suppressLog: true })\n * ```\n * @returns An array of records matching asset ID to transaction ID of the opt in\n */\n async bulkOptIn(\n account: string | Address,\n assetIds: bigint[],\n options?: Omit<CommonTransactionParams, 'sender'> & SendParams,\n ): Promise<BulkAssetOptInOutResult[]> {\n const results: BulkAssetOptInOutResult[] = []\n\n for (const assetGroup of chunkArray(assetIds, MAX_TRANSACTION_GROUP_SIZE)) {\n const composer = this._newGroup()\n\n for (const assetId of assetGroup) {\n composer.addAssetOptIn({\n ...options,\n sender: account,\n assetId: BigInt(assetId),\n })\n }\n\n const result = await composer.send(options)\n\n Config.getLogger(options?.suppressLog).info(\n `Successfully opted in ${account} for assets ${assetGroup.join(', ')} with transaction IDs ${result.txIds.join(', ')}` +\n `\\n Grouped under ${result.groupId} in round ${result.confirmations?.[0]?.confirmedRound}.`,\n )\n\n assetGroup.forEach((assetId, index) => {\n results.push({ assetId: BigInt(assetId), transactionId: result.txIds[index] })\n })\n }\n\n return results\n }\n\n /**\n * Opt an account out of a list of Algorand Standard Assets.\n *\n * Transactions will be sent in batches of 16 as transaction groups.\n *\n * @param account The account to opt-in\n * @param assetIds The list of asset IDs to opt-out of\n * @param options Any parameters to control the transaction or execution of the transaction\n * @example Example using AlgorandClient\n * ```typescript\n * // Basic example\n * assetManager.bulkOptOut(\"ACCOUNTADDRESS\", [12345n, 67890n])\n * // With configuration\n * assetManager.bulkOptOut(\"ACCOUNTADDRESS\", [12345n, 67890n], { ensureZeroBalance: true, maxFee: (1000).microAlgo(), suppressLog: true })\n * ```\n * @returns An array of records matching asset ID to transaction ID of the opt in\n */\n async bulkOptOut(\n account: string | Address,\n assetIds: bigint[],\n options?: Omit<CommonTransactionParams, 'sender'> &\n SendParams & {\n /** Whether or not to check if the account has a zero balance for each asset first or not.\n *\n * Defaults to `true`.\n *\n * If this is set to `true` and the account has an asset balance it will throw an error.\n *\n * If this is set to `false` and the account has an asset balance it will lose those assets to the asset creator.\n */\n ensureZeroBalance?: boolean\n },\n ): Promise<BulkAssetOptInOutResult[]> {\n const results: BulkAssetOptInOutResult[] = []\n\n for (const assetGroup of chunkArray(assetIds, MAX_TRANSACTION_GROUP_SIZE)) {\n const composer = this._newGroup()\n\n const notOptedInAssetIds: bigint[] = []\n const nonZeroBalanceAssetIds: bigint[] = []\n for (const assetId of assetGroup) {\n if (options?.ensureZeroBalance !== false) {\n try {\n const accountAssetInfo = await this.getAccountInformation(account, assetId)\n if (accountAssetInfo.balance !== 0n) {\n nonZeroBalanceAssetIds.push(BigInt(assetId))\n }\n } catch {\n notOptedInAssetIds.push(BigInt(assetId))\n }\n }\n }\n\n if (notOptedInAssetIds.length > 0 || nonZeroBalanceAssetIds.length > 0) {\n throw new Error(\n `Account ${account}${notOptedInAssetIds.length > 0 ? ` is not opted-in to Asset${notOptedInAssetIds.length > 1 ? 's' : ''} ${notOptedInAssetIds.join(', ')}` : ''}${\n nonZeroBalanceAssetIds.length > 0\n ? ` has non-zero balance for Asset${nonZeroBalanceAssetIds.length > 1 ? 's' : ''} ${nonZeroBalanceAssetIds.join(', ')}`\n : ''\n }; can't opt-out.`,\n )\n }\n\n for (const assetId of assetGroup) {\n composer.addAssetOptOut({\n ...options,\n creator: (await this.getById(BigInt(assetId))).creator,\n sender: account,\n assetId: BigInt(assetId),\n })\n }\n\n const result = await composer.send(options)\n\n Config.getLogger(options?.suppressLog).info(\n `Successfully opted ${account} out of assets ${assetGroup.join(', ')} with transaction IDs ${result.txIds.join(', ')}` +\n `\\n Grouped under ${result.groupId} in round ${result.confirmations?.[0]?.confirmedRound}.`,\n )\n\n assetGroup.forEach((assetId, index) => {\n results.push({ assetId: BigInt(assetId), transactionId: result.txIds[index] })\n })\n }\n\n return results\n }\n}\n"],"mappings":";;;;;;AA0IA,IAAa,eAAb,MAA0B;CACxB,AAAQ;CACR,AAAQ;;;;;;;;;;CAWR,YAAY,OAAoB,UAAuE;AACrG,OAAK,SAAS;AACd,OAAK,YAAY;;;;;;;;;;;;;CAcnB,MAAa,QAAQ,SAA4C;EAC/D,MAAM,QAAQ,MAAM,KAAK,OAAO,aAAa,QAAQ;AAErD,SAAO;GACL,SAAS,OAAO,MAAM,GAAG;GACzB,OAAO,OAAO,MAAM,OAAO,MAAM;GACjC,UAAU,OAAO,MAAM,OAAO,SAAS;GACvC,WAAW,MAAM,OAAO;GACxB,kBAAkB,MAAM,OAAO;GAC/B,UAAU,MAAM,OAAO;GACvB,iBAAiB,MAAM,OAAO;GAC9B,KAAK,MAAM,OAAO;GAClB,YAAY,MAAM,OAAO;GACzB,SAAS,MAAM,OAAO;GACtB,SAAS,MAAM,OAAO;GACtB,UAAU,MAAM,OAAO;GACvB,QAAQ,MAAM,OAAO;GACrB,SAAS,MAAM,OAAO;GACtB,eAAe,MAAM,OAAO;GAC5B,cAAc,MAAM,OAAO;GAC5B;;;;;;;;;;;;;;;;;CAkBH,MAAa,sBAAsB,QAA0B,SAAmD;EAC9G,MAAM,OAAO,MAAM,KAAK,OAAO,wBAAwB,OAAO,UAAU,EAAE,QAAQ;AAElF,SAAO;GACL,SAAS,OAAO,QAAQ;GACx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,MACR,WAAW,UAAU,mBAAmB,SAAS,IAAI,4BAA4B,mBAAmB,SAAS,IAAI,MAAM,GAAG,GAAG,mBAAmB,KAAK,KAAK,KAAK,KAC7J,uBAAuB,SAAS,IAC5B,kCAAkC,uBAAuB,SAAS,IAAI,MAAM,GAAG,GAAG,uBAAuB,KAAK,KAAK,KACnH,GACL,kBACF;AAGH,QAAK,MAAM,WAAW,WACpB,UAAS,eAAe;IACtB,GAAG;IACH,UAAU,MAAM,KAAK,QAAQ,OAAO,QAAQ,CAAC,EAAE;IAC/C,QAAQ;IACR,SAAS,OAAO,QAAQ;IACzB,CAAC;GAGJ,MAAM,SAAS,MAAM,SAAS,KAAK,QAAQ;AAE3C,UAAO,UAAU,SAAS,YAAY,CAAC,KACrC,sBAAsB,QAAQ,iBAAiB,WAAW,KAAK,KAAK,CAAC,wBAAwB,OAAO,MAAM,KAAK,KAAK,qBAC7F,OAAO,QAAQ,YAAY,OAAO,gBAAgB,IAAI,eAAe,GAC7F;AAED,cAAW,SAAS,SAAS,UAAU;AACrC,YAAQ,KAAK;KAAE,SAAS,OAAO,QAAQ;KAAE,eAAe,OAAO,MAAM;KAAQ,CAAC;KAC9E;;AAGJ,SAAO"}
|
|
1
|
+
{"version":3,"file":"asset-manager.mjs","names":["results: BulkAssetOptInOutResult[]","notOptedInAssetIds: bigint[]","nonZeroBalanceAssetIds: bigint[]"],"sources":["../../src/types/asset-manager.ts"],"sourcesContent":["import { AlgodClient } from '@algorandfoundation/algokit-algod-client'\nimport { Address, MAX_TRANSACTION_GROUP_SIZE } from '@algorandfoundation/algokit-common'\nimport { Config } from '../config'\nimport { chunkArray } from '../util'\nimport { AccountAssetInformation } from './account'\nimport { CommonTransactionParams, TransactionComposer, TransactionComposerConfig } from './composer'\nimport { SendParams } from './transaction'\n\n/** Individual result from performing a bulk opt-in or bulk opt-out for an account against a series of assets. */\nexport interface BulkAssetOptInOutResult {\n /** The ID of the asset opted into / out of */\n assetId: bigint\n /** The transaction ID of the resulting opt in / out */\n transactionId: string\n}\n\n/** Information about an asset. */\nexport interface AssetInformation {\n /** The ID of the asset. */\n assetId: bigint\n\n /** The address of the account that created the asset.\n *\n * This is the address where the parameters for this asset can be found,\n * and also the address where unwanted asset units can be sent when\n * closing out an asset position and opting-out of the asset.\n */\n creator: string\n\n /** The total amount of the smallest divisible (decimal) units that were created of the asset.\n *\n * For example, if `decimals` is, say, 2, then for every 100 `total` there is 1 whole unit.\n */\n total: bigint\n\n /** The amount of decimal places the asset was created with.\n *\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 * * and so on up to 19 decimal places.\n */\n decimals: number\n\n /** Whether the asset was frozen by default for all accounts.\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.\n */\n defaultFrozen?: boolean\n\n /** The address of the optional account that can manage the configuration of the asset and destroy it.\n *\n * If not set the asset is permanently immutable.\n */\n manager?: string\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 the field is permanently empty.\n */\n reserve?: string\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 the field is permanently empty.\n */\n freeze?: string\n\n /**\n * The address of the optional account that can clawback holdings of this asset from any account.\n *\n * 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 the field is permanently empty.\n */\n clawback?: string\n\n /** The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n */\n unitName?: string\n\n /** The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n */\n unitNameAsBytes?: Uint8Array\n\n /** The optional name of the asset.\n *\n * Max size is 32 bytes.\n */\n assetName?: string\n\n /** The optional name of the asset.\n *\n * Max size is 32 bytes.\n */\n assetNameAsBytes?: Uint8Array\n\n /** Optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n */\n url?: string\n\n /** Optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n */\n urlAsBytes?: Uint8Array\n\n /** 32-byte hash of some metadata that is relevant to the asset and/or asset holders.\n *\n * The format of this metadata is up to the application.\n */\n metadataHash?: Uint8Array\n}\n\n/** Allows management of asset information. */\nexport class AssetManager {\n private _algod: AlgodClient\n private _newGroup: () => TransactionComposer\n\n /**\n * Create a new asset manager.\n * @param algod An algod client\n * @param newGroup A function that creates a new `TransactionComposer` transaction group\n * @example Create a new asset manager\n * ```typescript\n * const assetManager = new AssetManager(algod, () => new TransactionComposer({algod, () => signer, () => suggestedParams}))\n * ```\n */\n constructor(algod: AlgodClient, newGroup: (config?: TransactionComposerConfig) => TransactionComposer) {\n this._algod = algod\n this._newGroup = newGroup\n }\n\n /**\n * Returns the current asset information for the asset with the given ID.\n *\n * @example\n * ```typescript\n * const assetInfo = await assetManager.getById(12353n);\n * ```\n *\n * @param assetId The ID of the asset\n * @returns The asset information\n */\n public async getById(assetId: bigint): Promise<AssetInformation> {\n const asset = await this._algod.assetById(assetId)\n\n return {\n assetId: BigInt(asset.id),\n total: BigInt(asset.params.total),\n decimals: Number(asset.params.decimals),\n assetName: asset.params.name,\n assetNameAsBytes: asset.params.nameB64,\n unitName: asset.params.unitName,\n unitNameAsBytes: asset.params.unitNameB64,\n url: asset.params.url,\n urlAsBytes: asset.params.urlB64,\n creator: asset.params.creator,\n manager: asset.params.manager,\n clawback: asset.params.clawback,\n freeze: asset.params.freeze,\n reserve: asset.params.reserve,\n defaultFrozen: asset.params.defaultFrozen,\n metadataHash: asset.params.metadataHash,\n }\n }\n\n /**\n * Returns the given sender account's asset holding for a given asset.\n *\n * @example\n * ```typescript\n * const address = \"XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA\";\n * const assetId = 123345n;\n * const accountInfo = await assetManager.getAccountInformation(address, assetId);\n * ```\n *\n * [Response data schema details](https://dev.algorand.co/reference/rest-apis/algod/#accountassetinformation)\n * @param sender The address of the sender/account to look up\n * @param assetId The ID of the asset to return a holding for\n * @returns The account asset holding information\n */\n public async getAccountInformation(sender: string | Address, assetId: bigint): Promise<AccountAssetInformation> {\n const info = await this._algod.accountAssetInformation(sender.toString(), assetId)\n\n return {\n assetId: BigInt(assetId),\n balance: BigInt(info.assetHolding?.amount ?? 0),\n frozen: info.assetHolding?.isFrozen === true,\n round: BigInt(info['round']),\n }\n }\n\n /**\n * Opt an account in to a list of Algorand Standard Assets.\n *\n * Transactions will be sent in batches of 16 as transaction groups.\n *\n * @param account The account to opt-in\n * @param assetIds The list of asset IDs to opt-in to\n * @param options Any parameters to control the transaction or execution of the transaction\n * @example Example using AlgorandClient\n * ```typescript\n * // Basic example\n * assetManager.bulkOptIn(\"ACCOUNTADDRESS\", [12345n, 67890n])\n * // With configuration\n * assetManager.bulkOptIn(\"ACCOUNTADDRESS\", [12345n, 67890n], { maxFee: (1000).microAlgo(), suppressLog: true })\n * ```\n * @returns An array of records matching asset ID to transaction ID of the opt in\n */\n async bulkOptIn(\n account: string | Address,\n assetIds: bigint[],\n options?: Omit<CommonTransactionParams, 'sender'> & SendParams,\n ): Promise<BulkAssetOptInOutResult[]> {\n const results: BulkAssetOptInOutResult[] = []\n\n for (const assetGroup of chunkArray(assetIds, MAX_TRANSACTION_GROUP_SIZE)) {\n const composer = this._newGroup()\n\n for (const assetId of assetGroup) {\n composer.addAssetOptIn({\n ...options,\n sender: account,\n assetId: BigInt(assetId),\n })\n }\n\n const result = await composer.send(options)\n\n Config.getLogger(options?.suppressLog).info(\n `Successfully opted in ${account} for assets ${assetGroup.join(', ')} with transaction IDs ${result.txIds.join(', ')}` +\n `\\n Grouped under ${result.groupId} in round ${result.confirmations?.[0]?.confirmedRound}.`,\n )\n\n assetGroup.forEach((assetId, index) => {\n results.push({ assetId: BigInt(assetId), transactionId: result.txIds[index] })\n })\n }\n\n return results\n }\n\n /**\n * Opt an account out of a list of Algorand Standard Assets.\n *\n * Transactions will be sent in batches of 16 as transaction groups.\n *\n * @param account The account to opt-in\n * @param assetIds The list of asset IDs to opt-out of\n * @param options Any parameters to control the transaction or execution of the transaction\n * @example Example using AlgorandClient\n * ```typescript\n * // Basic example\n * assetManager.bulkOptOut(\"ACCOUNTADDRESS\", [12345n, 67890n])\n * // With configuration\n * assetManager.bulkOptOut(\"ACCOUNTADDRESS\", [12345n, 67890n], { ensureZeroBalance: true, maxFee: (1000).microAlgo(), suppressLog: true })\n * ```\n * @returns An array of records matching asset ID to transaction ID of the opt in\n */\n async bulkOptOut(\n account: string | Address,\n assetIds: bigint[],\n options?: Omit<CommonTransactionParams, 'sender'> &\n SendParams & {\n /** Whether or not to check if the account has a zero balance for each asset first or not.\n *\n * Defaults to `true`.\n *\n * If this is set to `true` and the account has an asset balance it will throw an error.\n *\n * If this is set to `false` and the account has an asset balance it will lose those assets to the asset creator.\n */\n ensureZeroBalance?: boolean\n },\n ): Promise<BulkAssetOptInOutResult[]> {\n const results: BulkAssetOptInOutResult[] = []\n\n for (const assetGroup of chunkArray(assetIds, MAX_TRANSACTION_GROUP_SIZE)) {\n const composer = this._newGroup()\n\n const notOptedInAssetIds: bigint[] = []\n const nonZeroBalanceAssetIds: bigint[] = []\n for (const assetId of assetGroup) {\n if (options?.ensureZeroBalance !== false) {\n try {\n const accountAssetInfo = await this.getAccountInformation(account, assetId)\n if (accountAssetInfo.balance !== 0n) {\n nonZeroBalanceAssetIds.push(BigInt(assetId))\n }\n } catch {\n notOptedInAssetIds.push(BigInt(assetId))\n }\n }\n }\n\n if (notOptedInAssetIds.length > 0 || nonZeroBalanceAssetIds.length > 0) {\n throw new Error(\n `Account ${account}${notOptedInAssetIds.length > 0 ? ` is not opted-in to Asset${notOptedInAssetIds.length > 1 ? 's' : ''} ${notOptedInAssetIds.join(', ')}` : ''}${\n nonZeroBalanceAssetIds.length > 0\n ? ` has non-zero balance for Asset${nonZeroBalanceAssetIds.length > 1 ? 's' : ''} ${nonZeroBalanceAssetIds.join(', ')}`\n : ''\n }; can't opt-out.`,\n )\n }\n\n for (const assetId of assetGroup) {\n composer.addAssetOptOut({\n ...options,\n creator: (await this.getById(BigInt(assetId))).creator,\n sender: account,\n assetId: BigInt(assetId),\n })\n }\n\n const result = await composer.send(options)\n\n Config.getLogger(options?.suppressLog).info(\n `Successfully opted ${account} out of assets ${assetGroup.join(', ')} with transaction IDs ${result.txIds.join(', ')}` +\n `\\n Grouped under ${result.groupId} in round ${result.confirmations?.[0]?.confirmedRound}.`,\n )\n\n assetGroup.forEach((assetId, index) => {\n results.push({ assetId: BigInt(assetId), transactionId: result.txIds[index] })\n })\n }\n\n return results\n }\n}\n"],"mappings":";;;;;;AA0IA,IAAa,eAAb,MAA0B;CACxB,AAAQ;CACR,AAAQ;;;;;;;;;;CAWR,YAAY,OAAoB,UAAuE;AACrG,OAAK,SAAS;AACd,OAAK,YAAY;;;;;;;;;;;;;CAcnB,MAAa,QAAQ,SAA4C;EAC/D,MAAM,QAAQ,MAAM,KAAK,OAAO,UAAU,QAAQ;AAElD,SAAO;GACL,SAAS,OAAO,MAAM,GAAG;GACzB,OAAO,OAAO,MAAM,OAAO,MAAM;GACjC,UAAU,OAAO,MAAM,OAAO,SAAS;GACvC,WAAW,MAAM,OAAO;GACxB,kBAAkB,MAAM,OAAO;GAC/B,UAAU,MAAM,OAAO;GACvB,iBAAiB,MAAM,OAAO;GAC9B,KAAK,MAAM,OAAO;GAClB,YAAY,MAAM,OAAO;GACzB,SAAS,MAAM,OAAO;GACtB,SAAS,MAAM,OAAO;GACtB,UAA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BAAmC,EAAE;AAC3C,QAAK,MAAM,WAAW,WACpB,KAAI,SAAS,sBAAsB,MACjC,KAAI;AAEF,SADyB,MAAM,KAAK,sBAAsB,SAAS,QAAQ,EACtD,YAAY,GAC/B,wBAAuB,KAAK,OAAO,QAAQ,CAAC;WAExC;AACN,uBAAmB,KAAK,OAAO,QAAQ,CAAC;;AAK9C,OAAI,mBAAmB,SAAS,KAAK,uBAAuB,SAAS,EACnE,OAAM,IAAI,MACR,WAAW,UAAU,mBAAmB,SAAS,IAAI,4BAA4B,mBAAmB,SAAS,IAAI,MAAM,GAAG,GAAG,mBAAmB,KAAK,KAAK,KAAK,KAC7J,uBAAuB,SAAS,IAC5B,kCAAkC,uBAAuB,SAAS,IAAI,MAAM,GAAG,GAAG,uBAAuB,KAAK,KAAK,KACnH,GACL,kBACF;AAGH,QAAK,MAAM,WAAW,WACpB,UAAS,eAAe;IACtB,GAAG;IACH,UAAU,MAAM,KAAK,QAAQ,OAAO,QAAQ,CAAC,EAAE;IAC/C,QAAQ;IACR,SAAS,OAAO,QAAQ;IACzB,CAAC;GAGJ,MAAM,SAAS,MAAM,SAAS,KAAK,QAAQ;AAE3C,UAAO,UAAU,SAAS,YAAY,CAAC,KACrC,sBAAsB,QAAQ,iBAAiB,WAAW,KAAK,KAAK,CAAC,wBAAwB,OAAO,MAAM,KAAK,KAAK,qBAC7F,OAAO,QAAQ,YAAY,OAAO,gBAAgB,IAAI,eAAe,GAC7F;AAED,cAAW,SAAS,SAAS,UAAU;AACrC,YAAQ,KAAK;KAAE,SAAS,OAAO,QAAQ;KAAE,eAAe,OAAO,MAAM;KAAQ,CAAC;KAC9E;;AAGJ,SAAO"}
|
|
@@ -5,12 +5,9 @@ type AsyncEventListener<T = unknown> = (event: T, eventName: string | symbol) =>
|
|
|
5
5
|
declare class AsyncEventEmitter {
|
|
6
6
|
private listenerWrapperMap;
|
|
7
7
|
private listenerMap;
|
|
8
|
-
emitAsync<K extends
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
on<T = unknown>(eventName: string | symbol, listener: AsyncEventListener<T>): AsyncEventEmitter;
|
|
12
|
-
once<K extends EventType>(eventName: K, listener: AsyncEventListener<EventDataMap[K]>): AsyncEventEmitter;
|
|
13
|
-
once<T = unknown>(eventName: string | symbol, listener: AsyncEventListener<T>): AsyncEventEmitter;
|
|
8
|
+
emitAsync<K extends string | symbol>(eventName: K, event: K extends EventType ? EventDataMap[K] : unknown): Promise<void>;
|
|
9
|
+
on<K extends string | symbol>(eventName: K, listener: AsyncEventListener<K extends EventType ? EventDataMap[K] : unknown>): AsyncEventEmitter;
|
|
10
|
+
once<K extends string | symbol>(eventName: K, listener: AsyncEventListener<K extends EventType ? EventDataMap[K] : unknown>): AsyncEventEmitter;
|
|
14
11
|
removeListener(eventName: string | symbol, listener: AsyncEventListener): AsyncEventEmitter;
|
|
15
12
|
off: (eventName: string | symbol, listener: AsyncEventListener) => AsyncEventEmitter;
|
|
16
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-event-emitter.js","names":["wrappedListener: AsyncEventListener","eventName"],"sources":["../../src/types/async-event-emitter.ts"],"sourcesContent":["import { EventDataMap, EventType } from './lifecycle-events'\n\nexport type AsyncEventListener<T = unknown> = (event: T, eventName: string | symbol) => Promise<void> | void\n\nexport class AsyncEventEmitter {\n private listenerWrapperMap = new WeakMap<AsyncEventListener, AsyncEventListener>()\n private listenerMap: Record<string | symbol, AsyncEventListener[]> = {}\n\n async emitAsync<K extends
|
|
1
|
+
{"version":3,"file":"async-event-emitter.js","names":["wrappedListener: AsyncEventListener","eventName"],"sources":["../../src/types/async-event-emitter.ts"],"sourcesContent":["import { EventDataMap, EventType } from './lifecycle-events'\n\nexport type AsyncEventListener<T = unknown> = (event: T, eventName: string | symbol) => Promise<void> | void\n\nexport class AsyncEventEmitter {\n private listenerWrapperMap = new WeakMap<AsyncEventListener, AsyncEventListener>()\n private listenerMap: Record<string | symbol, AsyncEventListener[]> = {}\n\n async emitAsync<K extends string | symbol>(eventName: K, event: K extends EventType ? EventDataMap[K] : unknown): Promise<void> {\n for (const listener of this.listenerMap[eventName] ?? []) {\n await listener(event, eventName)\n }\n }\n\n on<K extends string | symbol>(\n eventName: K,\n listener: AsyncEventListener<K extends EventType ? EventDataMap[K] : unknown>,\n ): AsyncEventEmitter {\n if (!this.listenerMap[eventName]) this.listenerMap[eventName] = []\n this.listenerMap[eventName].push(listener as AsyncEventListener)\n return this\n }\n\n once<K extends string | symbol>(\n eventName: K,\n listener: AsyncEventListener<K extends EventType ? EventDataMap[K] : unknown>,\n ): AsyncEventEmitter {\n const wrappedListener: AsyncEventListener = async (event, eventName) => {\n try {\n return await (listener as AsyncEventListener)(event, eventName)\n } finally {\n this.removeListener(eventName, wrappedListener)\n }\n }\n this.listenerWrapperMap.set(listener as AsyncEventListener, wrappedListener)\n return this.on(eventName, wrappedListener as AsyncEventListener<K extends EventType ? EventDataMap[K] : unknown>)\n }\n\n removeListener(eventName: string | symbol, listener: AsyncEventListener): AsyncEventEmitter {\n const wrappedListener = this.listenerWrapperMap.get(listener)\n if (wrappedListener) {\n this.listenerWrapperMap.delete(listener)\n if (this.listenerMap[eventName]?.indexOf(wrappedListener) !== -1) {\n this.listenerMap[eventName].splice(this.listenerMap[eventName].indexOf(wrappedListener), 1)\n }\n } else {\n if (this.listenerMap[eventName]?.indexOf(listener) !== -1) {\n this.listenerMap[eventName].splice(this.listenerMap[eventName].indexOf(listener), 1)\n }\n }\n\n return this\n }\n\n off = this.removeListener\n}\n"],"mappings":";;AAIA,IAAa,oBAAb,MAA+B;CAC7B,AAAQ,qCAAqB,IAAI,SAAiD;CAClF,AAAQ,cAA6D,EAAE;CAEvE,MAAM,UAAqC,WAAc,OAAuE;AAC9H,OAAK,MAAM,YAAY,KAAK,YAAY,cAAc,EAAE,CACtD,OAAM,SAAS,OAAO,UAAU;;CAIpC,GACE,WACA,UACmB;AACnB,MAAI,CAAC,KAAK,YAAY,WAAY,MAAK,YAAY,aAAa,EAAE;AAClE,OAAK,YAAY,WAAW,KAAK,SAA+B;AAChE,SAAO;;CAGT,KACE,WACA,UACmB;EACnB,MAAMA,kBAAsC,OAAO,OAAO,gBAAc;AACtE,OAAI;AACF,WAAO,MAAO,SAAgC,OAAOC,YAAU;aACvD;AACR,SAAK,eAAeA,aAAW,gBAAgB;;;AAGnD,OAAK,mBAAmB,IAAI,UAAgC,gBAAgB;AAC5E,SAAO,KAAK,GAAG,WAAW,gBAAuF;;CAGnH,eAAe,WAA4B,UAAiD;EAC1F,MAAM,kBAAkB,KAAK,mBAAmB,IAAI,SAAS;AAC7D,MAAI,iBAAiB;AACnB,QAAK,mBAAmB,OAAO,SAAS;AACxC,OAAI,KAAK,YAAY,YAAY,QAAQ,gBAAgB,KAAK,GAC5D,MAAK,YAAY,WAAW,OAAO,KAAK,YAAY,WAAW,QAAQ,gBAAgB,EAAE,EAAE;aAGzF,KAAK,YAAY,YAAY,QAAQ,SAAS,KAAK,GACrD,MAAK,YAAY,WAAW,OAAO,KAAK,YAAY,WAAW,QAAQ,SAAS,EAAE,EAAE;AAIxF,SAAO;;CAGT,MAAM,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-event-emitter.mjs","names":["wrappedListener: AsyncEventListener","eventName"],"sources":["../../src/types/async-event-emitter.ts"],"sourcesContent":["import { EventDataMap, EventType } from './lifecycle-events'\n\nexport type AsyncEventListener<T = unknown> = (event: T, eventName: string | symbol) => Promise<void> | void\n\nexport class AsyncEventEmitter {\n private listenerWrapperMap = new WeakMap<AsyncEventListener, AsyncEventListener>()\n private listenerMap: Record<string | symbol, AsyncEventListener[]> = {}\n\n async emitAsync<K extends
|
|
1
|
+
{"version":3,"file":"async-event-emitter.mjs","names":["wrappedListener: AsyncEventListener","eventName"],"sources":["../../src/types/async-event-emitter.ts"],"sourcesContent":["import { EventDataMap, EventType } from './lifecycle-events'\n\nexport type AsyncEventListener<T = unknown> = (event: T, eventName: string | symbol) => Promise<void> | void\n\nexport class AsyncEventEmitter {\n private listenerWrapperMap = new WeakMap<AsyncEventListener, AsyncEventListener>()\n private listenerMap: Record<string | symbol, AsyncEventListener[]> = {}\n\n async emitAsync<K extends string | symbol>(eventName: K, event: K extends EventType ? EventDataMap[K] : unknown): Promise<void> {\n for (const listener of this.listenerMap[eventName] ?? []) {\n await listener(event, eventName)\n }\n }\n\n on<K extends string | symbol>(\n eventName: K,\n listener: AsyncEventListener<K extends EventType ? EventDataMap[K] : unknown>,\n ): AsyncEventEmitter {\n if (!this.listenerMap[eventName]) this.listenerMap[eventName] = []\n this.listenerMap[eventName].push(listener as AsyncEventListener)\n return this\n }\n\n once<K extends string | symbol>(\n eventName: K,\n listener: AsyncEventListener<K extends EventType ? EventDataMap[K] : unknown>,\n ): AsyncEventEmitter {\n const wrappedListener: AsyncEventListener = async (event, eventName) => {\n try {\n return await (listener as AsyncEventListener)(event, eventName)\n } finally {\n this.removeListener(eventName, wrappedListener)\n }\n }\n this.listenerWrapperMap.set(listener as AsyncEventListener, wrappedListener)\n return this.on(eventName, wrappedListener as AsyncEventListener<K extends EventType ? EventDataMap[K] : unknown>)\n }\n\n removeListener(eventName: string | symbol, listener: AsyncEventListener): AsyncEventEmitter {\n const wrappedListener = this.listenerWrapperMap.get(listener)\n if (wrappedListener) {\n this.listenerWrapperMap.delete(listener)\n if (this.listenerMap[eventName]?.indexOf(wrappedListener) !== -1) {\n this.listenerMap[eventName].splice(this.listenerMap[eventName].indexOf(wrappedListener), 1)\n }\n } else {\n if (this.listenerMap[eventName]?.indexOf(listener) !== -1) {\n this.listenerMap[eventName].splice(this.listenerMap[eventName].indexOf(listener), 1)\n }\n }\n\n return this\n }\n\n off = this.removeListener\n}\n"],"mappings":";AAIA,IAAa,oBAAb,MAA+B;CAC7B,AAAQ,qCAAqB,IAAI,SAAiD;CAClF,AAAQ,cAA6D,EAAE;CAEvE,MAAM,UAAqC,WAAc,OAAuE;AAC9H,OAAK,MAAM,YAAY,KAAK,YAAY,cAAc,EAAE,CACtD,OAAM,SAAS,OAAO,UAAU;;CAIpC,GACE,WACA,UACmB;AACnB,MAAI,CAAC,KAAK,YAAY,WAAY,MAAK,YAAY,aAAa,EAAE;AAClE,OAAK,YAAY,WAAW,KAAK,SAA+B;AAChE,SAAO;;CAGT,KACE,WACA,UACmB;EACnB,MAAMA,kBAAsC,OAAO,OAAO,gBAAc;AACtE,OAAI;AACF,WAAO,MAAO,SAAgC,OAAOC,YAAU;aACvD;AACR,SAAK,eAAeA,aAAW,gBAAgB;;;AAGnD,OAAK,mBAAmB,IAAI,UAAgC,gBAAgB;AAC5E,SAAO,KAAK,GAAG,WAAW,gBAAuF;;CAGnH,eAAe,WAA4B,UAAiD;EAC1F,MAAM,kBAAkB,KAAK,mBAAmB,IAAI,SAAS;AAC7D,MAAI,iBAAiB;AACnB,QAAK,mBAAmB,OAAO,SAAS;AACxC,OAAI,KAAK,YAAY,YAAY,QAAQ,gBAAgB,KAAK,GAC5D,MAAK,YAAY,WAAW,OAAO,KAAK,YAAY,WAAW,QAAQ,gBAAgB,EAAE,EAAE;aAGzF,KAAK,YAAY,YAAY,QAAQ,SAAS,KAAK,GACrD,MAAK,YAAY,WAAW,OAAO,KAAK,YAAY,WAAW,QAAQ,SAAS,EAAE,EAAE;AAIxF,SAAO;;CAGT,MAAM,KAAK"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Expand } from "../packages/common/src/expand.js";
|
|
1
2
|
import { AlgodClient } from "../packages/algod_client/src/client.js";
|
|
2
|
-
import { Expand } from "./expand.js";
|
|
3
3
|
import { IndexerClient } from "../packages/indexer_client/src/client.js";
|
|
4
4
|
import { KmdClient } from "../packages/kmd_client/src/client.js";
|
|
5
5
|
import { AppClient, AppClientParams, ResolveAppClientByCreatorAndName } from "./app-client.js";
|