@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.
Files changed (159) hide show
  1. package/account/account.d.ts +13 -5
  2. package/account/account.d.ts.map +1 -1
  3. package/account/account.js +26 -6
  4. package/account/account.js.map +1 -1
  5. package/account/account.mjs +26 -6
  6. package/account/account.mjs.map +1 -1
  7. package/account/get-account.d.ts +4 -4
  8. package/account/get-account.js +2 -2
  9. package/account/get-account.mjs +2 -2
  10. package/amount.d.ts +28 -6
  11. package/amount.d.ts.map +1 -1
  12. package/amount.js +31 -11
  13. package/amount.js.map +1 -1
  14. package/amount.mjs +30 -12
  15. package/amount.mjs.map +1 -1
  16. package/asset.d.ts +10 -0
  17. package/asset.d.ts.map +1 -1
  18. package/asset.js +71 -198
  19. package/asset.js.map +1 -1
  20. package/asset.mjs +72 -199
  21. package/asset.mjs.map +1 -1
  22. package/dispenser-client.d.ts +1 -1
  23. package/dispenser-client.js +2 -2
  24. package/dispenser-client.js.map +1 -1
  25. package/dispenser-client.mjs +2 -2
  26. package/dispenser-client.mjs.map +1 -1
  27. package/index.d.ts +4 -3
  28. package/index.d.ts.map +1 -1
  29. package/index.js +11 -8
  30. package/index.js.map +1 -1
  31. package/index.mjs +6 -4
  32. package/index.mjs.map +1 -1
  33. package/localnet/get-or-create-kmd-wallet-account.d.ts +1 -1
  34. package/localnet/get-or-create-kmd-wallet-account.js +1 -1
  35. package/localnet/get-or-create-kmd-wallet-account.mjs +1 -1
  36. package/package.json +3 -2
  37. package/testing/_asset.d.ts +2 -4
  38. package/testing/_asset.d.ts.map +1 -1
  39. package/testing/account.js +8 -2
  40. package/testing/account.js.map +1 -1
  41. package/testing/account.mjs +8 -2
  42. package/testing/account.mjs.map +1 -1
  43. package/testing/fixtures/algorand-fixture.d.ts +1 -1
  44. package/testing/fixtures/algorand-fixture.js +7 -2
  45. package/testing/fixtures/algorand-fixture.js.map +1 -1
  46. package/testing/fixtures/algorand-fixture.mjs +7 -2
  47. package/testing/fixtures/algorand-fixture.mjs.map +1 -1
  48. package/transaction/legacy-bridge.d.ts +10 -0
  49. package/transaction/legacy-bridge.d.ts.map +1 -0
  50. package/transaction/legacy-bridge.js +35 -0
  51. package/transaction/legacy-bridge.js.map +1 -0
  52. package/transaction/legacy-bridge.mjs +33 -0
  53. package/transaction/legacy-bridge.mjs.map +1 -0
  54. package/transaction/transaction.d.ts +1 -1
  55. package/transaction/transaction.js +5 -5
  56. package/transaction/transaction.js.map +1 -1
  57. package/transaction/transaction.mjs +5 -5
  58. package/transaction/transaction.mjs.map +1 -1
  59. package/transfer/transfer-algos.d.ts +4 -2
  60. package/transfer/transfer-algos.d.ts.map +1 -1
  61. package/transfer/transfer-algos.js +13 -22
  62. package/transfer/transfer-algos.js.map +1 -1
  63. package/transfer/transfer-algos.mjs +14 -23
  64. package/transfer/transfer-algos.mjs.map +1 -1
  65. package/transfer/transfer.d.ts +8 -1
  66. package/transfer/transfer.d.ts.map +1 -1
  67. package/transfer/transfer.js +57 -94
  68. package/transfer/transfer.js.map +1 -1
  69. package/transfer/transfer.mjs +58 -95
  70. package/transfer/transfer.mjs.map +1 -1
  71. package/types/account-manager.d.ts +141 -24
  72. package/types/account-manager.d.ts.map +1 -1
  73. package/types/account-manager.js +217 -44
  74. package/types/account-manager.js.map +1 -1
  75. package/types/account-manager.mjs +216 -43
  76. package/types/account-manager.mjs.map +1 -1
  77. package/types/account.d.ts +122 -7
  78. package/types/account.d.ts.map +1 -1
  79. package/types/account.js.map +1 -1
  80. package/types/account.mjs.map +1 -1
  81. package/types/algorand-client-transaction-creator.d.ts +289 -0
  82. package/types/algorand-client-transaction-creator.d.ts.map +1 -0
  83. package/types/algorand-client-transaction-creator.js +299 -0
  84. package/types/algorand-client-transaction-creator.js.map +1 -0
  85. package/types/algorand-client-transaction-creator.mjs +297 -0
  86. package/types/algorand-client-transaction-creator.mjs.map +1 -0
  87. package/types/algorand-client-transaction-sender.d.ts +433 -0
  88. package/types/algorand-client-transaction-sender.d.ts.map +1 -0
  89. package/types/algorand-client-transaction-sender.js +422 -0
  90. package/types/algorand-client-transaction-sender.js.map +1 -0
  91. package/types/algorand-client-transaction-sender.mjs +420 -0
  92. package/types/algorand-client-transaction-sender.mjs.map +1 -0
  93. package/types/algorand-client.d.ts +28 -78
  94. package/types/algorand-client.d.ts.map +1 -1
  95. package/types/algorand-client.js +33 -122
  96. package/types/algorand-client.js.map +1 -1
  97. package/types/algorand-client.mjs +34 -123
  98. package/types/algorand-client.mjs.map +1 -1
  99. package/types/amount.d.ts +18 -6
  100. package/types/amount.d.ts.map +1 -1
  101. package/types/amount.js +33 -10
  102. package/types/amount.js.map +1 -1
  103. package/types/amount.mjs +33 -10
  104. package/types/amount.mjs.map +1 -1
  105. package/types/app-client.d.ts +3 -3
  106. package/types/app-client.d.ts.map +1 -1
  107. package/types/app-client.js +7 -10
  108. package/types/app-client.js.map +1 -1
  109. package/types/app-client.mjs +8 -11
  110. package/types/app-client.mjs.map +1 -1
  111. package/types/asset-manager.d.ts +205 -0
  112. package/types/asset-manager.d.ts.map +1 -0
  113. package/types/asset-manager.js +180 -0
  114. package/types/asset-manager.js.map +1 -0
  115. package/types/asset-manager.mjs +178 -0
  116. package/types/asset-manager.mjs.map +1 -0
  117. package/types/asset.d.ts +4 -4
  118. package/types/asset.d.ts.map +1 -1
  119. package/types/client-manager.d.ts +40 -2
  120. package/types/client-manager.d.ts.map +1 -1
  121. package/types/client-manager.js +44 -3
  122. package/types/client-manager.js.map +1 -1
  123. package/types/client-manager.mjs +44 -3
  124. package/types/client-manager.mjs.map +1 -1
  125. package/types/composer.d.ts +226 -68
  126. package/types/composer.d.ts.map +1 -1
  127. package/types/composer.js +78 -64
  128. package/types/composer.js.map +1 -1
  129. package/types/composer.mjs +75 -64
  130. package/types/composer.mjs.map +1 -1
  131. package/types/dispenser-client.d.ts +12 -4
  132. package/types/dispenser-client.d.ts.map +1 -1
  133. package/types/dispenser-client.js +9 -9
  134. package/types/dispenser-client.js.map +1 -1
  135. package/types/dispenser-client.mjs +9 -9
  136. package/types/dispenser-client.mjs.map +1 -1
  137. package/types/indexer.d.ts +7 -7
  138. package/types/indexer.d.ts.map +1 -1
  139. package/types/kmd-account-manager.d.ts +3 -3
  140. package/types/kmd-account-manager.js +6 -6
  141. package/types/kmd-account-manager.js.map +1 -1
  142. package/types/kmd-account-manager.mjs +7 -7
  143. package/types/kmd-account-manager.mjs.map +1 -1
  144. package/types/network-client.d.ts +7 -1
  145. package/types/network-client.d.ts.map +1 -1
  146. package/types/network-client.js +10 -0
  147. package/types/network-client.js.map +1 -1
  148. package/types/network-client.mjs +9 -0
  149. package/types/network-client.mjs.map +1 -1
  150. package/types/testing.d.ts +1 -1
  151. package/types/testing.d.ts.map +1 -1
  152. package/types/transfer.d.ts +8 -7
  153. package/types/transfer.d.ts.map +1 -1
  154. package/util.d.ts +13 -0
  155. package/util.d.ts.map +1 -1
  156. package/util.js +25 -0
  157. package/util.js.map +1 -1
  158. package/util.mjs +24 -1
  159. package/util.mjs.map +1 -1
@@ -0,0 +1,289 @@
1
+ import algosdk from 'algosdk';
2
+ import AlgoKitComposer, { MethodCallParams } from './composer';
3
+ import Transaction = algosdk.Transaction;
4
+ /** Orchestrates creating transactions for `AlgorandClient`. */
5
+ export declare class AlgorandClientTransactionCreator {
6
+ private _newGroup;
7
+ /**
8
+ * Creates a new `AlgorandClientTransactionCreator`
9
+ * @param newGroup A lambda that starts a new `AlgoKitComposer` transaction group
10
+ */
11
+ constructor(newGroup: () => AlgoKitComposer);
12
+ private _transaction;
13
+ /**
14
+ * Create a payment transaction to transfer Algo between accounts.
15
+ * @param params The parameters for the payment transaction
16
+ * @example Basic example
17
+ * ```typescript
18
+ * const result = await algorandClient.send.payment({
19
+ * sender: 'SENDERADDRESS',
20
+ * receiver: 'RECEIVERADDRESS',
21
+ * amount: (4).algo(),
22
+ * })
23
+ * ```
24
+ * @example Advanced example
25
+ * ```typescript
26
+ * const result = await algorandClient.send.payment({
27
+ * amount: (4).algo(),
28
+ * receiver: 'RECEIVERADDRESS',
29
+ * sender: 'SENDERADDRESS',
30
+ * closeRemainderTo: 'CLOSEREMAINDERTOADDRESS',
31
+ * lease: 'lease',
32
+ * note: 'note',
33
+ * // Use this with caution, it's generally better to use algorand.account.rekeyAccount
34
+ * rekeyTo: 'REKEYTOADDRESS',
35
+ * // You wouldn't normally set this field
36
+ * firstValidRound: 1000n,
37
+ * validityWindow: 10,
38
+ * extraFee: (1000).microAlgo(),
39
+ * staticFee: (1000).microAlgo(),
40
+ * // Max fee doesn't make sense with extraFee AND staticFee
41
+ * // already specified, but here for completeness
42
+ * maxFee: (3000).microAlgo(),
43
+ * })
44
+ * ```
45
+ *
46
+ * @returns The payment transaction
47
+ */
48
+ payment: (params: import("./composer").PaymentParams) => Promise<Transaction>;
49
+ /** Create a create Algorand Standard Asset transaction.
50
+ *
51
+ * The account that sends this transaction will automatically be
52
+ * opted in to the asset and will hold all units after creation.
53
+ *
54
+ * @param params The parameters for the asset creation transaction
55
+ *
56
+ * @example Basic example
57
+ * ```typescript
58
+ * await algorand.transaction.assetCreate({sender: "CREATORADDRESS", total: 100n})
59
+ * ```
60
+ * @example Advanced example
61
+ * ```typescript
62
+ * await algorand.transaction.assetCreate({
63
+ * sender: 'CREATORADDRESS',
64
+ * total: 100n,
65
+ * decimals: 2,
66
+ * assetName: 'asset',
67
+ * unitName: 'unit',
68
+ * url: 'url',
69
+ * metadataHash: 'metadataHash',
70
+ * defaultFrozen: false,
71
+ * manager: 'MANAGERADDRESS',
72
+ * reserve: 'RESERVEADDRESS',
73
+ * freeze: 'FREEZEADDRESS',
74
+ * clawback: 'CLAWBACKADDRESS',
75
+ * lease: 'lease',
76
+ * note: 'note',
77
+ * // You wouldn't normally set this field
78
+ * firstValidRound: 1000n,
79
+ * validityWindow: 10,
80
+ * extraFee: (1000).microAlgo(),
81
+ * staticFee: (1000).microAlgo(),
82
+ * // Max fee doesn't make sense with extraFee AND staticFee
83
+ * // already specified, but here for completeness
84
+ * maxFee: (3000).microAlgo(),
85
+ * })
86
+ * ```
87
+ * @returns The asset create transaction
88
+ */
89
+ assetCreate: (params: import("./composer").AssetCreateParams) => Promise<Transaction>;
90
+ /** Create an asset config transaction to reconfigure an existing Algorand Standard Asset.
91
+ *
92
+ * **Note:** The manager, reserve, freeze, and clawback addresses
93
+ * are immutably empty if they are not set. If manager is not set then
94
+ * all fields are immutable from that point forward.
95
+ *
96
+ * @param params The parameters for the asset config transaction
97
+ *
98
+ * @example Basic example
99
+ * ```typescript
100
+ * await algorand.transaction.assetConfig({sender: "MANAGERADDRESS", assetId: 123456n, manager: "MANAGERADDRESS" })
101
+ * ```
102
+ * @example Advanced example
103
+ * ```typescript
104
+ * await algorand.transaction.assetConfig({
105
+ * sender: 'MANAGERADDRESS',
106
+ * assetId: 123456n,
107
+ * manager: 'MANAGERADDRESS',
108
+ * reserve: 'RESERVEADDRESS',
109
+ * freeze: 'FREEZEADDRESS',
110
+ * clawback: 'CLAWBACKADDRESS',
111
+ * lease: 'lease',
112
+ * note: 'note',
113
+ * // You wouldn't normally set this field
114
+ * firstValidRound: 1000n,
115
+ * validityWindow: 10,
116
+ * extraFee: (1000).microAlgo(),
117
+ * staticFee: (1000).microAlgo(),
118
+ * // Max fee doesn't make sense with extraFee AND staticFee
119
+ * // already specified, but here for completeness
120
+ * maxFee: (3000).microAlgo(),
121
+ * })
122
+ * ```
123
+ * @returns The asset config transaction
124
+ */
125
+ assetConfig: (params: import("./composer").AssetConfigParams) => Promise<Transaction>;
126
+ /** Create an Algorand Standard Asset freeze transaction.
127
+ *
128
+ * @param params The parameters for the asset freeze transaction
129
+ *
130
+ * @example Basic example
131
+ * ```typescript
132
+ * await algorand.transaction.assetFreeze({sender: "MANAGERADDRESS", assetId: 123456n, account: "ACCOUNTADDRESS", frozen: true })
133
+ * ```
134
+ * @example Advanced example
135
+ * ```typescript
136
+ * await algorand.transaction.assetFreeze({
137
+ * sender: 'MANAGERADDRESS',
138
+ * assetId: 123456n,
139
+ * account: 'ACCOUNTADDRESS',
140
+ * frozen: true,
141
+ * lease: 'lease',
142
+ * note: 'note',
143
+ * // You wouldn't normally set this field
144
+ * firstValidRound: 1000n,
145
+ * validityWindow: 10,
146
+ * extraFee: (1000).microAlgo(),
147
+ * staticFee: (1000).microAlgo(),
148
+ * // Max fee doesn't make sense with extraFee AND staticFee
149
+ * // already specified, but here for completeness
150
+ * maxFee: (3000).microAlgo(),
151
+ * })
152
+ * ```
153
+ * @returns The asset freeze transaction
154
+ */
155
+ assetFreeze: (params: import("./composer").AssetFreezeParams) => Promise<Transaction>;
156
+ /** Create an Algorand Standard Asset destroy transaction.
157
+ *
158
+ * Created assets can be destroyed only by the asset manager account.
159
+ * All of the assets must be owned by the creator of the asset before
160
+ * the asset can be deleted.
161
+ *
162
+ * @param params The parameters for the asset destroy transaction
163
+ *
164
+ * @example Basic example
165
+ * ```typescript
166
+ * await algorand.transaction.assetDestroy({sender: "MANAGERADDRESS", assetId: 123456n })
167
+ * ```
168
+ * @example Advanced example
169
+ * ```typescript
170
+ * await algorand.transaction.assetDestroy({
171
+ * sender: 'MANAGERADDRESS',
172
+ * assetId: 123456n,
173
+ * lease: 'lease',
174
+ * note: 'note',
175
+ * // You wouldn't normally set this field
176
+ * firstValidRound: 1000n,
177
+ * validityWindow: 10,
178
+ * extraFee: (1000).microAlgo(),
179
+ * staticFee: (1000).microAlgo(),
180
+ * // Max fee doesn't make sense with extraFee AND staticFee
181
+ * // already specified, but here for completeness
182
+ * maxFee: (3000).microAlgo(),
183
+ * })
184
+ * ```
185
+ * @returns The asset destroy transaction
186
+ */
187
+ assetDestroy: (params: import("./composer").AssetDestroyParams) => Promise<Transaction>;
188
+ /** Create an Algorand Standard Asset transfer transaction.
189
+ *
190
+ * @param params The parameters for the asset transfer transaction
191
+ *
192
+ * @example Basic example
193
+ * ```typescript
194
+ * await algorand.transaction.assetTransfer({sender: "HOLDERADDRESS", assetId: 123456n, amount: 1n, receiver: "RECEIVERADDRESS" })
195
+ * ```
196
+ * @example Advanced example (with clawback)
197
+ * ```typescript
198
+ * await algorand.transaction.assetTransfer({
199
+ * sender: 'CLAWBACKADDRESS',
200
+ * assetId: 123456n,
201
+ * amount: 1n,
202
+ * receiver: 'RECEIVERADDRESS',
203
+ * clawbackTarget: 'HOLDERADDRESS',
204
+ * // This field needs to be used with caution
205
+ * closeAssetTo: 'ADDRESSTOCLOSETO'
206
+ * lease: 'lease',
207
+ * note: 'note',
208
+ * // You wouldn't normally set this field
209
+ * firstValidRound: 1000n,
210
+ * validityWindow: 10,
211
+ * extraFee: (1000).microAlgo(),
212
+ * staticFee: (1000).microAlgo(),
213
+ * // Max fee doesn't make sense with extraFee AND staticFee
214
+ * // already specified, but here for completeness
215
+ * maxFee: (3000).microAlgo(),
216
+ * })
217
+ * ```
218
+ * @returns The result of the asset transfer transaction
219
+ */
220
+ assetTransfer: (params: import("./composer").AssetTransferParams) => Promise<Transaction>;
221
+ /** Create an Algorand Standard Asset opt-in transaction.
222
+ *
223
+ * @param params The parameters for the asset opt-in transaction
224
+ *
225
+ * @example Basic example
226
+ * ```typescript
227
+ * await algorand.transaction.assetOptIn({sender: "SENDERADDRESS", assetId: 123456n })
228
+ * ```
229
+ * @example Advanced example
230
+ * ```typescript
231
+ * await algorand.transaction.assetOptIn({
232
+ * sender: 'SENDERADDRESS',
233
+ * assetId: 123456n,
234
+ * lease: 'lease',
235
+ * note: 'note',
236
+ * // You wouldn't normally set this field
237
+ * firstValidRound: 1000n,
238
+ * validityWindow: 10,
239
+ * extraFee: (1000).microAlgo(),
240
+ * staticFee: (1000).microAlgo(),
241
+ * // Max fee doesn't make sense with extraFee AND staticFee
242
+ * // already specified, but here for completeness
243
+ * maxFee: (3000).microAlgo(),
244
+ * })
245
+ * ```
246
+ * @returns The asset opt-in transaction
247
+ */
248
+ assetOptIn: (params: import("./composer").AssetOptInParams) => Promise<Transaction>;
249
+ /** Create an asset opt-out transaction.
250
+ *
251
+ * *Note:* If the account has a balance of the asset,
252
+ * it will lose those assets
253
+ *
254
+ * @param params The parameters for the asset opt-out transaction
255
+ *
256
+ * @example Basic example
257
+ * ```typescript
258
+ * await algorand.transaction.assetOptOut({sender: "SENDERADDRESS", creator: "CREATORADDRESS", assetId: 123456n })
259
+ * ```
260
+ * @example Advanced example
261
+ * ```typescript
262
+ * await algorand.transaction.assetOptIn({
263
+ * sender: 'SENDERADDRESS',
264
+ * assetId: 123456n,
265
+ * creator: 'CREATORADDRESS',
266
+ * ensureZeroBalance: true,
267
+ * lease: 'lease',
268
+ * note: 'note',
269
+ * // You wouldn't normally set this field
270
+ * firstValidRound: 1000n,
271
+ * validityWindow: 10,
272
+ * extraFee: (1000).microAlgo(),
273
+ * staticFee: (1000).microAlgo(),
274
+ * // Max fee doesn't make sense with extraFee AND staticFee
275
+ * // already specified, but here for completeness
276
+ * maxFee: (3000).microAlgo(),
277
+ * })
278
+ * ```
279
+ * @returns The asset opt-out transaction
280
+ */
281
+ assetOptOut: (params: import("./composer").AssetOptOutParams) => Promise<Transaction>;
282
+ /** Create an application call transaction. */
283
+ appCall: (params: import("./composer").AppCallParams) => Promise<Transaction>;
284
+ /** Create an application call with ABI method call transaction. */
285
+ methodCall: (params: MethodCallParams) => Promise<algosdk.Transaction[]>;
286
+ /** Create an online key registration transaction. */
287
+ onlineKeyRegistration: (params: import("./composer").OnlineKeyRegistrationParams) => Promise<Transaction>;
288
+ }
289
+ //# sourceMappingURL=algorand-client-transaction-creator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"algorand-client-transaction-creator.d.ts","sourceRoot":"","sources":["../../src/types/algorand-client-transaction-creator.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,eAAe,EAAE,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE9D,OAAO,WAAW,GAAG,OAAO,CAAC,WAAW,CAAA;AAExC,+DAA+D;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ientTransactionCreator`
7
+ * @param newGroup A lambda that starts a new `AlgoKitComposer` transaction group
8
+ */
9
+ constructor(newGroup) {
10
+ /**
11
+ * Create a payment transaction to transfer Algo between accounts.
12
+ * @param params The parameters for the payment transaction
13
+ * @example Basic example
14
+ * ```typescript
15
+ * const result = await algorandClient.send.payment({
16
+ * sender: 'SENDERADDRESS',
17
+ * receiver: 'RECEIVERADDRESS',
18
+ * amount: (4).algo(),
19
+ * })
20
+ * ```
21
+ * @example Advanced example
22
+ * ```typescript
23
+ * const result = await algorandClient.send.payment({
24
+ * amount: (4).algo(),
25
+ * receiver: 'RECEIVERADDRESS',
26
+ * sender: 'SENDERADDRESS',
27
+ * closeRemainderTo: 'CLOSEREMAINDERTOADDRESS',
28
+ * lease: 'lease',
29
+ * note: 'note',
30
+ * // Use this with caution, it's generally better to use algorand.account.rekeyAccount
31
+ * rekeyTo: 'REKEYTOADDRESS',
32
+ * // You wouldn't normally set this field
33
+ * firstValidRound: 1000n,
34
+ * validityWindow: 10,
35
+ * extraFee: (1000).microAlgo(),
36
+ * staticFee: (1000).microAlgo(),
37
+ * // Max fee doesn't make sense with extraFee AND staticFee
38
+ * // already specified, but here for completeness
39
+ * maxFee: (3000).microAlgo(),
40
+ * })
41
+ * ```
42
+ *
43
+ * @returns The payment transaction
44
+ */
45
+ this.payment = this._transaction((c) => c.addPayment);
46
+ /** Create a create Algorand Standard Asset transaction.
47
+ *
48
+ * The account that sends this transaction will automatically be
49
+ * opted in to the asset and will hold all units after creation.
50
+ *
51
+ * @param params The parameters for the asset creation transaction
52
+ *
53
+ * @example Basic example
54
+ * ```typescript
55
+ * await algorand.transaction.assetCreate({sender: "CREATORADDRESS", total: 100n})
56
+ * ```
57
+ * @example Advanced example
58
+ * ```typescript
59
+ * await algorand.transaction.assetCreate({
60
+ * sender: 'CREATORADDRESS',
61
+ * total: 100n,
62
+ * decimals: 2,
63
+ * assetName: 'asset',
64
+ * unitName: 'unit',
65
+ * url: 'url',
66
+ * metadataHash: 'metadataHash',
67
+ * defaultFrozen: false,
68
+ * manager: 'MANAGERADDRESS',
69
+ * reserve: 'RESERVEADDRESS',
70
+ * freeze: 'FREEZEADDRESS',
71
+ * clawback: 'CLAWBACKADDRESS',
72
+ * lease: 'lease',
73
+ * note: 'note',
74
+ * // You wouldn't normally set this field
75
+ * firstValidRound: 1000n,
76
+ * validityWindow: 10,
77
+ * extraFee: (1000).microAlgo(),
78
+ * staticFee: (1000).microAlgo(),
79
+ * // Max fee doesn't make sense with extraFee AND staticFee
80
+ * // already specified, but here for completeness
81
+ * maxFee: (3000).microAlgo(),
82
+ * })
83
+ * ```
84
+ * @returns The asset create transaction
85
+ */
86
+ this.assetCreate = this._transaction((c) => c.addAssetCreate);
87
+ /** Create an asset config transaction to reconfigure an existing Algorand Standard Asset.
88
+ *
89
+ * **Note:** The manager, reserve, freeze, and clawback addresses
90
+ * are immutably empty if they are not set. If manager is not set then
91
+ * all fields are immutable from that point forward.
92
+ *
93
+ * @param params The parameters for the asset config transaction
94
+ *
95
+ * @example Basic example
96
+ * ```typescript
97
+ * await algorand.transaction.assetConfig({sender: "MANAGERADDRESS", assetId: 123456n, manager: "MANAGERADDRESS" })
98
+ * ```
99
+ * @example Advanced example
100
+ * ```typescript
101
+ * await algorand.transaction.assetConfig({
102
+ * sender: 'MANAGERADDRESS',
103
+ * assetId: 123456n,
104
+ * manager: 'MANAGERADDRESS',
105
+ * reserve: 'RESERVEADDRESS',
106
+ * freeze: 'FREEZEADDRESS',
107
+ * clawback: 'CLAWBACKADDRESS',
108
+ * lease: 'lease',
109
+ * note: 'note',
110
+ * // You wouldn't normally set this field
111
+ * firstValidRound: 1000n,
112
+ * validityWindow: 10,
113
+ * extraFee: (1000).microAlgo(),
114
+ * staticFee: (1000).microAlgo(),
115
+ * // Max fee doesn't make sense with extraFee AND staticFee
116
+ * // already specified, but here for completeness
117
+ * maxFee: (3000).microAlgo(),
118
+ * })
119
+ * ```
120
+ * @returns The asset config transaction
121
+ */
122
+ this.assetConfig = this._transaction((c) => c.addAssetConfig);
123
+ /** Create an Algorand Standard Asset freeze transaction.
124
+ *
125
+ * @param params The parameters for the asset freeze transaction
126
+ *
127
+ * @example Basic example
128
+ * ```typescript
129
+ * await algorand.transaction.assetFreeze({sender: "MANAGERADDRESS", assetId: 123456n, account: "ACCOUNTADDRESS", frozen: true })
130
+ * ```
131
+ * @example Advanced example
132
+ * ```typescript
133
+ * await algorand.transaction.assetFreeze({
134
+ * sender: 'MANAGERADDRESS',
135
+ * assetId: 123456n,
136
+ * account: 'ACCOUNTADDRESS',
137
+ * frozen: true,
138
+ * lease: 'lease',
139
+ * note: 'note',
140
+ * // You wouldn't normally set this field
141
+ * firstValidRound: 1000n,
142
+ * validityWindow: 10,
143
+ * extraFee: (1000).microAlgo(),
144
+ * staticFee: (1000).microAlgo(),
145
+ * // Max fee doesn't make sense with extraFee AND staticFee
146
+ * // already specified, but here for completeness
147
+ * maxFee: (3000).microAlgo(),
148
+ * })
149
+ * ```
150
+ * @returns The asset freeze transaction
151
+ */
152
+ this.assetFreeze = this._transaction((c) => c.addAssetFreeze);
153
+ /** Create an Algorand Standard Asset destroy transaction.
154
+ *
155
+ * Created assets can be destroyed only by the asset manager account.
156
+ * All of the assets must be owned by the creator of the asset before
157
+ * the asset can be deleted.
158
+ *
159
+ * @param params The parameters for the asset destroy transaction
160
+ *
161
+ * @example Basic example
162
+ * ```typescript
163
+ * await algorand.transaction.assetDestroy({sender: "MANAGERADDRESS", assetId: 123456n })
164
+ * ```
165
+ * @example Advanced example
166
+ * ```typescript
167
+ * await algorand.transaction.assetDestroy({
168
+ * sender: 'MANAGERADDRESS',
169
+ * assetId: 123456n,
170
+ * lease: 'lease',
171
+ * note: 'note',
172
+ * // You wouldn't normally set this field
173
+ * firstValidRound: 1000n,
174
+ * validityWindow: 10,
175
+ * extraFee: (1000).microAlgo(),
176
+ * staticFee: (1000).microAlgo(),
177
+ * // Max fee doesn't make sense with extraFee AND staticFee
178
+ * // already specified, but here for completeness
179
+ * maxFee: (3000).microAlgo(),
180
+ * })
181
+ * ```
182
+ * @returns The asset destroy transaction
183
+ */
184
+ this.assetDestroy = this._transaction((c) => c.addAssetDestroy);
185
+ /** Create an Algorand Standard Asset transfer transaction.
186
+ *
187
+ * @param params The parameters for the asset transfer transaction
188
+ *
189
+ * @example Basic example
190
+ * ```typescript
191
+ * await algorand.transaction.assetTransfer({sender: "HOLDERADDRESS", assetId: 123456n, amount: 1n, receiver: "RECEIVERADDRESS" })
192
+ * ```
193
+ * @example Advanced example (with clawback)
194
+ * ```typescript
195
+ * await algorand.transaction.assetTransfer({
196
+ * sender: 'CLAWBACKADDRESS',
197
+ * assetId: 123456n,
198
+ * amount: 1n,
199
+ * receiver: 'RECEIVERADDRESS',
200
+ * clawbackTarget: 'HOLDERADDRESS',
201
+ * // This field needs to be used with caution
202
+ * closeAssetTo: 'ADDRESSTOCLOSETO'
203
+ * lease: 'lease',
204
+ * note: 'note',
205
+ * // You wouldn't normally set this field
206
+ * firstValidRound: 1000n,
207
+ * validityWindow: 10,
208
+ * extraFee: (1000).microAlgo(),
209
+ * staticFee: (1000).microAlgo(),
210
+ * // Max fee doesn't make sense with extraFee AND staticFee
211
+ * // already specified, but here for completeness
212
+ * maxFee: (3000).microAlgo(),
213
+ * })
214
+ * ```
215
+ * @returns The result of the asset transfer transaction
216
+ */
217
+ this.assetTransfer = this._transaction((c) => c.addAssetTransfer);
218
+ /** Create an Algorand Standard Asset opt-in transaction.
219
+ *
220
+ * @param params The parameters for the asset opt-in transaction
221
+ *
222
+ * @example Basic example
223
+ * ```typescript
224
+ * await algorand.transaction.assetOptIn({sender: "SENDERADDRESS", assetId: 123456n })
225
+ * ```
226
+ * @example Advanced example
227
+ * ```typescript
228
+ * await algorand.transaction.assetOptIn({
229
+ * sender: 'SENDERADDRESS',
230
+ * assetId: 123456n,
231
+ * lease: 'lease',
232
+ * note: 'note',
233
+ * // You wouldn't normally set this field
234
+ * firstValidRound: 1000n,
235
+ * validityWindow: 10,
236
+ * extraFee: (1000).microAlgo(),
237
+ * staticFee: (1000).microAlgo(),
238
+ * // Max fee doesn't make sense with extraFee AND staticFee
239
+ * // already specified, but here for completeness
240
+ * maxFee: (3000).microAlgo(),
241
+ * })
242
+ * ```
243
+ * @returns The asset opt-in transaction
244
+ */
245
+ this.assetOptIn = this._transaction((c) => c.addAssetOptIn);
246
+ /** Create an asset opt-out transaction.
247
+ *
248
+ * *Note:* If the account has a balance of the asset,
249
+ * it will lose those assets
250
+ *
251
+ * @param params The parameters for the asset opt-out transaction
252
+ *
253
+ * @example Basic example
254
+ * ```typescript
255
+ * await algorand.transaction.assetOptOut({sender: "SENDERADDRESS", creator: "CREATORADDRESS", assetId: 123456n })
256
+ * ```
257
+ * @example Advanced example
258
+ * ```typescript
259
+ * await algorand.transaction.assetOptIn({
260
+ * sender: 'SENDERADDRESS',
261
+ * assetId: 123456n,
262
+ * creator: 'CREATORADDRESS',
263
+ * ensureZeroBalance: true,
264
+ * lease: 'lease',
265
+ * note: 'note',
266
+ * // You wouldn't normally set this field
267
+ * firstValidRound: 1000n,
268
+ * validityWindow: 10,
269
+ * extraFee: (1000).microAlgo(),
270
+ * staticFee: (1000).microAlgo(),
271
+ * // Max fee doesn't make sense with extraFee AND staticFee
272
+ * // already specified, but here for completeness
273
+ * maxFee: (3000).microAlgo(),
274
+ * })
275
+ * ```
276
+ * @returns The asset opt-out transaction
277
+ */
278
+ this.assetOptOut = this._transaction((c) => c.addAssetOptOut);
279
+ /** Create an application call transaction. */
280
+ this.appCall = this._transaction((c) => c.addAppCall);
281
+ /** Create an application call with ABI method call transaction. */
282
+ this.methodCall = async (params) => {
283
+ return await this._newGroup().addMethodCall(params).buildTransactions();
284
+ };
285
+ /** Create an online key registration transaction. */
286
+ this.onlineKeyRegistration = this._transaction((c) => c.addOnlineKeyRegistration);
287
+ this._newGroup = newGroup;
288
+ }
289
+ _transaction(c) {
290
+ return async (params) => {
291
+ const composer = this._newGroup();
292
+ const result = await c(composer).apply(composer, [params]).buildTransactions();
293
+ return result[result.length - 1];
294
+ };
295
+ }
296
+ }
297
+
298
+ exports.AlgorandClientTransactionCreator = AlgorandClientTransactionCreator;
299
+ //# sourceMappingURL=algorand-client-transaction-creator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"algorand-client-transaction-creator.js","sources":["../../src/types/algorand-client-transaction-creator.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA;MACa,gCAAgC,CAAA;AAG3C;;;AAGG;AACH,IAAA,WAAA,CAAY,QAA+B,EAAA;AAY3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCG;AACH,QAAA,IAAA,CAAA,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CAAA;AAChD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCG;AACH,QAAA,IAAA,CAAA,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CAAA;AACxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCG;AACH,QAAA,IAAA,CAAA,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CAAA;AACxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AACH,QAAA,IAAA,CAAA,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CAAA;AACxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;AACH,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,eAAe,CAAC,CAAA;AAC1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BG;AACH,QAAA,IAAA,CAAA,aAAa,GAAG,IAAI,CAAC,YA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