@algorandfoundation/algokit-utils 9.2.1 → 9.2.2

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,84 +1,87 @@
1
- import { AlgoAmount } from "./amount.js";
2
- import { MultisigAccount, SigningAccount, TransactionSignerAccount } from "./account.js";
3
- import { Expand } from "./expand.js";
4
- import { ABIReturn } from "./app.js";
5
- import algosdk from "algosdk";
6
-
7
- //#region src/types/transaction.d.ts
8
- type TransactionNote = Uint8Array | TransactionNoteData | Arc2TransactionNote;
9
- type TransactionNoteData = string | null | undefined | number | any[] | Record<string, any>;
1
+ import algosdk from 'algosdk';
2
+ import { MultisigAccount, SigningAccount, TransactionSignerAccount } from './account';
3
+ import { AlgoAmount } from './amount';
4
+ import { ABIReturn } from './app';
5
+ import { Expand } from './expand';
6
+ import Account = algosdk.Account;
7
+ import AtomicTransactionComposer = algosdk.AtomicTransactionComposer;
8
+ import LogicSigAccount = algosdk.LogicSigAccount;
9
+ import Transaction = algosdk.Transaction;
10
+ import modelsv2 = algosdk.modelsv2;
11
+ export type TransactionNote = Uint8Array | TransactionNoteData | Arc2TransactionNote;
12
+ export type TransactionNoteData = string | null | undefined | number | any[] | Record<string, any>;
10
13
  /** ARC-0002 compatible transaction note components https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md */
11
- type Arc2TransactionNote = {
12
- dAppName: string;
13
- format: 'm' | 'b' | 'u';
14
- data: string;
14
+ export type Arc2TransactionNote = {
15
+ dAppName: string;
16
+ format: 'm' | 'b' | 'u';
17
+ data: string;
15
18
  } | {
16
- dAppName: string;
17
- format: 'j';
18
- data: TransactionNoteData;
19
+ dAppName: string;
20
+ format: 'j';
21
+ data: TransactionNoteData;
19
22
  };
20
23
  /** The sending configuration for a transaction */
21
- interface SendTransactionParams {
22
- /** Whether to skip signing and sending the transaction to the chain (default: transaction signed and sent to chain, unless `atc` specified)
23
- * and instead just return the raw transaction, e.g. so you can add it to a group of transactions */
24
- skipSending?: boolean;
25
- /** Whether to skip waiting for the submitted transaction (only relevant if `skipSending` is `false` or unset) */
26
- skipWaiting?: boolean;
27
- /** An optional `AtomicTransactionComposer` to add the transaction to, if specified then `skipSending: undefined` has the same effect as `skipSending: true` */
28
- atc?: AtomicTransactionComposer;
29
- /** Whether to suppress log messages from transaction send, default: do not suppress */
30
- suppressLog?: boolean;
31
- /** The flat fee you want to pay, useful for covering extra fees in a transaction group or app call */
32
- fee?: AlgoAmount;
33
- /** 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 */
34
- maxFee?: AlgoAmount;
35
- /** The maximum number of rounds to wait for confirmation, only applies if `skipWaiting` is `undefined` or `false`, default: wait up to 5 rounds */
36
- maxRoundsToWaitForConfirmation?: number;
37
- /** 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. */
38
- populateAppCallResources?: boolean;
24
+ export interface SendTransactionParams {
25
+ /** Whether to skip signing and sending the transaction to the chain (default: transaction signed and sent to chain, unless `atc` specified)
26
+ * and instead just return the raw transaction, e.g. so you can add it to a group of transactions */
27
+ skipSending?: boolean;
28
+ /** Whether to skip waiting for the submitted transaction (only relevant if `skipSending` is `false` or unset) */
29
+ skipWaiting?: boolean;
30
+ /** An optional `AtomicTransactionComposer` to add the transaction to, if specified then `skipSending: undefined` has the same effect as `skipSending: true` */
31
+ atc?: AtomicTransactionComposer;
32
+ /** Whether to suppress log messages from transaction send, default: do not suppress */
33
+ suppressLog?: boolean;
34
+ /** The flat fee you want to pay, useful for covering extra fees in a transaction group or app call */
35
+ fee?: AlgoAmount;
36
+ /** 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 */
37
+ maxFee?: AlgoAmount;
38
+ /** The maximum number of rounds to wait for confirmation, only applies if `skipWaiting` is `undefined` or `false`, default: wait up to 5 rounds */
39
+ maxRoundsToWaitForConfirmation?: number;
40
+ /** 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. */
41
+ populateAppCallResources?: boolean;
39
42
  }
40
43
  /** Result from sending a single transaction. */
41
- type SendSingleTransactionResult = Expand<SendAtomicTransactionComposerResults & ConfirmedTransactionResult>;
44
+ export type SendSingleTransactionResult = Expand<SendAtomicTransactionComposerResults & ConfirmedTransactionResult>;
42
45
  /** The result of sending a transaction */
43
- interface SendTransactionResult {
44
- /** The transaction */
45
- transaction: Transaction;
46
- /** The response if the transaction was sent and waited for */
47
- confirmation?: modelsv2.PendingTransactionResponse;
46
+ export interface SendTransactionResult {
47
+ /** The transaction */
48
+ transaction: Transaction;
49
+ /** The response if the transaction was sent and waited for */
50
+ confirmation?: modelsv2.PendingTransactionResponse;
48
51
  }
49
52
  /** The result of preparing and/or sending multiple transactions */
50
- interface SendTransactionResults {
51
- /** The transactions that have been prepared and/or sent */
52
- transactions: Transaction[];
53
- /** The responses if the transactions were sent and waited for,
54
- * the index of the confirmation will match the index of the underlying transaction
55
- */
56
- confirmations?: modelsv2.PendingTransactionResponse[];
53
+ export interface SendTransactionResults {
54
+ /** The transactions that have been prepared and/or sent */
55
+ transactions: Transaction[];
56
+ /** The responses if the transactions were sent and waited for,
57
+ * the index of the confirmation will match the index of the underlying transaction
58
+ */
59
+ confirmations?: modelsv2.PendingTransactionResponse[];
57
60
  }
58
61
  /** The result of preparing and/or sending multiple transactions using an `AtomicTransactionComposer` */
59
- interface SendAtomicTransactionComposerResults extends SendTransactionResults {
60
- /** base64 encoded representation of the group ID of the atomic group */
61
- groupId: string;
62
- /** The transaction IDs that have been prepared and/or sent */
63
- txIds: string[];
64
- /** If ABI method(s) were called the processed return values */
65
- returns?: ABIReturn[];
66
- /** The responses if the transactions were sent and waited for,
67
- * the index of the confirmation will match the index of the underlying transaction
68
- */
69
- confirmations: modelsv2.PendingTransactionResponse[];
62
+ export interface SendAtomicTransactionComposerResults extends SendTransactionResults {
63
+ /** base64 encoded representation of the group ID of the atomic group */
64
+ groupId: string;
65
+ /** The transaction IDs that have been prepared and/or sent */
66
+ txIds: string[];
67
+ /** If ABI method(s) were called the processed return values */
68
+ returns?: ABIReturn[];
69
+ /** The responses if the transactions were sent and waited for,
70
+ * the index of the confirmation will match the index of the underlying transaction
71
+ */
72
+ confirmations: modelsv2.PendingTransactionResponse[];
70
73
  }
71
74
  /** The result of sending and confirming a transaction */
72
- interface ConfirmedTransactionResult extends SendTransactionResult {
73
- /** The response from sending and waiting for the transaction */
74
- confirmation: modelsv2.PendingTransactionResponse;
75
+ export interface ConfirmedTransactionResult extends SendTransactionResult {
76
+ /** The response from sending and waiting for the transaction */
77
+ confirmation: modelsv2.PendingTransactionResponse;
75
78
  }
76
79
  /** The result of sending and confirming one or more transactions, but where there is a primary transaction of interest */
77
- interface ConfirmedTransactionResults extends SendTransactionResult, SendTransactionResults {
78
- /** The response from sending and waiting for the primary transaction */
79
- confirmation: modelsv2.PendingTransactionResponse;
80
- /** The response from sending and waiting for the transactions */
81
- confirmations: modelsv2.PendingTransactionResponse[];
80
+ export interface ConfirmedTransactionResults extends SendTransactionResult, SendTransactionResults {
81
+ /** The response from sending and waiting for the primary transaction */
82
+ confirmation: modelsv2.PendingTransactionResponse;
83
+ /** The response from sending and waiting for the transactions */
84
+ confirmations: modelsv2.PendingTransactionResponse[];
82
85
  }
83
86
  /** Core account abstraction when signing/sending transactions
84
87
  *
@@ -90,59 +93,56 @@ interface ConfirmedTransactionResults extends SendTransactionResult, SendTransac
90
93
  * * `MultisigAccount` - An AlgoKit Utils class that wraps a multisig account and provides mechanisms to get a multisig account
91
94
  * * `TransactionSignerAccount` - An AlgoKit Utils class that wraps the in-built `algosdk.TransactionSigner` along with the sender address
92
95
  */
93
- type SendTransactionFrom = Account | SigningAccount | LogicSigAccount | MultisigAccount | TransactionSignerAccount;
96
+ export type SendTransactionFrom = Account | SigningAccount | LogicSigAccount | MultisigAccount | TransactionSignerAccount;
94
97
  /** Defines an unsigned transaction that will appear in a group of transactions along with its signing information */
95
- interface TransactionToSign {
96
- /** The unsigned transaction to sign and send */
97
- transaction: Transaction;
98
- /** The account to use to sign the transaction, either an account (with private key loaded) or a logic signature account */
99
- signer: SendTransactionFrom;
98
+ export interface TransactionToSign {
99
+ /** The unsigned transaction to sign and send */
100
+ transaction: Transaction;
101
+ /** The account to use to sign the transaction, either an account (with private key loaded) or a logic signature account */
102
+ signer: SendTransactionFrom;
100
103
  }
101
104
  /** A group of transactions to send together as an atomic group
102
105
  * https://dev.algorand.co/concepts/transactions/atomic-txn-groups/
103
106
  */
104
- interface TransactionGroupToSend {
105
- /** Any parameters to control the semantics of the send to the network */
106
- sendParams?: Omit<SendTransactionParams, 'fee' | 'maxFee' | 'skipSending' | 'atc'>;
107
- /** The list of transactions to send, which can either be a raw transaction (in which case `signer` is required),
108
- * 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)
109
- * or the transaction with its signer (`signer` is ignored)
110
- **/
111
- transactions: (TransactionToSign | Transaction | Promise<SendTransactionResult>)[];
112
- /** Optional signer to pass in, required if at least one transaction provided is just the transaction, ignored otherwise */
113
- signer?: SendTransactionFrom;
107
+ export interface TransactionGroupToSend {
108
+ /** Any parameters to control the semantics of the send to the network */
109
+ sendParams?: Omit<SendTransactionParams, 'fee' | 'maxFee' | 'skipSending' | 'atc'>;
110
+ /** The list of transactions to send, which can either be a raw transaction (in which case `signer` is required),
111
+ * 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)
112
+ * or the transaction with its signer (`signer` is ignored)
113
+ **/
114
+ transactions: (TransactionToSign | Transaction | Promise<SendTransactionResult>)[];
115
+ /** Optional signer to pass in, required if at least one transaction provided is just the transaction, ignored otherwise */
116
+ signer?: SendTransactionFrom;
114
117
  }
115
118
  /** Parameters to configure transaction sending. */
116
- interface SendParams {
117
- /** The number of rounds to wait for confirmation. By default until the latest lastValid has past. */
118
- maxRoundsToWaitForConfirmation?: number;
119
- /** Whether to suppress log messages from transaction send, default: do not suppress. */
120
- suppressLog?: boolean;
121
- /** Whether to use simulate to automatically populate app call resources in the txn objects. Defaults to `Config.populateAppCallResources`. */
122
- populateAppCallResources?: boolean;
123
- /** Whether to use simulate to automatically calculate required app call inner transaction fees and cover them in the parent app call transaction fee */
124
- coverAppCallInnerTransactionFees?: boolean;
119
+ export interface SendParams {
120
+ /** The number of rounds to wait for confirmation. By default until the latest lastValid has past. */
121
+ maxRoundsToWaitForConfirmation?: number;
122
+ /** Whether to suppress log messages from transaction send, default: do not suppress. */
123
+ suppressLog?: boolean;
124
+ /** Whether to use simulate to automatically populate app call resources in the txn objects. Defaults to `Config.populateAppCallResources`. */
125
+ populateAppCallResources?: boolean;
126
+ /** Whether to use simulate to automatically calculate required app call inner transaction fees and cover them in the parent app call transaction fee */
127
+ coverAppCallInnerTransactionFees?: boolean;
125
128
  }
126
129
  /** Additional context about the `AtomicTransactionComposer`. */
127
- interface AdditionalAtomicTransactionComposerContext {
128
- /** A map of transaction index in the `AtomicTransactionComposer` to the max fee that can be calculated for a transaction in the group */
129
- maxFees: Map<number, AlgoAmount>;
130
- suggestedParams: Pick<algosdk.SuggestedParams, 'fee' | 'minFee'>;
130
+ export interface AdditionalAtomicTransactionComposerContext {
131
+ /** A map of transaction index in the `AtomicTransactionComposer` to the max fee that can be calculated for a transaction in the group */
132
+ maxFees: Map<number, AlgoAmount>;
133
+ suggestedParams: Pick<algosdk.SuggestedParams, 'fee' | 'minFee'>;
131
134
  }
132
135
  /** An `AtomicTransactionComposer` with transactions to send. */
133
- interface AtomicTransactionComposerToSend extends SendParams {
134
- /** The `AtomicTransactionComposer` with transactions loaded to send */
135
- atc: AtomicTransactionComposer;
136
- /**
137
- * @deprecated - set the parameters at the top level instead
138
- * Any parameters to control the semantics of the send to the network */
139
- sendParams?: Omit<SendTransactionParams, 'fee' | 'maxFee' | 'skipSending' | 'atc'>;
140
- /**
141
- * Additional `AtomicTransactionComposer` context used when building the transaction group that is sent.
142
- * This additional context is used and must be supplied when coverAppCallInnerTransactionFees is set to true.
143
- **/
144
- additionalAtcContext?: AdditionalAtomicTransactionComposerContext;
136
+ export interface AtomicTransactionComposerToSend extends SendParams {
137
+ /** The `AtomicTransactionComposer` with transactions loaded to send */
138
+ atc: AtomicTransactionComposer;
139
+ /**
140
+ * @deprecated - set the parameters at the top level instead
141
+ * Any parameters to control the semantics of the send to the network */
142
+ sendParams?: Omit<SendTransactionParams, 'fee' | 'maxFee' | 'skipSending' | 'atc'>;
143
+ /**
144
+ * Additional `AtomicTransactionComposer` context used when building the transaction group that is sent.
145
+ * This additional context is used and must be supplied when coverAppCallInnerTransactionFees is set to true.
146
+ **/
147
+ additionalAtcContext?: AdditionalAtomicTransactionComposerContext;
145
148
  }
146
- //#endregion
147
- export { AdditionalAtomicTransactionComposerContext, Arc2TransactionNote, AtomicTransactionComposerToSend, ConfirmedTransactionResult, ConfirmedTransactionResults, SendAtomicTransactionComposerResults, SendParams, SendSingleTransactionResult, SendTransactionFrom, SendTransactionParams, SendTransactionResult, SendTransactionResults, TransactionGroupToSend, TransactionNote, TransactionNoteData, TransactionToSign };
148
- //# sourceMappingURL=transaction.d.ts.map
@@ -1,80 +1,76 @@
1
- import { AlgoAmount } from "./amount.js";
2
- import { SendTransactionFrom, SendTransactionParams, TransactionNote } from "./transaction.js";
3
- import { TestNetDispenserApiClient } from "./dispenser-client.js";
4
- import algosdk from "algosdk";
5
-
6
- //#region src/types/transfer.d.ts
1
+ import algosdk from 'algosdk';
2
+ import { AlgoAmount } from './amount';
3
+ import { TestNetDispenserApiClient } from './dispenser-client';
4
+ import { SendTransactionFrom, SendTransactionParams, TransactionNote } from './transaction';
5
+ import SuggestedParams = algosdk.SuggestedParams;
7
6
  /** @deprecated Parameters for `transferAlgos` call. */
8
- interface AlgoTransferParams extends SendTransactionParams {
9
- /** The account that will send the Algo */
10
- from: SendTransactionFrom;
11
- /** The account / account address that will receive the Algo */
12
- to: SendTransactionFrom | string;
13
- /** The amount to send */
14
- amount: AlgoAmount;
15
- /** Optional transaction parameters */
16
- transactionParams?: SuggestedParams;
17
- /** The (optional) transaction note */
18
- note?: TransactionNote;
19
- /** An (optional) [transaction lease](https://dev.algorand.co/concepts/transactions/leases) to apply */
20
- lease?: string | Uint8Array;
7
+ export interface AlgoTransferParams extends SendTransactionParams {
8
+ /** The account that will send the Algo */
9
+ from: SendTransactionFrom;
10
+ /** The account / account address that will receive the Algo */
11
+ to: SendTransactionFrom | string;
12
+ /** The amount to send */
13
+ amount: AlgoAmount;
14
+ /** Optional transaction parameters */
15
+ transactionParams?: SuggestedParams;
16
+ /** The (optional) transaction note */
17
+ note?: TransactionNote;
18
+ /** An (optional) [transaction lease](https://dev.algorand.co/concepts/transactions/leases) to apply */
19
+ lease?: string | Uint8Array;
21
20
  }
22
21
  /** @deprecated Parameters for `rekeyAccount` call. */
23
- interface AlgoRekeyParams extends SendTransactionParams {
24
- /** The account that will be rekeyed */
25
- from: SendTransactionFrom;
26
- /** The account / account address that will have the private key that is authorised to transact on behalf of the from account from now on */
27
- rekeyTo: SendTransactionFrom | string;
28
- /** Optional transaction parameters */
29
- transactionParams?: SuggestedParams;
30
- /** The (optional) transaction note */
31
- note?: TransactionNote;
32
- /** An (optional) [transaction lease](https://dev.algorand.co/concepts/transactions/leases) to apply */
33
- lease?: string | Uint8Array;
22
+ export interface AlgoRekeyParams extends SendTransactionParams {
23
+ /** The account that will be rekeyed */
24
+ from: SendTransactionFrom;
25
+ /** The account / account address that will have the private key that is authorised to transact on behalf of the from account from now on */
26
+ rekeyTo: SendTransactionFrom | string;
27
+ /** Optional transaction parameters */
28
+ transactionParams?: SuggestedParams;
29
+ /** The (optional) transaction note */
30
+ note?: TransactionNote;
31
+ /** An (optional) [transaction lease](https://dev.algorand.co/concepts/transactions/leases) to apply */
32
+ lease?: string | Uint8Array;
34
33
  }
35
34
  /** @deprecated Parameters for `ensureFunded` call. */
36
- interface EnsureFundedParams extends SendTransactionParams {
37
- /** The account to fund */
38
- accountToFund: SendTransactionFrom | string;
39
- /** The account to use as a funding source, will default to using the dispenser account returned by `algokit.getDispenserAccount` */
40
- fundingSource?: SendTransactionFrom | TestNetDispenserApiClient;
41
- /** The minimum balance of Algo that the account should have available to spend (i.e. on top of minimum balance requirement) */
42
- minSpendingBalance: AlgoAmount;
43
- /** When issuing a funding amount, the minimum amount to transfer (avoids many small transfers if this gets called often on an active account) */
44
- minFundingIncrement?: AlgoAmount;
45
- /** Optional transaction parameters */
46
- transactionParams?: SuggestedParams;
47
- /** The (optional) transaction note, default: "Funding account to meet minimum requirement" */
48
- note?: TransactionNote;
49
- /** An (optional) [transaction lease](https://dev.algorand.co/concepts/transactions/leases) to apply */
50
- lease?: string | Uint8Array;
35
+ export interface EnsureFundedParams extends SendTransactionParams {
36
+ /** The account to fund */
37
+ accountToFund: SendTransactionFrom | string;
38
+ /** The account to use as a funding source, will default to using the dispenser account returned by `algokit.getDispenserAccount` */
39
+ fundingSource?: SendTransactionFrom | TestNetDispenserApiClient;
40
+ /** The minimum balance of Algo that the account should have available to spend (i.e. on top of minimum balance requirement) */
41
+ minSpendingBalance: AlgoAmount;
42
+ /** When issuing a funding amount, the minimum amount to transfer (avoids many small transfers if this gets called often on an active account) */
43
+ minFundingIncrement?: AlgoAmount;
44
+ /** Optional transaction parameters */
45
+ transactionParams?: SuggestedParams;
46
+ /** The (optional) transaction note, default: "Funding account to meet minimum requirement" */
47
+ note?: TransactionNote;
48
+ /** An (optional) [transaction lease](https://dev.algorand.co/concepts/transactions/leases) to apply */
49
+ lease?: string | Uint8Array;
51
50
  }
52
51
  /** @deprecated Parameters for `transferAsset` call. */
53
- interface TransferAssetParams extends SendTransactionParams {
54
- /** The account that will send the asset */
55
- from: SendTransactionFrom;
56
- /** The account / account address that will receive the asset */
57
- to: SendTransactionFrom | string;
58
- /** The asset id that will be transfered */
59
- assetId: number;
60
- /** The amount to send as the smallest divisible unit value */
61
- amount: number | bigint;
62
- /** Optional transaction parameters */
63
- transactionParams?: SuggestedParams;
64
- /** An address of a target account from which to perform a clawback operation. Please note, in such cases senderAccount must be equal to clawback field on ASA metadata. */
65
- clawbackFrom?: SendTransactionFrom | string;
66
- /** The (optional) transaction note */
67
- note?: TransactionNote;
68
- /** An (optional) [transaction lease](https://dev.algorand.co/concepts/transactions/leases) to apply */
69
- lease?: string | Uint8Array;
52
+ export interface TransferAssetParams extends SendTransactionParams {
53
+ /** The account that will send the asset */
54
+ from: SendTransactionFrom;
55
+ /** The account / account address that will receive the asset */
56
+ to: SendTransactionFrom | string;
57
+ /** The asset id that will be transfered */
58
+ assetId: number;
59
+ /** The amount to send as the smallest divisible unit value */
60
+ amount: number | bigint;
61
+ /** Optional transaction parameters */
62
+ transactionParams?: SuggestedParams;
63
+ /** An address of a target account from which to perform a clawback operation. Please note, in such cases senderAccount must be equal to clawback field on ASA metadata. */
64
+ clawbackFrom?: SendTransactionFrom | string;
65
+ /** The (optional) transaction note */
66
+ note?: TransactionNote;
67
+ /** An (optional) [transaction lease](https://dev.algorand.co/concepts/transactions/leases) to apply */
68
+ lease?: string | Uint8Array;
70
69
  }
71
70
  /** @deprecated */
72
- interface EnsureFundedReturnType {
73
- /** The transaction */
74
- transactionId: string;
75
- /** The response if the transaction was sent and waited for */
76
- amount: number;
71
+ export interface EnsureFundedReturnType {
72
+ /** The transaction */
73
+ transactionId: string;
74
+ /** The response if the transaction was sent and waited for */
75
+ amount: number;
77
76
  }
78
- //#endregion
79
- export { AlgoRekeyParams, AlgoTransferParams, EnsureFundedParams, EnsureFundedReturnType, TransferAssetParams };
80
- //# sourceMappingURL=transfer.d.ts.map
package/util.d.ts ADDED
@@ -0,0 +1,48 @@
1
+ import { ABIReturnType, ABIType, ABIValue } from 'algosdk';
2
+ /**
3
+ * Converts a value which might be a number or a bigint into a number to be used with apis that don't support bigint.
4
+ *
5
+ * Throws an UnsafeConversionError if the conversion would result in an unsafe integer for the Number type
6
+ * @param value
7
+ */
8
+ export declare const toNumber: (value: number | bigint) => number;
9
+ export declare class UnsafeConversionError extends Error {
10
+ }
11
+ /**
12
+ * Calculates the amount of funds to add to a wallet to bring it up to the minimum spending balance.
13
+ * @param minSpendingBalance The minimum spending balance for the wallet
14
+ * @param currentSpendingBalance The current spending balance for the wallet
15
+ * @param minFundingIncrement The minimum amount of funds that can be added to the wallet
16
+ * @returns The amount of funds to add to the wallet or null if the wallet is already above the minimum spending balance
17
+ */
18
+ export declare const calculateFundAmount: (minSpendingBalance: bigint, currentSpendingBalance: bigint, minFundingIncrement: bigint) => bigint | null;
19
+ /**
20
+ * Checks if the current environment is Node.js
21
+ *
22
+ * @returns A boolean indicating whether the current environment is Node.js
23
+ */
24
+ export declare const isNode: () => boolean;
25
+ /**
26
+ * Returns the given array split into chunks of `batchSize` batches.
27
+ * @param array The array to chunk
28
+ * @param batchSize The size of batches to split the array into
29
+ * @returns A generator that yields the array split into chunks of `batchSize` batches
30
+ */
31
+ export declare function chunkArray<T>(array: T[], batchSize: number): Generator<T[], void>;
32
+ /**
33
+ * Memoize calls to the given function in an in-memory map.
34
+ * @param fn The function to memoize
35
+ * @returns The memoized function
36
+ */
37
+ export declare const memoize: <T = unknown, R = unknown>(fn: (val: T) => R) => (val: T) => R;
38
+ export declare const binaryStartsWith: (base: Uint8Array, startsWith: Uint8Array) => boolean;
39
+ export declare const defaultJsonValueReplacer: (key: string, value: unknown) => unknown;
40
+ export declare const asJson: (value: unknown, replacer?: (key: string, value: unknown) => unknown, space?: string | number) => string;
41
+ /** Calculate minimum number of extra program pages required for provided approval and clear state programs */
42
+ export declare const calculateExtraProgramPages: (approvalProgram: Uint8Array, clearStateProgram?: Uint8Array) => number;
43
+ /** Take a decoded ABI value and convert all byte arrays (including nested ones) from number[] to Uint8Arrays */
44
+ export declare function convertAbiByteArrays(value: ABIValue, type: ABIReturnType): ABIValue;
45
+ /**
46
+ * Convert bigint values to numbers for uint types with bit size < 53
47
+ */
48
+ export declare const convertABIDecodedBigIntToNumber: (value: ABIValue, type: ABIType) => ABIValue;