@algorandfoundation/algokit-utils 9.2.0 → 9.2.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_virtual/_rolldown/runtime.js +33 -0
- package/_virtual/_rolldown/runtime.mjs +13 -0
- package/account/account.d.ts +25 -30
- package/account/account.js +151 -146
- package/account/account.js.map +1 -1
- package/account/account.mjs +149 -144
- package/account/account.mjs.map +1 -1
- package/account/get-account-config-from-environment.d.ts +7 -2
- package/account/get-account-config-from-environment.js +19 -21
- package/account/get-account-config-from-environment.js.map +1 -1
- package/account/get-account-config-from-environment.mjs +19 -19
- package/account/get-account-config-from-environment.mjs.map +1 -1
- package/account/get-account.d.ts +14 -12
- package/account/get-account.js +56 -59
- package/account/get-account.js.map +1 -1
- package/account/get-account.mjs +56 -57
- package/account/get-account.mjs.map +1 -1
- package/account/get-dispenser-account.d.ts +9 -5
- package/account/get-dispenser-account.js +20 -18
- package/account/get-dispenser-account.js.map +1 -1
- package/account/get-dispenser-account.mjs +20 -16
- package/account/get-dispenser-account.mjs.map +1 -1
- package/account/mnemonic-account.d.ts +7 -3
- package/account/mnemonic-account.js +17 -17
- package/account/mnemonic-account.js.map +1 -1
- package/account/mnemonic-account.mjs +15 -15
- package/account/mnemonic-account.mjs.map +1 -1
- package/amount.d.ts +40 -35
- package/amount.js +33 -34
- package/amount.js.map +1 -1
- package/amount.mjs +33 -32
- package/amount.mjs.map +1 -1
- package/app-client.d.ts +10 -6
- package/app-client.js +91 -86
- package/app-client.js.map +1 -1
- package/app-client.mjs +91 -84
- package/app-client.mjs.map +1 -1
- package/app-deploy.d.ts +26 -24
- package/app-deploy.js +235 -253
- package/app-deploy.js.map +1 -1
- package/app-deploy.mjs +233 -251
- package/app-deploy.mjs.map +1 -1
- package/app.d.ts +45 -46
- package/app.js +253 -271
- package/app.js.map +1 -1
- package/app.mjs +249 -267
- package/app.mjs.map +1 -1
- package/asset.d.ts +16 -12
- package/asset.js +116 -122
- package/asset.js.map +1 -1
- package/asset.mjs +116 -120
- package/asset.mjs.map +1 -1
- package/config.d.ts +7 -2
- package/config.js +5 -7
- package/config.js.map +1 -1
- package/config.mjs +5 -4
- package/config.mjs.map +1 -1
- package/debugging/debugging.d.ts +5 -1
- package/debugging/debugging.js +11 -11
- package/debugging/debugging.js.map +1 -1
- package/debugging/debugging.mjs +11 -9
- package/debugging/debugging.mjs.map +1 -1
- package/dispenser-client.d.ts +7 -2
- package/dispenser-client.js +23 -24
- package/dispenser-client.js.map +1 -1
- package/dispenser-client.mjs +23 -22
- package/dispenser-client.mjs.map +1 -1
- package/index.d.ts +27 -18
- package/index.js +140 -143
- package/index.mjs +27 -29
- package/indexer-lookup.d.ts +18 -11
- package/indexer-lookup.js +112 -120
- package/indexer-lookup.js.map +1 -1
- package/indexer-lookup.mjs +105 -118
- package/indexer-lookup.mjs.map +1 -1
- package/localnet/get-kmd-wallet-account.d.ts +9 -7
- package/localnet/get-kmd-wallet-account.js +28 -26
- package/localnet/get-kmd-wallet-account.js.map +1 -1
- package/localnet/get-kmd-wallet-account.mjs +28 -24
- package/localnet/get-kmd-wallet-account.mjs.map +1 -1
- package/localnet/get-localnet-dispenser-account.d.ts +7 -5
- package/localnet/get-localnet-dispenser-account.js +17 -15
- package/localnet/get-localnet-dispenser-account.js.map +1 -1
- package/localnet/get-localnet-dispenser-account.mjs +17 -13
- package/localnet/get-localnet-dispenser-account.mjs.map +1 -1
- package/localnet/get-or-create-kmd-wallet-account.d.ts +10 -8
- package/localnet/get-or-create-kmd-wallet-account.js +28 -26
- package/localnet/get-or-create-kmd-wallet-account.js.map +1 -1
- package/localnet/get-or-create-kmd-wallet-account.mjs +28 -24
- package/localnet/get-or-create-kmd-wallet-account.mjs.map +1 -1
- package/localnet/is-localnet.d.ts +7 -3
- package/localnet/is-localnet.js +9 -10
- package/localnet/is-localnet.js.map +1 -1
- package/localnet/is-localnet.mjs +9 -8
- package/localnet/is-localnet.mjs.map +1 -1
- package/network-client.d.ts +17 -15
- package/network-client.js +115 -116
- package/network-client.js.map +1 -1
- package/network-client.mjs +115 -114
- package/network-client.mjs.map +1 -1
- package/package.json +12 -3
- package/testing/account.d.ts +11 -9
- package/testing/account.js +31 -33
- package/testing/account.js.map +1 -1
- package/testing/account.mjs +29 -31
- package/testing/account.mjs.map +1 -1
- package/testing/fixtures/algokit-log-capture-fixture.d.ts +7 -2
- package/testing/fixtures/algokit-log-capture-fixture.js +36 -41
- package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -1
- package/testing/fixtures/algokit-log-capture-fixture.mjs +36 -39
- package/testing/fixtures/algokit-log-capture-fixture.mjs.map +1 -1
- package/testing/fixtures/algorand-fixture.d.ts +9 -4
- package/testing/fixtures/algorand-fixture.js +67 -62
- package/testing/fixtures/algorand-fixture.js.map +1 -1
- package/testing/fixtures/algorand-fixture.mjs +66 -59
- package/testing/fixtures/algorand-fixture.mjs.map +1 -1
- package/testing/index.d.ts +7 -5
- package/testing/index.js +13 -18
- package/testing/index.mjs +7 -7
- package/testing/indexer.d.ts +5 -1
- package/testing/indexer.js +28 -37
- package/testing/indexer.js.map +1 -1
- package/testing/indexer.mjs +28 -35
- package/testing/indexer.mjs.map +1 -1
- package/testing/test-logger.d.ts +41 -36
- package/testing/test-logger.js +71 -76
- package/testing/test-logger.js.map +1 -1
- package/testing/test-logger.mjs +71 -74
- package/testing/test-logger.mjs.map +1 -1
- package/testing/transaction-logger.d.ts +30 -27
- package/testing/transaction-logger.js +77 -93
- package/testing/transaction-logger.js.map +1 -1
- package/testing/transaction-logger.mjs +74 -90
- package/testing/transaction-logger.mjs.map +1 -1
- package/transaction/legacy-bridge.js +100 -111
- package/transaction/legacy-bridge.js.map +1 -1
- package/transaction/legacy-bridge.mjs +97 -108
- package/transaction/legacy-bridge.mjs.map +1 -1
- package/transaction/perform-atomic-transaction-composer-simulate.d.ts +7 -5
- package/transaction/perform-atomic-transaction-composer-simulate.js +31 -36
- package/transaction/perform-atomic-transaction-composer-simulate.js.map +1 -1
- package/transaction/perform-atomic-transaction-composer-simulate.mjs +28 -33
- package/transaction/perform-atomic-transaction-composer-simulate.mjs.map +1 -1
- package/transaction/transaction.d.ts +34 -35
- package/transaction/transaction.js +716 -914
- package/transaction/transaction.js.map +1 -1
- package/transaction/transaction.mjs +713 -911
- package/transaction/transaction.mjs.map +1 -1
- package/transfer/transfer-algos.d.ts +9 -5
- package/transfer/transfer-algos.js +26 -27
- package/transfer/transfer-algos.js.map +1 -1
- package/transfer/transfer-algos.mjs +26 -25
- package/transfer/transfer-algos.mjs.map +1 -1
- package/transfer/transfer.d.ts +11 -8
- package/transfer/transfer.js +94 -100
- package/transfer/transfer.js.map +1 -1
- package/transfer/transfer.mjs +94 -98
- package/transfer/transfer.mjs.map +1 -1
- package/types/account-manager.d.ts +432 -429
- package/types/account-manager.js +591 -602
- package/types/account-manager.js.map +1 -1
- package/types/account-manager.mjs +587 -599
- package/types/account-manager.mjs.map +1 -1
- package/types/account.d.ts +192 -202
- package/types/account.js +91 -88
- package/types/account.js.map +1 -1
- package/types/account.mjs +88 -86
- package/types/account.mjs.map +1 -1
- package/types/algo-http-client-with-retry.d.ts +15 -10
- package/types/algo-http-client-with-retry.js +70 -92
- package/types/algo-http-client-with-retry.js.map +1 -1
- package/types/algo-http-client-with-retry.mjs +69 -90
- package/types/algo-http-client-with-retry.mjs.map +1 -1
- package/types/algorand-client-transaction-creator.d.ts +778 -771
- package/types/algorand-client-transaction-creator.js +733 -732
- package/types/algorand-client-transaction-creator.js.map +1 -1
- package/types/algorand-client-transaction-creator.mjs +732 -730
- package/types/algorand-client-transaction-creator.mjs.map +1 -1
- package/types/algorand-client-transaction-sender.d.ts +1090 -1360
- package/types/algorand-client-transaction-sender.js +930 -961
- package/types/algorand-client-transaction-sender.js.map +1 -1
- package/types/algorand-client-transaction-sender.mjs +927 -959
- package/types/algorand-client-transaction-sender.mjs.map +1 -1
- package/types/algorand-client.d.ts +239 -236
- package/types/algorand-client.js +322 -320
- package/types/algorand-client.js.map +1 -1
- package/types/algorand-client.mjs +321 -318
- package/types/algorand-client.mjs.map +1 -1
- package/types/amount.d.ts +47 -43
- package/types/amount.js +66 -70
- package/types/amount.js.map +1 -1
- package/types/amount.mjs +63 -68
- package/types/amount.mjs.map +1 -1
- package/types/app-arc56.d.ts +235 -272
- package/types/app-arc56.js +124 -170
- package/types/app-arc56.js.map +1 -1
- package/types/app-arc56.mjs +121 -168
- package/types/app-arc56.mjs.map +1 -1
- package/types/app-client.d.ts +1128 -2009
- package/types/app-client.js +1633 -1791
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +1624 -1783
- package/types/app-client.mjs.map +1 -1
- package/types/app-deployer.d.ts +139 -141
- package/types/app-deployer.js +344 -384
- package/types/app-deployer.js.map +1 -1
- package/types/app-deployer.mjs +341 -382
- package/types/app-deployer.mjs.map +1 -1
- package/types/app-factory.d.ts +762 -932
- package/types/app-factory.js +496 -488
- package/types/app-factory.js.map +1 -1
- package/types/app-factory.mjs +491 -484
- package/types/app-factory.mjs.map +1 -1
- package/types/app-manager.d.ts +304 -310
- package/types/app-manager.js +422 -475
- package/types/app-manager.js.map +1 -1
- package/types/app-manager.mjs +419 -473
- package/types/app-manager.mjs.map +1 -1
- package/types/app-spec.d.ts +118 -117
- package/types/app-spec.js +125 -135
- package/types/app-spec.js.map +1 -1
- package/types/app-spec.mjs +121 -132
- package/types/app-spec.mjs.map +1 -1
- package/types/app.d.ts +229 -241
- package/types/app.js +36 -28
- package/types/app.js.map +1 -1
- package/types/app.mjs +33 -26
- package/types/app.mjs.map +1 -1
- package/types/asset-manager.d.ts +204 -199
- package/types/asset-manager.js +165 -174
- package/types/asset-manager.js.map +1 -1
- package/types/asset-manager.mjs +164 -172
- package/types/asset-manager.mjs.map +1 -1
- package/types/asset.d.ts +95 -91
- package/types/asset.js +0 -3
- package/types/asset.mjs +0 -2
- package/types/async-event-emitter.d.ts +18 -13
- package/types/async-event-emitter.js +37 -49
- package/types/async-event-emitter.js.map +1 -1
- package/types/async-event-emitter.mjs +36 -47
- package/types/async-event-emitter.mjs.map +1 -1
- package/types/client-manager.d.ts +453 -451
- package/types/client-manager.js +602 -598
- package/types/client-manager.js.map +1 -1
- package/types/client-manager.mjs +597 -594
- package/types/client-manager.mjs.map +1 -1
- package/types/composer.d.ts +1211 -1258
- package/types/composer.js +1436 -1498
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +1430 -1493
- package/types/composer.mjs.map +1 -1
- package/types/config.d.ts +53 -48
- package/types/config.js +78 -77
- package/types/config.js.map +1 -1
- package/types/config.mjs +77 -75
- package/types/config.mjs.map +1 -1
- package/types/debugging.d.ts +25 -23
- package/types/debugging.js +9 -11
- package/types/debugging.js.map +1 -1
- package/types/debugging.mjs +8 -9
- package/types/debugging.mjs.map +1 -1
- package/types/dispenser-client.d.ts +57 -52
- package/types/dispenser-client.js +120 -141
- package/types/dispenser-client.js.map +1 -1
- package/types/dispenser-client.mjs +119 -139
- package/types/dispenser-client.mjs.map +1 -1
- package/types/expand.d.ts +5 -3
- package/types/expand.js +0 -3
- package/types/expand.mjs +0 -2
- package/types/indexer.d.ts +104 -100
- package/types/indexer.js +36 -31
- package/types/indexer.js.map +1 -1
- package/types/indexer.mjs +32 -30
- package/types/indexer.mjs.map +1 -1
- package/types/instance-of.d.ts +5 -3
- package/types/instance-of.js +0 -3
- package/types/instance-of.mjs +0 -2
- package/types/kmd-account-manager.d.ts +75 -70
- package/types/kmd-account-manager.js +150 -184
- package/types/kmd-account-manager.js.map +1 -1
- package/types/kmd-account-manager.mjs +147 -182
- package/types/kmd-account-manager.mjs.map +1 -1
- package/types/lifecycle-events.d.ts +13 -8
- package/types/lifecycle-events.js +10 -7
- package/types/lifecycle-events.js.map +1 -1
- package/types/lifecycle-events.mjs +9 -7
- package/types/lifecycle-events.mjs.map +1 -1
- package/types/logging.d.ts +15 -11
- package/types/logging.js +30 -31
- package/types/logging.js.map +1 -1
- package/types/logging.mjs +29 -29
- package/types/logging.mjs.map +1 -1
- package/types/logic-error.d.ts +33 -29
- package/types/logic-error.js +50 -49
- package/types/logic-error.js.map +1 -1
- package/types/logic-error.mjs +49 -47
- package/types/logic-error.mjs.map +1 -1
- package/types/network-client.d.ts +32 -27
- package/types/network-client.js +10 -9
- package/types/network-client.js.map +1 -1
- package/types/network-client.mjs +9 -7
- package/types/network-client.mjs.map +1 -1
- package/types/testing.d.ts +131 -132
- package/types/testing.js +0 -3
- package/types/testing.mjs +0 -2
- package/types/transaction.d.ts +110 -110
- package/types/transaction.js +0 -3
- package/types/transaction.mjs +0 -2
- package/types/transfer.d.ts +70 -66
- package/types/transfer.js +0 -3
- package/types/transfer.mjs +0 -2
- package/util.js +73 -118
- package/util.js.map +1 -1
- package/util.mjs +73 -116
- package/util.mjs.map +1 -1
- package/account/index.d.ts +0 -5
- package/debugging/index.d.ts +0 -1
- package/index.js.map +0 -1
- package/index.mjs.map +0 -1
- package/localnet/index.d.ts +0 -4
- package/testing/_asset.d.ts +0 -3
- package/testing/fixtures/index.d.ts +0 -2
- package/testing/index.js.map +0 -1
- package/testing/index.mjs.map +0 -1
- package/transaction/index.d.ts +0 -2
- package/transaction/legacy-bridge.d.ts +0 -35
- package/transfer/index.d.ts +0 -2
- package/types/asset.js.map +0 -1
- package/types/asset.mjs.map +0 -1
- package/types/expand.js.map +0 -1
- package/types/expand.mjs.map +0 -1
- package/types/instance-of.js.map +0 -1
- package/types/instance-of.mjs.map +0 -1
- package/types/testing.js.map +0 -1
- package/types/testing.mjs.map +0 -1
- package/types/transaction.js.map +0 -1
- package/types/transaction.mjs.map +0 -1
- package/types/transfer.js.map +0 -1
- package/types/transfer.mjs.map +0 -1
- package/util.d.ts +0 -48
package/types/testing.d.ts
CHANGED
|
@@ -1,150 +1,149 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import Indexer = algosdk.Indexer;
|
|
11
|
-
import Kmd = algosdk.Kmd;
|
|
12
|
-
import LogicSigAccount = algosdk.LogicSigAccount;
|
|
13
|
-
import Transaction = algosdk.Transaction;
|
|
1
|
+
import { AlgoAmount } from "./amount.js";
|
|
2
|
+
import { MultisigAccount, SigningAccount, TransactionSignerAccount } from "./account.js";
|
|
3
|
+
import { AlgoConfig } from "./network-client.js";
|
|
4
|
+
import { AlgorandClient } from "./algorand-client.js";
|
|
5
|
+
import { TestLogger } from "../testing/test-logger.js";
|
|
6
|
+
import { TransactionLogger } from "../testing/transaction-logger.js";
|
|
7
|
+
import algosdk, { Address } from "algosdk";
|
|
8
|
+
|
|
9
|
+
//#region src/types/testing.d.ts
|
|
14
10
|
/**
|
|
15
11
|
* Test automation context.
|
|
16
12
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
13
|
+
interface AlgorandTestAutomationContext {
|
|
14
|
+
/** An AlgorandClient instance loaded with the current context, including testAccount and any generated accounts loaded as signers */
|
|
15
|
+
algorand: AlgorandClient;
|
|
16
|
+
/** Algod client instance that will log transactions in `transactionLogger` */
|
|
17
|
+
algod: Algodv2;
|
|
18
|
+
/** Indexer client instance */
|
|
19
|
+
indexer: Indexer;
|
|
20
|
+
/** KMD client instance */
|
|
21
|
+
kmd: Kmd;
|
|
22
|
+
/** Transaction logger that will log transaction IDs for all transactions issued by `algod` */
|
|
23
|
+
transactionLogger: TransactionLogger;
|
|
24
|
+
/** Default, funded test account that is ephemerally created */
|
|
25
|
+
testAccount: Address & TransactionSignerAccount & Account;
|
|
26
|
+
/** Generate and fund an additional ephemerally created account */
|
|
27
|
+
generateAccount: (params: GetTestAccountParams) => Promise<Address & Account & TransactionSignerAccount>;
|
|
28
|
+
/** Wait for the indexer to catch up with all transactions logged by `transactionLogger` */
|
|
29
|
+
waitForIndexer: () => Promise<void>;
|
|
30
|
+
/** Wait for the indexer to catch up with the given transaction ID */
|
|
31
|
+
waitForIndexerTransaction: (transactionId: string) => Promise<algosdk.indexerModels.TransactionResponse>;
|
|
36
32
|
}
|
|
37
33
|
/**
|
|
38
34
|
* Parameters for the `getTestAccount` function.
|
|
39
35
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
interface GetTestAccountParams {
|
|
37
|
+
/** Initial funds to ensure the account has */
|
|
38
|
+
initialFunds: AlgoAmount;
|
|
39
|
+
/** Whether to suppress the log (which includes a mnemonic) or not (default: do not suppress the log) */
|
|
40
|
+
suppressLog?: boolean;
|
|
41
|
+
/** Optional override for how to get a test account; this allows you to retrieve accounts from a known or cached list of accounts. */
|
|
42
|
+
accountGetter?: (algorand: AlgorandClient) => Promise<Account>;
|
|
47
43
|
}
|
|
48
44
|
/** Configuration for creating an Algorand testing fixture. */
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
45
|
+
interface AlgorandFixtureConfig extends Partial<AlgoConfig> {
|
|
46
|
+
/** An optional algod client, if not specified then it will create one against `algodConfig` (if present) then environment variables defined network (if present) or default LocalNet. */
|
|
47
|
+
algod?: Algodv2;
|
|
48
|
+
/** An optional indexer client, if not specified then it will create one against `indexerConfig` (if present) then environment variables defined network (if present) or default LocalNet. */
|
|
49
|
+
indexer?: Indexer;
|
|
50
|
+
/** An optional kmd client, if not specified then it will create one against `kmdConfig` (if present) then environment variables defined network (if present) or default LocalNet. */
|
|
51
|
+
kmd?: Kmd;
|
|
52
|
+
/** The amount of funds to allocate to the default testing account, if not specified then it will get 10 ALGO. */
|
|
53
|
+
testAccountFunding?: AlgoAmount;
|
|
54
|
+
/** Optional override for how to get an account; this allows you to retrieve accounts from a known or cached list of accounts. */
|
|
55
|
+
accountGetter?: (algod: Algodv2, kmd?: Kmd) => Promise<Account>;
|
|
60
56
|
}
|
|
61
57
|
/** An Algorand automated testing fixture */
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
58
|
+
interface AlgorandFixture {
|
|
59
|
+
/**
|
|
60
|
+
* Retrieve the current context.
|
|
61
|
+
* Useful with destructuring.
|
|
62
|
+
*
|
|
63
|
+
* If you haven't called `newScope` then this will throw an error.
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* test('My test', () => {
|
|
67
|
+
* const {algod, indexer, testAccount, ...} = fixture.context
|
|
68
|
+
* })
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
get context(): AlgorandTestAutomationContext;
|
|
72
|
+
/**
|
|
73
|
+
* Retrieve an `AlgorandClient` loaded with the current context, including testAccount and any generated accounts loaded as signers.
|
|
74
|
+
*/
|
|
75
|
+
get algorand(): AlgorandClient;
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated Use newScope instead.
|
|
78
|
+
* Testing framework agnostic handler method to run before each test to prepare the `context` for that test with per test isolation.
|
|
79
|
+
*/
|
|
80
|
+
beforeEach: () => Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Creates a new isolated fixture scope (clean transaction logger, AlgorandClient, testAccount, etc.).
|
|
83
|
+
*
|
|
84
|
+
* You can call this from any testing framework specific hook method to control when you want a new scope.
|
|
85
|
+
*
|
|
86
|
+
* @example Jest / vitest - per test isolation (beforeEach)
|
|
87
|
+
* ```typescript
|
|
88
|
+
* describe('MY MODULE', () => {
|
|
89
|
+
* const fixture = algorandFixture()
|
|
90
|
+
* beforeEach(fixture.newScope)
|
|
91
|
+
*
|
|
92
|
+
* test('MY TEST', async () => {
|
|
93
|
+
* const { algorand, testAccount } = fixture.context
|
|
94
|
+
*
|
|
95
|
+
* // Test stuff!
|
|
96
|
+
* })
|
|
97
|
+
* })
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @example Jest / vitest - test suite isolation (beforeAll)
|
|
101
|
+
* ```typescript
|
|
102
|
+
* describe('MY MODULE', () => {
|
|
103
|
+
* const fixture = algorandFixture()
|
|
104
|
+
* beforeAll(fixture.newScope)
|
|
105
|
+
*
|
|
106
|
+
* test('test1', async () => {
|
|
107
|
+
* const { algorand, testAccount } = fixture.context
|
|
108
|
+
*
|
|
109
|
+
* // Test stuff!
|
|
110
|
+
* })
|
|
111
|
+
* test('test2', async () => {
|
|
112
|
+
* const { algorand, testAccount } = fixture.context
|
|
113
|
+
* // algorand and testAccount are the same as in test1
|
|
114
|
+
* })
|
|
115
|
+
* })
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
*/
|
|
119
|
+
newScope: () => Promise<void>;
|
|
124
120
|
}
|
|
125
121
|
/** Configuration for preparing a captured log snapshot.
|
|
126
122
|
* This helps ensure that the provided configuration items won't appear
|
|
127
123
|
* with random values in the log snapshot, but rather will get substituted with predictable ids.
|
|
128
124
|
*/
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
125
|
+
interface LogSnapshotConfig {
|
|
126
|
+
/** Any transaction IDs or transactions to replace the ID for predictably */
|
|
127
|
+
transactions?: (string | Transaction)[];
|
|
128
|
+
/** Any accounts/addresses to replace the address for predictably */
|
|
129
|
+
accounts?: (string | Address | Account | SigningAccount | LogicSigAccount | MultisigAccount | TransactionSignerAccount)[];
|
|
130
|
+
/** Any app IDs to replace predictably */
|
|
131
|
+
apps?: (string | number | bigint)[];
|
|
132
|
+
/** Optional filter predicate to filter out logs */
|
|
133
|
+
filterPredicate?: (log: string) => boolean;
|
|
138
134
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
135
|
+
interface AlgoKitLogCaptureFixture {
|
|
136
|
+
/** The test logger instance for the current test */
|
|
137
|
+
get testLogger(): TestLogger;
|
|
138
|
+
/**
|
|
139
|
+
* Testing framework agnostic handler method to run before each test to prepare the `testLogger` for that test.
|
|
140
|
+
*/
|
|
141
|
+
beforeEach: () => void;
|
|
142
|
+
/**
|
|
143
|
+
* Testing framework agnostic handler method to run after each test to reset the logger.
|
|
144
|
+
*/
|
|
145
|
+
afterEach: () => void;
|
|
150
146
|
}
|
|
147
|
+
//#endregion
|
|
148
|
+
export { AlgoKitLogCaptureFixture, AlgorandFixture, AlgorandFixtureConfig, AlgorandTestAutomationContext, GetTestAccountParams, LogSnapshotConfig };
|
|
149
|
+
//# sourceMappingURL=testing.d.ts.map
|
package/types/testing.js
CHANGED
package/types/testing.mjs
CHANGED
package/types/transaction.d.ts
CHANGED
|
@@ -1,87 +1,84 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { MultisigAccount, SigningAccount, TransactionSignerAccount } from
|
|
3
|
-
import {
|
|
4
|
-
import { ABIReturn } from
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import modelsv2 = algosdk.modelsv2;
|
|
11
|
-
export type TransactionNote = Uint8Array | TransactionNoteData | Arc2TransactionNote;
|
|
12
|
-
export type TransactionNoteData = string | null | undefined | number | any[] | Record<string, any>;
|
|
1
|
+
import { AlgoAmount } from "./amount.js";
|
|
2
|
+
import { MultisigAccount, SigningAccount, TransactionSignerAccount } from "./account.js";
|
|
3
|
+
import { Expand } from "./expand.js";
|
|
4
|
+
import { ABIReturn } from "./app.js";
|
|
5
|
+
import algosdk from "algosdk";
|
|
6
|
+
|
|
7
|
+
//#region src/types/transaction.d.ts
|
|
8
|
+
type TransactionNote = Uint8Array | TransactionNoteData | Arc2TransactionNote;
|
|
9
|
+
type TransactionNoteData = string | null | undefined | number | any[] | Record<string, any>;
|
|
13
10
|
/** ARC-0002 compatible transaction note components https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md */
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
type Arc2TransactionNote = {
|
|
12
|
+
dAppName: string;
|
|
13
|
+
format: 'm' | 'b' | 'u';
|
|
14
|
+
data: string;
|
|
18
15
|
} | {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
dAppName: string;
|
|
17
|
+
format: 'j';
|
|
18
|
+
data: TransactionNoteData;
|
|
22
19
|
};
|
|
23
20
|
/** The sending configuration for a transaction */
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
21
|
+
interface SendTransactionParams {
|
|
22
|
+
/** Whether to skip signing and sending the transaction to the chain (default: transaction signed and sent to chain, unless `atc` specified)
|
|
23
|
+
* and instead just return the raw transaction, e.g. so you can add it to a group of transactions */
|
|
24
|
+
skipSending?: boolean;
|
|
25
|
+
/** Whether to skip waiting for the submitted transaction (only relevant if `skipSending` is `false` or unset) */
|
|
26
|
+
skipWaiting?: boolean;
|
|
27
|
+
/** An optional `AtomicTransactionComposer` to add the transaction to, if specified then `skipSending: undefined` has the same effect as `skipSending: true` */
|
|
28
|
+
atc?: AtomicTransactionComposer;
|
|
29
|
+
/** Whether to suppress log messages from transaction send, default: do not suppress */
|
|
30
|
+
suppressLog?: boolean;
|
|
31
|
+
/** The flat fee you want to pay, useful for covering extra fees in a transaction group or app call */
|
|
32
|
+
fee?: AlgoAmount;
|
|
33
|
+
/** The maximum fee that you are happy to pay (default: unbounded) - if this is set it's possible the transaction could get rejected during network congestion */
|
|
34
|
+
maxFee?: AlgoAmount;
|
|
35
|
+
/** The maximum number of rounds to wait for confirmation, only applies if `skipWaiting` is `undefined` or `false`, default: wait up to 5 rounds */
|
|
36
|
+
maxRoundsToWaitForConfirmation?: number;
|
|
37
|
+
/** Whether to use simulate to automatically populate app call resources in the txn objects. Defaults to true when there are app calls in the group. */
|
|
38
|
+
populateAppCallResources?: boolean;
|
|
42
39
|
}
|
|
43
40
|
/** Result from sending a single transaction. */
|
|
44
|
-
|
|
41
|
+
type SendSingleTransactionResult = Expand<SendAtomicTransactionComposerResults & ConfirmedTransactionResult>;
|
|
45
42
|
/** The result of sending a transaction */
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
interface SendTransactionResult {
|
|
44
|
+
/** The transaction */
|
|
45
|
+
transaction: Transaction;
|
|
46
|
+
/** The response if the transaction was sent and waited for */
|
|
47
|
+
confirmation?: modelsv2.PendingTransactionResponse;
|
|
51
48
|
}
|
|
52
49
|
/** The result of preparing and/or sending multiple transactions */
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
50
|
+
interface SendTransactionResults {
|
|
51
|
+
/** The transactions that have been prepared and/or sent */
|
|
52
|
+
transactions: Transaction[];
|
|
53
|
+
/** The responses if the transactions were sent and waited for,
|
|
54
|
+
* the index of the confirmation will match the index of the underlying transaction
|
|
55
|
+
*/
|
|
56
|
+
confirmations?: modelsv2.PendingTransactionResponse[];
|
|
60
57
|
}
|
|
61
58
|
/** The result of preparing and/or sending multiple transactions using an `AtomicTransactionComposer` */
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
59
|
+
interface SendAtomicTransactionComposerResults extends SendTransactionResults {
|
|
60
|
+
/** base64 encoded representation of the group ID of the atomic group */
|
|
61
|
+
groupId: string;
|
|
62
|
+
/** The transaction IDs that have been prepared and/or sent */
|
|
63
|
+
txIds: string[];
|
|
64
|
+
/** If ABI method(s) were called the processed return values */
|
|
65
|
+
returns?: ABIReturn[];
|
|
66
|
+
/** The responses if the transactions were sent and waited for,
|
|
67
|
+
* the index of the confirmation will match the index of the underlying transaction
|
|
68
|
+
*/
|
|
69
|
+
confirmations: modelsv2.PendingTransactionResponse[];
|
|
73
70
|
}
|
|
74
71
|
/** The result of sending and confirming a transaction */
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
interface ConfirmedTransactionResult extends SendTransactionResult {
|
|
73
|
+
/** The response from sending and waiting for the transaction */
|
|
74
|
+
confirmation: modelsv2.PendingTransactionResponse;
|
|
78
75
|
}
|
|
79
76
|
/** The result of sending and confirming one or more transactions, but where there is a primary transaction of interest */
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
interface ConfirmedTransactionResults extends SendTransactionResult, SendTransactionResults {
|
|
78
|
+
/** The response from sending and waiting for the primary transaction */
|
|
79
|
+
confirmation: modelsv2.PendingTransactionResponse;
|
|
80
|
+
/** The response from sending and waiting for the transactions */
|
|
81
|
+
confirmations: modelsv2.PendingTransactionResponse[];
|
|
85
82
|
}
|
|
86
83
|
/** Core account abstraction when signing/sending transactions
|
|
87
84
|
*
|
|
@@ -93,56 +90,59 @@ export interface ConfirmedTransactionResults extends SendTransactionResult, Send
|
|
|
93
90
|
* * `MultisigAccount` - An AlgoKit Utils class that wraps a multisig account and provides mechanisms to get a multisig account
|
|
94
91
|
* * `TransactionSignerAccount` - An AlgoKit Utils class that wraps the in-built `algosdk.TransactionSigner` along with the sender address
|
|
95
92
|
*/
|
|
96
|
-
|
|
93
|
+
type SendTransactionFrom = Account | SigningAccount | LogicSigAccount | MultisigAccount | TransactionSignerAccount;
|
|
97
94
|
/** Defines an unsigned transaction that will appear in a group of transactions along with its signing information */
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
95
|
+
interface TransactionToSign {
|
|
96
|
+
/** The unsigned transaction to sign and send */
|
|
97
|
+
transaction: Transaction;
|
|
98
|
+
/** The account to use to sign the transaction, either an account (with private key loaded) or a logic signature account */
|
|
99
|
+
signer: SendTransactionFrom;
|
|
103
100
|
}
|
|
104
101
|
/** A group of transactions to send together as an atomic group
|
|
105
102
|
* https://dev.algorand.co/concepts/transactions/atomic-txn-groups/
|
|
106
103
|
*/
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
104
|
+
interface TransactionGroupToSend {
|
|
105
|
+
/** Any parameters to control the semantics of the send to the network */
|
|
106
|
+
sendParams?: Omit<SendTransactionParams, 'fee' | 'maxFee' | 'skipSending' | 'atc'>;
|
|
107
|
+
/** The list of transactions to send, which can either be a raw transaction (in which case `signer` is required),
|
|
108
|
+
* the async result of an AlgoKit utils method that returns a `SendTransactionResult` (saves unwrapping the promise, be sure to pass `skipSending: true`, `signer` is also required)
|
|
109
|
+
* or the transaction with its signer (`signer` is ignored)
|
|
110
|
+
**/
|
|
111
|
+
transactions: (TransactionToSign | Transaction | Promise<SendTransactionResult>)[];
|
|
112
|
+
/** Optional signer to pass in, required if at least one transaction provided is just the transaction, ignored otherwise */
|
|
113
|
+
signer?: SendTransactionFrom;
|
|
117
114
|
}
|
|
118
115
|
/** Parameters to configure transaction sending. */
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
116
|
+
interface SendParams {
|
|
117
|
+
/** The number of rounds to wait for confirmation. By default until the latest lastValid has past. */
|
|
118
|
+
maxRoundsToWaitForConfirmation?: number;
|
|
119
|
+
/** Whether to suppress log messages from transaction send, default: do not suppress. */
|
|
120
|
+
suppressLog?: boolean;
|
|
121
|
+
/** Whether to use simulate to automatically populate app call resources in the txn objects. Defaults to `Config.populateAppCallResources`. */
|
|
122
|
+
populateAppCallResources?: boolean;
|
|
123
|
+
/** Whether to use simulate to automatically calculate required app call inner transaction fees and cover them in the parent app call transaction fee */
|
|
124
|
+
coverAppCallInnerTransactionFees?: boolean;
|
|
128
125
|
}
|
|
129
126
|
/** Additional context about the `AtomicTransactionComposer`. */
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
127
|
+
interface AdditionalAtomicTransactionComposerContext {
|
|
128
|
+
/** A map of transaction index in the `AtomicTransactionComposer` to the max fee that can be calculated for a transaction in the group */
|
|
129
|
+
maxFees: Map<number, AlgoAmount>;
|
|
130
|
+
suggestedParams: Pick<algosdk.SuggestedParams, 'fee' | 'minFee'>;
|
|
134
131
|
}
|
|
135
132
|
/** An `AtomicTransactionComposer` with transactions to send. */
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
133
|
+
interface AtomicTransactionComposerToSend extends SendParams {
|
|
134
|
+
/** The `AtomicTransactionComposer` with transactions loaded to send */
|
|
135
|
+
atc: AtomicTransactionComposer;
|
|
136
|
+
/**
|
|
137
|
+
* @deprecated - set the parameters at the top level instead
|
|
138
|
+
* Any parameters to control the semantics of the send to the network */
|
|
139
|
+
sendParams?: Omit<SendTransactionParams, 'fee' | 'maxFee' | 'skipSending' | 'atc'>;
|
|
140
|
+
/**
|
|
141
|
+
* Additional `AtomicTransactionComposer` context used when building the transaction group that is sent.
|
|
142
|
+
* This additional context is used and must be supplied when coverAppCallInnerTransactionFees is set to true.
|
|
143
|
+
**/
|
|
144
|
+
additionalAtcContext?: AdditionalAtomicTransactionComposerContext;
|
|
148
145
|
}
|
|
146
|
+
//#endregion
|
|
147
|
+
export { AdditionalAtomicTransactionComposerContext, Arc2TransactionNote, AtomicTransactionComposerToSend, ConfirmedTransactionResult, ConfirmedTransactionResults, SendAtomicTransactionComposerResults, SendParams, SendSingleTransactionResult, SendTransactionFrom, SendTransactionParams, SendTransactionResult, SendTransactionResults, TransactionGroupToSend, TransactionNote, TransactionNoteData, TransactionToSign };
|
|
148
|
+
//# sourceMappingURL=transaction.d.ts.map
|
package/types/transaction.js
CHANGED
package/types/transaction.mjs
CHANGED