@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,448 @@
|
|
|
1
|
+
import { Address, ReadableAddress } from "./packages/common/src/address.js";
|
|
2
|
+
import { MultisigAccount, MultisigMetadata } from "./packages/transact/src/multisig.js";
|
|
3
|
+
import { DelegatedLsigSigner, LogicSigAccount, ProgramDataSigner } from "./packages/transact/src/logicsig.js";
|
|
4
|
+
import { AddressWithSigners, AddressWithTransactionSigner, MxBytesSigner, TransactionSigner } from "./packages/transact/src/signer.js";
|
|
5
|
+
import { AlgoAmount } from "./amount.js";
|
|
6
|
+
import { AccountInformation } from "./account.js";
|
|
7
|
+
import { SendParams, SendSingleTransactionResult } from "./transaction/types.js";
|
|
8
|
+
import { CommonTransactionParams } from "./transactions/common.js";
|
|
9
|
+
import { TestNetDispenserApiClient } from "./dispenser-client.js";
|
|
10
|
+
import { ClientManager } from "./client-manager.js";
|
|
11
|
+
import { KmdAccountManager } from "./kmd-account-manager.js";
|
|
12
|
+
|
|
13
|
+
//#region src/account-manager.d.ts
|
|
14
|
+
/** Result from performing an ensureFunded call. */
|
|
15
|
+
interface EnsureFundedResult {
|
|
16
|
+
/** The transaction ID of the transaction that funded the account. */
|
|
17
|
+
transactionId: string;
|
|
18
|
+
/** The amount that was sent to the account. */
|
|
19
|
+
amountFunded: AlgoAmount;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Returns a `TransactionSigner` for the given account that can sign a transaction.
|
|
23
|
+
* This function has memoization, so will return the same transaction signer for a given account.
|
|
24
|
+
* @param account An account that can sign a transaction
|
|
25
|
+
* @returns A transaction signer
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const signer = getAccountTransactionSigner(account)
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
declare const getAccountTransactionSigner: (val: AddressWithTransactionSigner | LogicSigAccount | MultisigAccount) => TransactionSigner;
|
|
32
|
+
/** Creates and keeps track of signing accounts that can sign transactions for a sending address. */
|
|
33
|
+
declare class AccountManager {
|
|
34
|
+
private _clientManager;
|
|
35
|
+
private _kmdAccountManager;
|
|
36
|
+
private _accounts;
|
|
37
|
+
private _defaultSigner?;
|
|
38
|
+
/**
|
|
39
|
+
* Create a new account manager.
|
|
40
|
+
* @param clientManager The ClientManager client to use for algod and kmd clients
|
|
41
|
+
* @example Create a new account manager
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const accountManager = new AccountManager(clientManager)
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
constructor(clientManager: ClientManager);
|
|
47
|
+
private _getComposer;
|
|
48
|
+
/**
|
|
49
|
+
* KMD account manager that allows you to easily get and create accounts using KMD.
|
|
50
|
+
* @returns The `KmdAccountManager` instance.
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const kmdManager = accountManager.kmd;
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
get kmd(): KmdAccountManager;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the default signer to use if no other signer is specified.
|
|
59
|
+
*
|
|
60
|
+
* If this isn't set an a transaction needs signing for a given sender
|
|
61
|
+
* then an error will be thrown from `getSigner` / `getAccount`.
|
|
62
|
+
* @param signer The signer to use, either a `TransactionSigner` or a `AddressWithSigner`
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const signer = accountManager.random() // Can be anything that returns a `TransactionSigner` or `AddressWithSigner`
|
|
66
|
+
* accountManager.setDefaultSigner(signer)
|
|
67
|
+
*
|
|
68
|
+
* // When signing a transaction, if there is no signer registered for the sender then the default signer will be used
|
|
69
|
+
* const signer = accountManager.getSigner("SENDERADDRESS")
|
|
70
|
+
* ```
|
|
71
|
+
* @returns The `AccountManager` so method calls can be chained
|
|
72
|
+
*/
|
|
73
|
+
setDefaultSigner(signer: TransactionSigner | AddressWithTransactionSigner): AccountManager;
|
|
74
|
+
/**
|
|
75
|
+
* Records the given account (that can sign) against the address of the provided account for later
|
|
76
|
+
* retrieval and returns a `AddressWithTransactionSigner` along with the original account in an `account` property.
|
|
77
|
+
*/
|
|
78
|
+
private signerAccount;
|
|
79
|
+
/**
|
|
80
|
+
* Tracks the given account for later signing.
|
|
81
|
+
*
|
|
82
|
+
* Note: If you are generating accounts via the various methods on `AccountManager`
|
|
83
|
+
* (like `random`, `fromMnemonic`, `logicsig`, etc.) then they automatically get tracked.
|
|
84
|
+
* @param account The account to register, which can be a `AddressWithSigner` or
|
|
85
|
+
* a `algosdk.Account`, `algosdk.LogicSigAccount`, `SigningAccount` or `MultisigAccount`
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const accountManager = new AccountManager(clientManager)
|
|
89
|
+
* .setSignerFromAccount(algosdk.generateAccount())
|
|
90
|
+
* .setSignerFromAccount(new algosdk.LogicSigAccount(program, args))
|
|
91
|
+
* .setSignerFromAccount(new SigningAccount(mnemonic, sender))
|
|
92
|
+
* .setSignerFromAccount(new MultisigAccount({version: 1, threshold: 1, addrs: ["ADDRESS1...", "ADDRESS2..."]}, [account1, account2]))
|
|
93
|
+
* .setSignerFromAccount({addr: "SENDERADDRESS", signer: transactionSigner})
|
|
94
|
+
* ```
|
|
95
|
+
* @returns The `AccountManager` instance for method chaining
|
|
96
|
+
*/
|
|
97
|
+
setSignerFromAccount(account: AddressWithTransactionSigner | LogicSigAccount | MultisigAccount): this;
|
|
98
|
+
/**
|
|
99
|
+
* Tracks the given `TransactionSigner` against the given sender address for later signing.
|
|
100
|
+
* @param sender The sender address to use this signer for
|
|
101
|
+
* @param signer The `TransactionSigner` to sign transactions with for the given sender
|
|
102
|
+
* @example
|
|
103
|
+
* ```typescript
|
|
104
|
+
* const accountManager = new AccountManager(clientManager)
|
|
105
|
+
* .setSigner("SENDERADDRESS", transactionSigner)
|
|
106
|
+
* ```
|
|
107
|
+
* @returns The `AccountManager` instance for method chaining
|
|
108
|
+
*/
|
|
109
|
+
setSigner(sender: string | Address, signer: TransactionSigner): this;
|
|
110
|
+
/**
|
|
111
|
+
* Takes all registered signers from the given `AccountManager` and adds them to this `AccountManager`.
|
|
112
|
+
*
|
|
113
|
+
* This is useful for situations where you have multiple contexts you are building accounts in such as unit tests.
|
|
114
|
+
* @param anotherAccountManager Another account manager with signers registered
|
|
115
|
+
* @param overwriteExisting Whether or not to overwrite any signers that have the same sender address with the ones in the other account manager or not (default: true)
|
|
116
|
+
* @returns The `AccountManager` instance for method chaining
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* accountManager2.setSigners(accountManager1);
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
setSigners(anotherAccountManager: AccountManager, overwriteExisting?: boolean): this;
|
|
123
|
+
/**
|
|
124
|
+
* Returns the `TransactionSigner` for the given sender address, ready to sign a transaction for that sender.
|
|
125
|
+
*
|
|
126
|
+
* If no signer has been registered for that address then the default signer is used if registered and
|
|
127
|
+
* if not then an error is thrown.
|
|
128
|
+
*
|
|
129
|
+
* @param sender The sender address
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* const signer = accountManager.getSigner("SENDERADDRESS")
|
|
133
|
+
* ```
|
|
134
|
+
* @returns The `TransactionSigner` or throws an error if not found and no default signer is set
|
|
135
|
+
*/
|
|
136
|
+
getSigner(sender: ReadableAddress): TransactionSigner;
|
|
137
|
+
/**
|
|
138
|
+
* Returns the `AddressWithSigner` for the given sender address.
|
|
139
|
+
*
|
|
140
|
+
* If no signer has been registered for that address then an error is thrown.
|
|
141
|
+
* @param sender The sender address
|
|
142
|
+
* @example
|
|
143
|
+
* ```typescript
|
|
144
|
+
* const sender = accountManager.random()
|
|
145
|
+
* // ...
|
|
146
|
+
* // Returns the `AddressWithSigner` for `sender` that has previously been registered
|
|
147
|
+
* const account = accountManager.getAccount(sender)
|
|
148
|
+
* ```
|
|
149
|
+
* @returns The `AddressWithSigner` or throws an error if not found
|
|
150
|
+
*/
|
|
151
|
+
getAccount(sender: ReadableAddress): AddressWithTransactionSigner;
|
|
152
|
+
/**
|
|
153
|
+
* Returns the given sender account's current status, balance and spendable amounts.
|
|
154
|
+
*
|
|
155
|
+
* [Response data schema details](https://dev.algorand.co/reference/rest-apis/algod/#accountinformation)
|
|
156
|
+
* @example
|
|
157
|
+
* ```typescript
|
|
158
|
+
* const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
159
|
+
* const accountInfo = await accountManager.getInformation(address);
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* @param sender The account / address to look up
|
|
163
|
+
* @returns The account information
|
|
164
|
+
*/
|
|
165
|
+
getInformation(sender: ReadableAddress): Promise<AccountInformation>;
|
|
166
|
+
/**
|
|
167
|
+
* Tracks and returns an Algorand account with secret key loaded (i.e. that can sign transactions) by taking the mnemonic secret.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* const account = accountManager.fromMnemonic("mnemonic secret ...")
|
|
172
|
+
* const rekeyedAccount = accountManager.fromMnemonic("mnemonic secret ...", "SENDERADDRESS...")
|
|
173
|
+
* ```
|
|
174
|
+
* @param mnemonicSecret The mnemonic secret representing the private key of an account; **Note: Be careful how the mnemonic is handled**,
|
|
175
|
+
* never commit it into source control and ideally load it from the environment (ideally via a secret storage service) rather than the file system.
|
|
176
|
+
* @param sender The optional sender address to use this signer for (aka a rekeyed account)
|
|
177
|
+
* @returns The account
|
|
178
|
+
*/
|
|
179
|
+
fromMnemonic(mnemonicSecret: string, sender?: string | Address): AddressWithTransactionSigner;
|
|
180
|
+
/**
|
|
181
|
+
* Tracks and returns an Algorand account that is a rekeyed version of the given account to a new sender.
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* const account = accountManager.fromMnemonic("mnemonic secret ...")
|
|
186
|
+
* const rekeyedAccount = accountManager.rekeyed(account, "SENDERADDRESS...")
|
|
187
|
+
* ```
|
|
188
|
+
* @param account The account to use as the signer for this new rekeyed account
|
|
189
|
+
* @param sender The sender address to use as the new sender
|
|
190
|
+
* @returns The account
|
|
191
|
+
*/
|
|
192
|
+
rekeyed(sender: string | Address, account: AddressWithTransactionSigner): Address & AddressWithTransactionSigner & {
|
|
193
|
+
account: {
|
|
194
|
+
addr: Address;
|
|
195
|
+
signer: TransactionSigner;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Tracks and returns an Algorand account with private key loaded by convention from environment variables based on the given name identifier.
|
|
200
|
+
*
|
|
201
|
+
* Note: This function expects to run in a Node.js environment.
|
|
202
|
+
*
|
|
203
|
+
* ## Convention:
|
|
204
|
+
* * **Non-LocalNet:** will load process.env['\{NAME\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,
|
|
205
|
+
* never commit it into source control and ideally load it via a secret storage service rather than the file system.
|
|
206
|
+
* If process.env['\{NAME\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)
|
|
207
|
+
* * **LocalNet:** will load the account from a KMD wallet called \{NAME\} and if that wallet doesn't exist it will create it and fund the account for you
|
|
208
|
+
*
|
|
209
|
+
* This allows you to write code that will work seamlessly in production and local development (LocalNet) without manual config locally (including when you reset the LocalNet).
|
|
210
|
+
*
|
|
211
|
+
* @example Default
|
|
212
|
+
*
|
|
213
|
+
* If you have a mnemonic secret loaded into `process.env.MY_ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:
|
|
214
|
+
* ```typescript
|
|
215
|
+
* const account = await accountManager.fromEnvironment('MY_ACCOUNT')
|
|
216
|
+
* ```
|
|
217
|
+
*
|
|
218
|
+
* If that code runs against LocalNet then a wallet called `MY_ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.
|
|
219
|
+
* If not running against LocalNet then it will use proces.env.MY_ACCOUNT_MNEMONIC as the private key and (if present) process.env.MY_ACCOUNT_SENDER as the sender address.
|
|
220
|
+
*
|
|
221
|
+
* @param name The name identifier of the account
|
|
222
|
+
* @param fundWith The optional amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account
|
|
223
|
+
* @returns The account
|
|
224
|
+
*/
|
|
225
|
+
fromEnvironment(name: string, fundWith?: AlgoAmount): Promise<AddressWithTransactionSigner>;
|
|
226
|
+
/**
|
|
227
|
+
* Tracks and returns an Algorand account with private key loaded from the given KMD wallet (identified by name).
|
|
228
|
+
*
|
|
229
|
+
* @param name The name of the wallet to retrieve an account from
|
|
230
|
+
* @param predicate An optional filter to use to find the account (otherwise it will return a random account from the wallet)
|
|
231
|
+
* @param sender The optional sender address to use this signer for (aka a rekeyed account)
|
|
232
|
+
* @example Get default funded account in a LocalNet
|
|
233
|
+
*
|
|
234
|
+
* ```typescript
|
|
235
|
+
* const defaultDispenserAccount = await accountManager.fromKmd('unencrypted-default-wallet',
|
|
236
|
+
* a => a.status !== 'Offline' && a.amount > 1_000_000_000
|
|
237
|
+
* )
|
|
238
|
+
* ```
|
|
239
|
+
* @returns The account
|
|
240
|
+
*/
|
|
241
|
+
fromKmd(name: string, predicate?: (account: Record<string, any>) => boolean, sender?: string | Address): Promise<Address & AddressWithTransactionSigner & {
|
|
242
|
+
account: AddressWithTransactionSigner;
|
|
243
|
+
}>;
|
|
244
|
+
/**
|
|
245
|
+
* Tracks and returns an account that supports partial or full multisig signing.
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```typescript
|
|
249
|
+
* const account = accountManager.multisig({version: 1, threshold: 1, addrs: ["ADDRESS1...", "ADDRESS2..."]},
|
|
250
|
+
* [(await accountManager.fromEnvironment('ACCOUNT1')).account])
|
|
251
|
+
* ```
|
|
252
|
+
* @param multisigParams The parameters that define the multisig account
|
|
253
|
+
* @param subSigners The signers that are currently present
|
|
254
|
+
* @returns A multisig account wrapper
|
|
255
|
+
*/
|
|
256
|
+
multisig(multisigParams: MultisigMetadata, subSigners: AddressWithSigners[]): Address & AddressWithTransactionSigner & {
|
|
257
|
+
account: MultisigAccount;
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* Tracks and returns an account that represents a logic signature.
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* ```typescript
|
|
264
|
+
* const account = accountManager.logicsig(program, [new Uint8Array(3, ...)])
|
|
265
|
+
* ```
|
|
266
|
+
* @param program The bytes that make up the compiled logic signature
|
|
267
|
+
* @param args The (binary) arguments to pass into the logic signature
|
|
268
|
+
* @returns A logic signature account wrapper
|
|
269
|
+
*/
|
|
270
|
+
logicsig(program: Uint8Array, args?: Array<Uint8Array>): Address & AddressWithTransactionSigner & {
|
|
271
|
+
account: LogicSigAccount;
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* Tracks and returns a new, random Algorand account with secret key loaded.
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* ```typescript
|
|
278
|
+
* const account = accountManager.random()
|
|
279
|
+
* ```
|
|
280
|
+
* @returns The account
|
|
281
|
+
*/
|
|
282
|
+
random(): Address & {
|
|
283
|
+
addr: Readonly<Address>;
|
|
284
|
+
signer: TransactionSigner;
|
|
285
|
+
lsigSigner: DelegatedLsigSigner;
|
|
286
|
+
programDataSigner: ProgramDataSigner;
|
|
287
|
+
mxBytesSigner: MxBytesSigner;
|
|
288
|
+
};
|
|
289
|
+
/**
|
|
290
|
+
* Returns an account (with private key loaded) that can act as a dispenser from
|
|
291
|
+
* environment variables, or against default LocalNet if no environment variables present.
|
|
292
|
+
*
|
|
293
|
+
* Note: requires a Node.js environment to execute.
|
|
294
|
+
*
|
|
295
|
+
* If present, it will load the account mnemonic stored in process.env.DISPENSER_MNEMONIC and optionally
|
|
296
|
+
* process.env.DISPENSER_SENDER if it's a rekeyed account.
|
|
297
|
+
*
|
|
298
|
+
* @example
|
|
299
|
+
* ```typescript
|
|
300
|
+
* const account = await accountManager.dispenserFromEnvironment()
|
|
301
|
+
* ```
|
|
302
|
+
*
|
|
303
|
+
* @returns The account
|
|
304
|
+
*/
|
|
305
|
+
dispenserFromEnvironment(): Promise<AddressWithTransactionSigner>;
|
|
306
|
+
/**
|
|
307
|
+
* Returns an Algorand account with private key loaded for the default LocalNet dispenser account (that can be used to fund other accounts).
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```typescript
|
|
311
|
+
* const account = await accountManager.localNetDispenser()
|
|
312
|
+
* ```
|
|
313
|
+
* @returns The account
|
|
314
|
+
*/
|
|
315
|
+
localNetDispenser(): Promise<Address & AddressWithTransactionSigner & {
|
|
316
|
+
account: AddressWithTransactionSigner;
|
|
317
|
+
}>;
|
|
318
|
+
/**
|
|
319
|
+
* Rekey an account to a new address.
|
|
320
|
+
*
|
|
321
|
+
* **Note:** Please be careful with this function and be sure to read the [official rekey guidance](https://dev.algorand.co/concepts/accounts/rekeying).
|
|
322
|
+
*
|
|
323
|
+
* @param account The account to rekey
|
|
324
|
+
* @param rekeyTo The account address or signing account of the account that will be used to authorise transactions for the rekeyed account going forward.
|
|
325
|
+
* If a signing account is provided that will now be tracked as the signer for `account` in this `AccountManager`
|
|
326
|
+
* @param options Any parameters to control the transaction or execution of the transaction
|
|
327
|
+
*
|
|
328
|
+
* @example Basic example (with string addresses)
|
|
329
|
+
* ```typescript
|
|
330
|
+
* await accountManager.rekeyAccount({account: "ACCOUNTADDRESS", rekeyTo: "NEWADDRESS"})
|
|
331
|
+
* ```
|
|
332
|
+
* @example Basic example (with signer accounts)
|
|
333
|
+
* ```typescript
|
|
334
|
+
* await accountManager.rekeyAccount({account: account1, rekeyTo: newSignerAccount})
|
|
335
|
+
* ```
|
|
336
|
+
* @example Advanced example
|
|
337
|
+
* ```typescript
|
|
338
|
+
* await accountManager.rekeyAccount({
|
|
339
|
+
* account: "ACCOUNTADDRESS",
|
|
340
|
+
* rekeyTo: "NEWADDRESS",
|
|
341
|
+
* lease: 'lease',
|
|
342
|
+
* note: 'note',
|
|
343
|
+
* firstValidRound: 1000n,
|
|
344
|
+
* validityWindow: 10,
|
|
345
|
+
* extraFee: (1000).microAlgo(),
|
|
346
|
+
* staticFee: (1000).microAlgo(),
|
|
347
|
+
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
348
|
+
* // already specified, but here for completeness
|
|
349
|
+
* maxFee: (3000).microAlgo(),
|
|
350
|
+
* maxRoundsToWaitForConfirmation: 5,
|
|
351
|
+
* suppressLog: true,
|
|
352
|
+
* })
|
|
353
|
+
* ```
|
|
354
|
+
* @returns The result of the transaction and the transaction that was sent
|
|
355
|
+
*/
|
|
356
|
+
rekeyAccount(account: string | Address, rekeyTo: string | Address | AddressWithTransactionSigner, options?: Omit<CommonTransactionParams, 'sender'> & SendParams): Promise<SendSingleTransactionResult>;
|
|
357
|
+
private _getEnsureFundedAmount;
|
|
358
|
+
/**
|
|
359
|
+
* Funds a given account using a dispenser account as a funding source such that
|
|
360
|
+
* the given account has a certain amount of Algo free to spend (accounting for
|
|
361
|
+
* Algo locked in minimum balance requirement).
|
|
362
|
+
*
|
|
363
|
+
* https://dev.algorand.co/concepts/smart-contracts/costs-constraints#mbr
|
|
364
|
+
*
|
|
365
|
+
* @param accountToFund The account to fund
|
|
366
|
+
* @param dispenserAccount The account to use as a dispenser funding source
|
|
367
|
+
* @param minSpendingBalance The minimum balance of Algo that the account should have available to spend (i.e. on top of minimum balance requirement)
|
|
368
|
+
* @param options Optional parameters to control the funding increment, transaction or execution of the transaction
|
|
369
|
+
* @example Example using AlgorandClient
|
|
370
|
+
* ```typescript
|
|
371
|
+
* // Basic example
|
|
372
|
+
* await accountManager.ensureFunded("ACCOUNTADDRESS", "DISPENSERADDRESS", algokit.algo(1))
|
|
373
|
+
* // With configuration
|
|
374
|
+
* await accountManager.ensureFunded("ACCOUNTADDRESS", "DISPENSERADDRESS", algokit.algo(1),
|
|
375
|
+
* { minFundingIncrement: algokit.algo(2), fee: (1000).microAlgo(), suppressLog: true }
|
|
376
|
+
* )
|
|
377
|
+
* ```
|
|
378
|
+
* @returns
|
|
379
|
+
* - The result of executing the dispensing transaction and the `amountFunded` if funds were needed.
|
|
380
|
+
* - `undefined` if no funds were needed.
|
|
381
|
+
*/
|
|
382
|
+
ensureFunded(accountToFund: string | Address, dispenserAccount: string | Address, minSpendingBalance: AlgoAmount, options?: {
|
|
383
|
+
minFundingIncrement?: AlgoAmount;
|
|
384
|
+
} & SendParams & Omit<CommonTransactionParams, 'sender'>): Promise<(SendSingleTransactionResult & EnsureFundedResult) | undefined>;
|
|
385
|
+
/**
|
|
386
|
+
* Funds a given account using a dispenser account retrieved from the environment,
|
|
387
|
+
* per the `dispenserFromEnvironment` method, as a funding source such that
|
|
388
|
+
* the given account has a certain amount of Algo free to spend (accounting for
|
|
389
|
+
* Algo locked in minimum balance requirement).
|
|
390
|
+
*
|
|
391
|
+
* **Note:** requires a Node.js environment to execute.
|
|
392
|
+
*
|
|
393
|
+
* The dispenser account is retrieved from the account mnemonic stored in
|
|
394
|
+
* process.env.DISPENSER_MNEMONIC and optionally process.env.DISPENSER_SENDER
|
|
395
|
+
* if it's a rekeyed account, or against default LocalNet if no environment variables present.
|
|
396
|
+
*
|
|
397
|
+
* https://dev.algorand.co/concepts/smart-contracts/costs-constraints#mbr
|
|
398
|
+
*
|
|
399
|
+
* @param accountToFund The account to fund
|
|
400
|
+
* @param minSpendingBalance The minimum balance of Algo that the account should have available to spend (i.e. on top of minimum balance requirement)
|
|
401
|
+
* @param options Optional parameters to control the funding increment, transaction or execution of the transaction
|
|
402
|
+
* @example Example using AlgorandClient
|
|
403
|
+
* ```typescript
|
|
404
|
+
* // Basic example
|
|
405
|
+
* await accountManager.ensureFundedFromEnvironment("ACCOUNTADDRESS", algokit.algo(1))
|
|
406
|
+
* // With configuration
|
|
407
|
+
* await accountManager.ensureFundedFromEnvironment("ACCOUNTADDRESS", algokit.algo(1),
|
|
408
|
+
* { minFundingIncrement: algokit.algo(2), fee: (1000).microAlgo(), suppressLog: true }
|
|
409
|
+
* )
|
|
410
|
+
* ```
|
|
411
|
+
* @returns
|
|
412
|
+
* - The result of executing the dispensing transaction and the `amountFunded` if funds were needed.
|
|
413
|
+
* - `undefined` if no funds were needed.
|
|
414
|
+
*/
|
|
415
|
+
ensureFundedFromEnvironment(accountToFund: string | Address, minSpendingBalance: AlgoAmount, options?: {
|
|
416
|
+
minFundingIncrement?: AlgoAmount;
|
|
417
|
+
} & SendParams & Omit<CommonTransactionParams, 'sender'>): Promise<(SendSingleTransactionResult & EnsureFundedResult) | undefined>;
|
|
418
|
+
/**
|
|
419
|
+
* Funds a given account using the TestNet Dispenser API as a funding source such that
|
|
420
|
+
* the account has a certain amount of Algo free to spend (accounting for Algo locked
|
|
421
|
+
* in minimum balance requirement).
|
|
422
|
+
*
|
|
423
|
+
* https://dev.algorand.co/concepts/smart-contracts/costs-constraints#mbr
|
|
424
|
+
*
|
|
425
|
+
* @param accountToFund The account to fund
|
|
426
|
+
* @param dispenserClient The TestNet dispenser funding client
|
|
427
|
+
* @param minSpendingBalance The minimum balance of Algo that the account should have available to spend (i.e. on top of minimum balance requirement)
|
|
428
|
+
* @param options Optional parameters to control the funding increment, transaction or execution of the transaction
|
|
429
|
+
* @example Example using AlgorandClient
|
|
430
|
+
* ```typescript
|
|
431
|
+
* // Basic example
|
|
432
|
+
* await accountManager.ensureFundedFromTestNetDispenserApi("ACCOUNTADDRESS", algorand.client.getTestNetDispenserFromEnvironment(), algokit.algo(1))
|
|
433
|
+
* // With configuration
|
|
434
|
+
* await accountManager.ensureFundedFromTestNetDispenserApi("ACCOUNTADDRESS", algorand.client.getTestNetDispenserFromEnvironment(), algokit.algo(1),
|
|
435
|
+
* { minFundingIncrement: algokit.algo(2) }
|
|
436
|
+
* )
|
|
437
|
+
* ```
|
|
438
|
+
* @returns
|
|
439
|
+
* - The result of executing the dispensing transaction and the `amountFunded` if funds were needed.
|
|
440
|
+
* - `undefined` if no funds were needed.
|
|
441
|
+
*/
|
|
442
|
+
ensureFundedFromTestNetDispenserApi(accountToFund: string | Address, dispenserClient: TestNetDispenserApiClient, minSpendingBalance: AlgoAmount, options?: {
|
|
443
|
+
minFundingIncrement?: AlgoAmount;
|
|
444
|
+
}): Promise<EnsureFundedResult | undefined>;
|
|
445
|
+
}
|
|
446
|
+
//#endregion
|
|
447
|
+
export { AccountManager, EnsureFundedResult, getAccountTransactionSigner };
|
|
448
|
+
//# sourceMappingURL=account-manager.d.ts.map
|