@algorandfoundation/algokit-utils 6.2.1 → 7.0.0-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.
- package/account/account.d.ts +13 -5
- package/account/account.d.ts.map +1 -1
- package/account/account.js +26 -6
- package/account/account.js.map +1 -1
- package/account/account.mjs +26 -6
- package/account/account.mjs.map +1 -1
- package/account/get-account.d.ts +4 -4
- package/account/get-account.js +2 -2
- package/account/get-account.mjs +2 -2
- package/amount.d.ts +28 -6
- package/amount.d.ts.map +1 -1
- package/amount.js +31 -11
- package/amount.js.map +1 -1
- package/amount.mjs +30 -12
- package/amount.mjs.map +1 -1
- package/asset.d.ts +10 -0
- package/asset.d.ts.map +1 -1
- package/asset.js +71 -198
- package/asset.js.map +1 -1
- package/asset.mjs +72 -199
- package/asset.mjs.map +1 -1
- package/dispenser-client.d.ts +1 -1
- package/dispenser-client.js +2 -2
- package/dispenser-client.js.map +1 -1
- package/dispenser-client.mjs +2 -2
- package/dispenser-client.mjs.map +1 -1
- package/index.d.ts +4 -3
- package/index.d.ts.map +1 -1
- package/index.js +11 -8
- package/index.js.map +1 -1
- package/index.mjs +6 -4
- package/index.mjs.map +1 -1
- package/localnet/get-or-create-kmd-wallet-account.d.ts +1 -1
- package/localnet/get-or-create-kmd-wallet-account.js +1 -1
- package/localnet/get-or-create-kmd-wallet-account.mjs +1 -1
- package/package.json +3 -2
- package/testing/_asset.d.ts +2 -4
- package/testing/_asset.d.ts.map +1 -1
- package/testing/account.js +8 -2
- package/testing/account.js.map +1 -1
- package/testing/account.mjs +8 -2
- package/testing/account.mjs.map +1 -1
- package/testing/fixtures/algorand-fixture.d.ts +1 -1
- package/testing/fixtures/algorand-fixture.js +7 -2
- package/testing/fixtures/algorand-fixture.js.map +1 -1
- package/testing/fixtures/algorand-fixture.mjs +7 -2
- package/testing/fixtures/algorand-fixture.mjs.map +1 -1
- package/transaction/legacy-bridge.d.ts +10 -0
- package/transaction/legacy-bridge.d.ts.map +1 -0
- package/transaction/legacy-bridge.js +35 -0
- package/transaction/legacy-bridge.js.map +1 -0
- package/transaction/legacy-bridge.mjs +33 -0
- package/transaction/legacy-bridge.mjs.map +1 -0
- package/transaction/transaction.d.ts +1 -1
- package/transaction/transaction.js +5 -5
- package/transaction/transaction.js.map +1 -1
- package/transaction/transaction.mjs +5 -5
- package/transaction/transaction.mjs.map +1 -1
- package/transfer/transfer-algos.d.ts +4 -2
- package/transfer/transfer-algos.d.ts.map +1 -1
- package/transfer/transfer-algos.js +13 -22
- package/transfer/transfer-algos.js.map +1 -1
- package/transfer/transfer-algos.mjs +14 -23
- package/transfer/transfer-algos.mjs.map +1 -1
- package/transfer/transfer.d.ts +8 -1
- package/transfer/transfer.d.ts.map +1 -1
- package/transfer/transfer.js +57 -94
- package/transfer/transfer.js.map +1 -1
- package/transfer/transfer.mjs +58 -95
- package/transfer/transfer.mjs.map +1 -1
- package/types/account-manager.d.ts +141 -24
- package/types/account-manager.d.ts.map +1 -1
- package/types/account-manager.js +217 -44
- package/types/account-manager.js.map +1 -1
- package/types/account-manager.mjs +216 -43
- package/types/account-manager.mjs.map +1 -1
- package/types/account.d.ts +122 -7
- package/types/account.d.ts.map +1 -1
- package/types/account.js.map +1 -1
- package/types/account.mjs.map +1 -1
- package/types/algorand-client-transaction-creator.d.ts +289 -0
- package/types/algorand-client-transaction-creator.d.ts.map +1 -0
- package/types/algorand-client-transaction-creator.js +299 -0
- package/types/algorand-client-transaction-creator.js.map +1 -0
- package/types/algorand-client-transaction-creator.mjs +297 -0
- package/types/algorand-client-transaction-creator.mjs.map +1 -0
- package/types/algorand-client-transaction-sender.d.ts +433 -0
- package/types/algorand-client-transaction-sender.d.ts.map +1 -0
- package/types/algorand-client-transaction-sender.js +422 -0
- package/types/algorand-client-transaction-sender.js.map +1 -0
- package/types/algorand-client-transaction-sender.mjs +420 -0
- package/types/algorand-client-transaction-sender.mjs.map +1 -0
- package/types/algorand-client.d.ts +28 -78
- package/types/algorand-client.d.ts.map +1 -1
- package/types/algorand-client.js +33 -122
- package/types/algorand-client.js.map +1 -1
- package/types/algorand-client.mjs +34 -123
- package/types/algorand-client.mjs.map +1 -1
- package/types/amount.d.ts +18 -6
- package/types/amount.d.ts.map +1 -1
- package/types/amount.js +33 -10
- package/types/amount.js.map +1 -1
- package/types/amount.mjs +33 -10
- package/types/amount.mjs.map +1 -1
- package/types/app-client.d.ts +3 -3
- package/types/app-client.d.ts.map +1 -1
- package/types/app-client.js +7 -10
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +8 -11
- package/types/app-client.mjs.map +1 -1
- package/types/asset-manager.d.ts +205 -0
- package/types/asset-manager.d.ts.map +1 -0
- package/types/asset-manager.js +180 -0
- package/types/asset-manager.js.map +1 -0
- package/types/asset-manager.mjs +178 -0
- package/types/asset-manager.mjs.map +1 -0
- package/types/asset.d.ts +4 -4
- package/types/asset.d.ts.map +1 -1
- package/types/client-manager.d.ts +40 -2
- package/types/client-manager.d.ts.map +1 -1
- package/types/client-manager.js +44 -3
- package/types/client-manager.js.map +1 -1
- package/types/client-manager.mjs +44 -3
- package/types/client-manager.mjs.map +1 -1
- package/types/composer.d.ts +226 -68
- package/types/composer.d.ts.map +1 -1
- package/types/composer.js +78 -64
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +75 -64
- package/types/composer.mjs.map +1 -1
- package/types/dispenser-client.d.ts +12 -4
- package/types/dispenser-client.d.ts.map +1 -1
- package/types/dispenser-client.js +9 -9
- package/types/dispenser-client.js.map +1 -1
- package/types/dispenser-client.mjs +9 -9
- package/types/dispenser-client.mjs.map +1 -1
- package/types/indexer.d.ts +7 -7
- package/types/indexer.d.ts.map +1 -1
- package/types/kmd-account-manager.d.ts +3 -3
- package/types/kmd-account-manager.js +6 -6
- package/types/kmd-account-manager.js.map +1 -1
- package/types/kmd-account-manager.mjs +7 -7
- package/types/kmd-account-manager.mjs.map +1 -1
- package/types/network-client.d.ts +7 -1
- package/types/network-client.d.ts.map +1 -1
- package/types/network-client.js +10 -0
- package/types/network-client.js.map +1 -1
- package/types/network-client.mjs +9 -0
- package/types/network-client.mjs.map +1 -1
- package/types/testing.d.ts +1 -1
- package/types/testing.d.ts.map +1 -1
- package/types/transfer.d.ts +8 -7
- package/types/transfer.d.ts.map +1 -1
- package/util.d.ts +13 -0
- package/util.d.ts.map +1 -1
- package/util.js +25 -0
- package/util.js.map +1 -1
- package/util.mjs +24 -1
- package/util.mjs.map +1 -1
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import { Config } from '../config.mjs';
|
|
2
|
+
|
|
3
|
+
/** Orchestrates sending transactions for `AlgorandClient`. */
|
|
4
|
+
class AlgorandClientTransactionSender {
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new `AlgorandClientSender`
|
|
7
|
+
* @param newGroup A lambda that starts a new `AlgoKitComposer` transaction group
|
|
8
|
+
* @param assetManager An `AssetManager` instance
|
|
9
|
+
*/
|
|
10
|
+
constructor(newGroup, assetManager) {
|
|
11
|
+
/**
|
|
12
|
+
* Send a payment transaction to transfer Algo between accounts.
|
|
13
|
+
* @param params The parameters for the payment transaction
|
|
14
|
+
* @example Basic example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const result = await algorandClient.send.payment({
|
|
17
|
+
* sender: 'SENDERADDRESS',
|
|
18
|
+
* receiver: 'RECEIVERADDRESS',
|
|
19
|
+
* amount: (4).algo(),
|
|
20
|
+
* })
|
|
21
|
+
* ```
|
|
22
|
+
* @example Advanced example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const result = await algorandClient.send.payment({
|
|
25
|
+
* amount: (4).algo(),
|
|
26
|
+
* receiver: 'RECEIVERADDRESS',
|
|
27
|
+
* sender: 'SENDERADDRESS',
|
|
28
|
+
* closeRemainderTo: 'CLOSEREMAINDERTOADDRESS',
|
|
29
|
+
* lease: 'lease',
|
|
30
|
+
* note: 'note',
|
|
31
|
+
* // Use this with caution, it's generally better to use algorand.account.rekeyAccount
|
|
32
|
+
* rekeyTo: 'REKEYTOADDRESS',
|
|
33
|
+
* // You wouldn't normally set this field
|
|
34
|
+
* firstValidRound: 1000n,
|
|
35
|
+
* validityWindow: 10,
|
|
36
|
+
* extraFee: (1000).microAlgo(),
|
|
37
|
+
* staticFee: (1000).microAlgo(),
|
|
38
|
+
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
39
|
+
* // already specified, but here for completeness
|
|
40
|
+
* maxFee: (3000).microAlgo(),
|
|
41
|
+
* // Signer only needed if you want to provide one,
|
|
42
|
+
* // generally you'd register it with AlgorandClient
|
|
43
|
+
* // against the sender and not need to pass it in
|
|
44
|
+
* signer: transactionSigner,
|
|
45
|
+
* maxRoundsToWaitForConfirmation: 5,
|
|
46
|
+
* suppressLog: true,
|
|
47
|
+
* })
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @returns The result of the transaction and the transaction that was sent
|
|
51
|
+
*/
|
|
52
|
+
this.payment = this._send((c) => c.addPayment, {
|
|
53
|
+
preLog: (params, transaction) => `Sending ${params.amount.microAlgo} µALGO from ${params.sender} to ${params.receiver} via transaction ${transaction.txID()}`,
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* Create a new Algorand Standard Asset.
|
|
57
|
+
*
|
|
58
|
+
* The account that sends this transaction will automatically be
|
|
59
|
+
* opted in to the asset and will hold all units after creation.
|
|
60
|
+
*
|
|
61
|
+
* @param params The parameters for the asset creation transaction
|
|
62
|
+
*
|
|
63
|
+
* @example Basic example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* await algorand.send.assetCreate({sender: "CREATORADDRESS", total: 100n})
|
|
66
|
+
* ```
|
|
67
|
+
* @example Advanced example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* await algorand.send.assetCreate({
|
|
70
|
+
* sender: 'CREATORADDRESS',
|
|
71
|
+
* total: 100n,
|
|
72
|
+
* decimals: 2,
|
|
73
|
+
* assetName: 'asset',
|
|
74
|
+
* unitName: 'unit',
|
|
75
|
+
* url: 'url',
|
|
76
|
+
* metadataHash: 'metadataHash',
|
|
77
|
+
* defaultFrozen: false,
|
|
78
|
+
* manager: 'MANAGERADDRESS',
|
|
79
|
+
* reserve: 'RESERVEADDRESS',
|
|
80
|
+
* freeze: 'FREEZEADDRESS',
|
|
81
|
+
* clawback: 'CLAWBACKADDRESS',
|
|
82
|
+
* lease: 'lease',
|
|
83
|
+
* note: 'note',
|
|
84
|
+
* // You wouldn't normally set this field
|
|
85
|
+
* firstValidRound: 1000n,
|
|
86
|
+
* validityWindow: 10,
|
|
87
|
+
* extraFee: (1000).microAlgo(),
|
|
88
|
+
* staticFee: (1000).microAlgo(),
|
|
89
|
+
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
90
|
+
* // already specified, but here for completeness
|
|
91
|
+
* maxFee: (3000).microAlgo(),
|
|
92
|
+
* // Signer only needed if you want to provide one,
|
|
93
|
+
* // generally you'd register it with AlgorandClient
|
|
94
|
+
* // against the sender and not need to pass it in
|
|
95
|
+
* signer: transactionSigner,
|
|
96
|
+
* maxRoundsToWaitForConfirmation: 5,
|
|
97
|
+
* suppressLog: true,
|
|
98
|
+
* })
|
|
99
|
+
* ```
|
|
100
|
+
* @returns The result of the transaction and the transaction that was sent
|
|
101
|
+
*/
|
|
102
|
+
this.assetCreate = async (params) => {
|
|
103
|
+
const result = await this._send((c) => c.addAssetCreate, {
|
|
104
|
+
postLog: (params, result) => `Created asset${params.assetName ? ` ${params.assetName}` : ''}${params.unitName ? ` (${params.unitName})` : ''} with ${params.total} units and ${params.decimals ?? 0} decimals created by ${params.sender} with ID ${result.confirmation.assetIndex} via transaction ${result.txIds.at(-1)}`,
|
|
105
|
+
})(params);
|
|
106
|
+
return { ...result, assetId: BigInt(result.confirmation.assetIndex ?? 0) };
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Configure an existing Algorand Standard Asset.
|
|
110
|
+
*
|
|
111
|
+
* **Note:** The manager, reserve, freeze, and clawback addresses
|
|
112
|
+
* are immutably empty if they are not set. If manager is not set then
|
|
113
|
+
* all fields are immutable from that point forward.
|
|
114
|
+
*
|
|
115
|
+
* @param params The parameters for the asset config transaction
|
|
116
|
+
*
|
|
117
|
+
* @example Basic example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* await algorand.send.assetConfig({sender: "MANAGERADDRESS", assetId: 123456n, manager: "MANAGERADDRESS" })
|
|
120
|
+
* ```
|
|
121
|
+
* @example Advanced example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* await algorand.send.assetConfig({
|
|
124
|
+
* sender: 'MANAGERADDRESS',
|
|
125
|
+
* assetId: 123456n,
|
|
126
|
+
* manager: 'MANAGERADDRESS',
|
|
127
|
+
* reserve: 'RESERVEADDRESS',
|
|
128
|
+
* freeze: 'FREEZEADDRESS',
|
|
129
|
+
* clawback: 'CLAWBACKADDRESS',
|
|
130
|
+
* lease: 'lease',
|
|
131
|
+
* note: 'note',
|
|
132
|
+
* // You wouldn't normally set this field
|
|
133
|
+
* firstValidRound: 1000n,
|
|
134
|
+
* validityWindow: 10,
|
|
135
|
+
* extraFee: (1000).microAlgo(),
|
|
136
|
+
* staticFee: (1000).microAlgo(),
|
|
137
|
+
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
138
|
+
* // already specified, but here for completeness
|
|
139
|
+
* maxFee: (3000).microAlgo(),
|
|
140
|
+
* // Signer only needed if you want to provide one,
|
|
141
|
+
* // generally you'd register it with AlgorandClient
|
|
142
|
+
* // against the sender and not need to pass it in
|
|
143
|
+
* signer: transactionSigner,
|
|
144
|
+
* maxRoundsToWaitForConfirmation: 5,
|
|
145
|
+
* suppressLog: true,
|
|
146
|
+
* })
|
|
147
|
+
* ```
|
|
148
|
+
* @returns The result of the transaction and the transaction that was sent
|
|
149
|
+
*/
|
|
150
|
+
this.assetConfig = this._send((c) => c.addAssetConfig, {
|
|
151
|
+
preLog: (params, transaction) => `Configuring asset with ID ${params.assetId} via transaction ${transaction.txID()}`,
|
|
152
|
+
});
|
|
153
|
+
/**
|
|
154
|
+
* Freeze or unfreeze an Algorand Standard Asset for an account.
|
|
155
|
+
*
|
|
156
|
+
* @param params The parameters for the asset freeze transaction
|
|
157
|
+
*
|
|
158
|
+
* @example Basic example
|
|
159
|
+
* ```typescript
|
|
160
|
+
* await algorand.send.assetFreeze({sender: "MANAGERADDRESS", assetId: 123456n, account: "ACCOUNTADDRESS", frozen: true })
|
|
161
|
+
* ```
|
|
162
|
+
* @example Advanced example
|
|
163
|
+
* ```typescript
|
|
164
|
+
* await algorand.send.assetFreeze({
|
|
165
|
+
* sender: 'MANAGERADDRESS',
|
|
166
|
+
* assetId: 123456n,
|
|
167
|
+
* account: 'ACCOUNTADDRESS',
|
|
168
|
+
* frozen: true,
|
|
169
|
+
* lease: 'lease',
|
|
170
|
+
* note: 'note',
|
|
171
|
+
* // You wouldn't normally set this field
|
|
172
|
+
* firstValidRound: 1000n,
|
|
173
|
+
* validityWindow: 10,
|
|
174
|
+
* extraFee: (1000).microAlgo(),
|
|
175
|
+
* staticFee: (1000).microAlgo(),
|
|
176
|
+
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
177
|
+
* // already specified, but here for completeness
|
|
178
|
+
* maxFee: (3000).microAlgo(),
|
|
179
|
+
* // Signer only needed if you want to provide one,
|
|
180
|
+
* // generally you'd register it with AlgorandClient
|
|
181
|
+
* // against the sender and not need to pass it in
|
|
182
|
+
* signer: transactionSigner,
|
|
183
|
+
* maxRoundsToWaitForConfirmation: 5,
|
|
184
|
+
* suppressLog: true,
|
|
185
|
+
* })
|
|
186
|
+
* ```
|
|
187
|
+
* @returns The result of the transaction and the transaction that was sent
|
|
188
|
+
*/
|
|
189
|
+
this.assetFreeze = this._send((c) => c.addAssetFreeze, {
|
|
190
|
+
preLog: (params, transaction) => `Freezing asset with ID ${params.assetId} via transaction ${transaction.txID()}`,
|
|
191
|
+
});
|
|
192
|
+
/**
|
|
193
|
+
* Destroys an Algorand Standard Asset.
|
|
194
|
+
*
|
|
195
|
+
* Created assets can be destroyed only by the asset manager account.
|
|
196
|
+
* All of the assets must be owned by the creator of the asset before
|
|
197
|
+
* the asset can be deleted.
|
|
198
|
+
*
|
|
199
|
+
* @param params The parameters for the asset destroy transaction
|
|
200
|
+
*
|
|
201
|
+
* @example Basic example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* await algorand.send.assetDestroy({sender: "MANAGERADDRESS", assetId: 123456n })
|
|
204
|
+
* ```
|
|
205
|
+
* @example Advanced example
|
|
206
|
+
* ```typescript
|
|
207
|
+
* await algorand.send.assetDestroy({
|
|
208
|
+
* sender: 'MANAGERADDRESS',
|
|
209
|
+
* assetId: 123456n,
|
|
210
|
+
* lease: 'lease',
|
|
211
|
+
* note: 'note',
|
|
212
|
+
* // You wouldn't normally set this field
|
|
213
|
+
* firstValidRound: 1000n,
|
|
214
|
+
* validityWindow: 10,
|
|
215
|
+
* extraFee: (1000).microAlgo(),
|
|
216
|
+
* staticFee: (1000).microAlgo(),
|
|
217
|
+
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
218
|
+
* // already specified, but here for completeness
|
|
219
|
+
* maxFee: (3000).microAlgo(),
|
|
220
|
+
* // Signer only needed if you want to provide one,
|
|
221
|
+
* // generally you'd register it with AlgorandClient
|
|
222
|
+
* // against the sender and not need to pass it in
|
|
223
|
+
* signer: transactionSigner,
|
|
224
|
+
* maxRoundsToWaitForConfirmation: 5,
|
|
225
|
+
* suppressLog: true,
|
|
226
|
+
* })
|
|
227
|
+
* ```
|
|
228
|
+
* @returns The result of the transaction and the transaction that was sent
|
|
229
|
+
*/
|
|
230
|
+
this.assetDestroy = this._send((c) => c.addAssetDestroy, {
|
|
231
|
+
preLog: (params, transaction) => `Destroying asset with ID ${params.assetId} via transaction ${transaction.txID()}`,
|
|
232
|
+
});
|
|
233
|
+
/**
|
|
234
|
+
* Transfer an Algorand Standard Asset.
|
|
235
|
+
*
|
|
236
|
+
* @param params The parameters for the asset transfer transaction
|
|
237
|
+
*
|
|
238
|
+
* @example Basic example
|
|
239
|
+
* ```typescript
|
|
240
|
+
* await algorand.send.assetTransfer({sender: "HOLDERADDRESS", assetId: 123456n, amount: 1n, receiver: "RECEIVERADDRESS" })
|
|
241
|
+
* ```
|
|
242
|
+
* @example Advanced example (with clawback)
|
|
243
|
+
* ```typescript
|
|
244
|
+
* await algorand.send.assetTransfer({
|
|
245
|
+
* sender: 'CLAWBACKADDRESS',
|
|
246
|
+
* assetId: 123456n,
|
|
247
|
+
* amount: 1n,
|
|
248
|
+
* receiver: 'RECEIVERADDRESS',
|
|
249
|
+
* clawbackTarget: 'HOLDERADDRESS',
|
|
250
|
+
* // This field needs to be used with caution
|
|
251
|
+
* closeAssetTo: 'ADDRESSTOCLOSETO'
|
|
252
|
+
* lease: 'lease',
|
|
253
|
+
* note: 'note',
|
|
254
|
+
* // You wouldn't normally set this field
|
|
255
|
+
* firstValidRound: 1000n,
|
|
256
|
+
* validityWindow: 10,
|
|
257
|
+
* extraFee: (1000).microAlgo(),
|
|
258
|
+
* staticFee: (1000).microAlgo(),
|
|
259
|
+
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
260
|
+
* // already specified, but here for completeness
|
|
261
|
+
* maxFee: (3000).microAlgo(),
|
|
262
|
+
* // Signer only needed if you want to provide one,
|
|
263
|
+
* // generally you'd register it with AlgorandClient
|
|
264
|
+
* // against the sender and not need to pass it in
|
|
265
|
+
* signer: transactionSigner,
|
|
266
|
+
* maxRoundsToWaitForConfirmation: 5,
|
|
267
|
+
* suppressLog: true,
|
|
268
|
+
* })
|
|
269
|
+
* ```
|
|
270
|
+
* @returns The result of the transaction and the transaction that was sent
|
|
271
|
+
*/
|
|
272
|
+
this.assetTransfer = this._send((c) => c.addAssetTransfer, {
|
|
273
|
+
preLog: (params, transaction) => `Transferring ${params.amount} units of asset with ID ${params.assetId} from ${params.sender} to ${params.receiver} via transaction ${transaction.txID()}`,
|
|
274
|
+
});
|
|
275
|
+
/**
|
|
276
|
+
* Opt an account into an Algorand Standard Asset.
|
|
277
|
+
*
|
|
278
|
+
* @param params The parameters for the asset opt-in transaction
|
|
279
|
+
*
|
|
280
|
+
* @example Basic example
|
|
281
|
+
* ```typescript
|
|
282
|
+
* await algorand.send.assetOptIn({sender: "SENDERADDRESS", assetId: 123456n })
|
|
283
|
+
* ```
|
|
284
|
+
* @example Advanced example
|
|
285
|
+
* ```typescript
|
|
286
|
+
* await algorand.send.assetOptIn({
|
|
287
|
+
* sender: 'SENDERADDRESS',
|
|
288
|
+
* assetId: 123456n,
|
|
289
|
+
* lease: 'lease',
|
|
290
|
+
* note: 'note',
|
|
291
|
+
* // You wouldn't normally set this field
|
|
292
|
+
* firstValidRound: 1000n,
|
|
293
|
+
* validityWindow: 10,
|
|
294
|
+
* extraFee: (1000).microAlgo(),
|
|
295
|
+
* staticFee: (1000).microAlgo(),
|
|
296
|
+
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
297
|
+
* // already specified, but here for completeness
|
|
298
|
+
* maxFee: (3000).microAlgo(),
|
|
299
|
+
* // Signer only needed if you want to provide one,
|
|
300
|
+
* // generally you'd register it with AlgorandClient
|
|
301
|
+
* // against the sender and not need to pass it in
|
|
302
|
+
* signer: transactionSigner,
|
|
303
|
+
* maxRoundsToWaitForConfirmation: 5,
|
|
304
|
+
* suppressLog: true,
|
|
305
|
+
* })
|
|
306
|
+
* ```
|
|
307
|
+
* @returns The result of the transaction and the transaction that was sent
|
|
308
|
+
*/
|
|
309
|
+
this.assetOptIn = this._send((c) => c.addAssetOptIn, {
|
|
310
|
+
preLog: (params, transaction) => `Opting in ${params.sender} to asset with ID ${params.assetId} via transaction ${transaction.txID()}`,
|
|
311
|
+
});
|
|
312
|
+
/**
|
|
313
|
+
* Opt an account out of an Algorand Standard Asset.
|
|
314
|
+
*
|
|
315
|
+
* *Note:* If the account has a balance of the asset,
|
|
316
|
+
* it will not be able to opt-out unless `ensureZeroBalance`
|
|
317
|
+
* is set to `false` (but then the account will lose the assets).
|
|
318
|
+
*
|
|
319
|
+
* @param params The parameters for the asset opt-out transaction
|
|
320
|
+
*
|
|
321
|
+
* @example Basic example (without creator)
|
|
322
|
+
* ```typescript
|
|
323
|
+
* await algorand.send.assetOptOut({sender: "SENDERADDRESS", assetId: 123456n, ensureZeroBalance: true })
|
|
324
|
+
* ```
|
|
325
|
+
* @example Basic example (with creator)
|
|
326
|
+
* ```typescript
|
|
327
|
+
* await algorand.send.assetOptOut({sender: "SENDERADDRESS", creator: "CREATORADDRESS", assetId: 123456n, ensureZeroBalance: true })
|
|
328
|
+
* ```
|
|
329
|
+
* @example Advanced example
|
|
330
|
+
* ```typescript
|
|
331
|
+
* await algorand.send.assetOptOut({
|
|
332
|
+
* sender: 'SENDERADDRESS',
|
|
333
|
+
* assetId: 123456n,
|
|
334
|
+
* creator: 'CREATORADDRESS',
|
|
335
|
+
* ensureZeroBalance: true,
|
|
336
|
+
* lease: 'lease',
|
|
337
|
+
* note: 'note',
|
|
338
|
+
* // You wouldn't normally set this field
|
|
339
|
+
* firstValidRound: 1000n,
|
|
340
|
+
* validityWindow: 10,
|
|
341
|
+
* extraFee: (1000).microAlgo(),
|
|
342
|
+
* staticFee: (1000).microAlgo(),
|
|
343
|
+
* // Max fee doesn't make sense with extraFee AND staticFee
|
|
344
|
+
* // already specified, but here for completeness
|
|
345
|
+
* maxFee: (3000).microAlgo(),
|
|
346
|
+
* // Signer only needed if you want to provide one,
|
|
347
|
+
* // generally you'd register it with AlgorandClient
|
|
348
|
+
* // against the sender and not need to pass it in
|
|
349
|
+
* signer: transactionSigner,
|
|
350
|
+
* maxRoundsToWaitForConfirmation: 5,
|
|
351
|
+
* suppressLog: true,
|
|
352
|
+
* })
|
|
353
|
+
* ```
|
|
354
|
+
* @returns The result of the transaction and the transaction that was sent
|
|
355
|
+
*/
|
|
356
|
+
this.assetOptOut = async (params) => {
|
|
357
|
+
if (params.ensureZeroBalance) {
|
|
358
|
+
let balance = 0n;
|
|
359
|
+
try {
|
|
360
|
+
const accountAssetInfo = await this._assetManager.getAccountInformation(params.sender, params.assetId);
|
|
361
|
+
balance = accountAssetInfo.balance;
|
|
362
|
+
}
|
|
363
|
+
catch (e) {
|
|
364
|
+
throw new Error(`Account ${params.sender} is not opted-in to Asset ${params.assetId}; can't opt-out.`);
|
|
365
|
+
}
|
|
366
|
+
if (balance !== 0n) {
|
|
367
|
+
throw new Error(`Account ${params.sender} does not have a zero balance for Asset ${params.assetId}; can't opt-out.`);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
params.creator = params.creator ?? (await this._assetManager.getById(params.assetId)).creator;
|
|
371
|
+
return await this._send((c) => c.addAssetOptOut, {
|
|
372
|
+
preLog: (params, transaction) => `Opting ${params.sender} out of asset with ID ${params.assetId} to creator ${params.creator} via transaction ${transaction.txID()}`,
|
|
373
|
+
})(params);
|
|
374
|
+
};
|
|
375
|
+
/**
|
|
376
|
+
* Call a smart contract.
|
|
377
|
+
*
|
|
378
|
+
* Note: you may prefer to use `algorandClient.client` to get an app client for more advanced functionality.
|
|
379
|
+
*/
|
|
380
|
+
this.appCall = this._send((c) => c.addAppCall);
|
|
381
|
+
/**
|
|
382
|
+
* Call a smart contract ABI method.
|
|
383
|
+
*
|
|
384
|
+
* Note: you may prefer to use `algorandClient.client` to get an app client for more advanced functionality.
|
|
385
|
+
*/
|
|
386
|
+
this.methodCall = this._send((c) => c.addMethodCall);
|
|
387
|
+
/** Register an online key. */
|
|
388
|
+
this.onlineKeyRegistration = this._send((c) => c.addOnlineKeyRegistration, {
|
|
389
|
+
preLog: (params, transaction) => `Registering online key for ${params.sender} via transaction ${transaction.txID()}`,
|
|
390
|
+
});
|
|
391
|
+
this._newGroup = newGroup;
|
|
392
|
+
this._assetManager = assetManager;
|
|
393
|
+
}
|
|
394
|
+
_send(c, log) {
|
|
395
|
+
return async (params) => {
|
|
396
|
+
const composer = this._newGroup();
|
|
397
|
+
// Ensure `this` is properly populated
|
|
398
|
+
c(composer).apply(composer, [params]);
|
|
399
|
+
if (log?.preLog) {
|
|
400
|
+
const transaction = (await composer.build()).transactions.at(-1).txn;
|
|
401
|
+
Config.getLogger(params?.suppressLog).debug(log.preLog(params, transaction));
|
|
402
|
+
}
|
|
403
|
+
const rawResult = await composer.execute(params);
|
|
404
|
+
const result = {
|
|
405
|
+
// Last item covers when a group is created by an app call with ABI transaction parameters
|
|
406
|
+
transaction: rawResult.transactions[rawResult.transactions.length - 1],
|
|
407
|
+
confirmation: rawResult.confirmations[rawResult.confirmations.length - 1],
|
|
408
|
+
txId: rawResult.txIds[0],
|
|
409
|
+
...rawResult,
|
|
410
|
+
};
|
|
411
|
+
if (log?.postLog) {
|
|
412
|
+
Config.getLogger(params?.suppressLog).debug(log.postLog(params, result));
|
|
413
|
+
}
|
|
414
|
+
return result;
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export { AlgorandClientTransactionSender };
|
|
420
|
+
//# sourceMappingURL=algorand-client-transaction-sender.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"algorand-client-transaction-sender.mjs","sources":["../../src/types/algorand-client-transaction-sender.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAWA;MACa,+BAA+B,CAAA;AAI1C;;;;AAIG;IACH,WAAY,CAAA,QAA+B,EAAE,YAA0B,EAAA;AAwCvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCG;AACH,QAAA,IAAA,CAAA,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE;YACxC,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,KAC1B,CAAA,QAAA,EAAW,MAAM,CAAC,MAAM,CAAC,SAAS,CAAA,YAAA,EAAe,MAAM,CAAC,MAAM,CAAA,IAAA,EAAO,MAAM,CAAC,QAAQ,CAAA,iBAAA,EAAoB,WAAW,CAAC,IAAI,EAAE,CAAE,CAAA;AAC/H,SAAA,CAAC,CAAA;AACF;;;;;;;;;;;;;;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AAE,EAAE,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC,GAAG,CAAA;AACrE,gBAAA,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAA;aAC7E;YAED,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;AAChD,YAAA,MAAM,MAAM,GAAG;;AAEb,gBAAA,WAAW,EAAE,SAAS,CAAC,YAAY,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;AACtE,gBAAA,YAAY,EAAE,SAAS,CAAC,aAAc,CAAC,SAAS,CAAC,aAAc,CAAC,MAAM,GAAG,CAAC,CAAC;AAC3E,gBAAA,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AACxB,gBAAA,GAAG,SAAS;aACb,CAAA;AAED,YAAA,IAAI,GAAG,EAAE,OAAO,EAAE;AAChB,gBAAA,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;aACzE;AAED,YAAA,OAAO,MAAM,CAAA;AACf,SAAC,CAAA;KACF;AA+YF;;;;"}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import algosdk from 'algosdk';
|
|
2
|
-
import { TransactionSignerAccount } from './account';
|
|
2
|
+
import { MultisigAccount, SigningAccount, TransactionSignerAccount } from './account';
|
|
3
3
|
import { AccountManager } from './account-manager';
|
|
4
|
+
import { AlgorandClientTransactionCreator } from './algorand-client-transaction-creator';
|
|
5
|
+
import { AlgorandClientTransactionSender } from './algorand-client-transaction-sender';
|
|
6
|
+
import { AssetManager } from './asset-manager';
|
|
4
7
|
import { AlgoSdkClients, ClientManager } from './client-manager';
|
|
5
|
-
import
|
|
8
|
+
import AlgoKitComposer from './composer';
|
|
6
9
|
import { AlgoConfig } from './network-client';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
/** Result from sending a single transaction. */
|
|
10
|
-
export type SendSingleTransactionResult = SendAtomicTransactionComposerResults & ConfirmedTransactionResult;
|
|
10
|
+
import Account = algosdk.Account;
|
|
11
|
+
import LogicSigAccount = algosdk.LogicSigAccount;
|
|
11
12
|
/**
|
|
12
13
|
* A client that brokers easy access to Algorand functionality.
|
|
13
14
|
*/
|
|
14
15
|
export declare class AlgorandClient {
|
|
15
16
|
private _clientManager;
|
|
16
17
|
private _accountManager;
|
|
18
|
+
private _assetManager;
|
|
19
|
+
private _transactionSender;
|
|
20
|
+
private _transactionCreator;
|
|
17
21
|
private _cachedSuggestedParams?;
|
|
18
22
|
private _cachedSuggestedParamsExpiry?;
|
|
19
23
|
private _cachedSuggestedParamsTimeout;
|
|
@@ -33,10 +37,20 @@ export declare class AlgorandClient {
|
|
|
33
37
|
setDefaultSigner(signer: algosdk.TransactionSigner | TransactionSignerAccount): AlgorandClient;
|
|
34
38
|
/**
|
|
35
39
|
* Tracks the given account for later signing.
|
|
36
|
-
* @param account The account to register
|
|
40
|
+
* @param account The account to register, which can be a `TransactionSignerAccount` or
|
|
41
|
+
* a `algosdk.Account`, `algosdk.LogicSigAccount`, `SigningAccount` or `MultisigAccount`
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const accountManager = AlgorandClient.mainnet()
|
|
45
|
+
* .setSignerFromAccount(algosdk.generateAccount())
|
|
46
|
+
* .setSignerFromAccount(new algosdk.LogicSigAccount(program, args))
|
|
47
|
+
* .setSignerFromAccount(new SigningAccount(mnemonic, sender))
|
|
48
|
+
* .setSignerFromAccount(new MultisigAccount({version: 1, threshold: 1, addrs: ["ADDRESS1...", "ADDRESS2..."]}, [account1, account2]))
|
|
49
|
+
* .setSignerFromAccount({addr: "SENDERADDRESS", signer: transactionSigner})
|
|
50
|
+
* ```
|
|
37
51
|
* @returns The `AlgorandClient` so method calls can be chained
|
|
38
52
|
*/
|
|
39
|
-
setSignerFromAccount(account: TransactionSignerAccount |
|
|
53
|
+
setSignerFromAccount(account: TransactionSignerAccount | TransactionSignerAccount | Account | LogicSigAccount | SigningAccount | MultisigAccount): this;
|
|
40
54
|
/**
|
|
41
55
|
* Tracks the given account for later signing.
|
|
42
56
|
* @param sender The sender address to use this signer for
|
|
@@ -63,82 +77,18 @@ export declare class AlgorandClient {
|
|
|
63
77
|
get client(): ClientManager;
|
|
64
78
|
/** Get or create accounts that can sign transactions. */
|
|
65
79
|
get account(): AccountManager;
|
|
66
|
-
/**
|
|
67
|
-
|
|
68
|
-
|
|
80
|
+
/** Methods for interacting with assets. */
|
|
81
|
+
get asset(): AssetManager;
|
|
82
|
+
/** Start a new `AlgoKitComposer` transaction group */
|
|
83
|
+
newGroup(): AlgoKitComposer;
|
|
69
84
|
/**
|
|
70
85
|
* Methods for sending a single transaction.
|
|
71
86
|
*/
|
|
72
|
-
send:
|
|
73
|
-
/**
|
|
74
|
-
* Send a payment transaction.
|
|
75
|
-
*/
|
|
76
|
-
payment: (params: import("./composer").PaymentParams, config?: ExecuteParams) => Promise<SendSingleTransactionResult>;
|
|
77
|
-
/**
|
|
78
|
-
* Create an asset.
|
|
79
|
-
*/
|
|
80
|
-
assetCreate: (params: import("./composer").AssetCreateParams, config?: ExecuteParams) => Promise<SendSingleTransactionResult>;
|
|
81
|
-
/**
|
|
82
|
-
* Configure an existing asset.
|
|
83
|
-
*/
|
|
84
|
-
assetConfig: (params: import("./composer").AssetConfigParams, config?: ExecuteParams) => Promise<SendSingleTransactionResult>;
|
|
85
|
-
/**
|
|
86
|
-
* Freeze or unfreeze an asset.
|
|
87
|
-
*/
|
|
88
|
-
assetFreeze: (params: import("./composer").AssetFreezeParams, config?: ExecuteParams) => Promise<SendSingleTransactionResult>;
|
|
89
|
-
/**
|
|
90
|
-
* Destroy an asset.
|
|
91
|
-
*/
|
|
92
|
-
assetDestroy: (params: import("./composer").AssetDestroyParams, config?: ExecuteParams) => Promise<SendSingleTransactionResult>;
|
|
93
|
-
/**
|
|
94
|
-
* Transfer an asset.
|
|
95
|
-
*/
|
|
96
|
-
assetTransfer: (params: import("./composer").AssetTransferParams, config?: ExecuteParams) => Promise<SendSingleTransactionResult>;
|
|
97
|
-
/**
|
|
98
|
-
* Opt an account into an asset.
|
|
99
|
-
*/
|
|
100
|
-
assetOptIn: (params: import("./composer").AssetOptInParams, config?: ExecuteParams) => Promise<SendSingleTransactionResult>;
|
|
101
|
-
/**
|
|
102
|
-
* Call a smart contract.
|
|
103
|
-
*
|
|
104
|
-
* Note: you may prefer to use `algorandClient.client` to get an app client for more advanced functionality.
|
|
105
|
-
*/
|
|
106
|
-
appCall: (params: import("./composer").AppCallParams, config?: ExecuteParams) => Promise<SendSingleTransactionResult>;
|
|
107
|
-
/**
|
|
108
|
-
* Call a smart contract ABI method.
|
|
109
|
-
*
|
|
110
|
-
* Note: you may prefer to use `algorandClient.client` to get an app client for more advanced functionality.
|
|
111
|
-
*/
|
|
112
|
-
methodCall: (params: MethodCallParams, config?: ExecuteParams) => Promise<SendSingleTransactionResult>;
|
|
113
|
-
/** Register an online key. */
|
|
114
|
-
onlineKeyRegistration: (params: import("./composer").OnlineKeyRegistrationParams, config?: ExecuteParams) => Promise<SendSingleTransactionResult>;
|
|
115
|
-
};
|
|
116
|
-
private _transaction;
|
|
87
|
+
get send(): AlgorandClientTransactionSender;
|
|
117
88
|
/**
|
|
118
89
|
* Methods for building transactions
|
|
119
90
|
*/
|
|
120
|
-
transactions:
|
|
121
|
-
/** Create a payment transaction. */
|
|
122
|
-
payment: (params: import("./composer").PaymentParams) => Promise<Transaction>;
|
|
123
|
-
/** Create an asset creation transaction. */
|
|
124
|
-
assetCreate: (params: import("./composer").AssetCreateParams) => Promise<Transaction>;
|
|
125
|
-
/** Create an asset config transaction. */
|
|
126
|
-
assetConfig: (params: import("./composer").AssetConfigParams) => Promise<Transaction>;
|
|
127
|
-
/** Create an asset freeze transaction. */
|
|
128
|
-
assetFreeze: (params: import("./composer").AssetFreezeParams) => Promise<Transaction>;
|
|
129
|
-
/** Create an asset destroy transaction. */
|
|
130
|
-
assetDestroy: (params: import("./composer").AssetDestroyParams) => Promise<Transaction>;
|
|
131
|
-
/** Create an asset transfer transaction. */
|
|
132
|
-
assetTransfer: (params: import("./composer").AssetTransferParams) => Promise<Transaction>;
|
|
133
|
-
/** Create an asset opt-in transaction. */
|
|
134
|
-
assetOptIn: (params: import("./composer").AssetOptInParams) => Promise<Transaction>;
|
|
135
|
-
/** Create an application call transaction. */
|
|
136
|
-
appCall: (params: import("./composer").AppCallParams) => Promise<Transaction>;
|
|
137
|
-
/** Create an application call with ABI method call transaction. */
|
|
138
|
-
methodCall: (params: MethodCallParams) => Promise<algosdk.Transaction[]>;
|
|
139
|
-
/** Create an online key registration transaction. */
|
|
140
|
-
onlineKeyRegistration: (params: import("./composer").OnlineKeyRegistrationParams) => Promise<Transaction>;
|
|
141
|
-
};
|
|
91
|
+
get transactions(): AlgorandClientTransactionCreator;
|
|
142
92
|
/**
|
|
143
93
|
* Returns an `AlgorandClient` pointing at default LocalNet ports and API token.
|
|
144
94
|
* @returns The `AlgorandClient`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algorand-client.d.ts","sourceRoot":"","sources":["../../src/types/algorand-client.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"algorand-client.d.ts","sourceRoot":"","sources":["../../src/types/algorand-client.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAA;AACxF,OAAO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