@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
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { Address } from "../packages/common/src/address.js";
|
|
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 "./test-logger.js";
|
|
14
|
+
import { TransactionLogger } from "./transaction-logger.js";
|
|
15
|
+
|
|
16
|
+
//#region src/testing/types.d.ts
|
|
17
|
+
/**
|
|
18
|
+
* Test automation context.
|
|
19
|
+
*/
|
|
20
|
+
interface AlgorandTestAutomationContext {
|
|
21
|
+
/** An AlgorandClient instance loaded with the current context, including testAccount and any generated accounts loaded as signers */
|
|
22
|
+
algorand: AlgorandClient;
|
|
23
|
+
/** Algod client instance that will log transactions in `transactionLogger` */
|
|
24
|
+
algod: AlgodClient;
|
|
25
|
+
/** Indexer client instance */
|
|
26
|
+
indexer: IndexerClient;
|
|
27
|
+
/** KMD client instance */
|
|
28
|
+
kmd: KmdClient;
|
|
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
|
+
}
|
|
154
|
+
//#endregion
|
|
155
|
+
export { AlgoKitLogCaptureFixture, AlgorandFixture, AlgorandFixtureConfig, AlgorandTestAutomationContext, GetTestAccountParams, LogSnapshotConfig };
|
|
156
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { performTransactionComposerSimulate } from "./perform-transaction-composer-simulate.js";
|
|
2
|
+
import { AdditionalTransactionComposerContext, Arc2TransactionNote, ConfirmedTransactionResult, ConfirmedTransactionResults, SendParams, SendSingleTransactionResult, SendTransactionComposerResults, SendTransactionFrom, SendTransactionParams, SendTransactionResult, SendTransactionResults, TransactionComposerToSend, TransactionGroupToSend, TransactionNote, TransactionNoteData, TransactionToSign } from "./types.js";
|
|
3
|
+
import { TransactionWithSigner, encodeLease, populateAppCallResources, prepareGroupForSending, sendTransactionComposer, waitForConfirmation } from "./transaction.js";
|
|
4
|
+
export { AdditionalTransactionComposerContext, Arc2TransactionNote, ConfirmedTransactionResult, ConfirmedTransactionResults, SendParams, SendSingleTransactionResult, SendTransactionComposerResults, SendTransactionFrom, SendTransactionParams, SendTransactionResult, SendTransactionResults, TransactionComposerToSend, TransactionGroupToSend, TransactionNote, TransactionNoteData, TransactionToSign, TransactionWithSigner, encodeLease, performTransactionComposerSimulate, populateAppCallResources, prepareGroupForSending, sendTransactionComposer, waitForConfirmation };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const require_perform_transaction_composer_simulate = require('./perform-transaction-composer-simulate.js');
|
|
2
|
+
const require_transaction = require('./transaction.js');
|
|
3
|
+
|
|
4
|
+
exports.encodeLease = require_transaction.encodeLease;
|
|
5
|
+
exports.performTransactionComposerSimulate = require_perform_transaction_composer_simulate.performTransactionComposerSimulate;
|
|
6
|
+
exports.populateAppCallResources = require_transaction.populateAppCallResources;
|
|
7
|
+
exports.prepareGroupForSending = require_transaction.prepareGroupForSending;
|
|
8
|
+
exports.sendTransactionComposer = require_transaction.sendTransactionComposer;
|
|
9
|
+
exports.waitForConfirmation = require_transaction.waitForConfirmation;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { performTransactionComposerSimulate } from "./perform-transaction-composer-simulate.mjs";
|
|
2
|
+
import { encodeLease, populateAppCallResources, prepareGroupForSending, sendTransactionComposer, waitForConfirmation } from "./transaction.mjs";
|
|
3
|
+
|
|
4
|
+
export { encodeLease, performTransactionComposerSimulate, populateAppCallResources, prepareGroupForSending, sendTransactionComposer, waitForConfirmation };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SimulateResponse } from "../packages/algod_client/src/models/simulate-response.js";
|
|
2
|
-
import { RawSimulateOptions, TransactionComposer } from "../
|
|
2
|
+
import { RawSimulateOptions, TransactionComposer } from "../composer.js";
|
|
3
3
|
|
|
4
4
|
//#region src/transaction/perform-transaction-composer-simulate.d.ts
|
|
5
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perform-transaction-composer-simulate.js","names":[],"sources":["../../src/transaction/perform-transaction-composer-simulate.ts"],"sourcesContent":["import { RawSimulateOptions, SimulateOptions, TransactionComposer } from '../
|
|
1
|
+
{"version":3,"file":"perform-transaction-composer-simulate.js","names":[],"sources":["../../src/transaction/perform-transaction-composer-simulate.ts"],"sourcesContent":["import { RawSimulateOptions, SimulateOptions, TransactionComposer } from '../composer'\n\n/**\n * @deprecated Use `composer.simulate` with\n * - `allowEmptySignatures` flag set to true\n * - `resultOnFailure` flag set to true\n *\n * Performs a simulation of the transactions loaded into the given TransactionComposer.\n * Uses empty transaction signers for all transactions.\n *\n * @param composer The TransactionComposer with transaction(s) loaded.\n * @returns The simulation result, which includes various details about how the transactions would be processed.\n */\nexport async function performTransactionComposerSimulate(composer: TransactionComposer, options?: RawSimulateOptions) {\n const simulateOptions = {\n ...(options ?? {\n skipSignatures: true,\n allowEmptySignatures: true,\n fixSigners: true,\n allowMoreLogging: true,\n execTraceConfig: {\n enable: true,\n scratchChange: true,\n stackChange: true,\n stateChange: true,\n },\n resultOnFailure: true,\n }),\n } satisfies SimulateOptions\n\n const simulateResult = await composer.simulate(simulateOptions)\n return simulateResult.simulateResponse\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,eAAsB,mCAAmC,UAA+B,SAA8B;CACpH,MAAM,kBAAkB,EACtB,GAAI,WAAW;EACb,gBAAgB;EAChB,sBAAsB;EACtB,YAAY;EACZ,kBAAkB;EAClB,iBAAiB;GACf,QAAQ;GACR,eAAe;GACf,aAAa;GACb,aAAa;GACd;EACD,iBAAiB;EAClB,EACF;AAGD,SADuB,MAAM,SAAS,SAAS,gBAAgB,EACzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perform-transaction-composer-simulate.mjs","names":[],"sources":["../../src/transaction/perform-transaction-composer-simulate.ts"],"sourcesContent":["import { RawSimulateOptions, SimulateOptions, TransactionComposer } from '../
|
|
1
|
+
{"version":3,"file":"perform-transaction-composer-simulate.mjs","names":[],"sources":["../../src/transaction/perform-transaction-composer-simulate.ts"],"sourcesContent":["import { RawSimulateOptions, SimulateOptions, TransactionComposer } from '../composer'\n\n/**\n * @deprecated Use `composer.simulate` with\n * - `allowEmptySignatures` flag set to true\n * - `resultOnFailure` flag set to true\n *\n * Performs a simulation of the transactions loaded into the given TransactionComposer.\n * Uses empty transaction signers for all transactions.\n *\n * @param composer The TransactionComposer with transaction(s) loaded.\n * @returns The simulation result, which includes various details about how the transactions would be processed.\n */\nexport async function performTransactionComposerSimulate(composer: TransactionComposer, options?: RawSimulateOptions) {\n const simulateOptions = {\n ...(options ?? {\n skipSignatures: true,\n allowEmptySignatures: true,\n fixSigners: true,\n allowMoreLogging: true,\n execTraceConfig: {\n enable: true,\n scratchChange: true,\n stackChange: true,\n stateChange: true,\n },\n resultOnFailure: true,\n }),\n } satisfies SimulateOptions\n\n const simulateResult = await composer.simulate(simulateOptions)\n return simulateResult.simulateResponse\n}\n"],"mappings":";;;;;;;;;;;;AAaA,eAAsB,mCAAmC,UAA+B,SAA8B;CACpH,MAAM,kBAAkB,EACtB,GAAI,WAAW;EACb,gBAAgB;EAChB,sBAAsB;EACtB,YAAY;EACZ,kBAAkB;EAClB,iBAAiB;GACf,QAAQ;GACR,eAAe;GACf,aAAa;GACb,aAAa;GACd;EACD,iBAAiB;EAClB,EACF;AAGD,SADuB,MAAM,SAAS,SAAS,gBAAgB,EACzC"}
|
|
@@ -2,8 +2,8 @@ import { Transaction } from "../packages/transact/src/transactions/transaction.j
|
|
|
2
2
|
import { TransactionSigner } from "../packages/transact/src/signer.js";
|
|
3
3
|
import { PendingTransactionResponse } from "../packages/algod_client/src/models/pending-transaction-response.js";
|
|
4
4
|
import { AlgodClient } from "../packages/algod_client/src/client.js";
|
|
5
|
-
import { AdditionalTransactionComposerContext, SendParams, SendTransactionComposerResults, TransactionComposerToSend } from "
|
|
6
|
-
import { TransactionComposer } from "../
|
|
5
|
+
import { AdditionalTransactionComposerContext, SendParams, SendTransactionComposerResults, TransactionComposerToSend } from "./types.js";
|
|
6
|
+
import { TransactionComposer } from "../composer.js";
|
|
7
7
|
|
|
8
8
|
//#region src/transaction/transaction.d.ts
|
|
9
9
|
/** Represents an unsigned transactions and a signer that can authorize that transaction. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","names":["e: any","toNumber"],"sources":["../../src/transaction/transaction.ts"],"sourcesContent":["import { AlgodClient, PendingTransactionResponse } from '@algorandfoundation/algokit-algod-client'\nimport { Transaction, TransactionSigner } from '@algorandfoundation/algokit-transact'\nimport { TransactionComposer } from '../
|
|
1
|
+
{"version":3,"file":"transaction.js","names":["e: any","toNumber"],"sources":["../../src/transaction/transaction.ts"],"sourcesContent":["import { AlgodClient, PendingTransactionResponse } from '@algorandfoundation/algokit-algod-client'\nimport { Transaction, TransactionSigner } from '@algorandfoundation/algokit-transact'\nimport { TransactionComposer } from '../composer'\nimport { toNumber } from '../util'\nimport { AdditionalTransactionComposerContext, SendParams, SendTransactionComposerResults, TransactionComposerToSend } from './types'\n\n/** Represents an unsigned transactions and a signer that can authorize that transaction. */\nexport interface TransactionWithSigner {\n /** An unsigned transaction */\n txn: Transaction\n /** A transaction signer that can authorize txn */\n signer: TransactionSigner\n}\n\n/** Encodes a transaction lease into a 32-byte array ready to be included in an Algorand transaction.\n *\n * @param lease The transaction lease as a string or binary array or null/undefined if there is no lease\n * @returns the transaction lease ready for inclusion in a transaction or `undefined` if there is no lease\n * @throws if the length of the data is > 32 bytes or empty\n * @example algokit.encodeLease('UNIQUE_ID')\n * @example algokit.encodeLease(new Uint8Array([1, 2, 3]))\n */\nexport function encodeLease(lease?: string | Uint8Array): Uint8Array | undefined {\n if (lease === null || typeof lease === 'undefined') {\n return undefined\n } else if (typeof lease === 'object' && lease.constructor === Uint8Array) {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received bytes with length ${lease.length}`,\n )\n }\n if (lease.length === 32) return lease\n const lease32 = new Uint8Array(32)\n lease32.set(lease, 0)\n return lease32\n } else if (typeof lease === 'string') {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received '${lease}' with length ${lease.length}`,\n )\n }\n const encoder = new TextEncoder()\n const lease32 = new Uint8Array(32)\n lease32.set(encoder.encode(lease), 0)\n return lease32\n } else {\n throw new Error(`Unknown lease type received of ${typeof lease}`)\n }\n}\n\n/**\n * @deprecated Use `composer.build()` directly\n * Take an existing Transaction Composer and return a new one with the required\n * app call resources populated into it\n *\n * @param algod The algod client to use for the simulation\n * @param composer The composer containing the txn group\n * @returns A new composer with the resources populated into the transactions\n *\n * @privateRemarks\n *\n * This entire function will eventually be implemented in simulate upstream in algod. The simulate endpoint will return\n * an array of refference arrays for each transaction, so this eventually will eventually just call simulate and set the\n * reference arrays in the transactions to the reference arrays returned by simulate.\n *\n * See https://github.com/algorand/go-algorand/pull/5684\n *\n */\nexport async function populateAppCallResources(composer: TransactionComposer) {\n await composer.build()\n return composer\n}\n\n/**\n * @deprecated Use `composer.setMaxFees()` instead if you need to set max fees for transactions.\n * Use `composer.build()` instead if you need to build transactions with resource population.\n *\n * Take an existing Transaction Composer and return a new one with changes applied to the transactions\n * based on the supplied sendParams to prepare it for sending.\n *\n * @param composer The Transaction Composer containing the txn group\n * @param sendParams The send params for the transaction group\n * @param additionalContext Additional context used to determine how best to change the transactions in the group\n * @returns A new Transaction Composer with the changes applied\n *\n * @privateRemarks\n * Parts of this function will eventually be implemented in algod. Namely:\n * - Simulate will return information on how to populate reference arrays, see https://github.com/algorand/go-algorand/pull/6015\n */\nexport async function prepareGroupForSending(\n composer: TransactionComposer,\n sendParams: SendParams,\n additionalContext?: AdditionalTransactionComposerContext,\n) {\n const newComposer = composer.clone({\n coverAppCallInnerTransactionFees: sendParams.coverAppCallInnerTransactionFees ?? false,\n populateAppCallResources: sendParams.populateAppCallResources ?? true,\n })\n\n if (additionalContext?.maxFees) {\n newComposer.setMaxFees(additionalContext?.maxFees)\n }\n\n await newComposer.build()\n\n return newComposer\n}\n\n/**\n * @deprecated Use `composer.send()` directly\n * Signs and sends transactions that have been collected by an `TransactionComposer`.\n * @param atcSend The parameters controlling the send, including `atc` The `TransactionComposer` and params to control send behaviour\n * @param algod An algod client\n * @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)\n */\nexport const sendTransactionComposer = async function (atcSend: TransactionComposerToSend): Promise<SendTransactionComposerResults> {\n const { transactionComposer: givenComposer, ...executeParams } = atcSend\n\n return atcSend.transactionComposer.send({\n ...executeParams,\n })\n}\n\n/**\n * Wait until the transaction is confirmed or rejected, or until `timeout`\n * number of rounds have passed.\n *\n * @param algod An algod client\n * @param transactionId The transaction ID to wait for\n * @param maxRoundsToWait Maximum number of rounds to wait\n *\n * @return Pending transaction information\n * @throws Throws an error if the transaction is not confirmed or rejected in the next `timeout` rounds\n */\nexport const waitForConfirmation = async function (\n transactionId: string,\n maxRoundsToWait: number | bigint,\n algod: AlgodClient,\n): Promise<PendingTransactionResponse> {\n if (maxRoundsToWait < 0) {\n throw new Error(`Invalid timeout, received ${maxRoundsToWait}, expected > 0`)\n }\n\n // Get current round\n const status = await algod.status()\n if (status === undefined) {\n throw new Error('Unable to get node status')\n }\n\n // Loop for up to `timeout` rounds looking for a confirmed transaction\n const startRound = BigInt(status.lastRound) + 1n\n let currentRound = startRound\n while (currentRound < startRound + BigInt(maxRoundsToWait)) {\n try {\n const pendingInfo = await algod.pendingTransactionInformation(transactionId)\n\n if (pendingInfo !== undefined) {\n const confirmedRound = pendingInfo.confirmedRound\n if (confirmedRound && confirmedRound > 0) {\n return pendingInfo\n } else {\n const poolError = pendingInfo.poolError\n if (poolError != null && poolError.length > 0) {\n // If there was a pool error, then the transaction has been rejected!\n throw new Error(`Transaction ${transactionId} was rejected; pool error: ${poolError}`)\n }\n }\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (e: any) {\n if ('status' in e && e.status === 404) {\n currentRound++\n continue\n }\n }\n\n await algod.statusAfterBlock(toNumber(currentRound))\n currentRound++\n }\n\n throw new Error(`Transaction ${transactionId} not confirmed after ${maxRoundsToWait} rounds`)\n}\n"],"mappings":";;;;;;;;;;;AAsBA,SAAgB,YAAY,OAAqD;AAC/E,KAAI,UAAU,QAAQ,OAAO,UAAU,YACrC;UACS,OAAO,UAAU,YAAY,MAAM,gBAAgB,YAAY;AACxE,MAAI,MAAM,WAAW,KAAK,MAAM,SAAS,GACvC,OAAM,IAAI,MACR,2GAA2G,MAAM,SAClH;AAEH,MAAI,MAAM,WAAW,GAAI,QAAO;EAChC,MAAM,UAAU,IAAI,WAAW,GAAG;AAClC,UAAQ,IAAI,OAAO,EAAE;AACrB,SAAO;YACE,OAAO,UAAU,UAAU;AACpC,MAAI,MAAM,WAAW,KAAK,MAAM,SAAS,GACvC,OAAM,IAAI,MACR,0FAA0F,MAAM,gBAAgB,MAAM,SACvH;EAEH,MAAM,UAAU,IAAI,aAAa;EACjC,MAAM,UAAU,IAAI,WAAW,GAAG;AAClC,UAAQ,IAAI,QAAQ,OAAO,MAAM,EAAE,EAAE;AACrC,SAAO;OAEP,OAAM,IAAI,MAAM,kCAAkC,OAAO,QAAQ;;;;;;;;;;;;;;;;;;;;AAsBrE,eAAsB,yBAAyB,UAA+B;AAC5E,OAAM,SAAS,OAAO;AACtB,QAAO;;;;;;;;;;;;;;;;;;AAmBT,eAAsB,uBACpB,UACA,YACA,mBACA;CACA,MAAM,cAAc,SAAS,MAAM;EACjC,kCAAkC,WAAW,oCAAoC;EACjF,0BAA0B,WAAW,4BAA4B;EAClE,CAAC;AAEF,KAAI,mBAAmB,QACrB,aAAY,WAAW,mBAAmB,QAAQ;AAGpD,OAAM,YAAY,OAAO;AAEzB,QAAO;;;;;;;;;AAUT,MAAa,0BAA0B,eAAgB,SAA6E;CAClI,MAAM,EAAE,qBAAqB,eAAe,GAAG,kBAAkB;AAEjE,QAAO,QAAQ,oBAAoB,KAAK,EACtC,GAAG,eACJ,CAAC;;;;;;;;;;;;;AAcJ,MAAa,sBAAsB,eACjC,eACA,iBACA,OACqC;AACrC,KAAI,kBAAkB,EACpB,OAAM,IAAI,MAAM,6BAA6B,gBAAgB,gBAAgB;CAI/E,MAAM,SAAS,MAAM,MAAM,QAAQ;AACnC,KAAI,WAAW,OACb,OAAM,IAAI,MAAM,4BAA4B;CAI9C,MAAM,aAAa,OAAO,OAAO,UAAU,GAAG;CAC9C,IAAI,eAAe;AACnB,QAAO,eAAe,aAAa,OAAO,gBAAgB,EAAE;AAC1D,MAAI;GACF,MAAM,cAAc,MAAM,MAAM,8BAA8B,cAAc;AAE5E,OAAI,gBAAgB,QAAW;IAC7B,MAAM,iBAAiB,YAAY;AACnC,QAAI,kBAAkB,iBAAiB,EACrC,QAAO;SACF;KACL,MAAM,YAAY,YAAY;AAC9B,SAAI,aAAa,QAAQ,UAAU,SAAS,EAE1C,OAAM,IAAI,MAAM,eAAe,cAAc,6BAA6B,YAAY;;;WAKrFA,GAAQ;AACf,OAAI,YAAY,KAAK,EAAE,WAAW,KAAK;AACrC;AACA;;;AAIJ,QAAM,MAAM,iBAAiBC,sBAAS,aAAa,CAAC;AACpD;;AAGF,OAAM,IAAI,MAAM,eAAe,cAAc,uBAAuB,gBAAgB,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.mjs","names":["e: any"],"sources":["../../src/transaction/transaction.ts"],"sourcesContent":["import { AlgodClient, PendingTransactionResponse } from '@algorandfoundation/algokit-algod-client'\nimport { Transaction, TransactionSigner } from '@algorandfoundation/algokit-transact'\nimport { TransactionComposer } from '../
|
|
1
|
+
{"version":3,"file":"transaction.mjs","names":["e: any"],"sources":["../../src/transaction/transaction.ts"],"sourcesContent":["import { AlgodClient, PendingTransactionResponse } from '@algorandfoundation/algokit-algod-client'\nimport { Transaction, TransactionSigner } from '@algorandfoundation/algokit-transact'\nimport { TransactionComposer } from '../composer'\nimport { toNumber } from '../util'\nimport { AdditionalTransactionComposerContext, SendParams, SendTransactionComposerResults, TransactionComposerToSend } from './types'\n\n/** Represents an unsigned transactions and a signer that can authorize that transaction. */\nexport interface TransactionWithSigner {\n /** An unsigned transaction */\n txn: Transaction\n /** A transaction signer that can authorize txn */\n signer: TransactionSigner\n}\n\n/** Encodes a transaction lease into a 32-byte array ready to be included in an Algorand transaction.\n *\n * @param lease The transaction lease as a string or binary array or null/undefined if there is no lease\n * @returns the transaction lease ready for inclusion in a transaction or `undefined` if there is no lease\n * @throws if the length of the data is > 32 bytes or empty\n * @example algokit.encodeLease('UNIQUE_ID')\n * @example algokit.encodeLease(new Uint8Array([1, 2, 3]))\n */\nexport function encodeLease(lease?: string | Uint8Array): Uint8Array | undefined {\n if (lease === null || typeof lease === 'undefined') {\n return undefined\n } else if (typeof lease === 'object' && lease.constructor === Uint8Array) {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received bytes with length ${lease.length}`,\n )\n }\n if (lease.length === 32) return lease\n const lease32 = new Uint8Array(32)\n lease32.set(lease, 0)\n return lease32\n } else if (typeof lease === 'string') {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received '${lease}' with length ${lease.length}`,\n )\n }\n const encoder = new TextEncoder()\n const lease32 = new Uint8Array(32)\n lease32.set(encoder.encode(lease), 0)\n return lease32\n } else {\n throw new Error(`Unknown lease type received of ${typeof lease}`)\n }\n}\n\n/**\n * @deprecated Use `composer.build()` directly\n * Take an existing Transaction Composer and return a new one with the required\n * app call resources populated into it\n *\n * @param algod The algod client to use for the simulation\n * @param composer The composer containing the txn group\n * @returns A new composer with the resources populated into the transactions\n *\n * @privateRemarks\n *\n * This entire function will eventually be implemented in simulate upstream in algod. The simulate endpoint will return\n * an array of refference arrays for each transaction, so this eventually will eventually just call simulate and set the\n * reference arrays in the transactions to the reference arrays returned by simulate.\n *\n * See https://github.com/algorand/go-algorand/pull/5684\n *\n */\nexport async function populateAppCallResources(composer: TransactionComposer) {\n await composer.build()\n return composer\n}\n\n/**\n * @deprecated Use `composer.setMaxFees()` instead if you need to set max fees for transactions.\n * Use `composer.build()` instead if you need to build transactions with resource population.\n *\n * Take an existing Transaction Composer and return a new one with changes applied to the transactions\n * based on the supplied sendParams to prepare it for sending.\n *\n * @param composer The Transaction Composer containing the txn group\n * @param sendParams The send params for the transaction group\n * @param additionalContext Additional context used to determine how best to change the transactions in the group\n * @returns A new Transaction Composer with the changes applied\n *\n * @privateRemarks\n * Parts of this function will eventually be implemented in algod. Namely:\n * - Simulate will return information on how to populate reference arrays, see https://github.com/algorand/go-algorand/pull/6015\n */\nexport async function prepareGroupForSending(\n composer: TransactionComposer,\n sendParams: SendParams,\n additionalContext?: AdditionalTransactionComposerContext,\n) {\n const newComposer = composer.clone({\n coverAppCallInnerTransactionFees: sendParams.coverAppCallInnerTransactionFees ?? false,\n populateAppCallResources: sendParams.populateAppCallResources ?? true,\n })\n\n if (additionalContext?.maxFees) {\n newComposer.setMaxFees(additionalContext?.maxFees)\n }\n\n await newComposer.build()\n\n return newComposer\n}\n\n/**\n * @deprecated Use `composer.send()` directly\n * Signs and sends transactions that have been collected by an `TransactionComposer`.\n * @param atcSend The parameters controlling the send, including `atc` The `TransactionComposer` and params to control send behaviour\n * @param algod An algod client\n * @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)\n */\nexport const sendTransactionComposer = async function (atcSend: TransactionComposerToSend): Promise<SendTransactionComposerResults> {\n const { transactionComposer: givenComposer, ...executeParams } = atcSend\n\n return atcSend.transactionComposer.send({\n ...executeParams,\n })\n}\n\n/**\n * Wait until the transaction is confirmed or rejected, or until `timeout`\n * number of rounds have passed.\n *\n * @param algod An algod client\n * @param transactionId The transaction ID to wait for\n * @param maxRoundsToWait Maximum number of rounds to wait\n *\n * @return Pending transaction information\n * @throws Throws an error if the transaction is not confirmed or rejected in the next `timeout` rounds\n */\nexport const waitForConfirmation = async function (\n transactionId: string,\n maxRoundsToWait: number | bigint,\n algod: AlgodClient,\n): Promise<PendingTransactionResponse> {\n if (maxRoundsToWait < 0) {\n throw new Error(`Invalid timeout, received ${maxRoundsToWait}, expected > 0`)\n }\n\n // Get current round\n const status = await algod.status()\n if (status === undefined) {\n throw new Error('Unable to get node status')\n }\n\n // Loop for up to `timeout` rounds looking for a confirmed transaction\n const startRound = BigInt(status.lastRound) + 1n\n let currentRound = startRound\n while (currentRound < startRound + BigInt(maxRoundsToWait)) {\n try {\n const pendingInfo = await algod.pendingTransactionInformation(transactionId)\n\n if (pendingInfo !== undefined) {\n const confirmedRound = pendingInfo.confirmedRound\n if (confirmedRound && confirmedRound > 0) {\n return pendingInfo\n } else {\n const poolError = pendingInfo.poolError\n if (poolError != null && poolError.length > 0) {\n // If there was a pool error, then the transaction has been rejected!\n throw new Error(`Transaction ${transactionId} was rejected; pool error: ${poolError}`)\n }\n }\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (e: any) {\n if ('status' in e && e.status === 404) {\n currentRound++\n continue\n }\n }\n\n await algod.statusAfterBlock(toNumber(currentRound))\n currentRound++\n }\n\n throw new Error(`Transaction ${transactionId} not confirmed after ${maxRoundsToWait} rounds`)\n}\n"],"mappings":";;;;;;;;;;;AAsBA,SAAgB,YAAY,OAAqD;AAC/E,KAAI,UAAU,QAAQ,OAAO,UAAU,YACrC;UACS,OAAO,UAAU,YAAY,MAAM,gBAAgB,YAAY;AACxE,MAAI,MAAM,WAAW,KAAK,MAAM,SAAS,GACvC,OAAM,IAAI,MACR,2GAA2G,MAAM,SAClH;AAEH,MAAI,MAAM,WAAW,GAAI,QAAO;EAChC,MAAM,UAAU,IAAI,WAAW,GAAG;AAClC,UAAQ,IAAI,OAAO,EAAE;AACrB,SAAO;YACE,OAAO,UAAU,UAAU;AACpC,MAAI,MAAM,WAAW,KAAK,MAAM,SAAS,GACvC,OAAM,IAAI,MACR,0FAA0F,MAAM,gBAAgB,MAAM,SACvH;EAEH,MAAM,UAAU,IAAI,aAAa;EACjC,MAAM,UAAU,IAAI,WAAW,GAAG;AAClC,UAAQ,IAAI,QAAQ,OAAO,MAAM,EAAE,EAAE;AACrC,SAAO;OAEP,OAAM,IAAI,MAAM,kCAAkC,OAAO,QAAQ;;;;;;;;;;;;;;;;;;;;AAsBrE,eAAsB,yBAAyB,UAA+B;AAC5E,OAAM,SAAS,OAAO;AACtB,QAAO;;;;;;;;;;;;;;;;;;AAmBT,eAAsB,uBACpB,UACA,YACA,mBACA;CACA,MAAM,cAAc,SAAS,MAAM;EACjC,kCAAkC,WAAW,oCAAoC;EACjF,0BAA0B,WAAW,4BAA4B;EAClE,CAAC;AAEF,KAAI,mBAAmB,QACrB,aAAY,WAAW,mBAAmB,QAAQ;AAGpD,OAAM,YAAY,OAAO;AAEzB,QAAO;;;;;;;;;AAUT,MAAa,0BAA0B,eAAgB,SAA6E;CAClI,MAAM,EAAE,qBAAqB,eAAe,GAAG,kBAAkB;AAEjE,QAAO,QAAQ,oBAAoB,KAAK,EACtC,GAAG,eACJ,CAAC;;;;;;;;;;;;;AAcJ,MAAa,sBAAsB,eACjC,eACA,iBACA,OACqC;AACrC,KAAI,kBAAkB,EACpB,OAAM,IAAI,MAAM,6BAA6B,gBAAgB,gBAAgB;CAI/E,MAAM,SAAS,MAAM,MAAM,QAAQ;AACnC,KAAI,WAAW,OACb,OAAM,IAAI,MAAM,4BAA4B;CAI9C,MAAM,aAAa,OAAO,OAAO,UAAU,GAAG;CAC9C,IAAI,eAAe;AACnB,QAAO,eAAe,aAAa,OAAO,gBAAgB,EAAE;AAC1D,MAAI;GACF,MAAM,cAAc,MAAM,MAAM,8BAA8B,cAAc;AAE5E,OAAI,gBAAgB,QAAW;IAC7B,MAAM,iBAAiB,YAAY;AACnC,QAAI,kBAAkB,iBAAiB,EACrC,QAAO;SACF;KACL,MAAM,YAAY,YAAY;AAC9B,SAAI,aAAa,QAAQ,UAAU,SAAS,EAE1C,OAAM,IAAI,MAAM,eAAe,cAAc,6BAA6B,YAAY;;;WAKrFA,GAAQ;AACf,OAAI,YAAY,KAAK,EAAE,WAAW,KAAK;AACrC;AACA;;;AAIJ,QAAM,MAAM,iBAAiB,SAAS,aAAa,CAAC;AACpD;;AAGF,OAAM,IAAI,MAAM,eAAe,cAAc,uBAAuB,gBAAgB,SAAS"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { Expand } from "../packages/common/src/expand.js";
|
|
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";
|
|
8
|
+
|
|
9
|
+
//#region src/transaction/types.d.ts
|
|
10
|
+
type TransactionNote = Uint8Array | TransactionNoteData | Arc2TransactionNote;
|
|
11
|
+
type TransactionNoteData = string | null | undefined | number | any[] | Record<string, any>;
|
|
12
|
+
/** ARC-0002 compatible transaction note components https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md */
|
|
13
|
+
type Arc2TransactionNote = {
|
|
14
|
+
dAppName: string;
|
|
15
|
+
format: 'm' | 'b' | 'u';
|
|
16
|
+
data: string;
|
|
17
|
+
} | {
|
|
18
|
+
dAppName: string;
|
|
19
|
+
format: 'j';
|
|
20
|
+
data: TransactionNoteData;
|
|
21
|
+
};
|
|
22
|
+
/** The sending configuration for a transaction */
|
|
23
|
+
interface SendTransactionParams {
|
|
24
|
+
/** Whether to skip signing and sending the transaction to the chain (default: transaction signed and sent to chain, unless `atc` specified)
|
|
25
|
+
* and instead just return the raw transaction, e.g. so you can add it to a group of transactions */
|
|
26
|
+
skipSending?: boolean;
|
|
27
|
+
/** Whether to skip waiting for the submitted transaction (only relevant if `skipSending` is `false` or unset) */
|
|
28
|
+
skipWaiting?: boolean;
|
|
29
|
+
/** An optional `TransactionComposer` to add the transaction to, if specified then `skipSending: undefined` has the same effect as `skipSending: true` */
|
|
30
|
+
transactionComposer?: TransactionComposer;
|
|
31
|
+
/** Whether to suppress log messages from transaction send, default: do not suppress */
|
|
32
|
+
suppressLog?: boolean;
|
|
33
|
+
/** The flat fee you want to pay, useful for covering extra fees in a transaction group or app call */
|
|
34
|
+
fee?: AlgoAmount;
|
|
35
|
+
/** The maximum fee that you are happy to pay (default: unbounded) - if this is set it's possible the transaction could get rejected during network congestion */
|
|
36
|
+
maxFee?: AlgoAmount;
|
|
37
|
+
/** The maximum number of rounds to wait for confirmation, only applies if `skipWaiting` is `undefined` or `false`, default: wait up to 5 rounds */
|
|
38
|
+
maxRoundsToWaitForConfirmation?: number;
|
|
39
|
+
/** Whether to use simulate to automatically populate app call resources in the txn objects. Defaults to true when there are app calls in the group. */
|
|
40
|
+
populateAppCallResources?: boolean;
|
|
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
|
+
* @deprecated 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
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
export { AdditionalTransactionComposerContext, Arc2TransactionNote, ConfirmedTransactionResult, ConfirmedTransactionResults, SendParams, SendSingleTransactionResult, SendTransactionComposerResults, SendTransactionFrom, SendTransactionParams, SendTransactionResult, SendTransactionResults, TransactionComposerToSend, TransactionGroupToSend, TransactionNote, TransactionNoteData, TransactionToSign };
|
|
133
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReadableAddress } from "../packages/common/src/address.js";
|
|
2
2
|
import { Expand } from "../packages/common/src/expand.js";
|
|
3
3
|
import { OnApplicationComplete, ResourceReference } from "../packages/transact/src/transactions/app-call.js";
|
|
4
|
-
import { BoxIdentifier, BoxReference } from "../
|
|
4
|
+
import { BoxIdentifier, BoxReference } from "../app-manager.js";
|
|
5
5
|
import { CommonTransactionParams } from "./common.js";
|
|
6
6
|
|
|
7
7
|
//#region src/transactions/app-call.d.ts
|
package/transactions/app-call.js
CHANGED
|
@@ -4,7 +4,7 @@ const require_util = require('../util.js');
|
|
|
4
4
|
const require_app_call = require('../packages/transact/src/transactions/app-call.js');
|
|
5
5
|
const require_transaction_type = require('../packages/transact/src/transactions/transaction-type.js');
|
|
6
6
|
const require_transaction = require('../packages/transact/src/transactions/transaction.js');
|
|
7
|
-
const require_app_manager = require('../
|
|
7
|
+
const require_app_manager = require('../app-manager.js');
|
|
8
8
|
const require_common = require('./common.js');
|
|
9
9
|
|
|
10
10
|
//#region src/transactions/app-call.ts
|