@algorandfoundation/algokit-utils 10.0.0-alpha.31 → 10.0.0-alpha.32
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/account-manager.d.ts +448 -0
- package/account-manager.js +623 -0
- package/account-manager.js.map +1 -0
- package/account-manager.mjs +620 -0
- package/account-manager.mjs.map +1 -0
- package/account.d.ts +156 -0
- package/account.js +10 -0
- package/account.js.map +1 -0
- package/account.mjs +9 -0
- package/account.mjs.map +1 -0
- package/algorand-client-transaction-creator.d.ts +1103 -0
- package/algorand-client-transaction-creator.js +735 -0
- package/algorand-client-transaction-creator.js.map +1 -0
- package/algorand-client-transaction-creator.mjs +734 -0
- package/algorand-client-transaction-creator.mjs.map +1 -0
- package/algorand-client-transaction-sender.d.ts +1317 -0
- package/algorand-client-transaction-sender.js +933 -0
- package/algorand-client-transaction-sender.js.map +1 -0
- package/algorand-client-transaction-sender.mjs +932 -0
- package/algorand-client-transaction-sender.mjs.map +1 -0
- package/algorand-client.d.ts +246 -0
- package/algorand-client.js +325 -0
- package/algorand-client.js.map +1 -0
- package/algorand-client.mjs +325 -0
- package/algorand-client.mjs.map +1 -0
- package/amount.d.ts +46 -3
- package/amount.js +92 -13
- package/amount.js.map +1 -1
- package/amount.mjs +80 -3
- package/amount.mjs.map +1 -1
- package/app-client.d.ts +2130 -0
- package/app-client.js +909 -0
- package/app-client.js.map +1 -0
- package/app-client.mjs +908 -0
- package/app-client.mjs.map +1 -0
- package/app-deployer.d.ts +166 -0
- package/app-deployer.js +353 -0
- package/app-deployer.js.map +1 -0
- package/app-deployer.mjs +353 -0
- package/app-deployer.mjs.map +1 -0
- package/app-factory.d.ts +965 -0
- package/app-factory.js +448 -0
- package/app-factory.js.map +1 -0
- package/app-factory.mjs +448 -0
- package/app-factory.mjs.map +1 -0
- package/app-manager.d.ts +323 -0
- package/app-manager.js +468 -0
- package/app-manager.js.map +1 -0
- package/app-manager.mjs +468 -0
- package/app-manager.mjs.map +1 -0
- package/app-spec.d.ts +203 -0
- package/app-spec.js +137 -0
- package/app-spec.js.map +1 -0
- package/app-spec.mjs +137 -0
- package/app-spec.mjs.map +1 -0
- package/app.d.ts +257 -0
- package/app.js +49 -0
- package/app.js.map +1 -0
- package/app.mjs +42 -0
- package/app.mjs.map +1 -0
- package/asset-manager.d.ts +212 -0
- package/asset-manager.js +166 -0
- package/asset-manager.js.map +1 -0
- package/asset-manager.mjs +166 -0
- package/asset-manager.mjs.map +1 -0
- package/async-event-emitter.d.ts +16 -0
- package/async-event-emitter.js +38 -0
- package/async-event-emitter.js.map +1 -0
- package/async-event-emitter.mjs +37 -0
- package/async-event-emitter.mjs.map +1 -0
- package/client-manager.d.ts +475 -0
- package/client-manager.js +616 -0
- package/client-manager.js.map +1 -0
- package/client-manager.mjs +616 -0
- package/client-manager.mjs.map +1 -0
- package/composer.d.ts +947 -0
- package/composer.js +1584 -0
- package/composer.js.map +1 -0
- package/composer.mjs +1583 -0
- package/composer.mjs.map +1 -0
- package/config.d.ts +1 -1
- package/config.js +2 -2
- package/config.js.map +1 -1
- package/config.mjs +1 -1
- package/config.mjs.map +1 -1
- package/debugging.d.ts +47 -0
- package/debugging.js +20 -0
- package/debugging.js.map +1 -0
- package/debugging.mjs +15 -0
- package/debugging.mjs.map +1 -0
- package/dispenser-client.d.ts +90 -0
- package/dispenser-client.js +127 -0
- package/dispenser-client.js.map +1 -0
- package/dispenser-client.mjs +127 -0
- package/dispenser-client.mjs.map +1 -0
- package/expand.d.ts +2 -0
- package/expand.js +0 -0
- package/expand.mjs +0 -0
- package/index.d.ts +6 -5
- package/index.js +4 -3
- package/index.mjs +5 -5
- package/indexer-client/indexer-lookup.d.ts +1 -1
- package/indexer-client/indexer-lookup.js.map +1 -1
- package/indexer-client/indexer-lookup.mjs.map +1 -1
- package/indexer.d.ts +40 -0
- package/indexer.js +38 -0
- package/indexer.js.map +1 -0
- package/indexer.mjs +35 -0
- package/indexer.mjs.map +1 -0
- package/instance-of.d.ts +8 -0
- package/kmd-account-manager.d.ts +74 -0
- package/kmd-account-manager.js +167 -0
- package/kmd-account-manager.js.map +1 -0
- package/kmd-account-manager.mjs +165 -0
- package/kmd-account-manager.mjs.map +1 -0
- package/lifecycle-events.d.ts +14 -0
- package/lifecycle-events.js +11 -0
- package/lifecycle-events.js.map +1 -0
- package/lifecycle-events.mjs +10 -0
- package/lifecycle-events.mjs.map +1 -0
- package/logging.d.ts +13 -0
- package/logging.js +47 -0
- package/logging.js.map +1 -0
- package/logging.mjs +42 -0
- package/logging.mjs.map +1 -0
- package/logic-error.d.ts +39 -0
- package/logic-error.js +54 -0
- package/logic-error.js.map +1 -0
- package/logic-error.mjs +53 -0
- package/logic-error.mjs.map +1 -0
- package/network-client.d.ts +43 -0
- package/network-client.js +14 -0
- package/network-client.js.map +1 -0
- package/network-client.mjs +13 -0
- package/network-client.mjs.map +1 -0
- package/package.json +11 -1
- package/testing/account.d.ts +2 -2
- package/testing/account.js +1 -1
- package/testing/account.js.map +1 -1
- package/testing/account.mjs +1 -1
- package/testing/account.mjs.map +1 -1
- package/testing/fixtures/algokit-log-capture-fixture.d.ts +1 -1
- package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -1
- package/testing/fixtures/algokit-log-capture-fixture.mjs.map +1 -1
- package/testing/fixtures/algorand-fixture.d.ts +2 -2
- package/testing/fixtures/algorand-fixture.js +2 -2
- package/testing/fixtures/algorand-fixture.js.map +1 -1
- package/testing/fixtures/algorand-fixture.mjs +2 -2
- package/testing/fixtures/algorand-fixture.mjs.map +1 -1
- package/testing/index.d.ts +2 -1
- package/testing/test-logger.d.ts +1 -1
- package/testing/test-logger.js.map +1 -1
- package/testing/test-logger.mjs.map +1 -1
- package/testing/types.d.ts +156 -0
- package/transaction/index.d.ts +4 -0
- package/transaction/index.js +9 -0
- package/transaction/index.mjs +4 -0
- package/transaction/perform-transaction-composer-simulate.d.ts +1 -1
- package/transaction/perform-transaction-composer-simulate.js.map +1 -1
- package/transaction/perform-transaction-composer-simulate.mjs.map +1 -1
- package/transaction/transaction.d.ts +2 -2
- package/transaction/transaction.js.map +1 -1
- package/transaction/transaction.mjs.map +1 -1
- package/transaction/types.d.ts +133 -0
- package/transactions/app-call.d.ts +1 -1
- package/transactions/app-call.js +1 -1
- package/transactions/app-call.js.map +1 -1
- package/transactions/app-call.mjs +1 -1
- package/transactions/app-call.mjs.map +1 -1
- package/transactions/common.d.ts +1 -1
- package/transactions/common.js.map +1 -1
- package/transactions/common.mjs.map +1 -1
- package/transactions/method-call.d.ts +1 -1
- package/transactions/method-call.js +1 -1
- package/transactions/method-call.js.map +1 -1
- package/transactions/method-call.mjs +1 -1
- package/transactions/method-call.mjs.map +1 -1
- package/transactions/payment.d.ts +1 -1
- package/transactions/payment.js.map +1 -1
- package/transactions/payment.mjs.map +1 -1
- package/types/account-manager.d.ts +11 -442
- package/types/account-manager.js +5 -616
- package/types/account-manager.js.map +1 -1
- package/types/account-manager.mjs +5 -614
- package/types/account-manager.mjs.map +1 -1
- package/types/account.d.ts +8 -150
- package/types/account.js +3 -4
- package/types/account.js.map +1 -1
- package/types/account.mjs +4 -4
- package/types/account.mjs.map +1 -1
- package/types/algorand-client-transaction-creator.d.ts +5 -1098
- package/types/algorand-client-transaction-creator.js +3 -729
- package/types/algorand-client-transaction-creator.js.map +1 -1
- package/types/algorand-client-transaction-creator.mjs +4 -729
- package/types/algorand-client-transaction-creator.mjs.map +1 -1
- package/types/algorand-client-transaction-sender.d.ts +5 -1312
- package/types/algorand-client-transaction-sender.js +3 -927
- package/types/algorand-client-transaction-sender.js.map +1 -1
- package/types/algorand-client-transaction-sender.mjs +3 -926
- package/types/algorand-client-transaction-sender.mjs.map +1 -1
- package/types/algorand-client.d.ts +5 -241
- package/types/algorand-client.js +3 -319
- package/types/algorand-client.js.map +1 -1
- package/types/algorand-client.mjs +3 -319
- package/types/algorand-client.mjs.map +1 -1
- package/types/amount.d.ts +6 -45
- package/types/amount.js +3 -79
- package/types/amount.js.map +1 -1
- package/types/amount.mjs +4 -79
- package/types/amount.mjs.map +1 -1
- package/types/app-client.d.ts +75 -2125
- package/types/app-client.js +3 -903
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +3 -902
- package/types/app-client.mjs.map +1 -1
- package/types/app-deployer.d.ts +21 -161
- package/types/app-deployer.js +3 -347
- package/types/app-deployer.js.map +1 -1
- package/types/app-deployer.mjs +3 -347
- package/types/app-deployer.mjs.map +1 -1
- package/types/app-factory.d.ts +21 -960
- package/types/app-factory.js +3 -442
- package/types/app-factory.js.map +1 -1
- package/types/app-factory.mjs +3 -442
- package/types/app-factory.mjs.map +1 -1
- package/types/app-manager.d.ts +15 -318
- package/types/app-manager.js +3 -462
- package/types/app-manager.js.map +1 -1
- package/types/app-manager.mjs +3 -462
- package/types/app-manager.mjs.map +1 -1
- package/types/app-spec.d.ts +39 -198
- package/types/app-spec.js +3 -131
- package/types/app-spec.js.map +1 -1
- package/types/app-spec.mjs +3 -131
- package/types/app-spec.mjs.map +1 -1
- package/types/app.d.ts +62 -247
- package/types/app.js +15 -37
- package/types/app.js.map +1 -1
- package/types/app.mjs +16 -37
- package/types/app.mjs.map +1 -1
- package/types/asset-manager.d.ts +9 -207
- package/types/asset-manager.js +3 -160
- package/types/asset-manager.js.map +1 -1
- package/types/asset-manager.mjs +3 -160
- package/types/asset-manager.mjs.map +1 -1
- package/types/async-event-emitter.d.ts +7 -11
- package/types/async-event-emitter.js +3 -32
- package/types/async-event-emitter.js.map +1 -1
- package/types/async-event-emitter.mjs +4 -32
- package/types/async-event-emitter.mjs.map +1 -1
- package/types/client-manager.d.ts +27 -470
- package/types/client-manager.js +3 -610
- package/types/client-manager.js.map +1 -1
- package/types/client-manager.mjs +3 -610
- package/types/client-manager.mjs.map +1 -1
- package/types/composer.d.ts +79 -943
- package/types/composer.js +3 -1578
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +3 -1577
- package/types/composer.mjs.map +1 -1
- package/types/config.d.ts +7 -52
- package/types/config.js +3 -74
- package/types/config.js.map +1 -1
- package/types/config.mjs +3 -74
- package/types/config.mjs.map +1 -1
- package/types/debugging.d.ts +12 -37
- package/types/debugging.js +11 -10
- package/types/debugging.js.map +1 -1
- package/types/debugging.mjs +12 -10
- package/types/debugging.mjs.map +1 -1
- package/types/dispenser-client.d.ts +11 -85
- package/types/dispenser-client.js +3 -121
- package/types/dispenser-client.js.map +1 -1
- package/types/dispenser-client.mjs +3 -121
- package/types/dispenser-client.mjs.map +1 -1
- package/types/expand.d.ts +8 -2
- package/types/indexer.d.ts +16 -36
- package/types/indexer.js +7 -30
- package/types/indexer.js.map +1 -1
- package/types/indexer.mjs +8 -30
- package/types/indexer.mjs.map +1 -1
- package/types/instance-of.d.ts +4 -4
- package/types/kmd-account-manager.d.ts +5 -69
- package/types/kmd-account-manager.js +3 -161
- package/types/kmd-account-manager.js.map +1 -1
- package/types/kmd-account-manager.mjs +3 -159
- package/types/kmd-account-manager.mjs.map +1 -1
- package/types/lifecycle-events.d.ts +7 -9
- package/types/lifecycle-events.js +3 -5
- package/types/lifecycle-events.js.map +1 -1
- package/types/lifecycle-events.mjs +4 -5
- package/types/lifecycle-events.mjs.map +1 -1
- package/types/logging.d.ts +14 -9
- package/types/logging.js +11 -37
- package/types/logging.js.map +1 -1
- package/types/logging.mjs +12 -37
- package/types/logging.mjs.map +1 -1
- package/types/logic-error.d.ts +8 -35
- package/types/logic-error.js +3 -48
- package/types/logic-error.js.map +1 -1
- package/types/logic-error.mjs +4 -48
- package/types/logic-error.mjs.map +1 -1
- package/types/network-client.d.ts +10 -39
- package/types/network-client.js +3 -8
- package/types/network-client.js.map +1 -1
- package/types/network-client.mjs +4 -8
- package/types/network-client.mjs.map +1 -1
- package/types/testing.d.ts +13 -151
- package/types/transaction.d.ts +33 -128
- package/updatable-config.d.ts +57 -0
- package/updatable-config.js +80 -0
- package/updatable-config.js.map +1 -0
- package/updatable-config.mjs +80 -0
- package/updatable-config.mjs.map +1 -0
- package/util.js +1 -1
- package/util.js.map +1 -1
- package/util.mjs +1 -1
- package/util.mjs.map +1 -1
package/types/testing.d.ts
CHANGED
|
@@ -1,156 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Transaction } from "../packages/transact/src/transactions/transaction.js";
|
|
3
|
-
import { MultisigAccount } from "../packages/transact/src/multisig.js";
|
|
4
|
-
import { LogicSigAccount } from "../packages/transact/src/logicsig.js";
|
|
5
|
-
import { AddressWithSigners, AddressWithTransactionSigner } from "../packages/transact/src/signer.js";
|
|
6
|
-
import { AlgodClient } from "../packages/algod_client/src/client.js";
|
|
7
|
-
import { AlgoAmount } from "./amount.js";
|
|
8
|
-
import { TransactionResponse } from "../packages/indexer_client/src/models/transaction-response.js";
|
|
9
|
-
import { IndexerClient } from "../packages/indexer_client/src/client.js";
|
|
10
|
-
import { KmdClient } from "../packages/kmd_client/src/client.js";
|
|
11
|
-
import { AlgoConfig } from "./network-client.js";
|
|
12
|
-
import { AlgorandClient } from "./algorand-client.js";
|
|
13
|
-
import { TestLogger } from "../testing/test-logger.js";
|
|
14
|
-
import { TransactionLogger } from "../testing/transaction-logger.js";
|
|
1
|
+
import { AlgoKitLogCaptureFixture as AlgoKitLogCaptureFixture$1, AlgorandFixture as AlgorandFixture$1, AlgorandFixtureConfig as AlgorandFixtureConfig$1, AlgorandTestAutomationContext as AlgorandTestAutomationContext$1, GetTestAccountParams as GetTestAccountParams$1, LogSnapshotConfig as LogSnapshotConfig$1 } from "../testing/types.js";
|
|
15
2
|
|
|
16
3
|
//#region src/types/testing.d.ts
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/** Transaction logger that will log transaction IDs for all transactions issued by `algod` */
|
|
30
|
-
transactionLogger: TransactionLogger;
|
|
31
|
-
/** Default, funded test account that is ephemerally created */
|
|
32
|
-
testAccount: Address & AddressWithSigners;
|
|
33
|
-
/** Generate and fund an additional ephemerally created account */
|
|
34
|
-
generateAccount: (params: GetTestAccountParams) => Promise<Address & AddressWithSigners>;
|
|
35
|
-
/** Wait for the indexer to catch up with all transactions logged by `transactionLogger` */
|
|
36
|
-
waitForIndexer: () => Promise<void>;
|
|
37
|
-
/** Wait for the indexer to catch up with the given transaction ID */
|
|
38
|
-
waitForIndexerTransaction: (transactionId: string) => Promise<TransactionResponse>;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Parameters for the `getTestAccount` function.
|
|
42
|
-
*/
|
|
43
|
-
interface GetTestAccountParams {
|
|
44
|
-
/** Initial funds to ensure the account has */
|
|
45
|
-
initialFunds: AlgoAmount;
|
|
46
|
-
/** Whether to suppress the log (which includes a mnemonic) or not (default: do not suppress the log) */
|
|
47
|
-
suppressLog?: boolean;
|
|
48
|
-
/** Optional override for how to get a test account; this allows you to retrieve accounts from a known or cached list of accounts. */
|
|
49
|
-
accountGetter?: (algorand: AlgorandClient) => Promise<Address & AddressWithSigners>;
|
|
50
|
-
}
|
|
51
|
-
/** Configuration for creating an Algorand testing fixture. */
|
|
52
|
-
interface AlgorandFixtureConfig extends Partial<AlgoConfig> {
|
|
53
|
-
/** 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. */
|
|
54
|
-
algod?: AlgodClient;
|
|
55
|
-
/** 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. */
|
|
56
|
-
indexer?: IndexerClient;
|
|
57
|
-
/** 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. */
|
|
58
|
-
kmd?: KmdClient;
|
|
59
|
-
/** The amount of funds to allocate to the default testing account, if not specified then it will get 10 ALGO. */
|
|
60
|
-
testAccountFunding?: AlgoAmount;
|
|
61
|
-
/** Optional override for how to get an account; this allows you to retrieve accounts from a known or cached list of accounts. */
|
|
62
|
-
accountGetter?: (algorand: AlgorandClient) => Promise<Address & AddressWithSigners>;
|
|
63
|
-
}
|
|
64
|
-
/** An Algorand automated testing fixture */
|
|
65
|
-
interface AlgorandFixture {
|
|
66
|
-
/**
|
|
67
|
-
* Retrieve the current context.
|
|
68
|
-
* Useful with destructuring.
|
|
69
|
-
*
|
|
70
|
-
* If you haven't called `newScope` then this will throw an error.
|
|
71
|
-
* @example
|
|
72
|
-
* ```typescript
|
|
73
|
-
* test('My test', () => {
|
|
74
|
-
* const {algod, indexer, testAccount, ...} = fixture.context
|
|
75
|
-
* })
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
get context(): AlgorandTestAutomationContext;
|
|
79
|
-
/**
|
|
80
|
-
* Retrieve an `AlgorandClient` loaded with the current context, including testAccount and any generated accounts loaded as signers.
|
|
81
|
-
*/
|
|
82
|
-
get algorand(): AlgorandClient;
|
|
83
|
-
/**
|
|
84
|
-
* @deprecated Use newScope instead.
|
|
85
|
-
* Testing framework agnostic handler method to run before each test to prepare the `context` for that test with per test isolation.
|
|
86
|
-
*/
|
|
87
|
-
beforeEach: () => Promise<void>;
|
|
88
|
-
/**
|
|
89
|
-
* Creates a new isolated fixture scope (clean transaction logger, AlgorandClient, testAccount, etc.).
|
|
90
|
-
*
|
|
91
|
-
* You can call this from any testing framework specific hook method to control when you want a new scope.
|
|
92
|
-
*
|
|
93
|
-
* @example Jest / vitest - per test isolation (beforeEach)
|
|
94
|
-
* ```typescript
|
|
95
|
-
* describe('MY MODULE', () => {
|
|
96
|
-
* const fixture = algorandFixture()
|
|
97
|
-
* beforeEach(fixture.newScope)
|
|
98
|
-
*
|
|
99
|
-
* test('MY TEST', async () => {
|
|
100
|
-
* const { algorand, testAccount } = fixture.context
|
|
101
|
-
*
|
|
102
|
-
* // Test stuff!
|
|
103
|
-
* })
|
|
104
|
-
* })
|
|
105
|
-
* ```
|
|
106
|
-
*
|
|
107
|
-
* @example Jest / vitest - test suite isolation (beforeAll)
|
|
108
|
-
* ```typescript
|
|
109
|
-
* describe('MY MODULE', () => {
|
|
110
|
-
* const fixture = algorandFixture()
|
|
111
|
-
* beforeAll(fixture.newScope)
|
|
112
|
-
*
|
|
113
|
-
* test('test1', async () => {
|
|
114
|
-
* const { algorand, testAccount } = fixture.context
|
|
115
|
-
*
|
|
116
|
-
* // Test stuff!
|
|
117
|
-
* })
|
|
118
|
-
* test('test2', async () => {
|
|
119
|
-
* const { algorand, testAccount } = fixture.context
|
|
120
|
-
* // algorand and testAccount are the same as in test1
|
|
121
|
-
* })
|
|
122
|
-
* })
|
|
123
|
-
* ```
|
|
124
|
-
*
|
|
125
|
-
*/
|
|
126
|
-
newScope: () => Promise<void>;
|
|
127
|
-
}
|
|
128
|
-
/** Configuration for preparing a captured log snapshot.
|
|
129
|
-
* This helps ensure that the provided configuration items won't appear
|
|
130
|
-
* with random values in the log snapshot, but rather will get substituted with predictable ids.
|
|
131
|
-
*/
|
|
132
|
-
interface LogSnapshotConfig {
|
|
133
|
-
/** Any transaction IDs or transactions to replace the ID for predictably */
|
|
134
|
-
transactions?: (string | Transaction)[];
|
|
135
|
-
/** Any accounts/addresses to replace the address for predictably */
|
|
136
|
-
accounts?: (string | Address | LogicSigAccount | MultisigAccount | AddressWithTransactionSigner)[];
|
|
137
|
-
/** Any app IDs to replace predictably */
|
|
138
|
-
apps?: (string | number | bigint)[];
|
|
139
|
-
/** Optional filter predicate to filter out logs */
|
|
140
|
-
filterPredicate?: (log: string) => boolean;
|
|
141
|
-
}
|
|
142
|
-
interface AlgoKitLogCaptureFixture {
|
|
143
|
-
/** The test logger instance for the current test */
|
|
144
|
-
get testLogger(): TestLogger;
|
|
145
|
-
/**
|
|
146
|
-
* Testing framework agnostic handler method to run before each test to prepare the `testLogger` for that test.
|
|
147
|
-
*/
|
|
148
|
-
beforeEach: () => void;
|
|
149
|
-
/**
|
|
150
|
-
* Testing framework agnostic handler method to run after each test to reset the logger.
|
|
151
|
-
*/
|
|
152
|
-
afterEach: () => void;
|
|
153
|
-
}
|
|
4
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/testing` instead */
|
|
5
|
+
type AlgorandTestAutomationContext = AlgorandTestAutomationContext$1;
|
|
6
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/testing` instead */
|
|
7
|
+
type GetTestAccountParams = GetTestAccountParams$1;
|
|
8
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/testing` instead */
|
|
9
|
+
type AlgorandFixtureConfig = AlgorandFixtureConfig$1;
|
|
10
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/testing` instead */
|
|
11
|
+
type AlgorandFixture = AlgorandFixture$1;
|
|
12
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/testing` instead */
|
|
13
|
+
type LogSnapshotConfig = LogSnapshotConfig$1;
|
|
14
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/testing` instead */
|
|
15
|
+
type AlgoKitLogCaptureFixture = AlgoKitLogCaptureFixture$1;
|
|
154
16
|
//#endregion
|
|
155
17
|
export { AlgoKitLogCaptureFixture, AlgorandFixture, AlgorandFixtureConfig, AlgorandTestAutomationContext, GetTestAccountParams, LogSnapshotConfig };
|
|
156
18
|
//# sourceMappingURL=testing.d.ts.map
|
package/types/transaction.d.ts
CHANGED
|
@@ -1,133 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ABIReturn } from "../packages/abi/src/abi-method.js";
|
|
3
|
-
import { Transaction } from "../packages/transact/src/transactions/transaction.js";
|
|
4
|
-
import { AddressWithTransactionSigner, SendingAddress, TransactionSigner } from "../packages/transact/src/signer.js";
|
|
5
|
-
import { PendingTransactionResponse } from "../packages/algod_client/src/models/pending-transaction-response.js";
|
|
6
|
-
import { AlgoAmount } from "./amount.js";
|
|
7
|
-
import { TransactionComposer } from "./composer.js";
|
|
1
|
+
import { AdditionalTransactionComposerContext as AdditionalTransactionComposerContext$1, Arc2TransactionNote as Arc2TransactionNote$1, ConfirmedTransactionResult as ConfirmedTransactionResult$1, ConfirmedTransactionResults as ConfirmedTransactionResults$1, SendParams as SendParams$1, SendSingleTransactionResult as SendSingleTransactionResult$1, SendTransactionComposerResults as SendTransactionComposerResults$1, SendTransactionFrom as SendTransactionFrom$1, SendTransactionParams as SendTransactionParams$1, SendTransactionResult as SendTransactionResult$1, SendTransactionResults as SendTransactionResults$1, TransactionComposerToSend as TransactionComposerToSend$1, TransactionGroupToSend as TransactionGroupToSend$1, TransactionNote as TransactionNote$1, TransactionNoteData as TransactionNoteData$1, TransactionToSign as TransactionToSign$1 } from "../transaction/types.js";
|
|
8
2
|
|
|
9
3
|
//#region src/types/transaction.d.ts
|
|
10
|
-
|
|
11
|
-
type
|
|
12
|
-
/**
|
|
13
|
-
type
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/** Result from sending a single transaction. */
|
|
43
|
-
type SendSingleTransactionResult = Expand<SendTransactionComposerResults & ConfirmedTransactionResult>;
|
|
44
|
-
/** The result of sending a transaction */
|
|
45
|
-
interface SendTransactionResult {
|
|
46
|
-
/** The transaction */
|
|
47
|
-
transaction: Transaction;
|
|
48
|
-
/** The response if the transaction was sent and waited for */
|
|
49
|
-
confirmation?: PendingTransactionResponse;
|
|
50
|
-
}
|
|
51
|
-
/** The result of preparing and/or sending multiple transactions */
|
|
52
|
-
interface SendTransactionResults {
|
|
53
|
-
/** The transactions that have been prepared and/or sent */
|
|
54
|
-
transactions: Transaction[];
|
|
55
|
-
/** The responses if the transactions were sent and waited for,
|
|
56
|
-
* the index of the confirmation will match the index of the underlying transaction
|
|
57
|
-
*/
|
|
58
|
-
confirmations?: PendingTransactionResponse[];
|
|
59
|
-
}
|
|
60
|
-
/** The result of preparing and/or sending multiple transactions using an `TransactionComposer` */
|
|
61
|
-
interface SendTransactionComposerResults extends Omit<SendTransactionResults, 'confirmations'> {
|
|
62
|
-
/** base64 encoded representation of the group ID of the group */
|
|
63
|
-
groupId: string | undefined;
|
|
64
|
-
/** The transaction IDs that have been prepared and/or sent */
|
|
65
|
-
txIds: string[];
|
|
66
|
-
/** If ABI method(s) were called the processed return values */
|
|
67
|
-
returns?: ABIReturn[];
|
|
68
|
-
/** The responses if the transactions were sent and waited for,
|
|
69
|
-
* the index of the confirmation will match the index of the underlying transaction
|
|
70
|
-
*/
|
|
71
|
-
confirmations: PendingTransactionResponse[];
|
|
72
|
-
}
|
|
73
|
-
/** The result of sending and confirming a transaction */
|
|
74
|
-
interface ConfirmedTransactionResult extends SendTransactionResult {
|
|
75
|
-
/** The response from sending and waiting for the transaction */
|
|
76
|
-
confirmation: PendingTransactionResponse;
|
|
77
|
-
}
|
|
78
|
-
/** The result of sending and confirming one or more transactions, but where there is a primary transaction of interest */
|
|
79
|
-
interface ConfirmedTransactionResults extends SendTransactionResult, SendTransactionResults {
|
|
80
|
-
/** The response from sending and waiting for the primary transaction */
|
|
81
|
-
confirmation: PendingTransactionResponse;
|
|
82
|
-
/** The response from sending and waiting for the transactions */
|
|
83
|
-
confirmations: PendingTransactionResponse[];
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* @deprcated Use `SendingAddress` instead
|
|
87
|
-
*/
|
|
88
|
-
type SendTransactionFrom = AddressWithTransactionSigner;
|
|
89
|
-
/** Defines an unsigned transaction that will appear in a group of transactions along with its signing information */
|
|
90
|
-
interface TransactionToSign {
|
|
91
|
-
/** The unsigned transaction to sign and send */
|
|
92
|
-
transaction: Transaction;
|
|
93
|
-
/** The account to use to sign the transaction, either an account (with private key loaded) or a logic signature account */
|
|
94
|
-
signer: AddressWithTransactionSigner | TransactionSigner;
|
|
95
|
-
}
|
|
96
|
-
/** A group of transactions to send together as an group
|
|
97
|
-
* https://dev.algorand.co/concepts/transactions/atomic-txn-groups/
|
|
98
|
-
*/
|
|
99
|
-
interface TransactionGroupToSend {
|
|
100
|
-
/** Any parameters to control the semantics of the send to the network */
|
|
101
|
-
sendParams?: Omit<SendTransactionParams, 'fee' | 'maxFee' | 'skipSending' | 'atc'>;
|
|
102
|
-
/** The list of transactions to send, which can either be a raw transaction (in which case `signer` is required),
|
|
103
|
-
* 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)
|
|
104
|
-
* or the transaction with its signer (`signer` is ignored)
|
|
105
|
-
**/
|
|
106
|
-
transactions: (TransactionToSign | Transaction | Promise<SendTransactionResult>)[];
|
|
107
|
-
/** Optional signer to pass in, required if at least one transaction provided is just the transaction, ignored otherwise */
|
|
108
|
-
signer?: SendingAddress;
|
|
109
|
-
}
|
|
110
|
-
/** Parameters to configure transaction sending. */
|
|
111
|
-
interface SendParams {
|
|
112
|
-
/** The number of rounds to wait for confirmation. By default until the latest lastValid has past. */
|
|
113
|
-
maxRoundsToWaitForConfirmation?: number;
|
|
114
|
-
/** Whether to suppress log messages from transaction send, default: do not suppress. */
|
|
115
|
-
suppressLog?: boolean;
|
|
116
|
-
/** Whether to use simulate to automatically populate app call resources in the txn objects. Defaults to `Config.populateAppCallResources`. */
|
|
117
|
-
populateAppCallResources?: boolean;
|
|
118
|
-
/** Whether to use simulate to automatically calculate required app call inner transaction fees and cover them in the parent app call transaction fee */
|
|
119
|
-
coverAppCallInnerTransactionFees?: boolean;
|
|
120
|
-
}
|
|
121
|
-
/** Additional context about the `TransactionComposer`. */
|
|
122
|
-
interface AdditionalTransactionComposerContext {
|
|
123
|
-
/** A map of transaction index in the `TransactionComposer` to the max fee that can be calculated for a transaction in the group */
|
|
124
|
-
maxFees: Map<number, AlgoAmount>;
|
|
125
|
-
}
|
|
126
|
-
/** An `TransactionComposer` with transactions to send. */
|
|
127
|
-
interface TransactionComposerToSend extends SendParams {
|
|
128
|
-
/** The `TransactionComposer` with transactions loaded to send */
|
|
129
|
-
transactionComposer: TransactionComposer;
|
|
130
|
-
}
|
|
4
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/transaction` instead */
|
|
5
|
+
type TransactionNote = TransactionNote$1;
|
|
6
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/transaction` instead */
|
|
7
|
+
type TransactionNoteData = TransactionNoteData$1;
|
|
8
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/transaction` instead */
|
|
9
|
+
type Arc2TransactionNote = Arc2TransactionNote$1;
|
|
10
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/transaction` instead */
|
|
11
|
+
type SendTransactionParams = SendTransactionParams$1;
|
|
12
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/transaction` instead */
|
|
13
|
+
type SendSingleTransactionResult = SendSingleTransactionResult$1;
|
|
14
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/transaction` instead */
|
|
15
|
+
type SendTransactionResult = SendTransactionResult$1;
|
|
16
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/transaction` instead */
|
|
17
|
+
type SendTransactionResults = SendTransactionResults$1;
|
|
18
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/transaction` instead */
|
|
19
|
+
type SendTransactionComposerResults = SendTransactionComposerResults$1;
|
|
20
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/transaction` instead */
|
|
21
|
+
type ConfirmedTransactionResult = ConfirmedTransactionResult$1;
|
|
22
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/transaction` instead */
|
|
23
|
+
type ConfirmedTransactionResults = ConfirmedTransactionResults$1;
|
|
24
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/transaction` instead */
|
|
25
|
+
type SendTransactionFrom = SendTransactionFrom$1;
|
|
26
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/transaction` instead */
|
|
27
|
+
type TransactionToSign = TransactionToSign$1;
|
|
28
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/transaction` instead */
|
|
29
|
+
type TransactionGroupToSend = TransactionGroupToSend$1;
|
|
30
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/transaction` instead */
|
|
31
|
+
type SendParams = SendParams$1;
|
|
32
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/transaction` instead */
|
|
33
|
+
type AdditionalTransactionComposerContext = AdditionalTransactionComposerContext$1;
|
|
34
|
+
/** @deprecated Import from `@algorandfoundation/algokit-utils/transaction` instead */
|
|
35
|
+
type TransactionComposerToSend = TransactionComposerToSend$1;
|
|
131
36
|
//#endregion
|
|
132
37
|
export { AdditionalTransactionComposerContext, Arc2TransactionNote, ConfirmedTransactionResult, ConfirmedTransactionResults, SendParams, SendSingleTransactionResult, SendTransactionComposerResults, SendTransactionFrom, SendTransactionParams, SendTransactionResult, SendTransactionResults, TransactionComposerToSend, TransactionGroupToSend, TransactionNote, TransactionNoteData, TransactionToSign };
|
|
133
38
|
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Logger } from "./packages/common/src/logger.js";
|
|
2
|
+
import { AsyncEventEmitter } from "./async-event-emitter.js";
|
|
3
|
+
|
|
4
|
+
//#region src/updatable-config.d.ts
|
|
5
|
+
/** The AlgoKit configuration type */
|
|
6
|
+
interface Config {
|
|
7
|
+
/** Logger */
|
|
8
|
+
logger: Logger;
|
|
9
|
+
/** Whether or not debug mode is enabled */
|
|
10
|
+
debug: boolean;
|
|
11
|
+
/** The path to the project root directory */
|
|
12
|
+
projectRoot: string | null;
|
|
13
|
+
/** Indicates whether to trace all operations */
|
|
14
|
+
traceAll: boolean;
|
|
15
|
+
/** The size of the trace buffer in megabytes */
|
|
16
|
+
traceBufferSizeMb: number;
|
|
17
|
+
/** The maximum depth to search for a specific file */
|
|
18
|
+
maxSearchDepth: number;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to enable populateAppCallResources in sendParams by default.
|
|
21
|
+
* Default value is false.
|
|
22
|
+
*/
|
|
23
|
+
populateAppCallResources: boolean;
|
|
24
|
+
events: AsyncEventEmitter;
|
|
25
|
+
}
|
|
26
|
+
/** Updatable AlgoKit config */
|
|
27
|
+
declare class UpdatableConfig implements Readonly<Config> {
|
|
28
|
+
private config;
|
|
29
|
+
get populateAppCallResources(): boolean;
|
|
30
|
+
get logger(): Logger;
|
|
31
|
+
get debug(): boolean;
|
|
32
|
+
get projectRoot(): string | null;
|
|
33
|
+
get traceAll(): boolean;
|
|
34
|
+
get traceBufferSizeMb(): number;
|
|
35
|
+
get maxSearchDepth(): number;
|
|
36
|
+
get events(): AsyncEventEmitter;
|
|
37
|
+
/**
|
|
38
|
+
* Returns the current logger, or the null logger if true is passed in to `returnNullLogger`
|
|
39
|
+
* @param returnNullLogger Whether or not to return the null logger
|
|
40
|
+
* @returns The requested logger
|
|
41
|
+
*/
|
|
42
|
+
getLogger(returnNullLogger?: boolean): Logger;
|
|
43
|
+
/**
|
|
44
|
+
* Temporarily run with debug set to true.
|
|
45
|
+
* @param lambda A lambda expression with code to run with debug config set to true
|
|
46
|
+
*/
|
|
47
|
+
withDebug(lambda: () => unknown): void;
|
|
48
|
+
constructor();
|
|
49
|
+
/**
|
|
50
|
+
* Update the AlgoKit configuration with your own configuration settings
|
|
51
|
+
* @param newConfig Partial or complete config to replace
|
|
52
|
+
*/
|
|
53
|
+
configure(newConfig: Partial<Config>): void;
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { Config, UpdatableConfig };
|
|
57
|
+
//# sourceMappingURL=updatable-config.d.ts.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const require_async_event_emitter = require('./async-event-emitter.js');
|
|
2
|
+
const require_logging = require('./logging.js');
|
|
3
|
+
|
|
4
|
+
//#region src/updatable-config.ts
|
|
5
|
+
/** Updatable AlgoKit config */
|
|
6
|
+
var UpdatableConfig = class {
|
|
7
|
+
config;
|
|
8
|
+
get populateAppCallResources() {
|
|
9
|
+
return this.config.populateAppCallResources;
|
|
10
|
+
}
|
|
11
|
+
get logger() {
|
|
12
|
+
return this.config.logger;
|
|
13
|
+
}
|
|
14
|
+
get debug() {
|
|
15
|
+
return this.config.debug;
|
|
16
|
+
}
|
|
17
|
+
get projectRoot() {
|
|
18
|
+
return this.config.projectRoot;
|
|
19
|
+
}
|
|
20
|
+
get traceAll() {
|
|
21
|
+
return this.config.traceAll;
|
|
22
|
+
}
|
|
23
|
+
get traceBufferSizeMb() {
|
|
24
|
+
return this.config.traceBufferSizeMb;
|
|
25
|
+
}
|
|
26
|
+
get maxSearchDepth() {
|
|
27
|
+
return this.config.maxSearchDepth;
|
|
28
|
+
}
|
|
29
|
+
get events() {
|
|
30
|
+
return this.config.events;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Returns the current logger, or the null logger if true is passed in to `returnNullLogger`
|
|
34
|
+
* @param returnNullLogger Whether or not to return the null logger
|
|
35
|
+
* @returns The requested logger
|
|
36
|
+
*/
|
|
37
|
+
getLogger(returnNullLogger) {
|
|
38
|
+
if (returnNullLogger) return require_logging.nullLogger;
|
|
39
|
+
return this.logger;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Temporarily run with debug set to true.
|
|
43
|
+
* @param lambda A lambda expression with code to run with debug config set to true
|
|
44
|
+
*/
|
|
45
|
+
withDebug(lambda) {
|
|
46
|
+
const original = this.config.debug;
|
|
47
|
+
try {
|
|
48
|
+
this.config.debug = true;
|
|
49
|
+
lambda();
|
|
50
|
+
} finally {
|
|
51
|
+
this.config.debug = original;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
constructor() {
|
|
55
|
+
this.config = {
|
|
56
|
+
logger: require_logging.consoleLogger,
|
|
57
|
+
debug: false,
|
|
58
|
+
projectRoot: null,
|
|
59
|
+
traceAll: false,
|
|
60
|
+
traceBufferSizeMb: 256,
|
|
61
|
+
maxSearchDepth: 10,
|
|
62
|
+
populateAppCallResources: true,
|
|
63
|
+
events: new require_async_event_emitter.AsyncEventEmitter()
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Update the AlgoKit configuration with your own configuration settings
|
|
68
|
+
* @param newConfig Partial or complete config to replace
|
|
69
|
+
*/
|
|
70
|
+
configure(newConfig) {
|
|
71
|
+
this.config = {
|
|
72
|
+
...this.config,
|
|
73
|
+
...newConfig
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
exports.UpdatableConfig = UpdatableConfig;
|
|
80
|
+
//# sourceMappingURL=updatable-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updatable-config.js","names":["nullLogger","consoleLogger","AsyncEventEmitter"],"sources":["../src/updatable-config.ts"],"sourcesContent":["import { AsyncEventEmitter } from './async-event-emitter'\nimport { Logger, consoleLogger, nullLogger } from './logging'\n\n/** The AlgoKit configuration type */\nexport interface Config {\n /** Logger */\n logger: Logger\n /** Whether or not debug mode is enabled */\n debug: boolean\n /** The path to the project root directory */\n projectRoot: string | null\n /** Indicates whether to trace all operations */\n traceAll: boolean\n /** The size of the trace buffer in megabytes */\n traceBufferSizeMb: number\n /** The maximum depth to search for a specific file */\n maxSearchDepth: number\n /**\n * Whether to enable populateAppCallResources in sendParams by default.\n * Default value is false.\n */\n populateAppCallResources: boolean\n\n events: AsyncEventEmitter\n}\n\n/** Updatable AlgoKit config */\nexport class UpdatableConfig implements Readonly<Config> {\n private config: Config\n\n get populateAppCallResources() {\n return this.config.populateAppCallResources\n }\n\n get logger() {\n return this.config.logger\n }\n\n get debug() {\n return this.config.debug\n }\n\n get projectRoot() {\n return this.config.projectRoot\n }\n\n get traceAll() {\n return this.config.traceAll\n }\n\n get traceBufferSizeMb() {\n return this.config.traceBufferSizeMb\n }\n\n get maxSearchDepth() {\n return this.config.maxSearchDepth\n }\n\n get events() {\n return this.config.events\n }\n\n /**\n * Returns the current logger, or the null logger if true is passed in to `returnNullLogger`\n * @param returnNullLogger Whether or not to return the null logger\n * @returns The requested logger\n */\n getLogger(returnNullLogger?: boolean) {\n if (returnNullLogger) {\n return nullLogger\n }\n\n return this.logger\n }\n\n /**\n * Temporarily run with debug set to true.\n * @param lambda A lambda expression with code to run with debug config set to true\n */\n withDebug(lambda: () => unknown) {\n const original = this.config.debug\n try {\n this.config.debug = true\n lambda()\n } finally {\n this.config.debug = original\n }\n }\n\n constructor() {\n this.config = {\n logger: consoleLogger,\n debug: false,\n projectRoot: null,\n traceAll: false,\n traceBufferSizeMb: 256,\n maxSearchDepth: 10,\n populateAppCallResources: true,\n events: new AsyncEventEmitter(),\n }\n }\n\n /**\n * Update the AlgoKit configuration with your own configuration settings\n * @param newConfig Partial or complete config to replace\n */\n configure(newConfig: Partial<Config>) {\n this.config = { ...this.config, ...newConfig }\n }\n}\n"],"mappings":";;;;;AA2BA,IAAa,kBAAb,MAAyD;CACvD,AAAQ;CAER,IAAI,2BAA2B;AAC7B,SAAO,KAAK,OAAO;;CAGrB,IAAI,SAAS;AACX,SAAO,KAAK,OAAO;;CAGrB,IAAI,QAAQ;AACV,SAAO,KAAK,OAAO;;CAGrB,IAAI,cAAc;AAChB,SAAO,KAAK,OAAO;;CAGrB,IAAI,WAAW;AACb,SAAO,KAAK,OAAO;;CAGrB,IAAI,oBAAoB;AACtB,SAAO,KAAK,OAAO;;CAGrB,IAAI,iBAAiB;AACnB,SAAO,KAAK,OAAO;;CAGrB,IAAI,SAAS;AACX,SAAO,KAAK,OAAO;;;;;;;CAQrB,UAAU,kBAA4B;AACpC,MAAI,iBACF,QAAOA;AAGT,SAAO,KAAK;;;;;;CAOd,UAAU,QAAuB;EAC/B,MAAM,WAAW,KAAK,OAAO;AAC7B,MAAI;AACF,QAAK,OAAO,QAAQ;AACpB,WAAQ;YACA;AACR,QAAK,OAAO,QAAQ;;;CAIxB,cAAc;AACZ,OAAK,SAAS;GACZ,QAAQC;GACR,OAAO;GACP,aAAa;GACb,UAAU;GACV,mBAAmB;GACnB,gBAAgB;GAChB,0BAA0B;GAC1B,QAAQ,IAAIC,+CAAmB;GAChC;;;;;;CAOH,UAAU,WAA4B;AACpC,OAAK,SAAS;GAAE,GAAG,KAAK;GAAQ,GAAG;GAAW"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { AsyncEventEmitter } from "./async-event-emitter.mjs";
|
|
2
|
+
import { consoleLogger, nullLogger } from "./logging.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/updatable-config.ts
|
|
5
|
+
/** Updatable AlgoKit config */
|
|
6
|
+
var UpdatableConfig = class {
|
|
7
|
+
config;
|
|
8
|
+
get populateAppCallResources() {
|
|
9
|
+
return this.config.populateAppCallResources;
|
|
10
|
+
}
|
|
11
|
+
get logger() {
|
|
12
|
+
return this.config.logger;
|
|
13
|
+
}
|
|
14
|
+
get debug() {
|
|
15
|
+
return this.config.debug;
|
|
16
|
+
}
|
|
17
|
+
get projectRoot() {
|
|
18
|
+
return this.config.projectRoot;
|
|
19
|
+
}
|
|
20
|
+
get traceAll() {
|
|
21
|
+
return this.config.traceAll;
|
|
22
|
+
}
|
|
23
|
+
get traceBufferSizeMb() {
|
|
24
|
+
return this.config.traceBufferSizeMb;
|
|
25
|
+
}
|
|
26
|
+
get maxSearchDepth() {
|
|
27
|
+
return this.config.maxSearchDepth;
|
|
28
|
+
}
|
|
29
|
+
get events() {
|
|
30
|
+
return this.config.events;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Returns the current logger, or the null logger if true is passed in to `returnNullLogger`
|
|
34
|
+
* @param returnNullLogger Whether or not to return the null logger
|
|
35
|
+
* @returns The requested logger
|
|
36
|
+
*/
|
|
37
|
+
getLogger(returnNullLogger) {
|
|
38
|
+
if (returnNullLogger) return nullLogger;
|
|
39
|
+
return this.logger;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Temporarily run with debug set to true.
|
|
43
|
+
* @param lambda A lambda expression with code to run with debug config set to true
|
|
44
|
+
*/
|
|
45
|
+
withDebug(lambda) {
|
|
46
|
+
const original = this.config.debug;
|
|
47
|
+
try {
|
|
48
|
+
this.config.debug = true;
|
|
49
|
+
lambda();
|
|
50
|
+
} finally {
|
|
51
|
+
this.config.debug = original;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
constructor() {
|
|
55
|
+
this.config = {
|
|
56
|
+
logger: consoleLogger,
|
|
57
|
+
debug: false,
|
|
58
|
+
projectRoot: null,
|
|
59
|
+
traceAll: false,
|
|
60
|
+
traceBufferSizeMb: 256,
|
|
61
|
+
maxSearchDepth: 10,
|
|
62
|
+
populateAppCallResources: true,
|
|
63
|
+
events: new AsyncEventEmitter()
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Update the AlgoKit configuration with your own configuration settings
|
|
68
|
+
* @param newConfig Partial or complete config to replace
|
|
69
|
+
*/
|
|
70
|
+
configure(newConfig) {
|
|
71
|
+
this.config = {
|
|
72
|
+
...this.config,
|
|
73
|
+
...newConfig
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
export { UpdatableConfig };
|
|
80
|
+
//# sourceMappingURL=updatable-config.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updatable-config.mjs","names":[],"sources":["../src/updatable-config.ts"],"sourcesContent":["import { AsyncEventEmitter } from './async-event-emitter'\nimport { Logger, consoleLogger, nullLogger } from './logging'\n\n/** The AlgoKit configuration type */\nexport interface Config {\n /** Logger */\n logger: Logger\n /** Whether or not debug mode is enabled */\n debug: boolean\n /** The path to the project root directory */\n projectRoot: string | null\n /** Indicates whether to trace all operations */\n traceAll: boolean\n /** The size of the trace buffer in megabytes */\n traceBufferSizeMb: number\n /** The maximum depth to search for a specific file */\n maxSearchDepth: number\n /**\n * Whether to enable populateAppCallResources in sendParams by default.\n * Default value is false.\n */\n populateAppCallResources: boolean\n\n events: AsyncEventEmitter\n}\n\n/** Updatable AlgoKit config */\nexport class UpdatableConfig implements Readonly<Config> {\n private config: Config\n\n get populateAppCallResources() {\n return this.config.populateAppCallResources\n }\n\n get logger() {\n return this.config.logger\n }\n\n get debug() {\n return this.config.debug\n }\n\n get projectRoot() {\n return this.config.projectRoot\n }\n\n get traceAll() {\n return this.config.traceAll\n }\n\n get traceBufferSizeMb() {\n return this.config.traceBufferSizeMb\n }\n\n get maxSearchDepth() {\n return this.config.maxSearchDepth\n }\n\n get events() {\n return this.config.events\n }\n\n /**\n * Returns the current logger, or the null logger if true is passed in to `returnNullLogger`\n * @param returnNullLogger Whether or not to return the null logger\n * @returns The requested logger\n */\n getLogger(returnNullLogger?: boolean) {\n if (returnNullLogger) {\n return nullLogger\n }\n\n return this.logger\n }\n\n /**\n * Temporarily run with debug set to true.\n * @param lambda A lambda expression with code to run with debug config set to true\n */\n withDebug(lambda: () => unknown) {\n const original = this.config.debug\n try {\n this.config.debug = true\n lambda()\n } finally {\n this.config.debug = original\n }\n }\n\n constructor() {\n this.config = {\n logger: consoleLogger,\n debug: false,\n projectRoot: null,\n traceAll: false,\n traceBufferSizeMb: 256,\n maxSearchDepth: 10,\n populateAppCallResources: true,\n events: new AsyncEventEmitter(),\n }\n }\n\n /**\n * Update the AlgoKit configuration with your own configuration settings\n * @param newConfig Partial or complete config to replace\n */\n configure(newConfig: Partial<Config>) {\n this.config = { ...this.config, ...newConfig }\n }\n}\n"],"mappings":";;;;;AA2BA,IAAa,kBAAb,MAAyD;CACvD,AAAQ;CAER,IAAI,2BAA2B;AAC7B,SAAO,KAAK,OAAO;;CAGrB,IAAI,SAAS;AACX,SAAO,KAAK,OAAO;;CAGrB,IAAI,QAAQ;AACV,SAAO,KAAK,OAAO;;CAGrB,IAAI,cAAc;AAChB,SAAO,KAAK,OAAO;;CAGrB,IAAI,WAAW;AACb,SAAO,KAAK,OAAO;;CAGrB,IAAI,oBAAoB;AACtB,SAAO,KAAK,OAAO;;CAGrB,IAAI,iBAAiB;AACnB,SAAO,KAAK,OAAO;;CAGrB,IAAI,SAAS;AACX,SAAO,KAAK,OAAO;;;;;;;CAQrB,UAAU,kBAA4B;AACpC,MAAI,iBACF,QAAO;AAGT,SAAO,KAAK;;;;;;CAOd,UAAU,QAAuB;EAC/B,MAAM,WAAW,KAAK,OAAO;AAC7B,MAAI;AACF,QAAK,OAAO,QAAQ;AACpB,WAAQ;YACA;AACR,QAAK,OAAO,QAAQ;;;CAIxB,cAAc;AACZ,OAAK,SAAS;GACZ,QAAQ;GACR,OAAO;GACP,aAAa;GACb,UAAU;GACV,mBAAmB;GACnB,gBAAgB;GAChB,0BAA0B;GAC1B,QAAQ,IAAI,mBAAmB;GAChC;;;;;;CAOH,UAAU,WAA4B;AACpC,OAAK,SAAS;GAAE,GAAG,KAAK;GAAQ,GAAG;GAAW"}
|
package/util.js
CHANGED
package/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","names":["APP_PAGE_MAX_SIZE"],"sources":["../src/util.ts"],"sourcesContent":["import { APP_PAGE_MAX_SIZE } from './
|
|
1
|
+
{"version":3,"file":"util.js","names":["APP_PAGE_MAX_SIZE"],"sources":["../src/util.ts"],"sourcesContent":["import { APP_PAGE_MAX_SIZE } from './app'\n\n/**\n * Converts a value which might be a number or a bigint into a number to be used with apis that don't support bigint.\n *\n * Throws an UnsafeConversionError if the conversion would result in an unsafe integer for the Number type\n * @param value\n */\nexport const toNumber = (value: number | bigint) => {\n if (typeof value === 'number') return value\n\n if (value > BigInt(Number.MAX_SAFE_INTEGER)) {\n throw new UnsafeConversionError(\n `Cannot convert ${value} to a Number as it is larger than the maximum safe integer the Number type can hold.`,\n )\n } else if (value < BigInt(Number.MIN_SAFE_INTEGER)) {\n throw new UnsafeConversionError(\n `Cannot convert ${value} to a Number as it is smaller than the minimum safe integer the Number type can hold.`,\n )\n }\n return Number(value)\n}\n\nexport class UnsafeConversionError extends Error {}\n\n/**\n * Calculates the amount of funds to add to a wallet to bring it up to the minimum spending balance.\n * @param minSpendingBalance The minimum spending balance for the wallet\n * @param currentSpendingBalance The current spending balance for the wallet\n * @param minFundingIncrement The minimum amount of funds that can be added to the wallet\n * @returns The amount of funds to add to the wallet or null if the wallet is already above the minimum spending balance\n */\nexport const calculateFundAmount = (\n minSpendingBalance: bigint,\n currentSpendingBalance: bigint,\n minFundingIncrement: bigint,\n): bigint | null => {\n if (minSpendingBalance > currentSpendingBalance) {\n const minFundAmount = minSpendingBalance - currentSpendingBalance\n return BigInt(Math.max(Number(minFundAmount), Number(minFundingIncrement)))\n } else {\n return null\n }\n}\n\n/**\n * Checks if the current environment is Node.js\n *\n * @returns A boolean indicating whether the current environment is Node.js\n */\nexport const isNode = () => {\n return typeof process !== 'undefined' && process.versions != null && process.versions.node != null\n}\n\n/**\n * Returns the given array split into chunks of `batchSize` batches.\n * @param array The array to chunk\n * @param batchSize The size of batches to split the array into\n * @returns A generator that yields the array split into chunks of `batchSize` batches\n */\nexport function* chunkArray<T>(array: T[], batchSize: number): Generator<T[], void> {\n for (let i = 0; i < array.length; i += batchSize) yield array.slice(i, i + batchSize)\n}\n\n/**\n * Memoize calls to the given function in an in-memory map.\n * @param fn The function to memoize\n * @returns The memoized function\n */\nexport const memoize = <T = unknown, R = unknown>(fn: (val: T) => R) => {\n const cache = new Map()\n const cached = function (this: unknown, val: T) {\n return cache.has(val) ? cache.get(val) : cache.set(val, fn.call(this, val)) && cache.get(val)\n }\n cached.cache = cache\n return cached as (val: T) => R\n}\n\nexport const binaryStartsWith = (base: Uint8Array, startsWith: Uint8Array): boolean => {\n if (startsWith.length > base.length) return false\n for (let i = 0; i < startsWith.length; i++) {\n if (base[i] !== startsWith[i]) return false\n }\n return true\n}\n\nexport const defaultJsonValueReplacer = (key: string, value: unknown) => {\n if (typeof value === 'bigint') {\n try {\n return toNumber(value)\n } catch {\n return value.toString()\n }\n }\n return value\n}\nexport const asJson = (\n value: unknown,\n replacer: (key: string, value: unknown) => unknown = defaultJsonValueReplacer,\n space?: string | number,\n) => {\n return JSON.stringify(value, replacer, space)\n}\n\n/** Calculate minimum number of extra program pages required for provided approval and clear state programs */\nexport const calculateExtraProgramPages = (approvalProgram: Uint8Array, clearStateProgram?: Uint8Array): number => {\n return Math.floor((approvalProgram.length + (clearStateProgram?.length ?? 0) - 1) / APP_PAGE_MAX_SIZE)\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,YAAY,UAA2B;AAClD,KAAI,OAAO,UAAU,SAAU,QAAO;AAEtC,KAAI,QAAQ,OAAO,OAAO,iBAAiB,CACzC,OAAM,IAAI,sBACR,kBAAkB,MAAM,sFACzB;UACQ,QAAQ,OAAO,OAAO,iBAAiB,CAChD,OAAM,IAAI,sBACR,kBAAkB,MAAM,uFACzB;AAEH,QAAO,OAAO,MAAM;;AAGtB,IAAa,wBAAb,cAA2C,MAAM;;;;;;;;AASjD,MAAa,uBACX,oBACA,wBACA,wBACkB;AAClB,KAAI,qBAAqB,wBAAwB;EAC/C,MAAM,gBAAgB,qBAAqB;AAC3C,SAAO,OAAO,KAAK,IAAI,OAAO,cAAc,EAAE,OAAO,oBAAoB,CAAC,CAAC;OAE3E,QAAO;;;;;;;;AAmBX,UAAiB,WAAc,OAAY,WAAyC;AAClF,MAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,UAAW,OAAM,MAAM,MAAM,GAAG,IAAI,UAAU;;;;;;;AAQvF,MAAa,WAAqC,OAAsB;CACtE,MAAM,wBAAQ,IAAI,KAAK;CACvB,MAAM,SAAS,SAAyB,KAAQ;AAC9C,SAAO,MAAM,IAAI,IAAI,GAAG,MAAM,IAAI,IAAI,GAAG,MAAM,IAAI,KAAK,GAAG,KAAK,MAAM,IAAI,CAAC,IAAI,MAAM,IAAI,IAAI;;AAE/F,QAAO,QAAQ;AACf,QAAO;;AAGT,MAAa,oBAAoB,MAAkB,eAAoC;AACrF,KAAI,WAAW,SAAS,KAAK,OAAQ,QAAO;AAC5C,MAAK,IAAI,IAAI,GAAG,IAAI,WAAW,QAAQ,IACrC,KAAI,KAAK,OAAO,WAAW,GAAI,QAAO;AAExC,QAAO;;AAGT,MAAa,4BAA4B,KAAa,UAAmB;AACvE,KAAI,OAAO,UAAU,SACnB,KAAI;AACF,SAAO,SAAS,MAAM;SAChB;AACN,SAAO,MAAM,UAAU;;AAG3B,QAAO;;AAET,MAAa,UACX,OACA,WAAqD,0BACrD,UACG;AACH,QAAO,KAAK,UAAU,OAAO,UAAU,MAAM;;;AAI/C,MAAa,8BAA8B,iBAA6B,sBAA2C;AACjH,QAAO,KAAK,OAAO,gBAAgB,UAAU,mBAAmB,UAAU,KAAK,KAAKA,8BAAkB"}
|
package/util.mjs
CHANGED
package/util.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.mjs","names":[],"sources":["../src/util.ts"],"sourcesContent":["import { APP_PAGE_MAX_SIZE } from './
|
|
1
|
+
{"version":3,"file":"util.mjs","names":[],"sources":["../src/util.ts"],"sourcesContent":["import { APP_PAGE_MAX_SIZE } from './app'\n\n/**\n * Converts a value which might be a number or a bigint into a number to be used with apis that don't support bigint.\n *\n * Throws an UnsafeConversionError if the conversion would result in an unsafe integer for the Number type\n * @param value\n */\nexport const toNumber = (value: number | bigint) => {\n if (typeof value === 'number') return value\n\n if (value > BigInt(Number.MAX_SAFE_INTEGER)) {\n throw new UnsafeConversionError(\n `Cannot convert ${value} to a Number as it is larger than the maximum safe integer the Number type can hold.`,\n )\n } else if (value < BigInt(Number.MIN_SAFE_INTEGER)) {\n throw new UnsafeConversionError(\n `Cannot convert ${value} to a Number as it is smaller than the minimum safe integer the Number type can hold.`,\n )\n }\n return Number(value)\n}\n\nexport class UnsafeConversionError extends Error {}\n\n/**\n * Calculates the amount of funds to add to a wallet to bring it up to the minimum spending balance.\n * @param minSpendingBalance The minimum spending balance for the wallet\n * @param currentSpendingBalance The current spending balance for the wallet\n * @param minFundingIncrement The minimum amount of funds that can be added to the wallet\n * @returns The amount of funds to add to the wallet or null if the wallet is already above the minimum spending balance\n */\nexport const calculateFundAmount = (\n minSpendingBalance: bigint,\n currentSpendingBalance: bigint,\n minFundingIncrement: bigint,\n): bigint | null => {\n if (minSpendingBalance > currentSpendingBalance) {\n const minFundAmount = minSpendingBalance - currentSpendingBalance\n return BigInt(Math.max(Number(minFundAmount), Number(minFundingIncrement)))\n } else {\n return null\n }\n}\n\n/**\n * Checks if the current environment is Node.js\n *\n * @returns A boolean indicating whether the current environment is Node.js\n */\nexport const isNode = () => {\n return typeof process !== 'undefined' && process.versions != null && process.versions.node != null\n}\n\n/**\n * Returns the given array split into chunks of `batchSize` batches.\n * @param array The array to chunk\n * @param batchSize The size of batches to split the array into\n * @returns A generator that yields the array split into chunks of `batchSize` batches\n */\nexport function* chunkArray<T>(array: T[], batchSize: number): Generator<T[], void> {\n for (let i = 0; i < array.length; i += batchSize) yield array.slice(i, i + batchSize)\n}\n\n/**\n * Memoize calls to the given function in an in-memory map.\n * @param fn The function to memoize\n * @returns The memoized function\n */\nexport const memoize = <T = unknown, R = unknown>(fn: (val: T) => R) => {\n const cache = new Map()\n const cached = function (this: unknown, val: T) {\n return cache.has(val) ? cache.get(val) : cache.set(val, fn.call(this, val)) && cache.get(val)\n }\n cached.cache = cache\n return cached as (val: T) => R\n}\n\nexport const binaryStartsWith = (base: Uint8Array, startsWith: Uint8Array): boolean => {\n if (startsWith.length > base.length) return false\n for (let i = 0; i < startsWith.length; i++) {\n if (base[i] !== startsWith[i]) return false\n }\n return true\n}\n\nexport const defaultJsonValueReplacer = (key: string, value: unknown) => {\n if (typeof value === 'bigint') {\n try {\n return toNumber(value)\n } catch {\n return value.toString()\n }\n }\n return value\n}\nexport const asJson = (\n value: unknown,\n replacer: (key: string, value: unknown) => unknown = defaultJsonValueReplacer,\n space?: string | number,\n) => {\n return JSON.stringify(value, replacer, space)\n}\n\n/** Calculate minimum number of extra program pages required for provided approval and clear state programs */\nexport const calculateExtraProgramPages = (approvalProgram: Uint8Array, clearStateProgram?: Uint8Array): number => {\n return Math.floor((approvalProgram.length + (clearStateProgram?.length ?? 0) - 1) / APP_PAGE_MAX_SIZE)\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,YAAY,UAA2B;AAClD,KAAI,OAAO,UAAU,SAAU,QAAO;AAEtC,KAAI,QAAQ,OAAO,OAAO,iBAAiB,CACzC,OAAM,IAAI,sBACR,kBAAkB,MAAM,sFACzB;UACQ,QAAQ,OAAO,OAAO,iBAAiB,CAChD,OAAM,IAAI,sBACR,kBAAkB,MAAM,uFACzB;AAEH,QAAO,OAAO,MAAM;;AAGtB,IAAa,wBAAb,cAA2C,MAAM;;;;;;;;AASjD,MAAa,uBACX,oBACA,wBACA,wBACkB;AAClB,KAAI,qBAAqB,wBAAwB;EAC/C,MAAM,gBAAgB,qBAAqB;AAC3C,SAAO,OAAO,KAAK,IAAI,OAAO,cAAc,EAAE,OAAO,oBAAoB,CAAC,CAAC;OAE3E,QAAO;;;;;;;;AAmBX,UAAiB,WAAc,OAAY,WAAyC;AAClF,MAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,UAAW,OAAM,MAAM,MAAM,GAAG,IAAI,UAAU;;;;;;;AAQvF,MAAa,WAAqC,OAAsB;CACtE,MAAM,wBAAQ,IAAI,KAAK;CACvB,MAAM,SAAS,SAAyB,KAAQ;AAC9C,SAAO,MAAM,IAAI,IAAI,GAAG,MAAM,IAAI,IAAI,GAAG,MAAM,IAAI,KAAK,GAAG,KAAK,MAAM,IAAI,CAAC,IAAI,MAAM,IAAI,IAAI;;AAE/F,QAAO,QAAQ;AACf,QAAO;;AAGT,MAAa,oBAAoB,MAAkB,eAAoC;AACrF,KAAI,WAAW,SAAS,KAAK,OAAQ,QAAO;AAC5C,MAAK,IAAI,IAAI,GAAG,IAAI,WAAW,QAAQ,IACrC,KAAI,KAAK,OAAO,WAAW,GAAI,QAAO;AAExC,QAAO;;AAGT,MAAa,4BAA4B,KAAa,UAAmB;AACvE,KAAI,OAAO,UAAU,SACnB,KAAI;AACF,SAAO,SAAS,MAAM;SAChB;AACN,SAAO,MAAM,UAAU;;AAG3B,QAAO;;AAET,MAAa,UACX,OACA,WAAqD,0BACrD,UACG;AACH,QAAO,KAAK,UAAU,OAAO,UAAU,MAAM;;;AAI/C,MAAa,8BAA8B,iBAA6B,sBAA2C;AACjH,QAAO,KAAK,OAAO,gBAAgB,UAAU,mBAAmB,UAAU,KAAK,KAAK,kBAAkB"}
|