@algorandfoundation/algokit-utils 9.2.0 → 9.2.1-beta.1
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/package.json
CHANGED
|
@@ -6,13 +6,17 @@
|
|
|
6
6
|
"**"
|
|
7
7
|
],
|
|
8
8
|
"name": "@algorandfoundation/algokit-utils",
|
|
9
|
-
"version": "9.2.
|
|
9
|
+
"version": "9.2.1-beta.1",
|
|
10
10
|
"private": false,
|
|
11
11
|
"description": "A set of core Algorand utilities written in TypeScript and released via npm that make it easier to build solutions on Algorand.",
|
|
12
12
|
"author": "Algorand Foundation",
|
|
13
13
|
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/algorandfoundation/algokit-utils-ts.git"
|
|
17
|
+
},
|
|
14
18
|
"engines": {
|
|
15
|
-
"node": ">=
|
|
19
|
+
"node": ">=22.0"
|
|
16
20
|
},
|
|
17
21
|
"type": "commonjs",
|
|
18
22
|
"module": "index.mjs",
|
|
@@ -36,7 +40,12 @@
|
|
|
36
40
|
"./package.json": "./package.json"
|
|
37
41
|
},
|
|
38
42
|
"overrides": {
|
|
39
|
-
"esbuild": "0.25.0"
|
|
43
|
+
"esbuild": "0.25.0",
|
|
44
|
+
"cross-spawn": ">=7.0.5",
|
|
45
|
+
"brace-expansion": ">=5.0.8",
|
|
46
|
+
"picomatch": ">=4.0.2",
|
|
47
|
+
"fast-uri": "3.1.4",
|
|
48
|
+
"postcss": ">=8.5.23"
|
|
40
49
|
},
|
|
41
50
|
"dependencies": {
|
|
42
51
|
"buffer": "^6.0.3"
|
package/testing/account.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { AlgorandClient } from
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import Kmd = algosdk.Kmd;
|
|
1
|
+
import { TransactionSignerAccount } from "../types/account.js";
|
|
2
|
+
import { AlgorandClient } from "../types/algorand-client.js";
|
|
3
|
+
import { GetTestAccountParams } from "../types/testing.js";
|
|
4
|
+
import algosdk, { Address } from "algosdk";
|
|
5
|
+
|
|
6
|
+
//#region src/testing/account.d.ts
|
|
8
7
|
/**
|
|
9
8
|
* @deprecated Use `getTestAccount(params, algorandClient)` instead. The `algorandClient` object can be created using `AlgorandClient.fromClients({ algod, kmd })`.
|
|
10
9
|
*
|
|
@@ -17,7 +16,7 @@ import Kmd = algosdk.Kmd;
|
|
|
17
16
|
* @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables and if not found fallback to the default LocalNet KMD client
|
|
18
17
|
* @returns The account, with private key loaded
|
|
19
18
|
*/
|
|
20
|
-
|
|
19
|
+
declare function getTestAccount(params: GetTestAccountParams, algod: Algodv2, kmd?: Kmd): Promise<Address & Account & TransactionSignerAccount>;
|
|
21
20
|
/**
|
|
22
21
|
* Creates an ephemeral Algorand account for the purposes of testing.
|
|
23
22
|
* Returns a newly created random test account that is funded from the dispenser
|
|
@@ -27,4 +26,7 @@ export declare function getTestAccount(params: GetTestAccountParams, algod: Algo
|
|
|
27
26
|
* @param algorand An AlgorandClient client
|
|
28
27
|
* @returns The account, with private key loaded
|
|
29
28
|
*/
|
|
30
|
-
|
|
29
|
+
declare function getTestAccount(params: GetTestAccountParams, algorand: AlgorandClient): Promise<Address & Account & TransactionSignerAccount>;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { getTestAccount };
|
|
32
|
+
//# sourceMappingURL=account.d.ts.map
|
package/testing/account.js
CHANGED
|
@@ -1,36 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_config = require("../config.js");
|
|
3
|
+
const require_algorand_client = require("../types/algorand-client.js");
|
|
4
|
+
let algosdk = require("algosdk");
|
|
5
|
+
algosdk = require_runtime.__toESM(algosdk);
|
|
6
|
+
//#region src/testing/account.ts
|
|
7
7
|
async function getTestAccount({ suppressLog, initialFunds, accountGetter }, algodOrAlgorandClient, kmd) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
address.sk = account.sk;
|
|
31
|
-
address.signer = algorand.account.getSigner(address);
|
|
32
|
-
return address;
|
|
8
|
+
const algorand = algodOrAlgorandClient instanceof require_algorand_client.AlgorandClient ? algodOrAlgorandClient : require_algorand_client.AlgorandClient.fromClients({
|
|
9
|
+
algod: algodOrAlgorandClient,
|
|
10
|
+
kmd
|
|
11
|
+
});
|
|
12
|
+
const account = accountGetter ? await accountGetter(algorand) : algosdk.default.generateAccount();
|
|
13
|
+
require_config.Config.getLogger(suppressLog).info(`New test account created with address '${account.addr}' and mnemonic '${algosdk.default.secretKeyToMnemonic(account.sk)}'.`);
|
|
14
|
+
const dispenser = await algorand.account.dispenserFromEnvironment();
|
|
15
|
+
await algorand.send.payment({
|
|
16
|
+
sender: dispenser,
|
|
17
|
+
receiver: account.addr,
|
|
18
|
+
amount: initialFunds,
|
|
19
|
+
note: "Funding test account",
|
|
20
|
+
suppressLog
|
|
21
|
+
});
|
|
22
|
+
const accountInfo = await algorand.account.getInformation(account.addr);
|
|
23
|
+
require_config.Config.getLogger(suppressLog).info("Test account funded; account balance: %d µALGO", accountInfo.balance.microAlgo);
|
|
24
|
+
algorand.setSignerFromAccount(account);
|
|
25
|
+
const address = algosdk.Address.fromString(account.addr.toString());
|
|
26
|
+
address.addr = account.addr;
|
|
27
|
+
address.sk = account.sk;
|
|
28
|
+
address.signer = algorand.account.getSigner(address);
|
|
29
|
+
return address;
|
|
33
30
|
}
|
|
34
|
-
|
|
31
|
+
//#endregion
|
|
35
32
|
exports.getTestAccount = getTestAccount;
|
|
36
|
-
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=account.js.map
|
package/testing/account.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sources":["../../src/testing/account.ts"],"sourcesContent":["import algosdk, { Address } from 'algosdk'\nimport { AlgorandClient, Config } from '../'\nimport { TransactionSignerAccount } from '../types/account'\nimport { GetTestAccountParams } from '../types/testing'\nimport Account = algosdk.Account\nimport Algodv2 = algosdk.Algodv2\nimport Kmd = algosdk.Kmd\n\n/**\n * @deprecated Use `getTestAccount(params, algorandClient)` instead. The `algorandClient` object can be created using `AlgorandClient.fromClients({ algod, kmd })`.\n *\n * Creates an ephemeral Algorand account for the purposes of testing.\n * Returns a newly created random test account that is funded from the dispenser\n * DO NOT USE THIS TO CREATE A MAINNET ACCOUNT!\n * Note: By default this will log the mnemonic of the account.\n * @param params The config for the test account to generate\n * @param algod An algod client\n * @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables and if not found fallback to the default LocalNet KMD client\n * @returns The account, with private key loaded\n */\nexport async function getTestAccount(\n params: GetTestAccountParams,\n algod: Algodv2,\n kmd?: Kmd,\n): Promise<Address & Account & TransactionSignerAccount>\n/**\n * Creates an ephemeral Algorand account for the purposes of testing.\n * Returns a newly created random test account that is funded from the dispenser\n * DO NOT USE THIS TO CREATE A MAINNET ACCOUNT!\n * Note: By default this will log the mnemonic of the account.\n * @param params The config for the test account to generate\n * @param algorand An AlgorandClient client\n * @returns The account, with private key loaded\n */\nexport async function getTestAccount(\n params: GetTestAccountParams,\n algorand: AlgorandClient,\n): Promise<Address & Account & TransactionSignerAccount>\nexport async function getTestAccount(\n { suppressLog, initialFunds, accountGetter }: GetTestAccountParams,\n algodOrAlgorandClient: Algodv2 | AlgorandClient,\n kmd?: Kmd,\n): Promise<Address & Account & TransactionSignerAccount> {\n const algorand =\n algodOrAlgorandClient instanceof AlgorandClient\n ? algodOrAlgorandClient\n : AlgorandClient.fromClients({\n algod: algodOrAlgorandClient,\n kmd,\n })\n\n const account = accountGetter ? await accountGetter(algorand) : algosdk.generateAccount()\n\n Config.getLogger(suppressLog).info(\n `New test account created with address '${account.addr}' and mnemonic '${algosdk.secretKeyToMnemonic(account.sk)}'.`,\n )\n\n const dispenser = await algorand.account.dispenserFromEnvironment()\n\n await algorand.send.payment({\n sender: dispenser,\n receiver: account.addr,\n amount: initialFunds,\n note: 'Funding test account',\n suppressLog,\n })\n\n const accountInfo = await algorand.account.getInformation(account.addr)\n\n Config.getLogger(suppressLog).info('Test account funded; account balance: %d µALGO', accountInfo.balance.microAlgo)\n\n algorand.setSignerFromAccount(account)\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const address = Address.fromString(account.addr.toString()) as any\n address.addr = account.addr\n address.sk = account.sk\n address.signer = algorand.account.getSigner(address)\n\n return address\n}\n"],"
|
|
1
|
+
{"version":3,"file":"account.js","names":["AlgorandClient","Address"],"sources":["../../src/testing/account.ts"],"sourcesContent":["import algosdk, { Address } from 'algosdk'\nimport { AlgorandClient, Config } from '../'\nimport { TransactionSignerAccount } from '../types/account'\nimport { GetTestAccountParams } from '../types/testing'\nimport Account = algosdk.Account\nimport Algodv2 = algosdk.Algodv2\nimport Kmd = algosdk.Kmd\n\n/**\n * @deprecated Use `getTestAccount(params, algorandClient)` instead. The `algorandClient` object can be created using `AlgorandClient.fromClients({ algod, kmd })`.\n *\n * Creates an ephemeral Algorand account for the purposes of testing.\n * Returns a newly created random test account that is funded from the dispenser\n * DO NOT USE THIS TO CREATE A MAINNET ACCOUNT!\n * Note: By default this will log the mnemonic of the account.\n * @param params The config for the test account to generate\n * @param algod An algod client\n * @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables and if not found fallback to the default LocalNet KMD client\n * @returns The account, with private key loaded\n */\nexport async function getTestAccount(\n params: GetTestAccountParams,\n algod: Algodv2,\n kmd?: Kmd,\n): Promise<Address & Account & TransactionSignerAccount>\n/**\n * Creates an ephemeral Algorand account for the purposes of testing.\n * Returns a newly created random test account that is funded from the dispenser\n * DO NOT USE THIS TO CREATE A MAINNET ACCOUNT!\n * Note: By default this will log the mnemonic of the account.\n * @param params The config for the test account to generate\n * @param algorand An AlgorandClient client\n * @returns The account, with private key loaded\n */\nexport async function getTestAccount(\n params: GetTestAccountParams,\n algorand: AlgorandClient,\n): Promise<Address & Account & TransactionSignerAccount>\nexport async function getTestAccount(\n { suppressLog, initialFunds, accountGetter }: GetTestAccountParams,\n algodOrAlgorandClient: Algodv2 | AlgorandClient,\n kmd?: Kmd,\n): Promise<Address & Account & TransactionSignerAccount> {\n const algorand =\n algodOrAlgorandClient instanceof AlgorandClient\n ? algodOrAlgorandClient\n : AlgorandClient.fromClients({\n algod: algodOrAlgorandClient,\n kmd,\n })\n\n const account = accountGetter ? await accountGetter(algorand) : algosdk.generateAccount()\n\n Config.getLogger(suppressLog).info(\n `New test account created with address '${account.addr}' and mnemonic '${algosdk.secretKeyToMnemonic(account.sk)}'.`,\n )\n\n const dispenser = await algorand.account.dispenserFromEnvironment()\n\n await algorand.send.payment({\n sender: dispenser,\n receiver: account.addr,\n amount: initialFunds,\n note: 'Funding test account',\n suppressLog,\n })\n\n const accountInfo = await algorand.account.getInformation(account.addr)\n\n Config.getLogger(suppressLog).info('Test account funded; account balance: %d µALGO', accountInfo.balance.microAlgo)\n\n algorand.setSignerFromAccount(account)\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const address = Address.fromString(account.addr.toString()) as any\n address.addr = account.addr\n address.sk = account.sk\n address.signer = algorand.account.getSigner(address)\n\n return address\n}\n"],"mappings":";;;;;;AAsCA,eAAsB,eACpB,EAAE,aAAa,cAAc,iBAC7B,uBACA,KACuD;CACvD,MAAM,WACJ,iCAAiCA,wBAAAA,iBAC7B,wBACAA,wBAAAA,eAAe,YAAY;EACzB,OAAO;EACP;CACF,CAAC;CAEP,MAAM,UAAU,gBAAgB,MAAM,cAAc,QAAQ,IAAI,QAAA,QAAQ,gBAAgB;CAExF,eAAA,OAAO,UAAU,WAAW,CAAC,CAAC,KAC5B,0CAA0C,QAAQ,KAAK,kBAAkB,QAAA,QAAQ,oBAAoB,QAAQ,EAAE,EAAE,GACnH;CAEA,MAAM,YAAY,MAAM,SAAS,QAAQ,yBAAyB;CAElE,MAAM,SAAS,KAAK,QAAQ;EAC1B,QAAQ;EACR,UAAU,QAAQ;EAClB,QAAQ;EACR,MAAM;EACN;CACF,CAAC;CAED,MAAM,cAAc,MAAM,SAAS,QAAQ,eAAe,QAAQ,IAAI;CAEtE,eAAA,OAAO,UAAU,WAAW,CAAC,CAAC,KAAK,kDAAkD,YAAY,QAAQ,SAAS;CAElH,SAAS,qBAAqB,OAAO;CAGrC,MAAM,UAAUC,QAAAA,QAAQ,WAAW,QAAQ,KAAK,SAAS,CAAC;CAC1D,QAAQ,OAAO,QAAQ;CACvB,QAAQ,KAAK,QAAQ;CACrB,QAAQ,SAAS,SAAS,QAAQ,UAAU,OAAO;CAEnD,OAAO;AACT"}
|
package/testing/account.mjs
CHANGED
|
@@ -1,34 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { AlgorandClient } from
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { Config } from "../config.mjs";
|
|
2
|
+
import { AlgorandClient } from "../types/algorand-client.mjs";
|
|
3
|
+
import algosdk, { Address } from "algosdk";
|
|
4
|
+
//#region src/testing/account.ts
|
|
5
5
|
async function getTestAccount({ suppressLog, initialFunds, accountGetter }, algodOrAlgorandClient, kmd) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
address.sk = account.sk;
|
|
29
|
-
address.signer = algorand.account.getSigner(address);
|
|
30
|
-
return address;
|
|
6
|
+
const algorand = algodOrAlgorandClient instanceof AlgorandClient ? algodOrAlgorandClient : AlgorandClient.fromClients({
|
|
7
|
+
algod: algodOrAlgorandClient,
|
|
8
|
+
kmd
|
|
9
|
+
});
|
|
10
|
+
const account = accountGetter ? await accountGetter(algorand) : algosdk.generateAccount();
|
|
11
|
+
Config.getLogger(suppressLog).info(`New test account created with address '${account.addr}' and mnemonic '${algosdk.secretKeyToMnemonic(account.sk)}'.`);
|
|
12
|
+
const dispenser = await algorand.account.dispenserFromEnvironment();
|
|
13
|
+
await algorand.send.payment({
|
|
14
|
+
sender: dispenser,
|
|
15
|
+
receiver: account.addr,
|
|
16
|
+
amount: initialFunds,
|
|
17
|
+
note: "Funding test account",
|
|
18
|
+
suppressLog
|
|
19
|
+
});
|
|
20
|
+
const accountInfo = await algorand.account.getInformation(account.addr);
|
|
21
|
+
Config.getLogger(suppressLog).info("Test account funded; account balance: %d µALGO", accountInfo.balance.microAlgo);
|
|
22
|
+
algorand.setSignerFromAccount(account);
|
|
23
|
+
const address = Address.fromString(account.addr.toString());
|
|
24
|
+
address.addr = account.addr;
|
|
25
|
+
address.sk = account.sk;
|
|
26
|
+
address.signer = algorand.account.getSigner(address);
|
|
27
|
+
return address;
|
|
31
28
|
}
|
|
32
|
-
|
|
29
|
+
//#endregion
|
|
33
30
|
export { getTestAccount };
|
|
34
|
-
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=account.mjs.map
|
package/testing/account.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.mjs","sources":["../../src/testing/account.ts"],"sourcesContent":["import algosdk, { Address } from 'algosdk'\nimport { AlgorandClient, Config } from '../'\nimport { TransactionSignerAccount } from '../types/account'\nimport { GetTestAccountParams } from '../types/testing'\nimport Account = algosdk.Account\nimport Algodv2 = algosdk.Algodv2\nimport Kmd = algosdk.Kmd\n\n/**\n * @deprecated Use `getTestAccount(params, algorandClient)` instead. The `algorandClient` object can be created using `AlgorandClient.fromClients({ algod, kmd })`.\n *\n * Creates an ephemeral Algorand account for the purposes of testing.\n * Returns a newly created random test account that is funded from the dispenser\n * DO NOT USE THIS TO CREATE A MAINNET ACCOUNT!\n * Note: By default this will log the mnemonic of the account.\n * @param params The config for the test account to generate\n * @param algod An algod client\n * @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables and if not found fallback to the default LocalNet KMD client\n * @returns The account, with private key loaded\n */\nexport async function getTestAccount(\n params: GetTestAccountParams,\n algod: Algodv2,\n kmd?: Kmd,\n): Promise<Address & Account & TransactionSignerAccount>\n/**\n * Creates an ephemeral Algorand account for the purposes of testing.\n * Returns a newly created random test account that is funded from the dispenser\n * DO NOT USE THIS TO CREATE A MAINNET ACCOUNT!\n * Note: By default this will log the mnemonic of the account.\n * @param params The config for the test account to generate\n * @param algorand An AlgorandClient client\n * @returns The account, with private key loaded\n */\nexport async function getTestAccount(\n params: GetTestAccountParams,\n algorand: AlgorandClient,\n): Promise<Address & Account & TransactionSignerAccount>\nexport async function getTestAccount(\n { suppressLog, initialFunds, accountGetter }: GetTestAccountParams,\n algodOrAlgorandClient: Algodv2 | AlgorandClient,\n kmd?: Kmd,\n): Promise<Address & Account & TransactionSignerAccount> {\n const algorand =\n algodOrAlgorandClient instanceof AlgorandClient\n ? algodOrAlgorandClient\n : AlgorandClient.fromClients({\n algod: algodOrAlgorandClient,\n kmd,\n })\n\n const account = accountGetter ? await accountGetter(algorand) : algosdk.generateAccount()\n\n Config.getLogger(suppressLog).info(\n `New test account created with address '${account.addr}' and mnemonic '${algosdk.secretKeyToMnemonic(account.sk)}'.`,\n )\n\n const dispenser = await algorand.account.dispenserFromEnvironment()\n\n await algorand.send.payment({\n sender: dispenser,\n receiver: account.addr,\n amount: initialFunds,\n note: 'Funding test account',\n suppressLog,\n })\n\n const accountInfo = await algorand.account.getInformation(account.addr)\n\n Config.getLogger(suppressLog).info('Test account funded; account balance: %d µALGO', accountInfo.balance.microAlgo)\n\n algorand.setSignerFromAccount(account)\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const address = Address.fromString(account.addr.toString()) as any\n address.addr = account.addr\n address.sk = account.sk\n address.signer = algorand.account.getSigner(address)\n\n return address\n}\n"],"
|
|
1
|
+
{"version":3,"file":"account.mjs","names":[],"sources":["../../src/testing/account.ts"],"sourcesContent":["import algosdk, { Address } from 'algosdk'\nimport { AlgorandClient, Config } from '../'\nimport { TransactionSignerAccount } from '../types/account'\nimport { GetTestAccountParams } from '../types/testing'\nimport Account = algosdk.Account\nimport Algodv2 = algosdk.Algodv2\nimport Kmd = algosdk.Kmd\n\n/**\n * @deprecated Use `getTestAccount(params, algorandClient)` instead. The `algorandClient` object can be created using `AlgorandClient.fromClients({ algod, kmd })`.\n *\n * Creates an ephemeral Algorand account for the purposes of testing.\n * Returns a newly created random test account that is funded from the dispenser\n * DO NOT USE THIS TO CREATE A MAINNET ACCOUNT!\n * Note: By default this will log the mnemonic of the account.\n * @param params The config for the test account to generate\n * @param algod An algod client\n * @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables and if not found fallback to the default LocalNet KMD client\n * @returns The account, with private key loaded\n */\nexport async function getTestAccount(\n params: GetTestAccountParams,\n algod: Algodv2,\n kmd?: Kmd,\n): Promise<Address & Account & TransactionSignerAccount>\n/**\n * Creates an ephemeral Algorand account for the purposes of testing.\n * Returns a newly created random test account that is funded from the dispenser\n * DO NOT USE THIS TO CREATE A MAINNET ACCOUNT!\n * Note: By default this will log the mnemonic of the account.\n * @param params The config for the test account to generate\n * @param algorand An AlgorandClient client\n * @returns The account, with private key loaded\n */\nexport async function getTestAccount(\n params: GetTestAccountParams,\n algorand: AlgorandClient,\n): Promise<Address & Account & TransactionSignerAccount>\nexport async function getTestAccount(\n { suppressLog, initialFunds, accountGetter }: GetTestAccountParams,\n algodOrAlgorandClient: Algodv2 | AlgorandClient,\n kmd?: Kmd,\n): Promise<Address & Account & TransactionSignerAccount> {\n const algorand =\n algodOrAlgorandClient instanceof AlgorandClient\n ? algodOrAlgorandClient\n : AlgorandClient.fromClients({\n algod: algodOrAlgorandClient,\n kmd,\n })\n\n const account = accountGetter ? await accountGetter(algorand) : algosdk.generateAccount()\n\n Config.getLogger(suppressLog).info(\n `New test account created with address '${account.addr}' and mnemonic '${algosdk.secretKeyToMnemonic(account.sk)}'.`,\n )\n\n const dispenser = await algorand.account.dispenserFromEnvironment()\n\n await algorand.send.payment({\n sender: dispenser,\n receiver: account.addr,\n amount: initialFunds,\n note: 'Funding test account',\n suppressLog,\n })\n\n const accountInfo = await algorand.account.getInformation(account.addr)\n\n Config.getLogger(suppressLog).info('Test account funded; account balance: %d µALGO', accountInfo.balance.microAlgo)\n\n algorand.setSignerFromAccount(account)\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const address = Address.fromString(account.addr.toString()) as any\n address.addr = account.addr\n address.sk = account.sk\n address.signer = algorand.account.getSigner(address)\n\n return address\n}\n"],"mappings":";;;;AAsCA,eAAsB,eACpB,EAAE,aAAa,cAAc,iBAC7B,uBACA,KACuD;CACvD,MAAM,WACJ,iCAAiC,iBAC7B,wBACA,eAAe,YAAY;EACzB,OAAO;EACP;CACF,CAAC;CAEP,MAAM,UAAU,gBAAgB,MAAM,cAAc,QAAQ,IAAI,QAAQ,gBAAgB;CAExF,OAAO,UAAU,WAAW,CAAC,CAAC,KAC5B,0CAA0C,QAAQ,KAAK,kBAAkB,QAAQ,oBAAoB,QAAQ,EAAE,EAAE,GACnH;CAEA,MAAM,YAAY,MAAM,SAAS,QAAQ,yBAAyB;CAElE,MAAM,SAAS,KAAK,QAAQ;EAC1B,QAAQ;EACR,UAAU,QAAQ;EAClB,QAAQ;EACR,MAAM;EACN;CACF,CAAC;CAED,MAAM,cAAc,MAAM,SAAS,QAAQ,eAAe,QAAQ,IAAI;CAEtE,OAAO,UAAU,WAAW,CAAC,CAAC,KAAK,kDAAkD,YAAY,QAAQ,SAAS;CAElH,SAAS,qBAAqB,OAAO;CAGrC,MAAM,UAAU,QAAQ,WAAW,QAAQ,KAAK,SAAS,CAAC;CAC1D,QAAQ,OAAO,QAAQ;CACvB,QAAQ,KAAK,QAAQ;CACrB,QAAQ,SAAS,SAAS,QAAQ,UAAU,OAAO;CAEnD,OAAO;AACT"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { AlgoKitLogCaptureFixture } from
|
|
1
|
+
import { AlgoKitLogCaptureFixture } from "../../types/testing.js";
|
|
2
|
+
|
|
3
|
+
//#region src/testing/fixtures/algokit-log-capture-fixture.d.ts
|
|
2
4
|
/**
|
|
3
5
|
* Creates a test fixture for capturing AlgoKit logs.
|
|
4
6
|
*
|
|
@@ -16,4 +18,7 @@ import { AlgoKitLogCaptureFixture } from '../../types/testing';
|
|
|
16
18
|
*
|
|
17
19
|
* @returns The fixture
|
|
18
20
|
*/
|
|
19
|
-
|
|
21
|
+
declare const algoKitLogCaptureFixture: () => AlgoKitLogCaptureFixture;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { algoKitLogCaptureFixture };
|
|
24
|
+
//# sourceMappingURL=algokit-log-capture-fixture.d.ts.map
|
|
@@ -1,45 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var config = require('../../config.js');
|
|
5
|
-
|
|
1
|
+
const require_config = require("../../config.js");
|
|
2
|
+
const require_test_logger = require("../test-logger.js");
|
|
3
|
+
//#region src/testing/fixtures/algokit-log-capture-fixture.ts
|
|
6
4
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
* Creates a test fixture for capturing AlgoKit logs.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const logs = algoKitLogCaptureFixture()
|
|
10
|
+
*
|
|
11
|
+
* beforeEach(logs.beforeEach)
|
|
12
|
+
* afterEach(logs.afterEach)
|
|
13
|
+
*
|
|
14
|
+
* test('My test', () => {
|
|
15
|
+
* const capturedLogs = logs.testLogger.capturedLogs
|
|
16
|
+
* })
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @returns The fixture
|
|
20
|
+
*/
|
|
23
21
|
const algoKitLogCaptureFixture = () => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
logger: originalLogger,
|
|
39
|
-
});
|
|
40
|
-
},
|
|
41
|
-
};
|
|
22
|
+
const originalLogger = require_config.Config.logger;
|
|
23
|
+
let hybridLogger;
|
|
24
|
+
return {
|
|
25
|
+
get testLogger() {
|
|
26
|
+
return hybridLogger;
|
|
27
|
+
},
|
|
28
|
+
beforeEach: () => {
|
|
29
|
+
hybridLogger = new require_test_logger.TestLogger(originalLogger);
|
|
30
|
+
require_config.Config.configure({ logger: hybridLogger });
|
|
31
|
+
},
|
|
32
|
+
afterEach: () => {
|
|
33
|
+
require_config.Config.configure({ logger: originalLogger });
|
|
34
|
+
}
|
|
35
|
+
};
|
|
42
36
|
};
|
|
43
|
-
|
|
37
|
+
//#endregion
|
|
44
38
|
exports.algoKitLogCaptureFixture = algoKitLogCaptureFixture;
|
|
45
|
-
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=algokit-log-capture-fixture.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algokit-log-capture-fixture.js","sources":["../../../src/testing/fixtures/algokit-log-capture-fixture.ts"],"sourcesContent":["import { Config } from '../../'\nimport { AlgoKitLogCaptureFixture } from '../../types/testing'\nimport { TestLogger } from '../test-logger'\n\n/**\n * Creates a test fixture for capturing AlgoKit logs.\n *\n * @example\n * ```typescript\n * const logs = algoKitLogCaptureFixture()\n *\n * beforeEach(logs.beforeEach)\n * afterEach(logs.afterEach)\n *\n * test('My test', () => {\n * const capturedLogs = logs.testLogger.capturedLogs\n * })\n * ```\n *\n * @returns The fixture\n */\nexport const algoKitLogCaptureFixture: () => AlgoKitLogCaptureFixture = () => {\n const originalLogger = Config.logger\n\n let hybridLogger: TestLogger\n\n return {\n get testLogger() {\n return hybridLogger\n },\n beforeEach: () => {\n hybridLogger = new TestLogger(originalLogger)\n Config.configure({\n logger: hybridLogger,\n })\n },\n afterEach: () => {\n Config.configure({\n logger: originalLogger,\n })\n },\n }\n}\n"],"
|
|
1
|
+
{"version":3,"file":"algokit-log-capture-fixture.js","names":["Config","TestLogger"],"sources":["../../../src/testing/fixtures/algokit-log-capture-fixture.ts"],"sourcesContent":["import { Config } from '../../'\nimport { AlgoKitLogCaptureFixture } from '../../types/testing'\nimport { TestLogger } from '../test-logger'\n\n/**\n * Creates a test fixture for capturing AlgoKit logs.\n *\n * @example\n * ```typescript\n * const logs = algoKitLogCaptureFixture()\n *\n * beforeEach(logs.beforeEach)\n * afterEach(logs.afterEach)\n *\n * test('My test', () => {\n * const capturedLogs = logs.testLogger.capturedLogs\n * })\n * ```\n *\n * @returns The fixture\n */\nexport const algoKitLogCaptureFixture: () => AlgoKitLogCaptureFixture = () => {\n const originalLogger = Config.logger\n\n let hybridLogger: TestLogger\n\n return {\n get testLogger() {\n return hybridLogger\n },\n beforeEach: () => {\n hybridLogger = new TestLogger(originalLogger)\n Config.configure({\n logger: hybridLogger,\n })\n },\n afterEach: () => {\n Config.configure({\n logger: originalLogger,\n })\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,iCAAiE;CAC5E,MAAM,iBAAiBA,eAAAA,OAAO;CAE9B,IAAI;CAEJ,OAAO;EACL,IAAI,aAAa;GACf,OAAO;EACT;EACA,kBAAkB;GAChB,eAAe,IAAIC,oBAAAA,WAAW,cAAc;GAC5C,eAAA,OAAO,UAAU,EACf,QAAQ,aACV,CAAC;EACH;EACA,iBAAiB;GACf,eAAA,OAAO,UAAU,EACf,QAAQ,eACV,CAAC;EACH;CACF;AACF"}
|
|
@@ -1,43 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { Config } from "../../config.mjs";
|
|
2
|
+
import { TestLogger } from "../test-logger.mjs";
|
|
3
|
+
//#region src/testing/fixtures/algokit-log-capture-fixture.ts
|
|
4
4
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
* Creates a test fixture for capturing AlgoKit logs.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const logs = algoKitLogCaptureFixture()
|
|
10
|
+
*
|
|
11
|
+
* beforeEach(logs.beforeEach)
|
|
12
|
+
* afterEach(logs.afterEach)
|
|
13
|
+
*
|
|
14
|
+
* test('My test', () => {
|
|
15
|
+
* const capturedLogs = logs.testLogger.capturedLogs
|
|
16
|
+
* })
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @returns The fixture
|
|
20
|
+
*/
|
|
21
21
|
const algoKitLogCaptureFixture = () => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
logger: originalLogger,
|
|
37
|
-
});
|
|
38
|
-
},
|
|
39
|
-
};
|
|
22
|
+
const originalLogger = Config.logger;
|
|
23
|
+
let hybridLogger;
|
|
24
|
+
return {
|
|
25
|
+
get testLogger() {
|
|
26
|
+
return hybridLogger;
|
|
27
|
+
},
|
|
28
|
+
beforeEach: () => {
|
|
29
|
+
hybridLogger = new TestLogger(originalLogger);
|
|
30
|
+
Config.configure({ logger: hybridLogger });
|
|
31
|
+
},
|
|
32
|
+
afterEach: () => {
|
|
33
|
+
Config.configure({ logger: originalLogger });
|
|
34
|
+
}
|
|
35
|
+
};
|
|
40
36
|
};
|
|
41
|
-
|
|
37
|
+
//#endregion
|
|
42
38
|
export { algoKitLogCaptureFixture };
|
|
43
|
-
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=algokit-log-capture-fixture.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algokit-log-capture-fixture.mjs","sources":["../../../src/testing/fixtures/algokit-log-capture-fixture.ts"],"sourcesContent":["import { Config } from '../../'\nimport { AlgoKitLogCaptureFixture } from '../../types/testing'\nimport { TestLogger } from '../test-logger'\n\n/**\n * Creates a test fixture for capturing AlgoKit logs.\n *\n * @example\n * ```typescript\n * const logs = algoKitLogCaptureFixture()\n *\n * beforeEach(logs.beforeEach)\n * afterEach(logs.afterEach)\n *\n * test('My test', () => {\n * const capturedLogs = logs.testLogger.capturedLogs\n * })\n * ```\n *\n * @returns The fixture\n */\nexport const algoKitLogCaptureFixture: () => AlgoKitLogCaptureFixture = () => {\n const originalLogger = Config.logger\n\n let hybridLogger: TestLogger\n\n return {\n get testLogger() {\n return hybridLogger\n },\n beforeEach: () => {\n hybridLogger = new TestLogger(originalLogger)\n Config.configure({\n logger: hybridLogger,\n })\n },\n afterEach: () => {\n Config.configure({\n logger: originalLogger,\n })\n },\n }\n}\n"],"
|
|
1
|
+
{"version":3,"file":"algokit-log-capture-fixture.mjs","names":[],"sources":["../../../src/testing/fixtures/algokit-log-capture-fixture.ts"],"sourcesContent":["import { Config } from '../../'\nimport { AlgoKitLogCaptureFixture } from '../../types/testing'\nimport { TestLogger } from '../test-logger'\n\n/**\n * Creates a test fixture for capturing AlgoKit logs.\n *\n * @example\n * ```typescript\n * const logs = algoKitLogCaptureFixture()\n *\n * beforeEach(logs.beforeEach)\n * afterEach(logs.afterEach)\n *\n * test('My test', () => {\n * const capturedLogs = logs.testLogger.capturedLogs\n * })\n * ```\n *\n * @returns The fixture\n */\nexport const algoKitLogCaptureFixture: () => AlgoKitLogCaptureFixture = () => {\n const originalLogger = Config.logger\n\n let hybridLogger: TestLogger\n\n return {\n get testLogger() {\n return hybridLogger\n },\n beforeEach: () => {\n hybridLogger = new TestLogger(originalLogger)\n Config.configure({\n logger: hybridLogger,\n })\n },\n afterEach: () => {\n Config.configure({\n logger: originalLogger,\n })\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,iCAAiE;CAC5E,MAAM,iBAAiB,OAAO;CAE9B,IAAI;CAEJ,OAAO;EACL,IAAI,aAAa;GACf,OAAO;EACT;EACA,kBAAkB;GAChB,eAAe,IAAI,WAAW,cAAc;GAC5C,OAAO,UAAU,EACf,QAAQ,aACV,CAAC;EACH;EACA,iBAAiB;GACf,OAAO,UAAU,EACf,QAAQ,eACV,CAAC;EACH;CACF;AACF"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { AlgoConfig } from
|
|
2
|
-
import { AlgorandFixture, AlgorandFixtureConfig } from
|
|
1
|
+
import { AlgoConfig } from "../../types/network-client.js";
|
|
2
|
+
import { AlgorandFixture, AlgorandFixtureConfig } from "../../types/testing.js";
|
|
3
|
+
|
|
4
|
+
//#region src/testing/fixtures/algorand-fixture.d.ts
|
|
3
5
|
/**
|
|
4
6
|
* Creates a test fixture for automated testing against Algorand.
|
|
5
7
|
* By default it tests against an environment variable specified client
|
|
@@ -50,7 +52,7 @@ import { AlgorandFixture, AlgorandFixtureConfig } from '../../types/testing';
|
|
|
50
52
|
* @param fixtureConfig The fixture configuration
|
|
51
53
|
* @returns The fixture
|
|
52
54
|
*/
|
|
53
|
-
|
|
55
|
+
declare function algorandFixture(fixtureConfig?: AlgorandFixtureConfig): AlgorandFixture;
|
|
54
56
|
/**
|
|
55
57
|
* @deprecated Config can be passed in directly to fixture config now.
|
|
56
58
|
*
|
|
@@ -64,4 +66,7 @@ export declare function algorandFixture(fixtureConfig?: AlgorandFixtureConfig):
|
|
|
64
66
|
* @param config The fixture configuration
|
|
65
67
|
* @returns The fixture
|
|
66
68
|
*/
|
|
67
|
-
|
|
69
|
+
declare function algorandFixture(fixtureConfig: AlgorandFixtureConfig | undefined, config: AlgoConfig): AlgorandFixture;
|
|
70
|
+
//#endregion
|
|
71
|
+
export { algorandFixture };
|
|
72
|
+
//# sourceMappingURL=algorand-fixture.d.ts.map
|