@algorandfoundation/algokit-utils 9.2.1-beta.3 → 9.2.2-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/account/account.d.ts +28 -23
  2. package/account/get-account-config-from-environment.d.ts +2 -7
  3. package/account/get-account.d.ts +12 -14
  4. package/account/get-dispenser-account.d.ts +5 -9
  5. package/account/index.d.ts +5 -0
  6. package/account/mnemonic-account.d.ts +3 -7
  7. package/amount.d.ts +35 -40
  8. package/app-client.d.ts +6 -10
  9. package/app-deploy.d.ts +23 -25
  10. package/app.d.ts +46 -45
  11. package/asset.d.ts +12 -16
  12. package/config.d.ts +2 -7
  13. package/debugging/debugging.d.ts +1 -5
  14. package/debugging/index.d.ts +1 -0
  15. package/dispenser-client.d.ts +2 -7
  16. package/index.d.ts +18 -27
  17. package/indexer-lookup.d.ts +11 -18
  18. package/localnet/get-kmd-wallet-account.d.ts +7 -9
  19. package/localnet/get-localnet-dispenser-account.d.ts +5 -7
  20. package/localnet/get-or-create-kmd-wallet-account.d.ts +8 -10
  21. package/localnet/index.d.ts +4 -0
  22. package/localnet/is-localnet.d.ts +3 -7
  23. package/network-client.d.ts +15 -17
  24. package/package.json +1 -1
  25. package/testing/_asset.d.ts +3 -0
  26. package/testing/account.d.ts +9 -11
  27. package/testing/fixtures/algokit-log-capture-fixture.d.ts +2 -7
  28. package/testing/fixtures/algorand-fixture.d.ts +4 -9
  29. package/testing/fixtures/index.d.ts +2 -0
  30. package/testing/index.d.ts +5 -7
  31. package/testing/indexer.d.ts +1 -5
  32. package/testing/test-logger.d.ts +36 -41
  33. package/testing/transaction-logger.d.ts +27 -30
  34. package/transaction/index.d.ts +2 -0
  35. package/transaction/legacy-bridge.d.ts +35 -0
  36. package/transaction/perform-atomic-transaction-composer-simulate.d.ts +5 -7
  37. package/transaction/resolve-signed-transactions.d.ts +16 -0
  38. package/transaction/transaction.d.ts +35 -34
  39. package/transfer/index.d.ts +2 -0
  40. package/transfer/transfer-algos.d.ts +5 -9
  41. package/transfer/transfer.d.ts +8 -11
  42. package/types/account-manager.d.ts +429 -432
  43. package/types/account.d.ts +202 -192
  44. package/types/algo-http-client-with-retry.d.ts +10 -15
  45. package/types/algorand-client-transaction-creator.d.ts +771 -778
  46. package/types/algorand-client-transaction-sender.d.ts +1085 -1090
  47. package/types/algorand-client.d.ts +236 -239
  48. package/types/amount.d.ts +43 -47
  49. package/types/app-arc56.d.ts +272 -235
  50. package/types/app-client.d.ts +1151 -1128
  51. package/types/app-deployer.d.ts +141 -139
  52. package/types/app-factory.d.ts +783 -762
  53. package/types/app-manager.d.ts +310 -304
  54. package/types/app-spec.d.ts +117 -118
  55. package/types/app.d.ts +241 -229
  56. package/types/asset-manager.d.ts +199 -204
  57. package/types/asset.d.ts +91 -95
  58. package/types/async-event-emitter.d.ts +13 -18
  59. package/types/client-manager.d.ts +451 -453
  60. package/types/composer.d.ts +1257 -1210
  61. package/types/config.d.ts +48 -53
  62. package/types/debugging.d.ts +23 -25
  63. package/types/dispenser-client.d.ts +52 -57
  64. package/types/expand.d.ts +3 -5
  65. package/types/indexer.d.ts +66 -70
  66. package/types/instance-of.d.ts +3 -5
  67. package/types/kmd-account-manager.d.ts +70 -75
  68. package/types/lifecycle-events.d.ts +8 -13
  69. package/types/logging.d.ts +11 -15
  70. package/types/logic-error.d.ts +29 -33
  71. package/types/network-client.d.ts +27 -32
  72. package/types/testing.d.ts +132 -131
  73. package/types/transaction.d.ts +110 -110
  74. package/types/transfer.d.ts +66 -70
  75. package/util.d.ts +48 -0
@@ -1,78 +1,73 @@
1
- import { AlgoAmount } from "./amount.js";
2
- import { SigningAccount, TransactionSignerAccount } from "./account.js";
3
- import { ClientManager } from "./client-manager.js";
4
- import algosdk, { Address } from "algosdk";
5
-
6
- //#region src/types/kmd-account-manager.d.ts
1
+ import algosdk, { Address } from 'algosdk';
2
+ import { SigningAccount, TransactionSignerAccount } from './account';
3
+ import { AlgoAmount } from './amount';
4
+ import { ClientManager } from './client-manager';
7
5
  /** Provides abstractions over a [KMD](https://github.com/algorand/go-algorand/blob/master/daemon/kmd/README.md) instance
8
6
  * that makes it easier to get and manage accounts using KMD. */
9
- declare class KmdAccountManager {
10
- private _clientManager;
11
- private _kmd?;
12
- /**
13
- * Create a new KMD manager.
14
- * @param clientManager A ClientManager client to use for algod and kmd clients
15
- */
16
- constructor(clientManager: ClientManager);
17
- kmd(): Promise<algosdk.Kmd>;
18
- /**
19
- * Returns an Algorand signing account with private key loaded from the given KMD wallet (identified by name).
20
- *
21
- * @param walletName The name of the wallet to retrieve an account from
22
- * @param predicate An optional filter to use to find the account (otherwise it will return a random account from the wallet)
23
- * @param sender The optional sender address to use this signer for (aka a rekeyed account)
24
- * @example Get default funded account in a LocalNet
25
- *
26
- * ```typescript
27
- * const defaultDispenserAccount = await kmdAccountManager.getWalletAccount(
28
- * 'unencrypted-default-wallet',
29
- * a => a.status !== 'Offline' && a.amount > 1_000_000_000
30
- * )
31
- * ```
32
- * @returns The signing account (with private key loaded) or undefined if no matching wallet or account was found
33
- */
34
- getWalletAccount(walletName: string, predicate?: (account: Record<string, any>) => boolean, sender?: string | Address): Promise<(TransactionSignerAccount & {
35
- account: SigningAccount;
36
- }) | undefined>;
37
- private findWalletAccount;
38
- /**
39
- * Gets an account with private key loaded from a KMD wallet of the given name, or alternatively creates one with funds in it via a KMD wallet of the given name.
40
- *
41
- * This is useful to get idempotent accounts from LocalNet without having to specify the private key (which will change when resetting the LocalNet).
42
- *
43
- * This significantly speeds up local dev time and improves experience since you can write code that *just works* first go without manual config in a fresh LocalNet.
44
- *
45
- * If this is used via `mnemonicAccountFromEnvironment`, then you can even use the same code that runs on production without changes for local development!
46
- *
47
- * @param name The name of the wallet to retrieve / create
48
- * @param fundWith The number of Algo to fund the account with when it gets created, if not specified then 1000 ALGO will be funded from the dispenser account
49
- *
50
- * @example
51
- * ```typescript
52
- * // Idempotently get (if exists) or create (if it doesn't exist yet) an account by name using KMD
53
- * // if creating it then fund it with 2 ALGO from the default dispenser account
54
- * const newAccount = await kmdAccountManager.getOrCreateWalletAccount('account1', (2).algo())
55
- * // This will return the same account as above since the name matches
56
- * const existingAccount = await kmdAccountManager.getOrCreateWalletAccount('account1')
57
- * ```
58
- *
59
- * @returns An Algorand account with private key loaded - either one that already existed in the given KMD wallet, or a new one that is funded for you
60
- */
61
- getOrCreateWalletAccount(name: string, fundWith?: AlgoAmount): Promise<TransactionSignerAccount & {
62
- account: SigningAccount;
63
- }>;
64
- /**
65
- * Returns an Algorand account with private key loaded for the default LocalNet dispenser account (that can be used to fund other accounts).
66
- * @example
67
- * ```typescript
68
- * const dispenser = await kmdAccountManager.getLocalNetDispenserAccount()
69
- * ```
70
- * @returns The default LocalNet dispenser account
71
- */
72
- getLocalNetDispenserAccount(): Promise<TransactionSignerAccount & {
73
- account: SigningAccount;
74
- }>;
7
+ export declare class KmdAccountManager {
8
+ private _clientManager;
9
+ private _kmd?;
10
+ /**
11
+ * Create a new KMD manager.
12
+ * @param clientManager A ClientManager client to use for algod and kmd clients
13
+ */
14
+ constructor(clientManager: ClientManager);
15
+ kmd(): Promise<algosdk.Kmd>;
16
+ /**
17
+ * Returns an Algorand signing account with private key loaded from the given KMD wallet (identified by name).
18
+ *
19
+ * @param walletName The name of the wallet to retrieve an account from
20
+ * @param predicate An optional filter to use to find the account (otherwise it will return a random account from the wallet)
21
+ * @param sender The optional sender address to use this signer for (aka a rekeyed account)
22
+ * @example Get default funded account in a LocalNet
23
+ *
24
+ * ```typescript
25
+ * const defaultDispenserAccount = await kmdAccountManager.getWalletAccount(
26
+ * 'unencrypted-default-wallet',
27
+ * a => a.status !== 'Offline' && a.amount > 1_000_000_000
28
+ * )
29
+ * ```
30
+ * @returns The signing account (with private key loaded) or undefined if no matching wallet or account was found
31
+ */
32
+ getWalletAccount(walletName: string, predicate?: (account: Record<string, any>) => boolean, sender?: string | Address): Promise<(TransactionSignerAccount & {
33
+ account: SigningAccount;
34
+ }) | undefined>;
35
+ private findWalletAccount;
36
+ /**
37
+ * Gets an account with private key loaded from a KMD wallet of the given name, or alternatively creates one with funds in it via a KMD wallet of the given name.
38
+ *
39
+ * This is useful to get idempotent accounts from LocalNet without having to specify the private key (which will change when resetting the LocalNet).
40
+ *
41
+ * This significantly speeds up local dev time and improves experience since you can write code that *just works* first go without manual config in a fresh LocalNet.
42
+ *
43
+ * If this is used via `mnemonicAccountFromEnvironment`, then you can even use the same code that runs on production without changes for local development!
44
+ *
45
+ * @param name The name of the wallet to retrieve / create
46
+ * @param fundWith The number of Algo to fund the account with when it gets created, if not specified then 1000 ALGO will be funded from the dispenser account
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * // Idempotently get (if exists) or create (if it doesn't exist yet) an account by name using KMD
51
+ * // if creating it then fund it with 2 ALGO from the default dispenser account
52
+ * const newAccount = await kmdAccountManager.getOrCreateWalletAccount('account1', (2).algo())
53
+ * // This will return the same account as above since the name matches
54
+ * const existingAccount = await kmdAccountManager.getOrCreateWalletAccount('account1')
55
+ * ```
56
+ *
57
+ * @returns An Algorand account with private key loaded - either one that already existed in the given KMD wallet, or a new one that is funded for you
58
+ */
59
+ getOrCreateWalletAccount(name: string, fundWith?: AlgoAmount): Promise<TransactionSignerAccount & {
60
+ account: SigningAccount;
61
+ }>;
62
+ /**
63
+ * Returns an Algorand account with private key loaded for the default LocalNet dispenser account (that can be used to fund other accounts).
64
+ * @example
65
+ * ```typescript
66
+ * const dispenser = await kmdAccountManager.getLocalNetDispenserAccount()
67
+ * ```
68
+ * @returns The default LocalNet dispenser account
69
+ */
70
+ getLocalNetDispenserAccount(): Promise<TransactionSignerAccount & {
71
+ account: SigningAccount;
72
+ }>;
75
73
  }
76
- //#endregion
77
- export { KmdAccountManager };
78
- //# sourceMappingURL=kmd-account-manager.d.ts.map
@@ -1,15 +1,10 @@
1
- import { AVMTracesEventData, TealSourcesDebugEventData } from "./debugging.js";
2
-
3
- //#region src/types/lifecycle-events.d.ts
4
- declare enum EventType {
5
- TxnGroupSimulated = "TxnGroupSimulated",
6
- AppCompiled = "AppCompiled"
1
+ import { AVMTracesEventData, TealSourcesDebugEventData } from './debugging';
2
+ export declare enum EventType {
3
+ TxnGroupSimulated = "TxnGroupSimulated",
4
+ AppCompiled = "AppCompiled"
7
5
  }
8
- type EventDataMap = {
9
- [EventType.TxnGroupSimulated]: AVMTracesEventData;
10
- [EventType.AppCompiled]: TealSourcesDebugEventData;
11
- [key: string]: unknown;
6
+ export type EventDataMap = {
7
+ [EventType.TxnGroupSimulated]: AVMTracesEventData;
8
+ [EventType.AppCompiled]: TealSourcesDebugEventData;
9
+ [key: string]: unknown;
12
10
  };
13
- //#endregion
14
- export { EventDataMap, EventType };
15
- //# sourceMappingURL=lifecycle-events.d.ts.map
@@ -1,19 +1,15 @@
1
- //#region src/types/logging.d.ts
2
1
  /** General purpose logger type, compatible with Winston and others. */
3
- type Logger = {
4
- error(message: string, ...optionalParams: unknown[]): void;
5
- warn(message: string, ...optionalParams: unknown[]): void;
6
- info(message: string, ...optionalParams: unknown[]): void;
7
- verbose(message: string, ...optionalParams: unknown[]): void;
8
- debug(message: string, ...optionalParams: unknown[]): void;
2
+ export type Logger = {
3
+ error(message: string, ...optionalParams: unknown[]): void;
4
+ warn(message: string, ...optionalParams: unknown[]): void;
5
+ info(message: string, ...optionalParams: unknown[]): void;
6
+ verbose(message: string, ...optionalParams: unknown[]): void;
7
+ debug(message: string, ...optionalParams: unknown[]): void;
9
8
  };
10
9
  /** A logger implementation that writes to console */
11
- declare const consoleLogger: Logger;
12
- declare const infoConsoleLogger: Logger;
13
- declare const verboseConsoleLogger: Logger;
14
- declare const warningConsoleLogger: Logger;
10
+ export declare const consoleLogger: Logger;
11
+ export declare const infoConsoleLogger: Logger;
12
+ export declare const verboseConsoleLogger: Logger;
13
+ export declare const warningConsoleLogger: Logger;
15
14
  /** A logger implementation that does nothing */
16
- declare const nullLogger: Logger;
17
- //#endregion
18
- export { Logger, consoleLogger, infoConsoleLogger, nullLogger, verboseConsoleLogger, warningConsoleLogger };
19
- //# sourceMappingURL=logging.d.ts.map
15
+ export declare const nullLogger: Logger;
@@ -1,39 +1,35 @@
1
- //#region src/types/logic-error.d.ts
2
1
  /**
3
2
  * Details about a smart contract logic error
4
3
  */
5
- interface LogicErrorDetails {
6
- /** The ID of the transaction with the logic error */
7
- txId: string;
8
- /** The program counter where the error was */
9
- pc: number;
10
- /** The error message */
11
- msg: string;
12
- /** The full error description */
13
- desc: string;
14
- /** Any trace information included in the error */
15
- traces: Record<string, unknown>[];
4
+ export interface LogicErrorDetails {
5
+ /** The ID of the transaction with the logic error */
6
+ txId: string;
7
+ /** The program counter where the error was */
8
+ pc: number;
9
+ /** The error message */
10
+ msg: string;
11
+ /** The full error description */
12
+ desc: string;
13
+ /** Any trace information included in the error */
14
+ traces: Record<string, unknown>[];
16
15
  }
17
16
  /** Wraps key functionality around processing logic errors */
18
- declare class LogicError extends Error {
19
- /** Takes an error message and parses out the details of any logic errors in there.
20
- * @param error The error message to parse
21
- * @returns The logic error details if any, or undefined
22
- */
23
- static parseLogicError(error: any): LogicErrorDetails | undefined;
24
- led: LogicErrorDetails;
25
- program: string[];
26
- lines: number;
27
- teal_line: number;
28
- stack?: string;
29
- /**
30
- * Create a new logic error object.
31
- * @param errorDetails The details of the logic error
32
- * @param program The TEAL source code, split by line
33
- * @param getLineForPc The source map of the TEAL source code
34
- */
35
- constructor(errorDetails: LogicErrorDetails, program: string[], getLineForPc: (pc: number) => number | undefined);
17
+ export declare class LogicError extends Error {
18
+ /** Takes an error message and parses out the details of any logic errors in there.
19
+ * @param error The error message to parse
20
+ * @returns The logic error details if any, or undefined
21
+ */
22
+ static parseLogicError(error: any): LogicErrorDetails | undefined;
23
+ led: LogicErrorDetails;
24
+ program: string[];
25
+ lines: number;
26
+ teal_line: number;
27
+ stack?: string;
28
+ /**
29
+ * Create a new logic error object.
30
+ * @param errorDetails The details of the logic error
31
+ * @param program The TEAL source code, split by line
32
+ * @param getLineForPc The source map of the TEAL source code
33
+ */
34
+ constructor(errorDetails: LogicErrorDetails, program: string[], getLineForPc: (pc: number) => number | undefined);
36
35
  }
37
- //#endregion
38
- export { LogicError, LogicErrorDetails };
39
- //# sourceMappingURL=logic-error.d.ts.map
@@ -1,43 +1,38 @@
1
- import { TokenHeader } from "algosdk";
2
-
3
- //#region src/types/network-client.d.ts
1
+ import { TokenHeader } from 'algosdk';
4
2
  /** Config for an Algorand SDK client. */
5
- interface AlgoClientConfig {
6
- /** Base URL of the server e.g. http://localhost, https://testnet-api.algonode.cloud/, etc. */
7
- server: string;
8
- /** The port to use e.g. 4001, 443, etc. */
9
- port?: string | number;
10
- /** The token to use for API authentication (or undefined if none needed) - can be a string, or an object with the header key => value */
11
- token?: string | TokenHeader;
3
+ export interface AlgoClientConfig {
4
+ /** Base URL of the server e.g. http://localhost, https://testnet-api.algonode.cloud/, etc. */
5
+ server: string;
6
+ /** The port to use e.g. 4001, 443, etc. */
7
+ port?: string | number;
8
+ /** The token to use for API authentication (or undefined if none needed) - can be a string, or an object with the header key => value */
9
+ token?: string | TokenHeader;
12
10
  }
13
11
  /** Configuration for algod, indexer and kmd clients. */
14
- interface AlgoConfig {
15
- /** Algod client configuration */
16
- algodConfig: AlgoClientConfig;
17
- /** Indexer client configuration */
18
- indexerConfig?: AlgoClientConfig;
19
- /** Kmd configuration */
20
- kmdConfig?: AlgoClientConfig;
12
+ export interface AlgoConfig {
13
+ /** Algod client configuration */
14
+ algodConfig: AlgoClientConfig;
15
+ /** Indexer client configuration */
16
+ indexerConfig?: AlgoClientConfig;
17
+ /** Kmd configuration */
18
+ kmdConfig?: AlgoClientConfig;
21
19
  }
22
20
  /** Details of the current network. */
23
- interface NetworkDetails {
24
- /** Whether or not the network is TestNet. */
25
- isTestNet: boolean;
26
- /** Whether or not the network is MainNet. */
27
- isMainNet: boolean;
28
- /** Whether or not the network is LocalNet. */
29
- isLocalNet: boolean;
30
- /** The genesis ID of the current network. */
31
- genesisId: string;
32
- /** The base64 genesis hash of the current network. */
33
- genesisHash: string;
21
+ export interface NetworkDetails {
22
+ /** Whether or not the network is TestNet. */
23
+ isTestNet: boolean;
24
+ /** Whether or not the network is MainNet. */
25
+ isMainNet: boolean;
26
+ /** Whether or not the network is LocalNet. */
27
+ isLocalNet: boolean;
28
+ /** The genesis ID of the current network. */
29
+ genesisId: string;
30
+ /** The base64 genesis hash of the current network. */
31
+ genesisHash: string;
34
32
  }
35
33
  /**
36
34
  * Returns true if the given network genesisId is associated with a LocalNet network.
37
35
  * @param genesisId The network genesis ID
38
36
  * @returns Whether the given genesis ID is associated with a LocalNet network
39
37
  */
40
- declare function genesisIdIsLocalNet(genesisId: string): genesisId is "devnet-v1" | "sandnet-v1" | "dockernet-v1";
41
- //#endregion
42
- export { AlgoClientConfig, AlgoConfig, NetworkDetails, genesisIdIsLocalNet };
43
- //# sourceMappingURL=network-client.d.ts.map
38
+ export declare function genesisIdIsLocalNet(genesisId: string): genesisId is "devnet-v1" | "sandnet-v1" | "dockernet-v1";
@@ -1,149 +1,150 @@
1
- import { AlgoAmount } from "./amount.js";
2
- import { MultisigAccount, SigningAccount, TransactionSignerAccount } from "./account.js";
3
- import { AlgoConfig } from "./network-client.js";
4
- import { AlgorandClient } from "./algorand-client.js";
5
- import { TestLogger } from "../testing/test-logger.js";
6
- import { TransactionLogger } from "../testing/transaction-logger.js";
7
- import algosdk, { Address } from "algosdk";
8
-
9
- //#region src/types/testing.d.ts
1
+ import algosdk, { Address } from 'algosdk';
2
+ import { TransactionLogger } from '../testing';
3
+ import { TestLogger } from '../testing/test-logger';
4
+ import { AlgoAmount } from '../types/amount';
5
+ import { MultisigAccount, SigningAccount, TransactionSignerAccount } from './account';
6
+ import { AlgorandClient } from './algorand-client';
7
+ import { AlgoConfig } from './network-client';
8
+ import Account = algosdk.Account;
9
+ import Algodv2 = algosdk.Algodv2;
10
+ import Indexer = algosdk.Indexer;
11
+ import Kmd = algosdk.Kmd;
12
+ import LogicSigAccount = algosdk.LogicSigAccount;
13
+ import Transaction = algosdk.Transaction;
10
14
  /**
11
15
  * Test automation context.
12
16
  */
13
- interface AlgorandTestAutomationContext {
14
- /** An AlgorandClient instance loaded with the current context, including testAccount and any generated accounts loaded as signers */
15
- algorand: AlgorandClient;
16
- /** Algod client instance that will log transactions in `transactionLogger` */
17
- algod: Algodv2;
18
- /** Indexer client instance */
19
- indexer: Indexer;
20
- /** KMD client instance */
21
- kmd: Kmd;
22
- /** Transaction logger that will log transaction IDs for all transactions issued by `algod` */
23
- transactionLogger: TransactionLogger;
24
- /** Default, funded test account that is ephemerally created */
25
- testAccount: Address & TransactionSignerAccount & Account;
26
- /** Generate and fund an additional ephemerally created account */
27
- generateAccount: (params: GetTestAccountParams) => Promise<Address & Account & TransactionSignerAccount>;
28
- /** Wait for the indexer to catch up with all transactions logged by `transactionLogger` */
29
- waitForIndexer: () => Promise<void>;
30
- /** Wait for the indexer to catch up with the given transaction ID */
31
- waitForIndexerTransaction: (transactionId: string) => Promise<algosdk.indexerModels.TransactionResponse>;
17
+ export interface AlgorandTestAutomationContext {
18
+ /** An AlgorandClient instance loaded with the current context, including testAccount and any generated accounts loaded as signers */
19
+ algorand: AlgorandClient;
20
+ /** Algod client instance that will log transactions in `transactionLogger` */
21
+ algod: Algodv2;
22
+ /** Indexer client instance */
23
+ indexer: Indexer;
24
+ /** KMD client instance */
25
+ kmd: Kmd;
26
+ /** Transaction logger that will log transaction IDs for all transactions issued by `algod` */
27
+ transactionLogger: TransactionLogger;
28
+ /** Default, funded test account that is ephemerally created */
29
+ testAccount: Address & TransactionSignerAccount & Account;
30
+ /** Generate and fund an additional ephemerally created account */
31
+ generateAccount: (params: GetTestAccountParams) => Promise<Address & Account & TransactionSignerAccount>;
32
+ /** Wait for the indexer to catch up with all transactions logged by `transactionLogger` */
33
+ waitForIndexer: () => Promise<void>;
34
+ /** Wait for the indexer to catch up with the given transaction ID */
35
+ waitForIndexerTransaction: (transactionId: string) => Promise<algosdk.indexerModels.TransactionResponse>;
32
36
  }
33
37
  /**
34
38
  * Parameters for the `getTestAccount` function.
35
39
  */
36
- interface GetTestAccountParams {
37
- /** Initial funds to ensure the account has */
38
- initialFunds: AlgoAmount;
39
- /** Whether to suppress the log (which includes a mnemonic) or not (default: do not suppress the log) */
40
- suppressLog?: boolean;
41
- /** Optional override for how to get a test account; this allows you to retrieve accounts from a known or cached list of accounts. */
42
- accountGetter?: (algorand: AlgorandClient) => Promise<Account>;
40
+ export interface GetTestAccountParams {
41
+ /** Initial funds to ensure the account has */
42
+ initialFunds: AlgoAmount;
43
+ /** Whether to suppress the log (which includes a mnemonic) or not (default: do not suppress the log) */
44
+ suppressLog?: boolean;
45
+ /** Optional override for how to get a test account; this allows you to retrieve accounts from a known or cached list of accounts. */
46
+ accountGetter?: (algorand: AlgorandClient) => Promise<Account>;
43
47
  }
44
48
  /** Configuration for creating an Algorand testing fixture. */
45
- interface AlgorandFixtureConfig extends Partial<AlgoConfig> {
46
- /** An optional algod client, if not specified then it will create one against `algodConfig` (if present) then environment variables defined network (if present) or default LocalNet. */
47
- algod?: Algodv2;
48
- /** An optional indexer client, if not specified then it will create one against `indexerConfig` (if present) then environment variables defined network (if present) or default LocalNet. */
49
- indexer?: Indexer;
50
- /** An optional kmd client, if not specified then it will create one against `kmdConfig` (if present) then environment variables defined network (if present) or default LocalNet. */
51
- kmd?: Kmd;
52
- /** The amount of funds to allocate to the default testing account, if not specified then it will get 10 ALGO. */
53
- testAccountFunding?: AlgoAmount;
54
- /** Optional override for how to get an account; this allows you to retrieve accounts from a known or cached list of accounts. */
55
- accountGetter?: (algod: Algodv2, kmd?: Kmd) => Promise<Account>;
49
+ export interface AlgorandFixtureConfig extends Partial<AlgoConfig> {
50
+ /** 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. */
51
+ algod?: Algodv2;
52
+ /** 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. */
53
+ indexer?: Indexer;
54
+ /** 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. */
55
+ kmd?: Kmd;
56
+ /** The amount of funds to allocate to the default testing account, if not specified then it will get 10 ALGO. */
57
+ testAccountFunding?: AlgoAmount;
58
+ /** Optional override for how to get an account; this allows you to retrieve accounts from a known or cached list of accounts. */
59
+ accountGetter?: (algod: Algodv2, kmd?: Kmd) => Promise<Account>;
56
60
  }
57
61
  /** An Algorand automated testing fixture */
58
- interface AlgorandFixture {
59
- /**
60
- * Retrieve the current context.
61
- * Useful with destructuring.
62
- *
63
- * If you haven't called `newScope` then this will throw an error.
64
- * @example
65
- * ```typescript
66
- * test('My test', () => {
67
- * const {algod, indexer, testAccount, ...} = fixture.context
68
- * })
69
- * ```
70
- */
71
- get context(): AlgorandTestAutomationContext;
72
- /**
73
- * Retrieve an `AlgorandClient` loaded with the current context, including testAccount and any generated accounts loaded as signers.
74
- */
75
- get algorand(): AlgorandClient;
76
- /**
77
- * @deprecated Use newScope instead.
78
- * Testing framework agnostic handler method to run before each test to prepare the `context` for that test with per test isolation.
79
- */
80
- beforeEach: () => Promise<void>;
81
- /**
82
- * Creates a new isolated fixture scope (clean transaction logger, AlgorandClient, testAccount, etc.).
83
- *
84
- * You can call this from any testing framework specific hook method to control when you want a new scope.
85
- *
86
- * @example Jest / vitest - per test isolation (beforeEach)
87
- * ```typescript
88
- * describe('MY MODULE', () => {
89
- * const fixture = algorandFixture()
90
- * beforeEach(fixture.newScope)
91
- *
92
- * test('MY TEST', async () => {
93
- * const { algorand, testAccount } = fixture.context
94
- *
95
- * // Test stuff!
96
- * })
97
- * })
98
- * ```
99
- *
100
- * @example Jest / vitest - test suite isolation (beforeAll)
101
- * ```typescript
102
- * describe('MY MODULE', () => {
103
- * const fixture = algorandFixture()
104
- * beforeAll(fixture.newScope)
105
- *
106
- * test('test1', async () => {
107
- * const { algorand, testAccount } = fixture.context
108
- *
109
- * // Test stuff!
110
- * })
111
- * test('test2', async () => {
112
- * const { algorand, testAccount } = fixture.context
113
- * // algorand and testAccount are the same as in test1
114
- * })
115
- * })
116
- * ```
117
- *
118
- */
119
- newScope: () => Promise<void>;
62
+ export interface AlgorandFixture {
63
+ /**
64
+ * Retrieve the current context.
65
+ * Useful with destructuring.
66
+ *
67
+ * If you haven't called `newScope` then this will throw an error.
68
+ * @example
69
+ * ```typescript
70
+ * test('My test', () => {
71
+ * const {algod, indexer, testAccount, ...} = fixture.context
72
+ * })
73
+ * ```
74
+ */
75
+ get context(): AlgorandTestAutomationContext;
76
+ /**
77
+ * Retrieve an `AlgorandClient` loaded with the current context, including testAccount and any generated accounts loaded as signers.
78
+ */
79
+ get algorand(): AlgorandClient;
80
+ /**
81
+ * @deprecated Use newScope instead.
82
+ * Testing framework agnostic handler method to run before each test to prepare the `context` for that test with per test isolation.
83
+ */
84
+ beforeEach: () => Promise<void>;
85
+ /**
86
+ * Creates a new isolated fixture scope (clean transaction logger, AlgorandClient, testAccount, etc.).
87
+ *
88
+ * You can call this from any testing framework specific hook method to control when you want a new scope.
89
+ *
90
+ * @example Jest / vitest - per test isolation (beforeEach)
91
+ * ```typescript
92
+ * describe('MY MODULE', () => {
93
+ * const fixture = algorandFixture()
94
+ * beforeEach(fixture.newScope)
95
+ *
96
+ * test('MY TEST', async () => {
97
+ * const { algorand, testAccount } = fixture.context
98
+ *
99
+ * // Test stuff!
100
+ * })
101
+ * })
102
+ * ```
103
+ *
104
+ * @example Jest / vitest - test suite isolation (beforeAll)
105
+ * ```typescript
106
+ * describe('MY MODULE', () => {
107
+ * const fixture = algorandFixture()
108
+ * beforeAll(fixture.newScope)
109
+ *
110
+ * test('test1', async () => {
111
+ * const { algorand, testAccount } = fixture.context
112
+ *
113
+ * // Test stuff!
114
+ * })
115
+ * test('test2', async () => {
116
+ * const { algorand, testAccount } = fixture.context
117
+ * // algorand and testAccount are the same as in test1
118
+ * })
119
+ * })
120
+ * ```
121
+ *
122
+ */
123
+ newScope: () => Promise<void>;
120
124
  }
121
125
  /** Configuration for preparing a captured log snapshot.
122
126
  * This helps ensure that the provided configuration items won't appear
123
127
  * with random values in the log snapshot, but rather will get substituted with predictable ids.
124
128
  */
125
- interface LogSnapshotConfig {
126
- /** Any transaction IDs or transactions to replace the ID for predictably */
127
- transactions?: (string | Transaction)[];
128
- /** Any accounts/addresses to replace the address for predictably */
129
- accounts?: (string | Address | Account | SigningAccount | LogicSigAccount | MultisigAccount | TransactionSignerAccount)[];
130
- /** Any app IDs to replace predictably */
131
- apps?: (string | number | bigint)[];
132
- /** Optional filter predicate to filter out logs */
133
- filterPredicate?: (log: string) => boolean;
129
+ export interface LogSnapshotConfig {
130
+ /** Any transaction IDs or transactions to replace the ID for predictably */
131
+ transactions?: (string | Transaction)[];
132
+ /** Any accounts/addresses to replace the address for predictably */
133
+ accounts?: (string | Address | Account | SigningAccount | LogicSigAccount | MultisigAccount | TransactionSignerAccount)[];
134
+ /** Any app IDs to replace predictably */
135
+ apps?: (string | number | bigint)[];
136
+ /** Optional filter predicate to filter out logs */
137
+ filterPredicate?: (log: string) => boolean;
134
138
  }
135
- interface AlgoKitLogCaptureFixture {
136
- /** The test logger instance for the current test */
137
- get testLogger(): TestLogger;
138
- /**
139
- * Testing framework agnostic handler method to run before each test to prepare the `testLogger` for that test.
140
- */
141
- beforeEach: () => void;
142
- /**
143
- * Testing framework agnostic handler method to run after each test to reset the logger.
144
- */
145
- afterEach: () => void;
139
+ export interface AlgoKitLogCaptureFixture {
140
+ /** The test logger instance for the current test */
141
+ get testLogger(): TestLogger;
142
+ /**
143
+ * Testing framework agnostic handler method to run before each test to prepare the `testLogger` for that test.
144
+ */
145
+ beforeEach: () => void;
146
+ /**
147
+ * Testing framework agnostic handler method to run after each test to reset the logger.
148
+ */
149
+ afterEach: () => void;
146
150
  }
147
- //#endregion
148
- export { AlgoKitLogCaptureFixture, AlgorandFixture, AlgorandFixtureConfig, AlgorandTestAutomationContext, GetTestAccountParams, LogSnapshotConfig };
149
- //# sourceMappingURL=testing.d.ts.map