@algorandfoundation/algokit-utils 10.0.0-alpha.1 → 10.0.0-alpha.10
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/README.md +27 -5
- package/_virtual/rolldown_runtime.js +20 -11
- package/_virtual/rolldown_runtime.mjs +10 -5
- package/algo25/index.d.ts +2 -0
- package/algo25/index.js +9 -0
- package/algo25/index.mjs +3 -0
- package/algod-client/index.d.ts +2 -5
- package/package.json +1 -1
- package/packages/abi/src/abi-method.d.ts +1 -1
- package/packages/abi/src/abi-method.js.map +1 -1
- package/packages/abi/src/abi-method.mjs.map +1 -1
- package/packages/abi/src/abi-type.d.ts +1 -1
- package/packages/abi/src/abi-type.js +2 -1
- package/packages/abi/src/abi-type.js.map +1 -1
- package/packages/abi/src/abi-type.mjs +2 -1
- package/packages/abi/src/abi-type.mjs.map +1 -1
- package/packages/abi/src/arc56-contract.js +1 -0
- package/packages/abi/src/arc56-contract.js.map +1 -1
- package/packages/abi/src/arc56-contract.mjs +1 -0
- package/packages/abi/src/arc56-contract.mjs.map +1 -1
- package/packages/algo25/src/english.js.map +1 -1
- package/packages/algo25/src/english.mjs.map +1 -1
- package/packages/algo25/src/index.d.ts +40 -0
- package/packages/algo25/src/index.js +44 -0
- package/packages/algo25/src/index.js.map +1 -1
- package/packages/algo25/src/index.mjs +39 -1
- package/packages/algo25/src/index.mjs.map +1 -1
- package/packages/algod_client/src/apis/api-service.d.ts +44 -44
- package/packages/algod_client/src/apis/api-service.js +153 -153
- package/packages/algod_client/src/apis/api-service.js.map +1 -1
- package/packages/algod_client/src/apis/api-service.mjs +153 -153
- 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 +4 -4
- package/packages/algod_client/src/core/model-runtime.js.map +1 -1
- package/packages/algod_client/src/core/model-runtime.mjs +6 -6
- 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 +49 -29
- package/packages/algod_client/src/models/block.js +174 -98
- package/packages/algod_client/src/models/block.js.map +1 -1
- package/packages/algod_client/src/models/block.mjs +174 -98
- package/packages/algod_client/src/models/block.mjs.map +1 -1
- package/packages/algod_client/src/models/ledger-state-delta.js +1 -1
- package/packages/algod_client/src/models/ledger-state-delta.js.map +1 -1
- package/packages/algod_client/src/models/ledger-state-delta.mjs +2 -2
- package/packages/algod_client/src/models/ledger-state-delta.mjs.map +1 -1
- package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.d.ts +3 -5
- package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.js +4 -6
- package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.js.map +1 -1
- package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.mjs +3 -5
- package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.mjs.map +1 -1
- package/packages/algod_client/src/models/transaction-parameters-response.js +2 -2
- package/packages/algod_client/src/models/transaction-parameters-response.js.map +1 -1
- package/packages/algod_client/src/models/transaction-parameters-response.mjs +2 -2
- package/packages/algod_client/src/models/transaction-parameters-response.mjs.map +1 -1
- package/packages/common/src/address.js +0 -14
- package/packages/common/src/address.js.map +1 -1
- package/packages/common/src/address.mjs +1 -14
- package/packages/common/src/address.mjs.map +1 -1
- package/packages/common/src/codecs/composite/map.js +7 -4
- package/packages/common/src/codecs/composite/map.js.map +1 -1
- package/packages/common/src/codecs/composite/map.mjs +7 -4
- package/packages/common/src/codecs/composite/map.mjs.map +1 -1
- package/packages/common/src/codecs/composite/record.js +0 -1
- package/packages/common/src/codecs/composite/record.js.map +1 -1
- package/packages/common/src/codecs/primitives/address.js +0 -1
- package/packages/common/src/codecs/primitives/address.js.map +1 -1
- package/packages/common/src/codecs/primitives/bytes.js +0 -1
- package/packages/common/src/codecs/primitives/bytes.js.map +1 -1
- package/packages/common/src/codecs/primitives/fixed-bytes.js +0 -1
- package/packages/common/src/codecs/primitives/fixed-bytes.js.map +1 -1
- package/packages/common/src/codecs/wire.js +0 -1
- package/packages/common/src/codecs/wire.js.map +1 -1
- package/packages/common/src/json.mjs +2 -2
- package/packages/common/src/json.mjs.map +1 -1
- package/packages/common/src/msgpack.js +0 -1
- package/packages/common/src/msgpack.js.map +1 -1
- package/packages/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 +4 -4
- package/packages/indexer_client/src/core/model-runtime.js.map +1 -1
- package/packages/indexer_client/src/core/model-runtime.mjs +6 -6
- 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.js +8 -8
- package/packages/indexer_client/src/models/block.js.map +1 -1
- package/packages/indexer_client/src/models/block.mjs +8 -8
- 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/state-proof-verifier.js +2 -2
- package/packages/indexer_client/src/models/state-proof-verifier.js.map +1 -1
- package/packages/indexer_client/src/models/state-proof-verifier.mjs +2 -2
- package/packages/indexer_client/src/models/state-proof-verifier.mjs.map +1 -1
- package/packages/indexer_client/src/models/state-schema.d.ts +2 -2
- package/packages/indexer_client/src/models/state-schema.js +2 -2
- package/packages/indexer_client/src/models/state-schema.js.map +1 -1
- package/packages/indexer_client/src/models/state-schema.mjs +2 -2
- package/packages/indexer_client/src/models/state-schema.mjs.map +1 -1
- package/packages/indexer_client/src/models/teal-key-value.d.ts +1 -1
- package/packages/indexer_client/src/models/teal-key-value.js +2 -2
- package/packages/indexer_client/src/models/teal-key-value.js.map +1 -1
- package/packages/indexer_client/src/models/teal-key-value.mjs +2 -2
- package/packages/indexer_client/src/models/teal-key-value.mjs.map +1 -1
- package/packages/indexer_client/src/models/transaction-heartbeat.js +2 -1
- package/packages/indexer_client/src/models/transaction-heartbeat.js.map +1 -1
- package/packages/indexer_client/src/models/transaction-heartbeat.mjs +2 -1
- package/packages/indexer_client/src/models/transaction-heartbeat.mjs.map +1 -1
- package/packages/indexer_client/src/models/transaction-keyreg.js +4 -4
- package/packages/indexer_client/src/models/transaction-keyreg.js.map +1 -1
- package/packages/indexer_client/src/models/transaction-keyreg.mjs +4 -4
- package/packages/indexer_client/src/models/transaction-keyreg.mjs.map +1 -1
- package/packages/indexer_client/src/models/transaction-signature-logicsig.js +2 -1
- package/packages/indexer_client/src/models/transaction-signature-logicsig.js.map +1 -1
- package/packages/indexer_client/src/models/transaction-signature-logicsig.mjs +2 -1
- package/packages/indexer_client/src/models/transaction-signature-logicsig.mjs.map +1 -1
- package/packages/indexer_client/src/models/transaction-signature-multisig-subsignature.js +3 -3
- package/packages/indexer_client/src/models/transaction-signature-multisig-subsignature.js.map +1 -1
- package/packages/indexer_client/src/models/transaction-signature-multisig-subsignature.mjs +3 -3
- package/packages/indexer_client/src/models/transaction-signature-multisig-subsignature.mjs.map +1 -1
- package/packages/indexer_client/src/models/transaction.d.ts +2 -2
- package/packages/indexer_client/src/models/transaction.js +6 -5
- package/packages/indexer_client/src/models/transaction.js.map +1 -1
- package/packages/indexer_client/src/models/transaction.mjs +6 -5
- package/packages/indexer_client/src/models/transaction.mjs.map +1 -1
- package/packages/kmd_client/src/apis/api-service.d.ts +5 -5
- package/packages/kmd_client/src/apis/api-service.js +32 -32
- package/packages/kmd_client/src/apis/api-service.js.map +1 -1
- package/packages/kmd_client/src/apis/api-service.mjs +32 -32
- package/packages/kmd_client/src/apis/api-service.mjs.map +1 -1
- package/packages/kmd_client/src/core/api-error.js +3 -1
- package/packages/kmd_client/src/core/api-error.js.map +1 -1
- package/packages/kmd_client/src/core/api-error.mjs +3 -1
- package/packages/kmd_client/src/core/api-error.mjs.map +1 -1
- package/packages/kmd_client/src/core/model-runtime.js +4 -4
- package/packages/kmd_client/src/core/model-runtime.js.map +1 -1
- package/packages/kmd_client/src/core/model-runtime.mjs +6 -6
- package/packages/kmd_client/src/core/model-runtime.mjs.map +1 -1
- package/packages/sdk/src/encoding/encoding.js +12 -2
- package/packages/sdk/src/encoding/encoding.js.map +1 -1
- package/packages/sdk/src/encoding/encoding.mjs +12 -1
- package/packages/sdk/src/encoding/encoding.mjs.map +1 -1
- package/packages/sdk/src/encoding/schema/map.js +0 -2
- package/packages/sdk/src/encoding/schema/map.js.map +1 -1
- package/packages/sdk/src/utils/utils.mjs +2 -2
- package/packages/sdk/src/utils/utils.mjs.map +1 -1
- package/packages/transact/src/logicsig.d.ts +3 -15
- package/packages/transact/src/logicsig.js +16 -36
- package/packages/transact/src/logicsig.js.map +1 -1
- package/packages/transact/src/logicsig.mjs +18 -36
- package/packages/transact/src/logicsig.mjs.map +1 -1
- package/packages/transact/src/multisig.d.ts +7 -115
- package/packages/transact/src/multisig.js +86 -136
- package/packages/transact/src/multisig.js.map +1 -1
- package/packages/transact/src/multisig.mjs +87 -117
- package/packages/transact/src/multisig.mjs.map +1 -1
- package/packages/transact/src/transactions/app-call.d.ts +10 -10
- 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/reference-types-meta.d.ts +26 -0
- package/packages/transact/src/transactions/reference-types-meta.js +71 -0
- package/packages/transact/src/transactions/reference-types-meta.js.map +1 -0
- package/packages/transact/src/transactions/reference-types-meta.mjs +69 -0
- package/packages/transact/src/transactions/reference-types-meta.mjs.map +1 -0
- package/packages/transact/src/transactions/signed-transaction-meta.js +2 -3
- package/packages/transact/src/transactions/signed-transaction-meta.js.map +1 -1
- package/packages/transact/src/transactions/signed-transaction-meta.mjs +3 -3
- package/packages/transact/src/transactions/signed-transaction-meta.mjs.map +1 -1
- package/packages/transact/src/transactions/signed-transaction.d.ts +2 -2
- package/packages/transact/src/transactions/signed-transaction.js.map +1 -1
- package/packages/transact/src/transactions/signed-transaction.mjs.map +1 -1
- package/packages/transact/src/transactions/transaction-meta.js +29 -23
- package/packages/transact/src/transactions/transaction-meta.js.map +1 -1
- package/packages/transact/src/transactions/transaction-meta.mjs +29 -23
- package/packages/transact/src/transactions/transaction-meta.mjs.map +1 -1
- package/packages/transact/src/transactions/transaction.js +1 -0
- package/packages/transact/src/transactions/transaction.js.map +1 -1
- package/packages/transact/src/transactions/transaction.mjs +1 -0
- package/packages/transact/src/transactions/transaction.mjs.map +1 -1
- package/sdk/index.js +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/transact/index.d.ts +5 -4
- package/transact/index.js +4 -22
- package/transact/index.mjs +4 -3
- 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 +4 -3
- package/transactions/app-call.js +15 -15
- package/transactions/app-call.js.map +1 -1
- package/transactions/app-call.mjs +15 -15
- 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/method-call.js +12 -12
- package/transactions/method-call.js.map +1 -1
- package/transactions/method-call.mjs +12 -12
- package/transactions/method-call.mjs.map +1 -1
- package/types/account-manager.js +2 -2
- package/types/account-manager.js.map +1 -1
- package/types/account-manager.mjs +2 -2
- package/types/account-manager.mjs.map +1 -1
- package/types/algorand-client-transaction-creator.d.ts +97 -83
- 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 +100 -86
- 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/app-client.d.ts +265 -260
- package/types/app-client.js +0 -1
- package/types/app-client.js.map +1 -1
- package/types/app-deployer.js +1 -1
- package/types/app-deployer.js.map +1 -1
- package/types/app-deployer.mjs +1 -1
- package/types/app-deployer.mjs.map +1 -1
- package/types/app-factory.d.ts +91 -88
- package/types/app-manager.d.ts +3 -1
- package/types/app-manager.js +16 -10
- package/types/app-manager.js.map +1 -1
- package/types/app-manager.mjs +16 -10
- 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/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/composer.d.ts +9 -0
- package/types/composer.js +28 -13
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +28 -12
- package/types/composer.mjs.map +1 -1
- package/types/kmd-account-manager.d.ts +1 -0
- package/types/kmd-account-manager.js +21 -10
- package/types/kmd-account-manager.js.map +1 -1
- package/types/kmd-account-manager.mjs +22 -11
- package/types/kmd-account-manager.mjs.map +1 -1
- package/types/testing.d.ts +2 -2
- 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/transact/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AppCallTransactionFields, BoxReference, HoldingReference, LocalsReference, OnApplicationComplete, ResourceReference, StateSchema, validateAppCallTransaction } from "../packages/transact/src/transactions/app-call.js";
|
|
2
2
|
import { AssetConfigTransactionFields, validateAssetConfigTransaction } from "../packages/transact/src/transactions/asset-config.js";
|
|
3
3
|
import { AssetFreezeTransactionFields, validateAssetFreezeTransaction } from "../packages/transact/src/transactions/asset-freeze.js";
|
|
4
4
|
import { AssetTransferTransactionFields, validateAssetTransferTransaction } from "../packages/transact/src/transactions/asset-transfer.js";
|
|
@@ -10,8 +10,9 @@ import { TransactionType } from "../packages/transact/src/transactions/transacti
|
|
|
10
10
|
import { Transaction, TransactionParams, assignFee, calculateFee, decodeTransaction, decodeTransactions, encodeTransaction, encodeTransactionRaw, encodeTransactions, estimateTransactionSize, getEncodedTransactionType, groupTransactions, transactionCodec } from "../packages/transact/src/transactions/transaction.js";
|
|
11
11
|
import { LogicSignature, MultisigSignature, MultisigSubsignature, SignedTransaction, decodeSignedTransaction, decodeSignedTransactions, encodeSignedTransaction, encodeSignedTransactions } from "../packages/transact/src/transactions/signed-transaction.js";
|
|
12
12
|
import { SignedTransactionMeta } from "../packages/transact/src/transactions/signed-transaction-meta.js";
|
|
13
|
+
import { BoxReferenceMeta, HoldingReferenceMeta, LocalsReferenceMeta } from "../packages/transact/src/transactions/reference-types-meta.js";
|
|
13
14
|
import { TransactionParamsMeta, transactionParamsCodec } from "../packages/transact/src/transactions/transaction-meta.js";
|
|
14
|
-
import {
|
|
15
|
-
import { DelegatedLsigSigner, LogicSigAccount, ProgramDataSigner
|
|
15
|
+
import { MultisigAccount, MultisigMetadata } from "../packages/transact/src/multisig.js";
|
|
16
|
+
import { DelegatedLsigSigner, LogicSigAccount, ProgramDataSigner } from "../packages/transact/src/logicsig.js";
|
|
16
17
|
import { AddressWithDelegatedLsigSigner, AddressWithMxBytesSigner, AddressWithProgramDataSigner, AddressWithSigners, AddressWithTransactionSigner, MxBytesSigner, SendingAddress, TransactionSigner, generateAddressWithSigners, makeEmptyTransactionSigner } from "../packages/transact/src/signer.js";
|
|
17
|
-
export {
|
|
18
|
+
export { AddressWithDelegatedLsigSigner, AddressWithMxBytesSigner, AddressWithProgramDataSigner, AddressWithSigners, AddressWithTransactionSigner, AppCallTransactionFields, AssetConfigTransactionFields, AssetFreezeTransactionFields, AssetTransferTransactionFields, BoxReference, BoxReferenceMeta, DelegatedLsigSigner, FalconSignatureStruct, FalconVerifier, HashFactory, HeartbeatProof, HeartbeatTransactionFields, HoldingReference, HoldingReferenceMeta, KeyRegistrationTransactionFields, LocalsReference, LocalsReferenceMeta, LogicSigAccount, LogicSignature, MerkleArrayProof, MerkleSignatureVerifier, MultisigAccount, MultisigMetadata, MultisigSignature, MultisigSubsignature, MxBytesSigner, OnApplicationComplete, Participant, PaymentTransactionFields, ProgramDataSigner, ResourceReference, Reveal, SendingAddress, SignedTransaction, SignedTransactionMeta, SigslotCommit, StateProof, StateProofMessage, StateProofTransactionFields, StateSchema, Transaction, TransactionParams, TransactionParamsMeta, TransactionSigner, TransactionType, assignFee, calculateFee, decodeSignedTransaction, decodeSignedTransactions, decodeTransaction, decodeTransactions, encodeSignedTransaction, encodeSignedTransactions, encodeTransaction, encodeTransactionRaw, encodeTransactions, estimateTransactionSize, generateAddressWithSigners, getEncodedTransactionType, groupTransactions, makeEmptyTransactionSigner, transactionCodec, transactionParamsCodec, validateAppCallTransaction, validateAssetConfigTransaction, validateAssetFreezeTransaction, validateAssetTransferTransaction, validateKeyRegistrationTransaction };
|
package/transact/index.js
CHANGED
|
@@ -8,35 +8,23 @@ const require_transaction_meta = require('../packages/transact/src/transactions/
|
|
|
8
8
|
const require_transaction = require('../packages/transact/src/transactions/transaction.js');
|
|
9
9
|
const require_signed_transaction_meta = require('../packages/transact/src/transactions/signed-transaction-meta.js');
|
|
10
10
|
const require_signed_transaction = require('../packages/transact/src/transactions/signed-transaction.js');
|
|
11
|
+
const require_reference_types_meta = require('../packages/transact/src/transactions/reference-types-meta.js');
|
|
11
12
|
const require_signer = require('../packages/transact/src/signer.js');
|
|
12
13
|
const require_multisig = require('../packages/transact/src/multisig.js');
|
|
13
14
|
const require_logicsig = require('../packages/transact/src/logicsig.js');
|
|
14
15
|
|
|
16
|
+
exports.BoxReferenceMeta = require_reference_types_meta.BoxReferenceMeta;
|
|
17
|
+
exports.HoldingReferenceMeta = require_reference_types_meta.HoldingReferenceMeta;
|
|
18
|
+
exports.LocalsReferenceMeta = require_reference_types_meta.LocalsReferenceMeta;
|
|
15
19
|
exports.LogicSigAccount = require_logicsig.LogicSigAccount;
|
|
16
|
-
exports.MULTISIG_MERGE_LESSTHANTWO_ERROR_MSG = require_multisig.MULTISIG_MERGE_LESSTHANTWO_ERROR_MSG;
|
|
17
|
-
exports.MULTISIG_MERGE_MISMATCH_AUTH_ADDR_MSG = require_multisig.MULTISIG_MERGE_MISMATCH_AUTH_ADDR_MSG;
|
|
18
|
-
exports.MULTISIG_MERGE_MISMATCH_ERROR_MSG = require_multisig.MULTISIG_MERGE_MISMATCH_ERROR_MSG;
|
|
19
|
-
exports.MULTISIG_MERGE_SIG_MISMATCH_ERROR_MSG = require_multisig.MULTISIG_MERGE_SIG_MISMATCH_ERROR_MSG;
|
|
20
|
-
exports.MULTISIG_MERGE_WRONG_PREIMAGE_ERROR_MSG = require_multisig.MULTISIG_MERGE_WRONG_PREIMAGE_ERROR_MSG;
|
|
21
|
-
exports.MULTISIG_NO_MUTATE_ERROR_MSG = require_multisig.MULTISIG_NO_MUTATE_ERROR_MSG;
|
|
22
|
-
exports.MULTISIG_SIGNATURE_LENGTH_ERROR_MSG = require_multisig.MULTISIG_SIGNATURE_LENGTH_ERROR_MSG;
|
|
23
|
-
exports.MULTISIG_USE_PARTIAL_SIGN_ERROR_MSG = require_multisig.MULTISIG_USE_PARTIAL_SIGN_ERROR_MSG;
|
|
24
20
|
exports.MultisigAccount = require_multisig.MultisigAccount;
|
|
25
21
|
exports.OnApplicationComplete = require_app_call.OnApplicationComplete;
|
|
26
22
|
exports.SignedTransactionMeta = require_signed_transaction_meta.SignedTransactionMeta;
|
|
27
23
|
exports.Transaction = require_transaction.Transaction;
|
|
28
24
|
exports.TransactionParamsMeta = require_transaction_meta.TransactionParamsMeta;
|
|
29
25
|
exports.TransactionType = require_transaction_type.TransactionType;
|
|
30
|
-
exports.addressFromMultisigPreImg = require_multisig.addressFromMultisigPreImg;
|
|
31
|
-
exports.addressFromMultisigPreImgAddrs = require_multisig.addressFromMultisigPreImgAddrs;
|
|
32
|
-
exports.addressFromMultisigSignature = require_multisig.addressFromMultisigSignature;
|
|
33
|
-
exports.appendSignRawMultisigSignature = require_multisig.appendSignRawMultisigSignature;
|
|
34
|
-
exports.applyMultisigSubsignature = require_multisig.applyMultisigSubsignature;
|
|
35
26
|
exports.assignFee = require_transaction.assignFee;
|
|
36
27
|
exports.calculateFee = require_transaction.calculateFee;
|
|
37
|
-
exports.createMultisigTransaction = require_multisig.createMultisigTransaction;
|
|
38
|
-
exports.decodeLogicSignature = require_logicsig.decodeLogicSignature;
|
|
39
|
-
exports.decodeMultiSignature = require_multisig.decodeMultiSignature;
|
|
40
28
|
exports.decodeSignedTransaction = require_signed_transaction.decodeSignedTransaction;
|
|
41
29
|
exports.decodeSignedTransactions = require_signed_transaction.decodeSignedTransactions;
|
|
42
30
|
exports.decodeTransaction = require_transaction.decodeTransaction;
|
|
@@ -51,12 +39,6 @@ exports.generateAddressWithSigners = require_signer.generateAddressWithSigners;
|
|
|
51
39
|
exports.getEncodedTransactionType = require_transaction.getEncodedTransactionType;
|
|
52
40
|
exports.groupTransactions = require_transaction.groupTransactions;
|
|
53
41
|
exports.makeEmptyTransactionSigner = require_signer.makeEmptyTransactionSigner;
|
|
54
|
-
exports.mergeMultisigTransactions = require_multisig.mergeMultisigTransactions;
|
|
55
|
-
exports.mergeMultisignatures = require_multisig.mergeMultisignatures;
|
|
56
|
-
exports.multisigAddress = require_multisig.multisigAddress;
|
|
57
|
-
exports.newMultisigSignature = require_multisig.newMultisigSignature;
|
|
58
|
-
exports.participantsFromMultisigSignature = require_multisig.participantsFromMultisigSignature;
|
|
59
|
-
exports.sanityCheckProgram = require_logicsig.sanityCheckProgram;
|
|
60
42
|
exports.transactionCodec = require_transaction.transactionCodec;
|
|
61
43
|
exports.transactionParamsCodec = require_transaction_meta.transactionParamsCodec;
|
|
62
44
|
exports.validateAppCallTransaction = require_app_call.validateAppCallTransaction;
|
package/transact/index.mjs
CHANGED
|
@@ -8,8 +8,9 @@ import { TransactionParamsMeta, transactionParamsCodec } from "../packages/trans
|
|
|
8
8
|
import { Transaction, assignFee, calculateFee, decodeTransaction, decodeTransactions, encodeTransaction, encodeTransactionRaw, encodeTransactions, estimateTransactionSize, getEncodedTransactionType, groupTransactions, transactionCodec } from "../packages/transact/src/transactions/transaction.mjs";
|
|
9
9
|
import { SignedTransactionMeta } from "../packages/transact/src/transactions/signed-transaction-meta.mjs";
|
|
10
10
|
import { decodeSignedTransaction, decodeSignedTransactions, encodeSignedTransaction, encodeSignedTransactions } from "../packages/transact/src/transactions/signed-transaction.mjs";
|
|
11
|
+
import { BoxReferenceMeta, HoldingReferenceMeta, LocalsReferenceMeta } from "../packages/transact/src/transactions/reference-types-meta.mjs";
|
|
11
12
|
import { generateAddressWithSigners, makeEmptyTransactionSigner } from "../packages/transact/src/signer.mjs";
|
|
12
|
-
import {
|
|
13
|
-
import { LogicSigAccount
|
|
13
|
+
import { MultisigAccount } from "../packages/transact/src/multisig.mjs";
|
|
14
|
+
import { LogicSigAccount } from "../packages/transact/src/logicsig.mjs";
|
|
14
15
|
|
|
15
|
-
export {
|
|
16
|
+
export { BoxReferenceMeta, HoldingReferenceMeta, LocalsReferenceMeta, LogicSigAccount, MultisigAccount, OnApplicationComplete, SignedTransactionMeta, Transaction, TransactionParamsMeta, TransactionType, assignFee, calculateFee, decodeSignedTransaction, decodeSignedTransactions, decodeTransaction, decodeTransactions, encodeSignedTransaction, encodeSignedTransactions, encodeTransaction, encodeTransactionRaw, encodeTransactions, estimateTransactionSize, generateAddressWithSigners, getEncodedTransactionType, groupTransactions, makeEmptyTransactionSigner, transactionCodec, transactionParamsCodec, validateAppCallTransaction, validateAssetConfigTransaction, validateAssetFreezeTransaction, validateAssetTransferTransaction, validateKeyRegistrationTransaction };
|
|
@@ -80,7 +80,7 @@ async function prepareGroupForSending(composer, sendParams, additionalContext) {
|
|
|
80
80
|
* @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)
|
|
81
81
|
*/
|
|
82
82
|
const sendTransactionComposer = async function(atcSend) {
|
|
83
|
-
const { transactionComposer: givenComposer
|
|
83
|
+
const { transactionComposer: givenComposer, ...executeParams } = atcSend;
|
|
84
84
|
return atcSend.transactionComposer.send({ ...executeParams });
|
|
85
85
|
};
|
|
86
86
|
/**
|
|
@@ -96,7 +96,7 @@ const sendTransactionComposer = async function(atcSend) {
|
|
|
96
96
|
*/
|
|
97
97
|
const waitForConfirmation = async function(transactionId, maxRoundsToWait, algod) {
|
|
98
98
|
if (maxRoundsToWait < 0) throw new Error(`Invalid timeout, received ${maxRoundsToWait}, expected > 0`);
|
|
99
|
-
const status = await algod.
|
|
99
|
+
const status = await algod.status();
|
|
100
100
|
if (status === void 0) throw new Error("Unable to get node status");
|
|
101
101
|
const startRound = BigInt(status.lastRound) + 1n;
|
|
102
102
|
let currentRound = startRound;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","names":["e: any","toNumber"],"sources":["../../src/transaction/transaction.ts"],"sourcesContent":["import { AlgodClient, PendingTransactionResponse } from '@algorandfoundation/algokit-algod-client'\nimport { Transaction, TransactionSigner } from '@algorandfoundation/algokit-transact'\nimport { TransactionComposer } from '../types/composer'\nimport {\n AdditionalTransactionComposerContext,\n SendParams,\n SendTransactionComposerResults,\n TransactionComposerToSend,\n} from '../types/transaction'\nimport { toNumber } from '../util'\n\n/** Represents an unsigned transactions and a signer that can authorize that transaction. */\nexport interface TransactionWithSigner {\n /** An unsigned transaction */\n txn: Transaction\n /** A transaction signer that can authorize txn */\n signer: TransactionSigner\n}\n\n/** Encodes a transaction lease into a 32-byte array ready to be included in an Algorand transaction.\n *\n * @param lease The transaction lease as a string or binary array or null/undefined if there is no lease\n * @returns the transaction lease ready for inclusion in a transaction or `undefined` if there is no lease\n * @throws if the length of the data is > 32 bytes or empty\n * @example algokit.encodeLease('UNIQUE_ID')\n * @example algokit.encodeLease(new Uint8Array([1, 2, 3]))\n */\nexport function encodeLease(lease?: string | Uint8Array): Uint8Array | undefined {\n if (lease === null || typeof lease === 'undefined') {\n return undefined\n } else if (typeof lease === 'object' && lease.constructor === Uint8Array) {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received bytes with length ${lease.length}`,\n )\n }\n if (lease.length === 32) return lease\n const lease32 = new Uint8Array(32)\n lease32.set(lease, 0)\n return lease32\n } else if (typeof lease === 'string') {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received '${lease}' with length ${lease.length}`,\n )\n }\n const encoder = new TextEncoder()\n const lease32 = new Uint8Array(32)\n lease32.set(encoder.encode(lease), 0)\n return lease32\n } else {\n throw new Error(`Unknown lease type received of ${typeof lease}`)\n }\n}\n\n/**\n * @deprecated Use `composer.build()` directly\n * Take an existing Transaction Composer and return a new one with the required\n * app call resources populated into it\n *\n * @param algod The algod client to use for the simulation\n * @param composer The composer containing the txn group\n * @returns A new composer with the resources populated into the transactions\n *\n * @privateRemarks\n *\n * This entire function will eventually be implemented in simulate upstream in algod. The simulate endpoint will return\n * an array of refference arrays for each transaction, so this eventually will eventually just call simulate and set the\n * reference arrays in the transactions to the reference arrays returned by simulate.\n *\n * See https://github.com/algorand/go-algorand/pull/5684\n *\n */\nexport async function populateAppCallResources(composer: TransactionComposer) {\n await composer.build()\n return composer\n}\n\n/**\n * @deprecated Use `composer.setMaxFees()` instead if you need to set max fees for transactions.\n * Use `composer.build()` instead if you need to build transactions with resource population.\n *\n * Take an existing Transaction Composer and return a new one with changes applied to the transactions\n * based on the supplied sendParams to prepare it for sending.\n *\n * @param composer The Transaction Composer containing the txn group\n * @param sendParams The send params for the transaction group\n * @param additionalContext Additional context used to determine how best to change the transactions in the group\n * @returns A new Transaction Composer with the changes applied\n *\n * @privateRemarks\n * Parts of this function will eventually be implemented in algod. Namely:\n * - Simulate will return information on how to populate reference arrays, see https://github.com/algorand/go-algorand/pull/6015\n */\nexport async function prepareGroupForSending(\n composer: TransactionComposer,\n sendParams: SendParams,\n additionalContext?: AdditionalTransactionComposerContext,\n) {\n const newComposer = composer.clone({\n coverAppCallInnerTransactionFees: sendParams.coverAppCallInnerTransactionFees ?? false,\n populateAppCallResources: sendParams.populateAppCallResources ?? true,\n })\n\n if (additionalContext?.maxFees) {\n newComposer.setMaxFees(additionalContext?.maxFees)\n }\n\n await newComposer.build()\n\n return newComposer\n}\n\n/**\n * @deprecated Use `composer.send()` directly\n * Signs and sends transactions that have been collected by an `TransactionComposer`.\n * @param atcSend The parameters controlling the send, including `atc` The `TransactionComposer` and params to control send behaviour\n * @param algod An algod client\n * @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)\n */\nexport const sendTransactionComposer = async function (atcSend: TransactionComposerToSend): Promise<SendTransactionComposerResults> {\n const { transactionComposer: givenComposer, ...executeParams } = atcSend\n\n return atcSend.transactionComposer.send({\n ...executeParams,\n })\n}\n\n/**\n * Wait until the transaction is confirmed or rejected, or until `timeout`\n * number of rounds have passed.\n *\n * @param algod An algod client\n * @param transactionId The transaction ID to wait for\n * @param maxRoundsToWait Maximum number of rounds to wait\n *\n * @return Pending transaction information\n * @throws Throws an error if the transaction is not confirmed or rejected in the next `timeout` rounds\n */\nexport const waitForConfirmation = async function (\n transactionId: string,\n maxRoundsToWait: number | bigint,\n algod: AlgodClient,\n): Promise<PendingTransactionResponse> {\n if (maxRoundsToWait < 0) {\n throw new Error(`Invalid timeout, received ${maxRoundsToWait}, expected > 0`)\n }\n\n // Get current round\n const status = await algod.
|
|
1
|
+
{"version":3,"file":"transaction.js","names":["e: any","toNumber"],"sources":["../../src/transaction/transaction.ts"],"sourcesContent":["import { AlgodClient, PendingTransactionResponse } from '@algorandfoundation/algokit-algod-client'\nimport { Transaction, TransactionSigner } from '@algorandfoundation/algokit-transact'\nimport { TransactionComposer } from '../types/composer'\nimport {\n AdditionalTransactionComposerContext,\n SendParams,\n SendTransactionComposerResults,\n TransactionComposerToSend,\n} from '../types/transaction'\nimport { toNumber } from '../util'\n\n/** Represents an unsigned transactions and a signer that can authorize that transaction. */\nexport interface TransactionWithSigner {\n /** An unsigned transaction */\n txn: Transaction\n /** A transaction signer that can authorize txn */\n signer: TransactionSigner\n}\n\n/** Encodes a transaction lease into a 32-byte array ready to be included in an Algorand transaction.\n *\n * @param lease The transaction lease as a string or binary array or null/undefined if there is no lease\n * @returns the transaction lease ready for inclusion in a transaction or `undefined` if there is no lease\n * @throws if the length of the data is > 32 bytes or empty\n * @example algokit.encodeLease('UNIQUE_ID')\n * @example algokit.encodeLease(new Uint8Array([1, 2, 3]))\n */\nexport function encodeLease(lease?: string | Uint8Array): Uint8Array | undefined {\n if (lease === null || typeof lease === 'undefined') {\n return undefined\n } else if (typeof lease === 'object' && lease.constructor === Uint8Array) {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received bytes with length ${lease.length}`,\n )\n }\n if (lease.length === 32) return lease\n const lease32 = new Uint8Array(32)\n lease32.set(lease, 0)\n return lease32\n } else if (typeof lease === 'string') {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received '${lease}' with length ${lease.length}`,\n )\n }\n const encoder = new TextEncoder()\n const lease32 = new Uint8Array(32)\n lease32.set(encoder.encode(lease), 0)\n return lease32\n } else {\n throw new Error(`Unknown lease type received of ${typeof lease}`)\n }\n}\n\n/**\n * @deprecated Use `composer.build()` directly\n * Take an existing Transaction Composer and return a new one with the required\n * app call resources populated into it\n *\n * @param algod The algod client to use for the simulation\n * @param composer The composer containing the txn group\n * @returns A new composer with the resources populated into the transactions\n *\n * @privateRemarks\n *\n * This entire function will eventually be implemented in simulate upstream in algod. The simulate endpoint will return\n * an array of refference arrays for each transaction, so this eventually will eventually just call simulate and set the\n * reference arrays in the transactions to the reference arrays returned by simulate.\n *\n * See https://github.com/algorand/go-algorand/pull/5684\n *\n */\nexport async function populateAppCallResources(composer: TransactionComposer) {\n await composer.build()\n return composer\n}\n\n/**\n * @deprecated Use `composer.setMaxFees()` instead if you need to set max fees for transactions.\n * Use `composer.build()` instead if you need to build transactions with resource population.\n *\n * Take an existing Transaction Composer and return a new one with changes applied to the transactions\n * based on the supplied sendParams to prepare it for sending.\n *\n * @param composer The Transaction Composer containing the txn group\n * @param sendParams The send params for the transaction group\n * @param additionalContext Additional context used to determine how best to change the transactions in the group\n * @returns A new Transaction Composer with the changes applied\n *\n * @privateRemarks\n * Parts of this function will eventually be implemented in algod. Namely:\n * - Simulate will return information on how to populate reference arrays, see https://github.com/algorand/go-algorand/pull/6015\n */\nexport async function prepareGroupForSending(\n composer: TransactionComposer,\n sendParams: SendParams,\n additionalContext?: AdditionalTransactionComposerContext,\n) {\n const newComposer = composer.clone({\n coverAppCallInnerTransactionFees: sendParams.coverAppCallInnerTransactionFees ?? false,\n populateAppCallResources: sendParams.populateAppCallResources ?? true,\n })\n\n if (additionalContext?.maxFees) {\n newComposer.setMaxFees(additionalContext?.maxFees)\n }\n\n await newComposer.build()\n\n return newComposer\n}\n\n/**\n * @deprecated Use `composer.send()` directly\n * Signs and sends transactions that have been collected by an `TransactionComposer`.\n * @param atcSend The parameters controlling the send, including `atc` The `TransactionComposer` and params to control send behaviour\n * @param algod An algod client\n * @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)\n */\nexport const sendTransactionComposer = async function (atcSend: TransactionComposerToSend): Promise<SendTransactionComposerResults> {\n const { transactionComposer: givenComposer, ...executeParams } = atcSend\n\n return atcSend.transactionComposer.send({\n ...executeParams,\n })\n}\n\n/**\n * Wait until the transaction is confirmed or rejected, or until `timeout`\n * number of rounds have passed.\n *\n * @param algod An algod client\n * @param transactionId The transaction ID to wait for\n * @param maxRoundsToWait Maximum number of rounds to wait\n *\n * @return Pending transaction information\n * @throws Throws an error if the transaction is not confirmed or rejected in the next `timeout` rounds\n */\nexport const waitForConfirmation = async function (\n transactionId: string,\n maxRoundsToWait: number | bigint,\n algod: AlgodClient,\n): Promise<PendingTransactionResponse> {\n if (maxRoundsToWait < 0) {\n throw new Error(`Invalid timeout, received ${maxRoundsToWait}, expected > 0`)\n }\n\n // Get current round\n const status = await algod.status()\n if (status === undefined) {\n throw new Error('Unable to get node status')\n }\n\n // Loop for up to `timeout` rounds looking for a confirmed transaction\n const startRound = BigInt(status.lastRound) + 1n\n let currentRound = startRound\n while (currentRound < startRound + BigInt(maxRoundsToWait)) {\n try {\n const pendingInfo = await algod.pendingTransactionInformation(transactionId)\n\n if (pendingInfo !== undefined) {\n const confirmedRound = pendingInfo.confirmedRound\n if (confirmedRound && confirmedRound > 0) {\n return pendingInfo\n } else {\n const poolError = pendingInfo.poolError\n if (poolError != null && poolError.length > 0) {\n // If there was a pool error, then the transaction has been rejected!\n throw new Error(`Transaction ${transactionId} was rejected; pool error: ${poolError}`)\n }\n }\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (e: any) {\n if ('status' in e && e.status === 404) {\n currentRound++\n continue\n }\n }\n\n await algod.statusAfterBlock(toNumber(currentRound))\n currentRound++\n }\n\n throw new Error(`Transaction ${transactionId} not confirmed after ${maxRoundsToWait} rounds`)\n}\n"],"mappings":";;;;;;;;;;;AA2BA,SAAgB,YAAY,OAAqD;AAC/E,KAAI,UAAU,QAAQ,OAAO,UAAU,YACrC;UACS,OAAO,UAAU,YAAY,MAAM,gBAAgB,YAAY;AACxE,MAAI,MAAM,WAAW,KAAK,MAAM,SAAS,GACvC,OAAM,IAAI,MACR,2GAA2G,MAAM,SAClH;AAEH,MAAI,MAAM,WAAW,GAAI,QAAO;EAChC,MAAM,UAAU,IAAI,WAAW,GAAG;AAClC,UAAQ,IAAI,OAAO,EAAE;AACrB,SAAO;YACE,OAAO,UAAU,UAAU;AACpC,MAAI,MAAM,WAAW,KA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AAY,YAAY;AAC9B,SAAI,aAAa,QAAQ,UAAU,SAAS,EAE1C,OAAM,IAAI,MAAM,eAAe,cAAc,6BAA6B,YAAY;;;WAKrFA,GAAQ;AACf,OAAI,YAAY,KAAK,EAAE,WAAW,KAAK;AACrC;AACA;;;AAIJ,QAAM,MAAM,iBAAiBC,sBAAS,aAAa,CAAC;AACpD;;AAGF,OAAM,IAAI,MAAM,eAAe,cAAc,uBAAuB,gBAAgB,SAAS"}
|
|
@@ -80,7 +80,7 @@ async function prepareGroupForSending(composer, sendParams, additionalContext) {
|
|
|
80
80
|
* @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)
|
|
81
81
|
*/
|
|
82
82
|
const sendTransactionComposer = async function(atcSend) {
|
|
83
|
-
const { transactionComposer: givenComposer
|
|
83
|
+
const { transactionComposer: givenComposer, ...executeParams } = atcSend;
|
|
84
84
|
return atcSend.transactionComposer.send({ ...executeParams });
|
|
85
85
|
};
|
|
86
86
|
/**
|
|
@@ -96,7 +96,7 @@ const sendTransactionComposer = async function(atcSend) {
|
|
|
96
96
|
*/
|
|
97
97
|
const waitForConfirmation = async function(transactionId, maxRoundsToWait, algod) {
|
|
98
98
|
if (maxRoundsToWait < 0) throw new Error(`Invalid timeout, received ${maxRoundsToWait}, expected > 0`);
|
|
99
|
-
const status = await algod.
|
|
99
|
+
const status = await algod.status();
|
|
100
100
|
if (status === void 0) throw new Error("Unable to get node status");
|
|
101
101
|
const startRound = BigInt(status.lastRound) + 1n;
|
|
102
102
|
let currentRound = startRound;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.mjs","names":["e: any"],"sources":["../../src/transaction/transaction.ts"],"sourcesContent":["import { AlgodClient, PendingTransactionResponse } from '@algorandfoundation/algokit-algod-client'\nimport { Transaction, TransactionSigner } from '@algorandfoundation/algokit-transact'\nimport { TransactionComposer } from '../types/composer'\nimport {\n AdditionalTransactionComposerContext,\n SendParams,\n SendTransactionComposerResults,\n TransactionComposerToSend,\n} from '../types/transaction'\nimport { toNumber } from '../util'\n\n/** Represents an unsigned transactions and a signer that can authorize that transaction. */\nexport interface TransactionWithSigner {\n /** An unsigned transaction */\n txn: Transaction\n /** A transaction signer that can authorize txn */\n signer: TransactionSigner\n}\n\n/** Encodes a transaction lease into a 32-byte array ready to be included in an Algorand transaction.\n *\n * @param lease The transaction lease as a string or binary array or null/undefined if there is no lease\n * @returns the transaction lease ready for inclusion in a transaction or `undefined` if there is no lease\n * @throws if the length of the data is > 32 bytes or empty\n * @example algokit.encodeLease('UNIQUE_ID')\n * @example algokit.encodeLease(new Uint8Array([1, 2, 3]))\n */\nexport function encodeLease(lease?: string | Uint8Array): Uint8Array | undefined {\n if (lease === null || typeof lease === 'undefined') {\n return undefined\n } else if (typeof lease === 'object' && lease.constructor === Uint8Array) {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received bytes with length ${lease.length}`,\n )\n }\n if (lease.length === 32) return lease\n const lease32 = new Uint8Array(32)\n lease32.set(lease, 0)\n return lease32\n } else if (typeof lease === 'string') {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received '${lease}' with length ${lease.length}`,\n )\n }\n const encoder = new TextEncoder()\n const lease32 = new Uint8Array(32)\n lease32.set(encoder.encode(lease), 0)\n return lease32\n } else {\n throw new Error(`Unknown lease type received of ${typeof lease}`)\n }\n}\n\n/**\n * @deprecated Use `composer.build()` directly\n * Take an existing Transaction Composer and return a new one with the required\n * app call resources populated into it\n *\n * @param algod The algod client to use for the simulation\n * @param composer The composer containing the txn group\n * @returns A new composer with the resources populated into the transactions\n *\n * @privateRemarks\n *\n * This entire function will eventually be implemented in simulate upstream in algod. The simulate endpoint will return\n * an array of refference arrays for each transaction, so this eventually will eventually just call simulate and set the\n * reference arrays in the transactions to the reference arrays returned by simulate.\n *\n * See https://github.com/algorand/go-algorand/pull/5684\n *\n */\nexport async function populateAppCallResources(composer: TransactionComposer) {\n await composer.build()\n return composer\n}\n\n/**\n * @deprecated Use `composer.setMaxFees()` instead if you need to set max fees for transactions.\n * Use `composer.build()` instead if you need to build transactions with resource population.\n *\n * Take an existing Transaction Composer and return a new one with changes applied to the transactions\n * based on the supplied sendParams to prepare it for sending.\n *\n * @param composer The Transaction Composer containing the txn group\n * @param sendParams The send params for the transaction group\n * @param additionalContext Additional context used to determine how best to change the transactions in the group\n * @returns A new Transaction Composer with the changes applied\n *\n * @privateRemarks\n * Parts of this function will eventually be implemented in algod. Namely:\n * - Simulate will return information on how to populate reference arrays, see https://github.com/algorand/go-algorand/pull/6015\n */\nexport async function prepareGroupForSending(\n composer: TransactionComposer,\n sendParams: SendParams,\n additionalContext?: AdditionalTransactionComposerContext,\n) {\n const newComposer = composer.clone({\n coverAppCallInnerTransactionFees: sendParams.coverAppCallInnerTransactionFees ?? false,\n populateAppCallResources: sendParams.populateAppCallResources ?? true,\n })\n\n if (additionalContext?.maxFees) {\n newComposer.setMaxFees(additionalContext?.maxFees)\n }\n\n await newComposer.build()\n\n return newComposer\n}\n\n/**\n * @deprecated Use `composer.send()` directly\n * Signs and sends transactions that have been collected by an `TransactionComposer`.\n * @param atcSend The parameters controlling the send, including `atc` The `TransactionComposer` and params to control send behaviour\n * @param algod An algod client\n * @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)\n */\nexport const sendTransactionComposer = async function (atcSend: TransactionComposerToSend): Promise<SendTransactionComposerResults> {\n const { transactionComposer: givenComposer, ...executeParams } = atcSend\n\n return atcSend.transactionComposer.send({\n ...executeParams,\n })\n}\n\n/**\n * Wait until the transaction is confirmed or rejected, or until `timeout`\n * number of rounds have passed.\n *\n * @param algod An algod client\n * @param transactionId The transaction ID to wait for\n * @param maxRoundsToWait Maximum number of rounds to wait\n *\n * @return Pending transaction information\n * @throws Throws an error if the transaction is not confirmed or rejected in the next `timeout` rounds\n */\nexport const waitForConfirmation = async function (\n transactionId: string,\n maxRoundsToWait: number | bigint,\n algod: AlgodClient,\n): Promise<PendingTransactionResponse> {\n if (maxRoundsToWait < 0) {\n throw new Error(`Invalid timeout, received ${maxRoundsToWait}, expected > 0`)\n }\n\n // Get current round\n const status = await algod.
|
|
1
|
+
{"version":3,"file":"transaction.mjs","names":["e: any"],"sources":["../../src/transaction/transaction.ts"],"sourcesContent":["import { AlgodClient, PendingTransactionResponse } from '@algorandfoundation/algokit-algod-client'\nimport { Transaction, TransactionSigner } from '@algorandfoundation/algokit-transact'\nimport { TransactionComposer } from '../types/composer'\nimport {\n AdditionalTransactionComposerContext,\n SendParams,\n SendTransactionComposerResults,\n TransactionComposerToSend,\n} from '../types/transaction'\nimport { toNumber } from '../util'\n\n/** Represents an unsigned transactions and a signer that can authorize that transaction. */\nexport interface TransactionWithSigner {\n /** An unsigned transaction */\n txn: Transaction\n /** A transaction signer that can authorize txn */\n signer: TransactionSigner\n}\n\n/** Encodes a transaction lease into a 32-byte array ready to be included in an Algorand transaction.\n *\n * @param lease The transaction lease as a string or binary array or null/undefined if there is no lease\n * @returns the transaction lease ready for inclusion in a transaction or `undefined` if there is no lease\n * @throws if the length of the data is > 32 bytes or empty\n * @example algokit.encodeLease('UNIQUE_ID')\n * @example algokit.encodeLease(new Uint8Array([1, 2, 3]))\n */\nexport function encodeLease(lease?: string | Uint8Array): Uint8Array | undefined {\n if (lease === null || typeof lease === 'undefined') {\n return undefined\n } else if (typeof lease === 'object' && lease.constructor === Uint8Array) {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received bytes with length ${lease.length}`,\n )\n }\n if (lease.length === 32) return lease\n const lease32 = new Uint8Array(32)\n lease32.set(lease, 0)\n return lease32\n } else if (typeof lease === 'string') {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received '${lease}' with length ${lease.length}`,\n )\n }\n const encoder = new TextEncoder()\n const lease32 = new Uint8Array(32)\n lease32.set(encoder.encode(lease), 0)\n return lease32\n } else {\n throw new Error(`Unknown lease type received of ${typeof lease}`)\n }\n}\n\n/**\n * @deprecated Use `composer.build()` directly\n * Take an existing Transaction Composer and return a new one with the required\n * app call resources populated into it\n *\n * @param algod The algod client to use for the simulation\n * @param composer The composer containing the txn group\n * @returns A new composer with the resources populated into the transactions\n *\n * @privateRemarks\n *\n * This entire function will eventually be implemented in simulate upstream in algod. The simulate endpoint will return\n * an array of refference arrays for each transaction, so this eventually will eventually just call simulate and set the\n * reference arrays in the transactions to the reference arrays returned by simulate.\n *\n * See https://github.com/algorand/go-algorand/pull/5684\n *\n */\nexport async function populateAppCallResources(composer: TransactionComposer) {\n await composer.build()\n return composer\n}\n\n/**\n * @deprecated Use `composer.setMaxFees()` instead if you need to set max fees for transactions.\n * Use `composer.build()` instead if you need to build transactions with resource population.\n *\n * Take an existing Transaction Composer and return a new one with changes applied to the transactions\n * based on the supplied sendParams to prepare it for sending.\n *\n * @param composer The Transaction Composer containing the txn group\n * @param sendParams The send params for the transaction group\n * @param additionalContext Additional context used to determine how best to change the transactions in the group\n * @returns A new Transaction Composer with the changes applied\n *\n * @privateRemarks\n * Parts of this function will eventually be implemented in algod. Namely:\n * - Simulate will return information on how to populate reference arrays, see https://github.com/algorand/go-algorand/pull/6015\n */\nexport async function prepareGroupForSending(\n composer: TransactionComposer,\n sendParams: SendParams,\n additionalContext?: AdditionalTransactionComposerContext,\n) {\n const newComposer = composer.clone({\n coverAppCallInnerTransactionFees: sendParams.coverAppCallInnerTransactionFees ?? false,\n populateAppCallResources: sendParams.populateAppCallResources ?? true,\n })\n\n if (additionalContext?.maxFees) {\n newComposer.setMaxFees(additionalContext?.maxFees)\n }\n\n await newComposer.build()\n\n return newComposer\n}\n\n/**\n * @deprecated Use `composer.send()` directly\n * Signs and sends transactions that have been collected by an `TransactionComposer`.\n * @param atcSend The parameters controlling the send, including `atc` The `TransactionComposer` and params to control send behaviour\n * @param algod An algod client\n * @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)\n */\nexport const sendTransactionComposer = async function (atcSend: TransactionComposerToSend): Promise<SendTransactionComposerResults> {\n const { transactionComposer: givenComposer, ...executeParams } = atcSend\n\n return atcSend.transactionComposer.send({\n ...executeParams,\n })\n}\n\n/**\n * Wait until the transaction is confirmed or rejected, or until `timeout`\n * number of rounds have passed.\n *\n * @param algod An algod client\n * @param transactionId The transaction ID to wait for\n * @param maxRoundsToWait Maximum number of rounds to wait\n *\n * @return Pending transaction information\n * @throws Throws an error if the transaction is not confirmed or rejected in the next `timeout` rounds\n */\nexport const waitForConfirmation = async function (\n transactionId: string,\n maxRoundsToWait: number | bigint,\n algod: AlgodClient,\n): Promise<PendingTransactionResponse> {\n if (maxRoundsToWait < 0) {\n throw new Error(`Invalid timeout, received ${maxRoundsToWait}, expected > 0`)\n }\n\n // Get current round\n const status = await algod.status()\n if (status === undefined) {\n throw new Error('Unable to get node status')\n }\n\n // Loop for up to `timeout` rounds looking for a confirmed transaction\n const startRound = BigInt(status.lastRound) + 1n\n let currentRound = startRound\n while (currentRound < startRound + BigInt(maxRoundsToWait)) {\n try {\n const pendingInfo = await algod.pendingTransactionInformation(transactionId)\n\n if (pendingInfo !== undefined) {\n const confirmedRound = pendingInfo.confirmedRound\n if (confirmedRound && confirmedRound > 0) {\n return pendingInfo\n } else {\n const poolError = pendingInfo.poolError\n if (poolError != null && poolError.length > 0) {\n // If there was a pool error, then the transaction has been rejected!\n throw new Error(`Transaction ${transactionId} was rejected; pool error: ${poolError}`)\n }\n }\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (e: any) {\n if ('status' in e && e.status === 404) {\n currentRound++\n continue\n }\n }\n\n await algod.statusAfterBlock(toNumber(currentRound))\n currentRound++\n }\n\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ACA,OACqC;AACrC,KAAI,kBAAkB,EACpB,OAAM,IAAI,MAAM,6BAA6B,gBAAgB,gBAAgB;CAI/E,MAAM,SAAS,MAAM,MAAM,QAAQ;AACnC,KAAI,WAAW,OACb,OAAM,IAAI,MAAM,4BAA4B;CAI9C,MAAM,aAAa,OAAO,OAAO,UAAU,GAAG;CAC9C,IAAI,eAAe;AACnB,QAAO,eAAe,aAAa,OAAO,gBAAgB,EAAE;AAC1D,MAAI;GACF,MAAM,cAAc,MAAM,MAAM,8BAA8B,cAAc;AAE5E,OAAI,gBAAgB,QAAW;IAC7B,MAAM,iBAAiB,YAAY;AACnC,QAAI,kBAAkB,iBAAiB,EACrC,QAAO;SACF;KACL,MAAM,YAAY,YAAY;AAC9B,SAAI,aAAa,QAAQ,UAAU,SAAS,EAE1C,OAAM,IAAI,MAAM,eAAe,cAAc,6BAA6B,YAAY;;;WAKrFA,GAAQ;AACf,OAAI,YAAY,KAAK,EAAE,WAAW,KAAK;AACrC;AACA;;;AAIJ,QAAM,MAAM,iBAAiB,SAAS,aAAa,CAAC;AACpD;;AAGF,OAAM,IAAI,MAAM,eAAe,cAAc,uBAAuB,gBAAgB,SAAS"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReadableAddress } from "../packages/common/src/address.js";
|
|
2
|
-
import {
|
|
2
|
+
import { OnApplicationComplete, ResourceReference } from "../packages/transact/src/transactions/app-call.js";
|
|
3
3
|
import { BoxIdentifier, BoxReference } from "../types/app-manager.js";
|
|
4
4
|
import { Expand } from "../types/expand.js";
|
|
5
5
|
import { CommonTransactionParams } from "./common.js";
|
|
@@ -26,12 +26,13 @@ type CommonAppCallParams = CommonTransactionParams & {
|
|
|
26
26
|
*/
|
|
27
27
|
boxReferences?: (BoxReference | BoxIdentifier)[];
|
|
28
28
|
/** Access references unifies `accountReferences`, `appReferences`, `assetReferences`, and `boxReferences` under a single list. If non-empty, these other reference lists must be empty. If access is empty, those other reference lists may be non-empty. */
|
|
29
|
-
accessReferences?:
|
|
30
|
-
/**
|
|
29
|
+
accessReferences?: ResourceReference[];
|
|
30
|
+
/** If set, the transaction will be rejected when the app's version is greater than or equal to this value. This can be used to prevent calling an app after it has been updated. Set to 0 or leave undefined to skip the version check. */
|
|
31
31
|
rejectVersion?: number;
|
|
32
32
|
};
|
|
33
33
|
/** Parameters to define an app create transaction */
|
|
34
34
|
type AppCreateParams = Expand<Omit<CommonAppCallParams, 'appId'> & {
|
|
35
|
+
appId?: 0;
|
|
35
36
|
onComplete?: Exclude<OnApplicationComplete, OnApplicationComplete.ClearState>;
|
|
36
37
|
/** The program to execute for all OnCompletes other than ClearState as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). */
|
|
37
38
|
approvalProgram: string | Uint8Array;
|
package/transactions/app-call.js
CHANGED
|
@@ -143,16 +143,16 @@ function populateGroupResources(transactions, groupResources) {
|
|
|
143
143
|
type: GroupResourceType.AppLocal,
|
|
144
144
|
data: appLocal
|
|
145
145
|
});
|
|
146
|
-
remainingAccounts = remainingAccounts.filter((acc) => acc !== appLocal.
|
|
147
|
-
remainingApps = remainingApps.filter((app) => app !== appLocal.
|
|
146
|
+
remainingAccounts = remainingAccounts.filter((acc) => acc !== appLocal.address);
|
|
147
|
+
remainingApps = remainingApps.filter((app) => app !== appLocal.appId);
|
|
148
148
|
});
|
|
149
149
|
if (groupResources.assetHoldings) groupResources.assetHoldings.forEach((assetHolding) => {
|
|
150
150
|
populateGroupResource(transactions, {
|
|
151
151
|
type: GroupResourceType.AssetHolding,
|
|
152
152
|
data: assetHolding
|
|
153
153
|
});
|
|
154
|
-
remainingAccounts = remainingAccounts.filter((acc) => acc !== assetHolding.
|
|
155
|
-
remainingAssets = remainingAssets.filter((asset) => asset !== assetHolding.
|
|
154
|
+
remainingAccounts = remainingAccounts.filter((acc) => acc !== assetHolding.address);
|
|
155
|
+
remainingAssets = remainingAssets.filter((asset) => asset !== assetHolding.assetId);
|
|
156
156
|
});
|
|
157
157
|
remainingAccounts.forEach((account) => {
|
|
158
158
|
populateGroupResource(transactions, {
|
|
@@ -164,11 +164,11 @@ function populateGroupResources(transactions, groupResources) {
|
|
|
164
164
|
populateGroupResource(transactions, {
|
|
165
165
|
type: GroupResourceType.Box,
|
|
166
166
|
data: {
|
|
167
|
-
appId: boxRef.
|
|
167
|
+
appId: boxRef.appId,
|
|
168
168
|
name: boxRef.name
|
|
169
169
|
}
|
|
170
170
|
});
|
|
171
|
-
remainingApps = remainingApps.filter((app) => app !== boxRef.
|
|
171
|
+
remainingApps = remainingApps.filter((app) => app !== boxRef.appId);
|
|
172
172
|
});
|
|
173
173
|
remainingAssets.forEach((asset) => {
|
|
174
174
|
populateGroupResource(transactions, {
|
|
@@ -201,7 +201,7 @@ function isAppCallBelowResourceLimit(txn) {
|
|
|
201
201
|
*/
|
|
202
202
|
function populateGroupResource(transactions, resource) {
|
|
203
203
|
if (resource.type === GroupResourceType.AssetHolding || resource.type === GroupResourceType.AppLocal) {
|
|
204
|
-
const address = resource.data.
|
|
204
|
+
const address = resource.data.address;
|
|
205
205
|
const groupIndex1 = transactions.findIndex((txn) => {
|
|
206
206
|
if (!isAppCallBelowResourceLimit(txn)) return false;
|
|
207
207
|
const appCall$1 = txn.appCall;
|
|
@@ -216,10 +216,10 @@ function populateGroupResource(transactions, resource) {
|
|
|
216
216
|
const appCall$1 = transactions[groupIndex1].appCall;
|
|
217
217
|
if (resource.type === GroupResourceType.AssetHolding) {
|
|
218
218
|
appCall$1.assetReferences = appCall$1.assetReferences ?? [];
|
|
219
|
-
if (!appCall$1.assetReferences.includes(resource.data.
|
|
219
|
+
if (!appCall$1.assetReferences.includes(resource.data.assetId)) appCall$1.assetReferences.push(resource.data.assetId);
|
|
220
220
|
} else {
|
|
221
221
|
appCall$1.appReferences = appCall$1.appReferences ?? [];
|
|
222
|
-
if (!appCall$1.appReferences.includes(resource.data.
|
|
222
|
+
if (!appCall$1.appReferences.includes(resource.data.appId)) appCall$1.appReferences.push(resource.data.appId);
|
|
223
223
|
}
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
@@ -227,8 +227,8 @@ function populateGroupResource(transactions, resource) {
|
|
|
227
227
|
if (!isAppCallBelowResourceLimit(txn)) return false;
|
|
228
228
|
const appCall$1 = txn.appCall;
|
|
229
229
|
if ((appCall$1.accountReferences?.length ?? 0) >= require_constants.MAX_ACCOUNT_REFERENCES) return false;
|
|
230
|
-
if (resource.type === GroupResourceType.AssetHolding) return appCall$1.assetReferences?.includes(resource.data.
|
|
231
|
-
else return appCall$1.appReferences?.includes(resource.data.
|
|
230
|
+
if (resource.type === GroupResourceType.AssetHolding) return appCall$1.assetReferences?.includes(resource.data.assetId) || false;
|
|
231
|
+
else return appCall$1.appReferences?.includes(resource.data.appId) || appCall$1.appId === resource.data.appId;
|
|
232
232
|
});
|
|
233
233
|
if (groupIndex2 !== -1) {
|
|
234
234
|
const appCall$1 = transactions[groupIndex2].appCall;
|
|
@@ -303,16 +303,16 @@ function populateGroupResource(transactions, resource) {
|
|
|
303
303
|
break;
|
|
304
304
|
case GroupResourceType.AssetHolding: {
|
|
305
305
|
appCall.assetReferences = appCall.assetReferences ?? [];
|
|
306
|
-
if (!appCall.assetReferences.includes(resource.data.
|
|
307
|
-
const address = resource.data.
|
|
306
|
+
if (!appCall.assetReferences.includes(resource.data.assetId)) appCall.assetReferences.push(resource.data.assetId);
|
|
307
|
+
const address = resource.data.address;
|
|
308
308
|
appCall.accountReferences = appCall.accountReferences ?? [];
|
|
309
309
|
if (!appCall.accountReferences.some((a) => a.equals(address))) appCall.accountReferences.push(address);
|
|
310
310
|
break;
|
|
311
311
|
}
|
|
312
312
|
case GroupResourceType.AppLocal: {
|
|
313
313
|
appCall.appReferences = appCall.appReferences ?? [];
|
|
314
|
-
if (!appCall.appReferences.includes(resource.data.
|
|
315
|
-
const address = resource.data.
|
|
314
|
+
if (!appCall.appReferences.includes(resource.data.appId)) appCall.appReferences.push(resource.data.appId);
|
|
315
|
+
const address = resource.data.address;
|
|
316
316
|
appCall.accountReferences = appCall.accountReferences ?? [];
|
|
317
317
|
if (!appCall.accountReferences.some((a) => a.equals(address))) appCall.accountReferences.push(address);
|
|
318
318
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-call.js","names":["buildTransactionCommonData","calculateExtraProgramPages","Transaction","TransactionType","OnApplicationComplete","getAddress","AppManager","MAX_OVERALL_REFERENCES","appCall","getApplicationAddress","MAX_ACCOUNT_REFERENCES","groupIndex"],"sources":["../../src/transactions/app-call.ts"],"sourcesContent":["import {\n ApplicationLocalReference,\n AssetHoldingReference,\n SimulateUnnamedResourcesAccessed,\n SuggestedParams,\n} from '@algorandfoundation/algokit-algod-client'\nimport {\n Address,\n MAX_ACCOUNT_REFERENCES,\n MAX_OVERALL_REFERENCES,\n ReadableAddress,\n getAddress,\n getApplicationAddress,\n} from '@algorandfoundation/algokit-common'\nimport {\n AccessReference,\n OnApplicationComplete,\n BoxReference as TransactBoxReference,\n Transaction,\n TransactionType,\n} from '@algorandfoundation/algokit-transact'\nimport { AppManager, BoxIdentifier, BoxReference as UtilsBoxReference } from '../types/app-manager'\nimport { Expand } from '../types/expand'\nimport { calculateExtraProgramPages } from '../util'\nimport { CommonTransactionParams, buildTransactionCommonData } from './common'\n\n/** Common parameters for defining an application call transaction. */\nexport type CommonAppCallParams = CommonTransactionParams & {\n /** ID of the application; 0 if the application is being created. */\n appId: bigint\n /** The [on-complete](https://dev.algorand.co/concepts/smart-contracts/avm#oncomplete) action of the call; defaults to no-op. */\n onComplete?: OnApplicationComplete\n /** Any [arguments to pass to the smart contract call](/concepts/smart-contracts/languages/teal/#argument-passing). */\n args?: Uint8Array[]\n /** Any account addresses to add to the [accounts array](https://dev.algorand.co/concepts/smart-contracts/resource-usage#what-are-reference-arrays). */\n accountReferences?: ReadableAddress[]\n /** The ID of any apps to load to the [foreign apps array](https://dev.algorand.co/concepts/smart-contracts/resource-usage#what-are-reference-arrays). */\n appReferences?: bigint[]\n /** The ID of any assets to load to the [foreign assets array](https://dev.algorand.co/concepts/smart-contracts/resource-usage#what-are-reference-arrays). */\n assetReferences?: bigint[]\n /** Any boxes to load to the [boxes array](https://dev.algorand.co/concepts/smart-contracts/resource-usage#what-are-reference-arrays).\n *\n * Either the name identifier (which will be set against app ID of `0` i.e.\n * the current app), or a box identifier with the name identifier and app ID.\n */\n boxReferences?: (UtilsBoxReference | BoxIdentifier)[]\n /** Access references unifies `accountReferences`, `appReferences`, `assetReferences`, and `boxReferences` under a single list. If non-empty, these other reference lists must be empty. If access is empty, those other reference lists may be non-empty. */\n accessReferences?: AccessReference[]\n /** The lowest application version for which this transaction should immediately fail. 0 indicates that no version check should be performed. */\n rejectVersion?: number\n}\n\n/** Parameters to define an app create transaction */\nexport type AppCreateParams = Expand<\n Omit<CommonAppCallParams, 'appId'> & {\n onComplete?: Exclude<OnApplicationComplete, OnApplicationComplete.ClearState>\n /** The program to execute for all OnCompletes other than ClearState as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). */\n approvalProgram: string | Uint8Array\n /** The program to execute for ClearState OnComplete as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). */\n clearStateProgram: string | Uint8Array\n /** The state schema for the app. This is immutable once the app is created. */\n schema?: {\n /** The number of integers saved in global state. */\n globalInts: number\n /** The number of byte slices saved in global state. */\n globalByteSlices: number\n /** The number of integers saved in local state. */\n localInts: number\n /** The number of byte slices saved in local state. */\n localByteSlices: number\n }\n /** Number of extra pages required for the programs.\n * Defaults to the number needed for the programs in this call if not specified.\n * This is immutable once the app is created. */\n extraProgramPages?: number\n }\n>\n\n/** Parameters to define an app update transaction */\nexport type AppUpdateParams = Expand<\n CommonAppCallParams & {\n onComplete?: OnApplicationComplete.UpdateApplication\n /** The program to execute for all OnCompletes other than ClearState as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array)) */\n approvalProgram: string | Uint8Array\n /** The program to execute for ClearState OnComplete as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array)) */\n clearStateProgram: string | Uint8Array\n }\n>\n\n/** Parameters to define an application call transaction. */\nexport type AppCallParams = CommonAppCallParams & {\n onComplete?: Exclude<OnApplicationComplete, OnApplicationComplete.UpdateApplication>\n}\n\n/** Common parameters to define an ABI method call transaction. */\nexport type AppMethodCallParams = CommonAppCallParams & {\n onComplete?: Exclude<OnApplicationComplete, OnApplicationComplete.UpdateApplication | OnApplicationComplete.ClearState>\n}\n\n/** Parameters to define an application delete call transaction. */\nexport type AppDeleteParams = CommonAppCallParams & {\n onComplete?: OnApplicationComplete.DeleteApplication\n}\n\nexport const buildAppCreate = async (\n params: AppCreateParams,\n appManager: AppManager,\n suggestedParams: SuggestedParams,\n defaultValidityWindow: bigint,\n): Promise<Transaction> => {\n const commonData = buildTransactionCommonData(params, suggestedParams, defaultValidityWindow)\n const approvalProgram =\n typeof params.approvalProgram === 'string'\n ? (await appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes\n : params.approvalProgram\n const clearStateProgram =\n typeof params.clearStateProgram === 'string'\n ? (await appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes\n : params.clearStateProgram\n const globalStateSchema =\n params.schema?.globalByteSlices !== undefined || params.schema?.globalInts !== undefined\n ? {\n numByteSlices: params.schema?.globalByteSlices ?? 0,\n numUints: params.schema?.globalInts ?? 0,\n }\n : undefined\n const localStateSchema =\n params.schema?.localByteSlices !== undefined || params.schema?.localInts !== undefined\n ? {\n numByteSlices: params.schema?.localByteSlices ?? 0,\n numUints: params.schema?.localInts ?? 0,\n }\n : undefined\n const extraProgramPages =\n params.extraProgramPages !== undefined ? params.extraProgramPages : calculateExtraProgramPages(approvalProgram!, clearStateProgram!)\n\n // If accessReferences is provided, we should not pass legacy foreign arrays\n const hasAccessReferences = params.accessReferences && params.accessReferences.length > 0\n\n return new Transaction({\n ...commonData,\n type: TransactionType.AppCall,\n appCall: {\n appId: 0n, // App creation always uses ID 0\n onComplete: params.onComplete ?? OnApplicationComplete.NoOp,\n approvalProgram: approvalProgram,\n clearStateProgram: clearStateProgram,\n globalStateSchema: globalStateSchema,\n localStateSchema: localStateSchema,\n extraProgramPages: extraProgramPages,\n args: params.args,\n ...(hasAccessReferences\n ? { accessReferences: params.accessReferences }\n : {\n accountReferences: params.accountReferences?.map((a) => getAddress(a)),\n appReferences: params.appReferences,\n assetReferences: params.assetReferences,\n boxReferences: params.boxReferences?.map(AppManager.getBoxReference),\n }),\n rejectVersion: params.rejectVersion,\n },\n })\n}\n\nexport const buildAppUpdate = async (\n params: AppUpdateParams,\n appManager: AppManager,\n suggestedParams: SuggestedParams,\n defaultValidityWindow: bigint,\n): Promise<Transaction> => {\n const commonData = buildTransactionCommonData(params, suggestedParams, defaultValidityWindow)\n const approvalProgram =\n typeof params.approvalProgram === 'string'\n ? (await appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes\n : params.approvalProgram\n const clearStateProgram =\n typeof params.clearStateProgram === 'string'\n ? (await appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes\n : params.clearStateProgram\n\n // If accessReferences is provided, we should not pass legacy foreign arrays\n const hasAccessReferences = params.accessReferences && params.accessReferences.length > 0\n\n return new Transaction({\n ...commonData,\n type: TransactionType.AppCall,\n appCall: {\n appId: params.appId,\n onComplete: OnApplicationComplete.UpdateApplication,\n approvalProgram: approvalProgram,\n clearStateProgram: clearStateProgram,\n args: params.args,\n ...(hasAccessReferences\n ? { accessReferences: params.accessReferences }\n : {\n accountReferences: params.accountReferences?.map((a) => getAddress(a)),\n appReferences: params.appReferences,\n assetReferences: params.assetReferences,\n boxReferences: params.boxReferences?.map(AppManager.getBoxReference),\n }),\n rejectVersion: params.rejectVersion,\n },\n })\n}\n\nexport const buildAppCall = (\n params: AppCallParams | AppDeleteParams,\n suggestedParams: SuggestedParams,\n defaultValidityWindow: bigint,\n): Transaction => {\n const commonData = buildTransactionCommonData(params, suggestedParams, defaultValidityWindow)\n // If accessReferences is provided, we should not pass legacy foreign arrays\n const hasAccessReferences = params.accessReferences && params.accessReferences.length > 0\n\n return new Transaction({\n ...commonData,\n type: TransactionType.AppCall,\n appCall: {\n appId: params.appId,\n onComplete: params.onComplete ?? OnApplicationComplete.NoOp,\n args: params.args,\n ...(hasAccessReferences\n ? { accessReferences: params.accessReferences }\n : {\n accountReferences: params.accountReferences?.map((a) => getAddress(a)),\n appReferences: params.appReferences,\n assetReferences: params.assetReferences,\n boxReferences: params.boxReferences?.map(AppManager.getBoxReference),\n }),\n rejectVersion: params.rejectVersion,\n },\n })\n}\n\n/**\n * Populate transaction-level resources for app call transactions\n */\nexport function populateTransactionResources(\n transaction: Transaction, // NOTE: transaction is mutated in place\n resourcesAccessed: SimulateUnnamedResourcesAccessed,\n groupIndex: number,\n): void {\n if (transaction.type !== TransactionType.AppCall || transaction.appCall === undefined) {\n return\n }\n\n // Check for unexpected resources at transaction level\n if (resourcesAccessed.boxes || resourcesAccessed.extraBoxRefs) {\n throw new Error('Unexpected boxes at the transaction level')\n }\n if (resourcesAccessed.appLocals) {\n throw new Error('Unexpected app locals at the transaction level')\n }\n if (resourcesAccessed.assetHoldings) {\n throw new Error('Unexpected asset holdings at the transaction level')\n }\n\n let accountsCount = 0\n let appsCount = 0\n let assetsCount = 0\n const boxesCount = transaction.appCall.boxReferences?.length ?? 0\n\n // Populate accounts\n if (resourcesAccessed.accounts) {\n transaction.appCall.accountReferences = transaction.appCall.accountReferences ?? []\n for (const account of resourcesAccessed.accounts) {\n const address = account\n if (!transaction.appCall.accountReferences.some((a) => a.equals(address))) {\n transaction.appCall.accountReferences.push(address)\n }\n }\n accountsCount = transaction.appCall.accountReferences.length\n }\n\n // Populate apps\n if (resourcesAccessed.apps) {\n transaction.appCall.appReferences = transaction.appCall.appReferences ?? []\n for (const appId of resourcesAccessed.apps) {\n if (!transaction.appCall.appReferences.includes(appId)) {\n transaction.appCall.appReferences.push(appId)\n }\n }\n appsCount = transaction.appCall.appReferences.length\n }\n\n // Populate assets\n if (resourcesAccessed.assets) {\n transaction.appCall.assetReferences = transaction.appCall.assetReferences ?? []\n for (const assetId of resourcesAccessed.assets) {\n if (!transaction.appCall.assetReferences.includes(assetId)) {\n transaction.appCall.assetReferences.push(assetId)\n }\n }\n assetsCount = transaction.appCall.assetReferences.length\n }\n\n if (accountsCount + assetsCount + appsCount + boxesCount > MAX_OVERALL_REFERENCES) {\n throw new Error(`Resource reference limit of ${MAX_OVERALL_REFERENCES} exceeded in transaction ${groupIndex}`)\n }\n}\n\nenum GroupResourceType {\n Account,\n App,\n Asset,\n Box,\n ExtraBoxRef,\n AssetHolding,\n AppLocal,\n}\n\n/**\n * Populate group-level resources for app call transactions\n */\nexport function populateGroupResources(\n transactions: Transaction[], // NOTE: transactions are mutated in place\n groupResources: SimulateUnnamedResourcesAccessed,\n): void {\n let remainingAccounts = [...(groupResources.accounts ?? [])]\n let remainingApps = [...(groupResources.apps ?? [])]\n let remainingAssets = [...(groupResources.assets ?? [])]\n const remainingBoxes = [...(groupResources.boxes ?? [])]\n\n // Process cross-reference resources first (app locals and asset holdings) as they are most restrictive\n if (groupResources.appLocals) {\n groupResources.appLocals.forEach((appLocal) => {\n populateGroupResource(transactions, { type: GroupResourceType.AppLocal, data: appLocal })\n // Remove resources from remaining if we're adding them here\n remainingAccounts = remainingAccounts.filter((acc) => acc !== appLocal.account)\n remainingApps = remainingApps.filter((app) => app !== appLocal.app)\n })\n }\n\n if (groupResources.assetHoldings) {\n groupResources.assetHoldings.forEach((assetHolding) => {\n populateGroupResource(transactions, { type: GroupResourceType.AssetHolding, data: assetHolding })\n // Remove resources from remaining if we're adding them here\n remainingAccounts = remainingAccounts.filter((acc) => acc !== assetHolding.account)\n remainingAssets = remainingAssets.filter((asset) => asset !== assetHolding.asset)\n })\n }\n\n // Process accounts next because account limit is 4\n remainingAccounts.forEach((account) => {\n populateGroupResource(transactions, { type: GroupResourceType.Account, data: account })\n })\n\n // Process boxes\n remainingBoxes.forEach((boxRef) => {\n populateGroupResource(transactions, {\n type: GroupResourceType.Box,\n data: {\n appId: boxRef.app,\n name: boxRef.name,\n },\n })\n // Remove apps as resource if we're adding it here\n remainingApps = remainingApps.filter((app) => app !== boxRef.app)\n })\n\n // Process assets\n remainingAssets.forEach((asset) => {\n populateGroupResource(transactions, { type: GroupResourceType.Asset, data: asset })\n })\n\n // Process remaining apps\n remainingApps.forEach((app) => {\n populateGroupResource(transactions, { type: GroupResourceType.App, data: app })\n })\n\n // Handle extra box refs\n if (groupResources.extraBoxRefs) {\n for (let i = 0; i < groupResources.extraBoxRefs; i++) {\n populateGroupResource(transactions, { type: GroupResourceType.ExtraBoxRef })\n }\n }\n}\n\n/**\n * Helper function to check if an app call transaction is below resource limit\n */\nfunction isAppCallBelowResourceLimit(txn: Transaction): boolean {\n if (txn.type !== TransactionType.AppCall) {\n return false\n }\n if (txn.appCall?.accessReferences?.length) {\n return false\n }\n\n const accountsCount = txn.appCall?.accountReferences?.length || 0\n const assetsCount = txn.appCall?.assetReferences?.length || 0\n const appsCount = txn.appCall?.appReferences?.length || 0\n const boxesCount = txn.appCall?.boxReferences?.length || 0\n\n return accountsCount + assetsCount + appsCount + boxesCount < MAX_OVERALL_REFERENCES\n}\n\ntype GroupResourceToPopulate =\n | { type: GroupResourceType.Account; data: Address }\n | { type: GroupResourceType.App; data: bigint }\n | { type: GroupResourceType.Asset; data: bigint }\n | { type: GroupResourceType.Box; data: TransactBoxReference }\n | { type: GroupResourceType.ExtraBoxRef }\n | { type: GroupResourceType.AssetHolding; data: AssetHoldingReference }\n | { type: GroupResourceType.AppLocal; data: ApplicationLocalReference }\n\n/**\n * Helper function to populate a specific resource into a transaction group\n */\nfunction populateGroupResource(\n transactions: Transaction[], // NOTE: transactions are mutated in place\n resource: GroupResourceToPopulate,\n): void {\n // For asset holdings and app locals, first try to find a transaction that already has the account available\n if (resource.type === GroupResourceType.AssetHolding || resource.type === GroupResourceType.AppLocal) {\n const address = resource.data.account\n\n // Try to find a transaction that already has the account available\n const groupIndex1 = transactions.findIndex((txn) => {\n if (!isAppCallBelowResourceLimit(txn)) {\n return false\n }\n\n const appCall = txn.appCall!\n\n // Check if account is in foreign accounts array\n if (appCall.accountReferences?.some((a) => a.equals(address))) {\n return true\n }\n\n // Check if account is available as an app account\n if (appCall.appReferences) {\n for (const appId of appCall.appReferences) {\n if (address === getApplicationAddress(appId)) {\n return true\n }\n }\n }\n\n // Check if account appears in any app call transaction fields\n if (txn.sender.equals(address)) {\n return true\n }\n\n return false\n })\n\n if (groupIndex1 !== -1) {\n const appCall = transactions[groupIndex1].appCall!\n if (resource.type === GroupResourceType.AssetHolding) {\n appCall.assetReferences = appCall.assetReferences ?? []\n if (!appCall.assetReferences.includes(resource.data.asset)) {\n appCall.assetReferences.push(resource.data.asset)\n }\n } else {\n appCall.appReferences = appCall.appReferences ?? []\n if (!appCall.appReferences.includes(resource.data.app)) {\n appCall.appReferences.push(resource.data.app)\n }\n }\n return\n }\n\n // Try to find a transaction that has the asset/app available and space for account\n const groupIndex2 = transactions.findIndex((txn) => {\n if (!isAppCallBelowResourceLimit(txn)) {\n return false\n }\n\n const appCall = txn.appCall!\n if ((appCall.accountReferences?.length ?? 0) >= MAX_ACCOUNT_REFERENCES) {\n return false\n }\n\n if (resource.type === GroupResourceType.AssetHolding) {\n return appCall.assetReferences?.includes(resource.data.asset) || false\n } else {\n return appCall.appReferences?.includes(resource.data.app) || appCall.appId === resource.data.app\n }\n })\n\n if (groupIndex2 !== -1) {\n const appCall = transactions[groupIndex2].appCall!\n appCall.accountReferences = appCall.accountReferences ?? []\n if (!appCall.accountReferences.includes(address)) {\n appCall.accountReferences.push(address)\n }\n return\n }\n }\n\n // For boxes, first try to find a transaction that already has the app available\n if (resource.type === GroupResourceType.Box) {\n const groupIndex = transactions.findIndex((txn) => {\n if (!isAppCallBelowResourceLimit(txn)) {\n return false\n }\n\n const appCall = txn.appCall!\n return appCall.appReferences?.includes(resource.data.appId) || appCall.appId === resource.data.appId\n })\n\n if (groupIndex !== -1) {\n const appCall = transactions[groupIndex].appCall!\n appCall.boxReferences = appCall.boxReferences ?? []\n const exists = appCall.boxReferences.some(\n (b) =>\n b.appId === resource.data.appId &&\n b.name.length === resource.data.name.length &&\n b.name.every((byte, i) => byte === resource.data.name[i]),\n )\n if (!exists) {\n appCall.boxReferences.push({ appId: resource.data.appId, name: resource.data.name })\n }\n return\n }\n }\n\n // Find the first transaction that can accommodate the resource\n const groupIndex = transactions.findIndex((txn) => {\n if (txn.type !== TransactionType.AppCall) {\n return false\n }\n if (txn.appCall?.accessReferences?.length) {\n return false\n }\n\n const appCall = txn.appCall!\n const accountsCount = appCall.accountReferences?.length ?? 0\n const assetsCount = appCall.assetReferences?.length ?? 0\n const appsCount = appCall.appReferences?.length ?? 0\n const boxesCount = appCall.boxReferences?.length ?? 0\n\n switch (resource.type) {\n case GroupResourceType.Account:\n return accountsCount + assetsCount + appsCount + boxesCount < MAX_OVERALL_REFERENCES\n case GroupResourceType.AssetHolding:\n case GroupResourceType.AppLocal:\n return accountsCount + assetsCount + appsCount + boxesCount < MAX_OVERALL_REFERENCES - 1\n case GroupResourceType.Box:\n if (resource.data.appId !== 0n) {\n return accountsCount + assetsCount + appsCount + boxesCount < MAX_OVERALL_REFERENCES - 1\n } else {\n return accountsCount + assetsCount + appsCount + boxesCount < MAX_OVERALL_REFERENCES\n }\n default:\n return accountsCount + assetsCount + appsCount + boxesCount < MAX_OVERALL_REFERENCES\n }\n })\n\n if (groupIndex === -1) {\n throw new Error('No more transactions below reference limit. Add another app call to the group.')\n }\n\n const appCall = transactions[groupIndex].appCall!\n\n switch (resource.type) {\n case GroupResourceType.Account: {\n appCall.accountReferences = appCall.accountReferences ?? []\n const address = resource.data\n if (!appCall.accountReferences.some((a) => a.equals(address))) {\n appCall.accountReferences.push(address)\n }\n break\n }\n case GroupResourceType.App:\n appCall.appReferences = appCall.appReferences ?? []\n if (!appCall.appReferences.includes(resource.data)) {\n appCall.appReferences.push(resource.data)\n }\n break\n case GroupResourceType.Box: {\n appCall.boxReferences = appCall.boxReferences ?? []\n const exists = appCall.boxReferences.some(\n (b) =>\n b.appId === resource.data.appId &&\n b.name.length === resource.data.name.length &&\n b.name.every((byte, i) => byte === resource.data.name[i]),\n )\n if (!exists) {\n appCall.boxReferences.push({ appId: resource.data.appId, name: resource.data.name })\n }\n if (resource.data.appId !== 0n) {\n appCall.appReferences = appCall.appReferences ?? []\n if (!appCall.appReferences.includes(resource.data.appId)) {\n appCall.appReferences.push(resource.data.appId)\n }\n }\n break\n }\n case GroupResourceType.ExtraBoxRef:\n appCall.boxReferences = appCall.boxReferences ?? []\n appCall.boxReferences.push({ appId: 0n, name: new Uint8Array(0) })\n break\n case GroupResourceType.AssetHolding: {\n appCall.assetReferences = appCall.assetReferences ?? []\n if (!appCall.assetReferences.includes(resource.data.asset)) {\n appCall.assetReferences.push(resource.data.asset)\n }\n const address = resource.data.account\n appCall.accountReferences = appCall.accountReferences ?? []\n if (!appCall.accountReferences.some((a) => a.equals(address))) {\n appCall.accountReferences.push(address)\n }\n break\n }\n case GroupResourceType.AppLocal: {\n appCall.appReferences = appCall.appReferences ?? []\n if (!appCall.appReferences.includes(resource.data.app)) {\n appCall.appReferences.push(resource.data.app)\n }\n const address = resource.data.account\n appCall.accountReferences = appCall.accountReferences ?? []\n if (!appCall.accountReferences.some((a) => a.equals(address))) {\n appCall.accountReferences.push(address)\n }\n break\n }\n case GroupResourceType.Asset:\n appCall.assetReferences = appCall.assetReferences ?? []\n if (!appCall.assetReferences.includes(resource.data)) {\n appCall.assetReferences.push(resource.data)\n }\n break\n }\n}\n"],"mappings":";;;;;;;;;;AAwGA,MAAa,iBAAiB,OAC5B,QACA,YACA,iBACA,0BACyB;CACzB,MAAM,aAAaA,0CAA2B,QAAQ,iBAAiB,sBAAsB;CAC7F,MAAM,kBACJ,OAAO,OAAO,oBAAoB,YAC7B,MAAM,WAAW,YAAY,OAAO,gBAAgB,EAAE,wBACvD,OAAO;CACb,MAAM,oBACJ,OAAO,OAAO,sBAAsB,YAC/B,MAAM,WAAW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ClD,SAAQ,gBAAgB,KAAK,SAAS,KAAK;AAE7C"}
|
|
1
|
+
{"version":3,"file":"app-call.js","names":["buildTransactionCommonData","calculateExtraProgramPages","Transaction","TransactionType","OnApplicationComplete","getAddress","AppManager","MAX_OVERALL_REFERENCES","appCall","getApplicationAddress","MAX_ACCOUNT_REFERENCES","groupIndex"],"sources":["../../src/transactions/app-call.ts"],"sourcesContent":["import { SimulateUnnamedResourcesAccessed, SuggestedParams } from '@algorandfoundation/algokit-algod-client'\nimport {\n Address,\n MAX_ACCOUNT_REFERENCES,\n MAX_OVERALL_REFERENCES,\n ReadableAddress,\n getAddress,\n getApplicationAddress,\n} from '@algorandfoundation/algokit-common'\nimport {\n HoldingReference,\n LocalsReference,\n OnApplicationComplete,\n ResourceReference,\n BoxReference as TransactBoxReference,\n Transaction,\n TransactionType,\n} from '@algorandfoundation/algokit-transact'\nimport { AppManager, BoxIdentifier, BoxReference as UtilsBoxReference } from '../types/app-manager'\nimport { Expand } from '../types/expand'\nimport { calculateExtraProgramPages } from '../util'\nimport { CommonTransactionParams, buildTransactionCommonData } from './common'\n\n/** Common parameters for defining an application call transaction. */\nexport type CommonAppCallParams = CommonTransactionParams & {\n /** ID of the application; 0 if the application is being created. */\n appId: bigint\n /** The [on-complete](https://dev.algorand.co/concepts/smart-contracts/avm#oncomplete) action of the call; defaults to no-op. */\n onComplete?: OnApplicationComplete\n /** Any [arguments to pass to the smart contract call](/concepts/smart-contracts/languages/teal/#argument-passing). */\n args?: Uint8Array[]\n /** Any account addresses to add to the [accounts array](https://dev.algorand.co/concepts/smart-contracts/resource-usage#what-are-reference-arrays). */\n accountReferences?: ReadableAddress[]\n /** The ID of any apps to load to the [foreign apps array](https://dev.algorand.co/concepts/smart-contracts/resource-usage#what-are-reference-arrays). */\n appReferences?: bigint[]\n /** The ID of any assets to load to the [foreign assets array](https://dev.algorand.co/concepts/smart-contracts/resource-usage#what-are-reference-arrays). */\n assetReferences?: bigint[]\n /** Any boxes to load to the [boxes array](https://dev.algorand.co/concepts/smart-contracts/resource-usage#what-are-reference-arrays).\n *\n * Either the name identifier (which will be set against app ID of `0` i.e.\n * the current app), or a box identifier with the name identifier and app ID.\n */\n boxReferences?: (UtilsBoxReference | BoxIdentifier)[]\n /** Access references unifies `accountReferences`, `appReferences`, `assetReferences`, and `boxReferences` under a single list. If non-empty, these other reference lists must be empty. If access is empty, those other reference lists may be non-empty. */\n accessReferences?: ResourceReference[]\n /** If set, the transaction will be rejected when the app's version is greater than or equal to this value. This can be used to prevent calling an app after it has been updated. Set to 0 or leave undefined to skip the version check. */\n rejectVersion?: number\n}\n\n/** Parameters to define an app create transaction */\nexport type AppCreateParams = Expand<\n Omit<CommonAppCallParams, 'appId'> & {\n appId?: 0\n onComplete?: Exclude<OnApplicationComplete, OnApplicationComplete.ClearState>\n /** The program to execute for all OnCompletes other than ClearState as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). */\n approvalProgram: string | Uint8Array\n /** The program to execute for ClearState OnComplete as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). */\n clearStateProgram: string | Uint8Array\n /** The state schema for the app. This is immutable once the app is created. */\n schema?: {\n /** The number of integers saved in global state. */\n globalInts: number\n /** The number of byte slices saved in global state. */\n globalByteSlices: number\n /** The number of integers saved in local state. */\n localInts: number\n /** The number of byte slices saved in local state. */\n localByteSlices: number\n }\n /** Number of extra pages required for the programs.\n * Defaults to the number needed for the programs in this call if not specified.\n * This is immutable once the app is created. */\n extraProgramPages?: number\n }\n>\n\n/** Parameters to define an app update transaction */\nexport type AppUpdateParams = Expand<\n CommonAppCallParams & {\n onComplete?: OnApplicationComplete.UpdateApplication\n /** The program to execute for all OnCompletes other than ClearState as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array)) */\n approvalProgram: string | Uint8Array\n /** The program to execute for ClearState OnComplete as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array)) */\n clearStateProgram: string | Uint8Array\n }\n>\n\n/** Parameters to define an application call transaction. */\nexport type AppCallParams = CommonAppCallParams & { onComplete?: Exclude<OnApplicationComplete, OnApplicationComplete.UpdateApplication> }\n\n/** Common parameters to define an ABI method call transaction. */\nexport type AppMethodCallParams = CommonAppCallParams & {\n onComplete?: Exclude<OnApplicationComplete, OnApplicationComplete.UpdateApplication | OnApplicationComplete.ClearState>\n}\n\n/** Parameters to define an application delete call transaction. */\nexport type AppDeleteParams = CommonAppCallParams & { onComplete?: OnApplicationComplete.DeleteApplication }\n\nexport const buildAppCreate = async (\n params: AppCreateParams,\n appManager: AppManager,\n suggestedParams: SuggestedParams,\n defaultValidityWindow: bigint,\n): Promise<Transaction> => {\n const commonData = buildTransactionCommonData(params, suggestedParams, defaultValidityWindow)\n const approvalProgram =\n typeof params.approvalProgram === 'string'\n ? (await appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes\n : params.approvalProgram\n const clearStateProgram =\n typeof params.clearStateProgram === 'string'\n ? (await appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes\n : params.clearStateProgram\n const globalStateSchema =\n params.schema?.globalByteSlices !== undefined || params.schema?.globalInts !== undefined\n ? { numByteSlices: params.schema?.globalByteSlices ?? 0, numUints: params.schema?.globalInts ?? 0 }\n : undefined\n const localStateSchema =\n params.schema?.localByteSlices !== undefined || params.schema?.localInts !== undefined\n ? { numByteSlices: params.schema?.localByteSlices ?? 0, numUints: params.schema?.localInts ?? 0 }\n : undefined\n const extraProgramPages =\n params.extraProgramPages !== undefined ? params.extraProgramPages : calculateExtraProgramPages(approvalProgram!, clearStateProgram!)\n\n // If accessReferences is provided, we should not pass legacy foreign arrays\n const hasAccessReferences = params.accessReferences && params.accessReferences.length > 0\n\n return new Transaction({\n ...commonData,\n type: TransactionType.AppCall,\n appCall: {\n appId: 0n, // App creation always uses ID 0\n onComplete: params.onComplete ?? OnApplicationComplete.NoOp,\n approvalProgram: approvalProgram,\n clearStateProgram: clearStateProgram,\n globalStateSchema: globalStateSchema,\n localStateSchema: localStateSchema,\n extraProgramPages: extraProgramPages,\n args: params.args,\n ...(hasAccessReferences\n ? { accessReferences: params.accessReferences }\n : {\n accountReferences: params.accountReferences?.map((a) => getAddress(a)),\n appReferences: params.appReferences,\n assetReferences: params.assetReferences,\n boxReferences: params.boxReferences?.map(AppManager.getBoxReference),\n }),\n rejectVersion: params.rejectVersion,\n },\n })\n}\n\nexport const buildAppUpdate = async (\n params: AppUpdateParams,\n appManager: AppManager,\n suggestedParams: SuggestedParams,\n defaultValidityWindow: bigint,\n): Promise<Transaction> => {\n const commonData = buildTransactionCommonData(params, suggestedParams, defaultValidityWindow)\n const approvalProgram =\n typeof params.approvalProgram === 'string'\n ? (await appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes\n : params.approvalProgram\n const clearStateProgram =\n typeof params.clearStateProgram === 'string'\n ? (await appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes\n : params.clearStateProgram\n\n // If accessReferences is provided, we should not pass legacy foreign arrays\n const hasAccessReferences = params.accessReferences && params.accessReferences.length > 0\n\n return new Transaction({\n ...commonData,\n type: TransactionType.AppCall,\n appCall: {\n appId: params.appId,\n onComplete: OnApplicationComplete.UpdateApplication,\n approvalProgram: approvalProgram,\n clearStateProgram: clearStateProgram,\n args: params.args,\n ...(hasAccessReferences\n ? { accessReferences: params.accessReferences }\n : {\n accountReferences: params.accountReferences?.map((a) => getAddress(a)),\n appReferences: params.appReferences,\n assetReferences: params.assetReferences,\n boxReferences: params.boxReferences?.map(AppManager.getBoxReference),\n }),\n rejectVersion: params.rejectVersion,\n },\n })\n}\n\nexport const buildAppCall = (\n params: AppCallParams | AppDeleteParams,\n suggestedParams: SuggestedParams,\n defaultValidityWindow: bigint,\n): Transaction => {\n const commonData = buildTransactionCommonData(params, suggestedParams, defaultValidityWindow)\n // If accessReferences is provided, we should not pass legacy foreign arrays\n const hasAccessReferences = params.accessReferences && params.accessReferences.length > 0\n\n return new Transaction({\n ...commonData,\n type: TransactionType.AppCall,\n appCall: {\n appId: params.appId,\n onComplete: params.onComplete ?? OnApplicationComplete.NoOp,\n args: params.args,\n ...(hasAccessReferences\n ? { accessReferences: params.accessReferences }\n : {\n accountReferences: params.accountReferences?.map((a) => getAddress(a)),\n appReferences: params.appReferences,\n assetReferences: params.assetReferences,\n boxReferences: params.boxReferences?.map(AppManager.getBoxReference),\n }),\n rejectVersion: params.rejectVersion,\n },\n })\n}\n\n/**\n * Populate transaction-level resources for app call transactions\n */\nexport function populateTransactionResources(\n transaction: Transaction, // NOTE: transaction is mutated in place\n resourcesAccessed: SimulateUnnamedResourcesAccessed,\n groupIndex: number,\n): void {\n if (transaction.type !== TransactionType.AppCall || transaction.appCall === undefined) {\n return\n }\n\n // Check for unexpected resources at transaction level\n if (resourcesAccessed.boxes || resourcesAccessed.extraBoxRefs) {\n throw new Error('Unexpected boxes at the transaction level')\n }\n if (resourcesAccessed.appLocals) {\n throw new Error('Unexpected app locals at the transaction level')\n }\n if (resourcesAccessed.assetHoldings) {\n throw new Error('Unexpected asset holdings at the transaction level')\n }\n\n let accountsCount = 0\n let appsCount = 0\n let assetsCount = 0\n const boxesCount = transaction.appCall.boxReferences?.length ?? 0\n\n // Populate accounts\n if (resourcesAccessed.accounts) {\n transaction.appCall.accountReferences = transaction.appCall.accountReferences ?? []\n for (const account of resourcesAccessed.accounts) {\n const address = account\n if (!transaction.appCall.accountReferences.some((a) => a.equals(address))) {\n transaction.appCall.accountReferences.push(address)\n }\n }\n accountsCount = transaction.appCall.accountReferences.length\n }\n\n // Populate apps\n if (resourcesAccessed.apps) {\n transaction.appCall.appReferences = transaction.appCall.appReferences ?? []\n for (const appId of resourcesAccessed.apps) {\n if (!transaction.appCall.appReferences.includes(appId)) {\n transaction.appCall.appReferences.push(appId)\n }\n }\n appsCount = transaction.appCall.appReferences.length\n }\n\n // Populate assets\n if (resourcesAccessed.assets) {\n transaction.appCall.assetReferences = transaction.appCall.assetReferences ?? []\n for (const assetId of resourcesAccessed.assets) {\n if (!transaction.appCall.assetReferences.includes(assetId)) {\n transaction.appCall.assetReferences.push(assetId)\n }\n }\n assetsCount = transaction.appCall.assetReferences.length\n }\n\n if (accountsCount + assetsCount + appsCount + boxesCount > MAX_OVERALL_REFERENCES) {\n throw new Error(`Resource reference limit of ${MAX_OVERALL_REFERENCES} exceeded in transaction ${groupIndex}`)\n }\n}\n\nenum GroupResourceType {\n Account,\n App,\n Asset,\n Box,\n ExtraBoxRef,\n AssetHolding,\n AppLocal,\n}\n\n/**\n * Populate group-level resources for app call transactions\n */\nexport function populateGroupResources(\n transactions: Transaction[], // NOTE: transactions are mutated in place\n groupResources: SimulateUnnamedResourcesAccessed,\n): void {\n let remainingAccounts = [...(groupResources.accounts ?? [])]\n let remainingApps = [...(groupResources.apps ?? [])]\n let remainingAssets = [...(groupResources.assets ?? [])]\n const remainingBoxes = [...(groupResources.boxes ?? [])]\n\n // Process cross-reference resources first (app locals and asset holdings) as they are most restrictive\n if (groupResources.appLocals) {\n groupResources.appLocals.forEach((appLocal) => {\n populateGroupResource(transactions, { type: GroupResourceType.AppLocal, data: appLocal })\n // Remove resources from remaining if we're adding them here\n remainingAccounts = remainingAccounts.filter((acc) => acc !== appLocal.address)\n remainingApps = remainingApps.filter((app) => app !== appLocal.appId)\n })\n }\n\n if (groupResources.assetHoldings) {\n groupResources.assetHoldings.forEach((assetHolding) => {\n populateGroupResource(transactions, { type: GroupResourceType.AssetHolding, data: assetHolding })\n // Remove resources from remaining if we're adding them here\n remainingAccounts = remainingAccounts.filter((acc) => acc !== assetHolding.address)\n remainingAssets = remainingAssets.filter((asset) => asset !== assetHolding.assetId)\n })\n }\n\n // Process accounts next because account limit is 4\n remainingAccounts.forEach((account) => {\n populateGroupResource(transactions, { type: GroupResourceType.Account, data: account })\n })\n\n // Process boxes\n remainingBoxes.forEach((boxRef) => {\n populateGroupResource(transactions, { type: GroupResourceType.Box, data: { appId: boxRef.appId, name: boxRef.name } })\n // Remove apps as resource if we're adding it here\n remainingApps = remainingApps.filter((app) => app !== boxRef.appId)\n })\n\n // Process assets\n remainingAssets.forEach((asset) => {\n populateGroupResource(transactions, { type: GroupResourceType.Asset, data: asset })\n })\n\n // Process remaining apps\n remainingApps.forEach((app) => {\n populateGroupResource(transactions, { type: GroupResourceType.App, data: app })\n })\n\n // Handle extra box refs\n if (groupResources.extraBoxRefs) {\n for (let i = 0; i < groupResources.extraBoxRefs; i++) {\n populateGroupResource(transactions, { type: GroupResourceType.ExtraBoxRef })\n }\n }\n}\n\n/**\n * Helper function to check if an app call transaction is below resource limit\n */\nfunction isAppCallBelowResourceLimit(txn: Transaction): boolean {\n if (txn.type !== TransactionType.AppCall) {\n return false\n }\n if (txn.appCall?.accessReferences?.length) {\n return false\n }\n\n const accountsCount = txn.appCall?.accountReferences?.length || 0\n const assetsCount = txn.appCall?.assetReferences?.length || 0\n const appsCount = txn.appCall?.appReferences?.length || 0\n const boxesCount = txn.appCall?.boxReferences?.length || 0\n\n return accountsCount + assetsCount + appsCount + boxesCount < MAX_OVERALL_REFERENCES\n}\n\ntype GroupResourceToPopulate =\n | { type: GroupResourceType.Account; data: Address }\n | { type: GroupResourceType.App; data: bigint }\n | { type: GroupResourceType.Asset; data: bigint }\n | { type: GroupResourceType.Box; data: TransactBoxReference }\n | { type: GroupResourceType.ExtraBoxRef }\n | { type: GroupResourceType.AssetHolding; data: HoldingReference }\n | { type: GroupResourceType.AppLocal; data: LocalsReference }\n\n/**\n * Helper function to populate a specific resource into a transaction group\n */\nfunction populateGroupResource(\n transactions: Transaction[], // NOTE: transactions are mutated in place\n resource: GroupResourceToPopulate,\n): void {\n // For asset holdings and app locals, first try to find a transaction that already has the account available\n if (resource.type === GroupResourceType.AssetHolding || resource.type === GroupResourceType.AppLocal) {\n const address = resource.data.address\n\n // Try to find a transaction that already has the account available\n const groupIndex1 = transactions.findIndex((txn) => {\n if (!isAppCallBelowResourceLimit(txn)) {\n return false\n }\n\n const appCall = txn.appCall!\n\n // Check if account is in foreign accounts array\n if (appCall.accountReferences?.some((a) => a.equals(address))) {\n return true\n }\n\n // Check if account is available as an app account\n if (appCall.appReferences) {\n for (const appId of appCall.appReferences) {\n if (address === getApplicationAddress(appId)) {\n return true\n }\n }\n }\n\n // Check if account appears in any app call transaction fields\n if (txn.sender.equals(address)) {\n return true\n }\n\n return false\n })\n\n if (groupIndex1 !== -1) {\n const appCall = transactions[groupIndex1].appCall!\n if (resource.type === GroupResourceType.AssetHolding) {\n appCall.assetReferences = appCall.assetReferences ?? []\n if (!appCall.assetReferences.includes(resource.data.assetId)) {\n appCall.assetReferences.push(resource.data.assetId)\n }\n } else {\n appCall.appReferences = appCall.appReferences ?? []\n if (!appCall.appReferences.includes(resource.data.appId)) {\n appCall.appReferences.push(resource.data.appId)\n }\n }\n return\n }\n\n // Try to find a transaction that has the asset/app available and space for account\n const groupIndex2 = transactions.findIndex((txn) => {\n if (!isAppCallBelowResourceLimit(txn)) {\n return false\n }\n\n const appCall = txn.appCall!\n if ((appCall.accountReferences?.length ?? 0) >= MAX_ACCOUNT_REFERENCES) {\n return false\n }\n\n if (resource.type === GroupResourceType.AssetHolding) {\n return appCall.assetReferences?.includes(resource.data.assetId) || false\n } else {\n return appCall.appReferences?.includes(resource.data.appId) || appCall.appId === resource.data.appId\n }\n })\n\n if (groupIndex2 !== -1) {\n const appCall = transactions[groupIndex2].appCall!\n appCall.accountReferences = appCall.accountReferences ?? []\n if (!appCall.accountReferences.includes(address)) {\n appCall.accountReferences.push(address)\n }\n return\n }\n }\n\n // For boxes, first try to find a transaction that already has the app available\n if (resource.type === GroupResourceType.Box) {\n const groupIndex = transactions.findIndex((txn) => {\n if (!isAppCallBelowResourceLimit(txn)) {\n return false\n }\n\n const appCall = txn.appCall!\n return appCall.appReferences?.includes(resource.data.appId) || appCall.appId === resource.data.appId\n })\n\n if (groupIndex !== -1) {\n const appCall = transactions[groupIndex].appCall!\n appCall.boxReferences = appCall.boxReferences ?? []\n const exists = appCall.boxReferences.some(\n (b) =>\n b.appId === resource.data.appId &&\n b.name.length === resource.data.name.length &&\n b.name.every((byte, i) => byte === resource.data.name[i]),\n )\n if (!exists) {\n appCall.boxReferences.push({ appId: resource.data.appId, name: resource.data.name })\n }\n return\n }\n }\n\n // Find the first transaction that can accommodate the resource\n const groupIndex = transactions.findIndex((txn) => {\n if (txn.type !== TransactionType.AppCall) {\n return false\n }\n if (txn.appCall?.accessReferences?.length) {\n return false\n }\n\n const appCall = txn.appCall!\n const accountsCount = appCall.accountReferences?.length ?? 0\n const assetsCount = appCall.assetReferences?.length ?? 0\n const appsCount = appCall.appReferences?.length ?? 0\n const boxesCount = appCall.boxReferences?.length ?? 0\n\n switch (resource.type) {\n case GroupResourceType.Account:\n return accountsCount + assetsCount + appsCount + boxesCount < MAX_OVERALL_REFERENCES\n case GroupResourceType.AssetHolding:\n case GroupResourceType.AppLocal:\n return accountsCount + assetsCount + appsCount + boxesCount < MAX_OVERALL_REFERENCES - 1\n case GroupResourceType.Box:\n if (resource.data.appId !== 0n) {\n return accountsCount + assetsCount + appsCount + boxesCount < MAX_OVERALL_REFERENCES - 1\n } else {\n return accountsCount + assetsCount + appsCount + boxesCount < MAX_OVERALL_REFERENCES\n }\n default:\n return accountsCount + assetsCount + appsCount + boxesCount < MAX_OVERALL_REFERENCES\n }\n })\n\n if (groupIndex === -1) {\n throw new Error('No more transactions below reference limit. Add another app call to the group.')\n }\n\n const appCall = transactions[groupIndex].appCall!\n\n switch (resource.type) {\n case GroupResourceType.Account: {\n appCall.accountReferences = appCall.accountReferences ?? []\n const address = resource.data\n if (!appCall.accountReferences.some((a) => a.equals(address))) {\n appCall.accountReferences.push(address)\n }\n break\n }\n case GroupResourceType.App:\n appCall.appReferences = appCall.appReferences ?? []\n if (!appCall.appReferences.includes(resource.data)) {\n appCall.appReferences.push(resource.data)\n }\n break\n case GroupResourceType.Box: {\n appCall.boxReferences = appCall.boxReferences ?? []\n const exists = appCall.boxReferences.some(\n (b) =>\n b.appId === resource.data.appId &&\n b.name.length === resource.data.name.length &&\n b.name.every((byte, i) => byte === resource.data.name[i]),\n )\n if (!exists) {\n appCall.boxReferences.push({ appId: resource.data.appId, name: resource.data.name })\n }\n if (resource.data.appId !== 0n) {\n appCall.appReferences = appCall.appReferences ?? []\n if (!appCall.appReferences.includes(resource.data.appId)) {\n appCall.appReferences.push(resource.data.appId)\n }\n }\n break\n }\n case GroupResourceType.ExtraBoxRef:\n appCall.boxReferences = appCall.boxReferences ?? []\n appCall.boxReferences.push({ appId: 0n, name: new Uint8Array(0) })\n break\n case GroupResourceType.AssetHolding: {\n appCall.assetReferences = appCall.assetReferences ?? []\n if (!appCall.assetReferences.includes(resource.data.assetId)) {\n appCall.assetReferences.push(resource.data.assetId)\n }\n const address = resource.data.address\n appCall.accountReferences = appCall.accountReferences ?? []\n if (!appCall.accountReferences.some((a) => a.equals(address))) {\n appCall.accountReferences.push(address)\n }\n break\n }\n case GroupResourceType.AppLocal: {\n appCall.appReferences = appCall.appReferences ?? []\n if (!appCall.appReferences.includes(resource.data.appId)) {\n appCall.appReferences.push(resource.data.appId)\n }\n const address = resource.data.address\n appCall.accountReferences = appCall.accountReferences ?? []\n if (!appCall.accountReferences.some((a) => a.equals(address))) {\n appCall.accountReferences.push(address)\n }\n break\n }\n case GroupResourceType.Asset:\n appCall.assetReferences = appCall.assetReferences ?? []\n if (!appCall.assetReferences.includes(resource.data)) {\n appCall.assetReferences.push(resource.data)\n }\n break\n }\n}\n"],"mappings":";;;;;;;;;;AAkGA,MAAa,iBAAiB,OAC5B,QACA,YACA,iBACA,0BACyB;CACzB,MAAM,aAAaA,0CAA2B,QAAQ,iBAAiB,sBAAsB;CAC7F,MAAM,kBACJ,OAAO,OAAO,oBAAoB,YAC7B,MAAM,WAAW,YAAY,OAAO,gBAAgB,EAAE,wBACvD,OAAO;CACb,MAAM,oBACJ,OAAO,OAAO,sBAAsB,YAC/B,MAAM,WAAW,YAAY,OAAO,kBAAkB,EAAE,wBACzD,OAAO;CACb,MAAM,oBACJ,OAAO,QAAQ,qBAAqB,U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143,16 @@ function populateGroupResources(transactions, groupResources) {
|
|
|
143
143
|
type: GroupResourceType.AppLocal,
|
|
144
144
|
data: appLocal
|
|
145
145
|
});
|
|
146
|
-
remainingAccounts = remainingAccounts.filter((acc) => acc !== appLocal.
|
|
147
|
-
remainingApps = remainingApps.filter((app) => app !== appLocal.
|
|
146
|
+
remainingAccounts = remainingAccounts.filter((acc) => acc !== appLocal.address);
|
|
147
|
+
remainingApps = remainingApps.filter((app) => app !== appLocal.appId);
|
|
148
148
|
});
|
|
149
149
|
if (groupResources.assetHoldings) groupResources.assetHoldings.forEach((assetHolding) => {
|
|
150
150
|
populateGroupResource(transactions, {
|
|
151
151
|
type: GroupResourceType.AssetHolding,
|
|
152
152
|
data: assetHolding
|
|
153
153
|
});
|
|
154
|
-
remainingAccounts = remainingAccounts.filter((acc) => acc !== assetHolding.
|
|
155
|
-
remainingAssets = remainingAssets.filter((asset) => asset !== assetHolding.
|
|
154
|
+
remainingAccounts = remainingAccounts.filter((acc) => acc !== assetHolding.address);
|
|
155
|
+
remainingAssets = remainingAssets.filter((asset) => asset !== assetHolding.assetId);
|
|
156
156
|
});
|
|
157
157
|
remainingAccounts.forEach((account) => {
|
|
158
158
|
populateGroupResource(transactions, {
|
|
@@ -164,11 +164,11 @@ function populateGroupResources(transactions, groupResources) {
|
|
|
164
164
|
populateGroupResource(transactions, {
|
|
165
165
|
type: GroupResourceType.Box,
|
|
166
166
|
data: {
|
|
167
|
-
appId: boxRef.
|
|
167
|
+
appId: boxRef.appId,
|
|
168
168
|
name: boxRef.name
|
|
169
169
|
}
|
|
170
170
|
});
|
|
171
|
-
remainingApps = remainingApps.filter((app) => app !== boxRef.
|
|
171
|
+
remainingApps = remainingApps.filter((app) => app !== boxRef.appId);
|
|
172
172
|
});
|
|
173
173
|
remainingAssets.forEach((asset) => {
|
|
174
174
|
populateGroupResource(transactions, {
|
|
@@ -201,7 +201,7 @@ function isAppCallBelowResourceLimit(txn) {
|
|
|
201
201
|
*/
|
|
202
202
|
function populateGroupResource(transactions, resource) {
|
|
203
203
|
if (resource.type === GroupResourceType.AssetHolding || resource.type === GroupResourceType.AppLocal) {
|
|
204
|
-
const address = resource.data.
|
|
204
|
+
const address = resource.data.address;
|
|
205
205
|
const groupIndex1 = transactions.findIndex((txn) => {
|
|
206
206
|
if (!isAppCallBelowResourceLimit(txn)) return false;
|
|
207
207
|
const appCall$1 = txn.appCall;
|
|
@@ -216,10 +216,10 @@ function populateGroupResource(transactions, resource) {
|
|
|
216
216
|
const appCall$1 = transactions[groupIndex1].appCall;
|
|
217
217
|
if (resource.type === GroupResourceType.AssetHolding) {
|
|
218
218
|
appCall$1.assetReferences = appCall$1.assetReferences ?? [];
|
|
219
|
-
if (!appCall$1.assetReferences.includes(resource.data.
|
|
219
|
+
if (!appCall$1.assetReferences.includes(resource.data.assetId)) appCall$1.assetReferences.push(resource.data.assetId);
|
|
220
220
|
} else {
|
|
221
221
|
appCall$1.appReferences = appCall$1.appReferences ?? [];
|
|
222
|
-
if (!appCall$1.appReferences.includes(resource.data.
|
|
222
|
+
if (!appCall$1.appReferences.includes(resource.data.appId)) appCall$1.appReferences.push(resource.data.appId);
|
|
223
223
|
}
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
@@ -227,8 +227,8 @@ function populateGroupResource(transactions, resource) {
|
|
|
227
227
|
if (!isAppCallBelowResourceLimit(txn)) return false;
|
|
228
228
|
const appCall$1 = txn.appCall;
|
|
229
229
|
if ((appCall$1.accountReferences?.length ?? 0) >= MAX_ACCOUNT_REFERENCES) return false;
|
|
230
|
-
if (resource.type === GroupResourceType.AssetHolding) return appCall$1.assetReferences?.includes(resource.data.
|
|
231
|
-
else return appCall$1.appReferences?.includes(resource.data.
|
|
230
|
+
if (resource.type === GroupResourceType.AssetHolding) return appCall$1.assetReferences?.includes(resource.data.assetId) || false;
|
|
231
|
+
else return appCall$1.appReferences?.includes(resource.data.appId) || appCall$1.appId === resource.data.appId;
|
|
232
232
|
});
|
|
233
233
|
if (groupIndex2 !== -1) {
|
|
234
234
|
const appCall$1 = transactions[groupIndex2].appCall;
|
|
@@ -303,16 +303,16 @@ function populateGroupResource(transactions, resource) {
|
|
|
303
303
|
break;
|
|
304
304
|
case GroupResourceType.AssetHolding: {
|
|
305
305
|
appCall.assetReferences = appCall.assetReferences ?? [];
|
|
306
|
-
if (!appCall.assetReferences.includes(resource.data.
|
|
307
|
-
const address = resource.data.
|
|
306
|
+
if (!appCall.assetReferences.includes(resource.data.assetId)) appCall.assetReferences.push(resource.data.assetId);
|
|
307
|
+
const address = resource.data.address;
|
|
308
308
|
appCall.accountReferences = appCall.accountReferences ?? [];
|
|
309
309
|
if (!appCall.accountReferences.some((a) => a.equals(address))) appCall.accountReferences.push(address);
|
|
310
310
|
break;
|
|
311
311
|
}
|
|
312
312
|
case GroupResourceType.AppLocal: {
|
|
313
313
|
appCall.appReferences = appCall.appReferences ?? [];
|
|
314
|
-
if (!appCall.appReferences.includes(resource.data.
|
|
315
|
-
const address = resource.data.
|
|
314
|
+
if (!appCall.appReferences.includes(resource.data.appId)) appCall.appReferences.push(resource.data.appId);
|
|
315
|
+
const address = resource.data.address;
|
|
316
316
|
appCall.accountReferences = appCall.accountReferences ?? [];
|
|
317
317
|
if (!appCall.accountReferences.some((a) => a.equals(address))) appCall.accountReferences.push(address);
|
|
318
318
|
break;
|