@layerzerolabs/lz-sui-oft-sdk-v2 3.0.136 → 3.0.137

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/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { bcs } from '@mysten/sui/bcs';
2
2
  import { Transaction } from '@mysten/sui/transactions';
3
- import { asObject, asU8, asBytes, asBool, asAddress, asU64, asU32, isTransactionArgument, asArgWithTx, asArgWithTxAsync, executeSimulate, asBytes32 } from '@layerzerolabs/lz-sui-sdk-v2';
3
+ import { asObject, asU8, executeSimulate, asBytes, asBool, asAddress, asU64, asU32, isTransactionArgument, asArgWithTx, asArgWithTxAsync, asBytes32 } from '@layerzerolabs/lz-sui-sdk-v2';
4
4
 
5
5
  var __typeError = (msg) => {
6
6
  throw TypeError(msg);
@@ -21,6 +21,10 @@ var OFTReceiptBcs = bcs.struct("OFTReceipt", {
21
21
  amount_sent_ld: bcs.U64,
22
22
  amount_received_ld: bcs.U64
23
23
  });
24
+ var OFTInfoV1Bcs = bcs.struct("OFTInfoV1", {
25
+ oft_package: bcs.Address,
26
+ oft_object: bcs.Address
27
+ });
24
28
  function parseOFTLimit(data) {
25
29
  const parsed = OFTLimitBcs.parse(data);
26
30
  return {
@@ -46,6 +50,13 @@ function parseOFTReceipt(data) {
46
50
  amountReceivedLd: BigInt(parsed.amount_received_ld)
47
51
  };
48
52
  }
53
+ function parseOFTInfoV1(data) {
54
+ const parsed = OFTInfoV1Bcs.parse(data);
55
+ return {
56
+ oftPackage: parsed.oft_package,
57
+ oftObject: parsed.oft_object
58
+ };
59
+ }
49
60
 
50
61
  // src/modules/oft.ts
51
62
  var MODULE_NAME = "oft";
@@ -65,21 +76,22 @@ var OFTErrorCode = {
65
76
  ESlippageExceeded: 9,
66
77
  EWrongPackageVersion: 10
67
78
  };
68
- var _OFT_instances, buildSendParam_fn, target_fn, oappObjectId_fn, adminCapId_fn;
79
+ var _OFT_instances, buildSendParam_fn, target_fn, oappObjectId_fn, oftObjectId_fn, adminCapId_fn, coinType_fn, OftInfo_fn, oftPackageId_fn;
69
80
  var OFT = class {
70
81
  /**
71
82
  * Creates a new OFT instance for interacting with an Omnichain Fungible Token
72
83
  *
73
84
  * @param protocolSDK - The LayerZero protocol SDK instance providing core cross-chain functionality
74
- * @param oftPackageId - The package ID of the core OFT framework (shared across all OFT implementations)
75
- * @param oftObjectId - The unique object ID of this OFT instance
76
- * @param coinType - The Sui coin type string (e.g., "0x123::mycoin::MYCOIN")
77
- * @param adminCapId - Optional admin capability object ID for privileged operations (required for admin functions)
85
+ * @param oftCallCapId - The OFT call capability ID used for OFT operations and accessing OFT information
86
+ * @param oftObjectId - Optional OFT object ID on Sui blockchain for direct OFT instance access
87
+ * @param coinType - Optional Sui coin type string (e.g., "0x123::mycoin::MYCOIN") that this OFT represents
88
+ * @param oappObjectId - Optional associated OApp object ID for cross-chain messaging operations
89
+ * @param adminCapId - Optional admin capability object ID for privileged operations
78
90
  */
79
- constructor(protocolSDK, oftPackageId, oftObjectId, coinType, oappObjectId, adminCapId) {
91
+ constructor(protocolSDK, oftCallCapId, oftObjectId, coinType, oappObjectId, adminCapId) {
80
92
  __privateAdd(this, _OFT_instances);
81
93
  this.protocolSDK = protocolSDK;
82
- this.oftPackageId = oftPackageId;
94
+ this.oftCallCapId = oftCallCapId;
83
95
  this.client = protocolSDK.client;
84
96
  this.objects = protocolSDK.objects;
85
97
  this.oftObjectId = oftObjectId;
@@ -102,16 +114,18 @@ var OFT = class {
102
114
  * Initialize an OFT instance with a treasury capability
103
115
  * Creates a new OFT that mints its own tokens
104
116
  * @param tx - The transaction to add the move call to
117
+ * @param coinType - The Sui coin type string (e.g., "0x123::mycoin::MYCOIN")
105
118
  * @param ticket - The OFTCreationTicket object ID or TransactionArgument
119
+ * @param oapp - The OApp object ID or TransactionArgument
106
120
  * @param treasury - The TreasuryCap object ID or TransactionArgument for the coin type
107
121
  * @param metadata - The CoinMetadata object ID or TransactionArgument for the coin type
108
122
  * @param sharedDecimals - Number of decimals to use for cross-chain operations
109
123
  * @returns TransactionResult array containing [AdminCap, MigrationCap] - MigrationCap must be transferred or stored
110
124
  */
111
- initOftMoveCall(tx, ticket, oapp, treasury, metadata, sharedDecimals) {
125
+ initOftMoveCall(tx, coinType, ticket, oapp, treasury, metadata, sharedDecimals) {
112
126
  return tx.moveCall({
113
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "init_oft", OFT_IMPL_MODULE_NAME),
114
- typeArguments: [this.coinType],
127
+ target: `${this.oftCallCapId}::${OFT_IMPL_MODULE_NAME}::init_oft`,
128
+ typeArguments: [coinType],
115
129
  arguments: [
116
130
  asObject(tx, ticket),
117
131
  asObject(tx, oapp),
@@ -125,15 +139,17 @@ var OFT = class {
125
139
  * Initialize an OFT adapter instance
126
140
  * Creates an OFT adapter that wraps an existing coin type
127
141
  * @param tx - The transaction to add the move call to
142
+ * @param coinType - The Sui coin type string (e.g., "0x123::mycoin::MYCOIN")
128
143
  * @param ticket - The OFTCreationTicket object ID or TransactionArgument
144
+ * @param oapp - The OApp object ID or TransactionArgument
129
145
  * @param metadata - The CoinMetadata object ID or TransactionArgument for the coin type
130
146
  * @param sharedDecimals - Number of decimals to use for cross-chain operations
131
147
  * @returns TransactionResult array containing [AdminCap, MigrationCap] - MigrationCap must be transferred or stored
132
148
  */
133
- initOftAdapterMoveCall(tx, ticket, oapp, metadata, sharedDecimals) {
149
+ initOftAdapterMoveCall(tx, coinType, ticket, oapp, metadata, sharedDecimals) {
134
150
  return tx.moveCall({
135
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "init_oft_adapter", OFT_IMPL_MODULE_NAME),
136
- typeArguments: [this.coinType],
151
+ target: `${this.oftCallCapId}::${OFT_IMPL_MODULE_NAME}::init_oft_adapter`,
152
+ typeArguments: [coinType],
137
153
  arguments: [asObject(tx, ticket), asObject(tx, oapp), asObject(tx, metadata), asU8(tx, sharedDecimals)]
138
154
  });
139
155
  }
@@ -141,7 +157,7 @@ var OFT = class {
141
157
  // ADMIN FUNCTIONS
142
158
  // ==========================================
143
159
  // These functions require admin privileges and are used for OFT configuration
144
- // and management. They require the adminCapId to be provided during construction.
160
+ // and management. The admin capability is automatically retrieved from the OFT instance.
145
161
  /**
146
162
  * Get LayerZero receive information for OFT registration
147
163
  *
@@ -152,12 +168,12 @@ var OFT = class {
152
168
  * @param composerManager - The composer manager object ID for routing compose transfers
153
169
  * @returns TransactionResult containing serialized execution metadata for endpoint registration
154
170
  */
155
- lzReceiveInfoMoveCall(tx, composerManager) {
171
+ async lzReceiveInfoMoveCall(tx, composerManager) {
156
172
  return tx.moveCall({
157
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "lz_receive_info", OFT_PTB_BUILDER_MODULE_NAME),
158
- typeArguments: [this.coinType],
173
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "lz_receive_info", OFT_PTB_BUILDER_MODULE_NAME),
174
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
159
175
  arguments: [
160
- tx.object(this.oftObjectId),
176
+ tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)),
161
177
  tx.object(this.objects.endpointV2),
162
178
  asObject(tx, composerManager),
163
179
  tx.object.clock()
@@ -167,17 +183,43 @@ var OFT = class {
167
183
  /**
168
184
  * Register OFT as an OApp with LayerZero endpoint
169
185
  * @param tx - The transaction to add the move call to
170
- * @param lzReceiveInfo - PTB Builder lzReceiveInfoMoveCall result, used for protocol SDK to dynamically build the PTB
171
- * for OFT's lzReceive operation
186
+ * @param coinType - The Sui coin type string (e.g., "0x123::mycoin::MYCOIN")
187
+ * @param oftObjectId - The OFT object ID
188
+ * @param oappObjectId - The OApp object ID
189
+ * @param composerManager - The composer manager object ID or TransactionArgument
190
+ * @param lzReceiveInfo - Optional LayerZero receive info as Uint8Array or TransactionArgument
172
191
  */
173
- registerOAppMoveCall(tx, lzReceiveInfo) {
192
+ async registerOAppMoveCall(tx, coinType, oftObjectId, oappObjectId, composerManager, lzReceiveInfo) {
193
+ const adminCapId = await executeSimulate(
194
+ this.client,
195
+ (tx2) => {
196
+ tx2.moveCall({
197
+ target: `${this.oftCallCapId}::${MODULE_NAME}::admin_cap`,
198
+ typeArguments: [coinType],
199
+ arguments: [tx2.object(oftObjectId)]
200
+ });
201
+ },
202
+ (result) => bcs.Address.parse(result[0].value)
203
+ );
204
+ if (lzReceiveInfo === void 0) {
205
+ lzReceiveInfo = tx.moveCall({
206
+ target: `${this.oftCallCapId}::${OFT_PTB_BUILDER_MODULE_NAME}::lz_receive_info`,
207
+ typeArguments: [coinType],
208
+ arguments: [
209
+ tx.object(oftObjectId),
210
+ tx.object(this.objects.endpointV2),
211
+ asObject(tx, composerManager),
212
+ tx.object.clock()
213
+ ]
214
+ });
215
+ }
174
216
  tx.moveCall({
175
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "register_oapp"),
176
- typeArguments: [this.coinType],
217
+ target: `${this.oftCallCapId}::${MODULE_NAME}::register_oapp`,
218
+ typeArguments: [coinType],
177
219
  arguments: [
178
- tx.object(this.oftObjectId),
179
- tx.object(__privateMethod(this, _OFT_instances, oappObjectId_fn).call(this)),
180
- tx.object(__privateMethod(this, _OFT_instances, adminCapId_fn).call(this)),
220
+ tx.object(oftObjectId),
221
+ tx.object(oappObjectId),
222
+ tx.object(adminCapId),
181
223
  tx.object(this.objects.endpointV2),
182
224
  asBytes(tx, lzReceiveInfo)
183
225
  ]
@@ -188,11 +230,11 @@ var OFT = class {
188
230
  * @param tx - The transaction to add the move call to
189
231
  * @param pause - Whether to pause or unpause operations
190
232
  */
191
- setPauseMoveCall(tx, pause) {
233
+ async setPauseMoveCall(tx, pause) {
192
234
  tx.moveCall({
193
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "set_pause"),
194
- typeArguments: [this.coinType],
195
- arguments: [tx.object(this.oftObjectId), tx.object(__privateMethod(this, _OFT_instances, adminCapId_fn).call(this)), asBool(tx, pause)]
235
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "set_pause"),
236
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
237
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)), tx.object(await __privateMethod(this, _OFT_instances, adminCapId_fn).call(this)), asBool(tx, pause)]
196
238
  });
197
239
  }
198
240
  // ==========================================
@@ -204,18 +246,27 @@ var OFT = class {
204
246
  * @param tx - The transaction to add the move call to
205
247
  * @param feeDepositAddress - The new fee deposit address
206
248
  */
207
- setFeeDepositAddressMoveCall(tx, feeDepositAddress) {
249
+ async setFeeDepositAddressMoveCall(tx, feeDepositAddress) {
208
250
  tx.moveCall({
209
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "set_fee_deposit_address"),
210
- typeArguments: [this.coinType],
211
- arguments: [tx.object(this.oftObjectId), tx.object(__privateMethod(this, _OFT_instances, adminCapId_fn).call(this)), asAddress(tx, feeDepositAddress)]
251
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "set_fee_deposit_address"),
252
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
253
+ arguments: [
254
+ tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)),
255
+ tx.object(await __privateMethod(this, _OFT_instances, adminCapId_fn).call(this)),
256
+ asAddress(tx, feeDepositAddress)
257
+ ]
212
258
  });
213
259
  }
214
- setDefaultFeeBpsMoveCall(tx, feeBps) {
260
+ /**
261
+ * Set default fee basis points for OFT transfers
262
+ * @param tx - The transaction to add the move call to
263
+ * @param feeBps - Default fee rate in basis points (0-10,000, where 10,000 = 100%)
264
+ */
265
+ async setDefaultFeeBpsMoveCall(tx, feeBps) {
215
266
  tx.moveCall({
216
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "set_default_fee_bps"),
217
- typeArguments: [this.coinType],
218
- arguments: [tx.object(this.oftObjectId), tx.object(__privateMethod(this, _OFT_instances, adminCapId_fn).call(this)), asU64(tx, feeBps)]
267
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "set_default_fee_bps"),
268
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
269
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)), tx.object(await __privateMethod(this, _OFT_instances, adminCapId_fn).call(this)), asU64(tx, feeBps)]
219
270
  });
220
271
  }
221
272
  /**
@@ -224,13 +275,13 @@ var OFT = class {
224
275
  * @param dstEid - Destination endpoint ID
225
276
  * @param feeBps - Fee rate in basis points (0-10,000, where 10,000 = 100%)
226
277
  */
227
- setFeeBpsMoveCall(tx, dstEid, feeBps) {
278
+ async setFeeBpsMoveCall(tx, dstEid, feeBps) {
228
279
  tx.moveCall({
229
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "set_fee_bps"),
230
- typeArguments: [this.coinType],
280
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "set_fee_bps"),
281
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
231
282
  arguments: [
232
- tx.object(this.oftObjectId),
233
- tx.object(__privateMethod(this, _OFT_instances, adminCapId_fn).call(this)),
283
+ tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)),
284
+ tx.object(await __privateMethod(this, _OFT_instances, adminCapId_fn).call(this)),
234
285
  asU32(tx, dstEid),
235
286
  asU64(tx, feeBps)
236
287
  ]
@@ -241,11 +292,11 @@ var OFT = class {
241
292
  * @param tx - The transaction to add the move call to
242
293
  * @param dstEid - Destination endpoint ID
243
294
  */
244
- unsetFeeBpsMoveCall(tx, dstEid) {
295
+ async unsetFeeBpsMoveCall(tx, dstEid) {
245
296
  tx.moveCall({
246
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "unset_fee_bps"),
247
- typeArguments: [this.coinType],
248
- arguments: [tx.object(this.oftObjectId), tx.object(__privateMethod(this, _OFT_instances, adminCapId_fn).call(this)), asU32(tx, dstEid)]
297
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "unset_fee_bps"),
298
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
299
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)), tx.object(await __privateMethod(this, _OFT_instances, adminCapId_fn).call(this)), asU32(tx, dstEid)]
249
300
  });
250
301
  }
251
302
  // ==========================================
@@ -258,11 +309,11 @@ var OFT = class {
258
309
  * @param migrationCap - Migration capability object ID or transaction argument
259
310
  * @returns TransactionResult containing the migration ticket
260
311
  */
261
- migrateMoveCall(tx, migrationCap) {
312
+ async migrateMoveCall(tx, migrationCap) {
262
313
  return tx.moveCall({
263
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "migrate"),
264
- typeArguments: [this.coinType],
265
- arguments: [tx.object(this.oftObjectId), asObject(tx, migrationCap)]
314
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "migrate"),
315
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
316
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)), asObject(tx, migrationCap)]
266
317
  });
267
318
  }
268
319
  // ==========================================
@@ -277,13 +328,13 @@ var OFT = class {
277
328
  * @param rateLimit - Rate limit amount
278
329
  * @param windowSeconds - Time window in seconds
279
330
  */
280
- setRateLimitMoveCall(tx, eid, inbound, rateLimit, windowSeconds) {
331
+ async setRateLimitMoveCall(tx, eid, inbound, rateLimit, windowSeconds) {
281
332
  tx.moveCall({
282
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "set_rate_limit"),
283
- typeArguments: [this.coinType],
333
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "set_rate_limit"),
334
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
284
335
  arguments: [
285
- tx.object(this.oftObjectId),
286
- tx.object(__privateMethod(this, _OFT_instances, adminCapId_fn).call(this)),
336
+ tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)),
337
+ tx.object(await __privateMethod(this, _OFT_instances, adminCapId_fn).call(this)),
287
338
  asU32(tx, eid),
288
339
  asBool(tx, inbound),
289
340
  asU64(tx, rateLimit),
@@ -298,13 +349,13 @@ var OFT = class {
298
349
  * @param eid - Endpoint ID
299
350
  * @param inbound - Whether this is for inbound or outbound transfers
300
351
  */
301
- unsetRateLimitMoveCall(tx, eid, inbound) {
352
+ async unsetRateLimitMoveCall(tx, eid, inbound) {
302
353
  tx.moveCall({
303
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "unset_rate_limit"),
304
- typeArguments: [this.coinType],
354
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "unset_rate_limit"),
355
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
305
356
  arguments: [
306
- tx.object(this.oftObjectId),
307
- tx.object(__privateMethod(this, _OFT_instances, adminCapId_fn).call(this)),
357
+ tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)),
358
+ tx.object(await __privateMethod(this, _OFT_instances, adminCapId_fn).call(this)),
308
359
  asU32(tx, eid),
309
360
  asBool(tx, inbound)
310
361
  ]
@@ -325,7 +376,7 @@ var OFT = class {
325
376
  * @throws Error if insufficient coins balance or no coins found
326
377
  */
327
378
  async splitCoinMoveCall(tx, owner, amount, limit = 200, pageSize = 50) {
328
- return this.protocolSDK.getUtils().splitCoinMoveCall(tx, this.coinType, owner, amount, limit, pageSize);
379
+ return this.protocolSDK.getUtils().splitCoinMoveCall(tx, await __privateMethod(this, _OFT_instances, coinType_fn).call(this), owner, amount, limit, pageSize);
329
380
  }
330
381
  /**
331
382
  * Send OFT tokens to destination chain
@@ -336,18 +387,20 @@ var OFT = class {
336
387
  * @param nativeFee - Native token fee amount
337
388
  * @param zroFee - ZRO token fee amount
338
389
  * @param refundAddress - Address for fee refunds
339
- * @returns Promise<TransactionResult> - Transaction result containing send operation and receipt objects
390
+ * @param validators - Optional PTB validators for transaction validation
391
+ * @param maxSimulationTimes - Optional maximum number of simulation attempts
392
+ * @returns Promise<void> - Completes when the send operation is processed
340
393
  */
341
394
  async sendMoveCall(tx, sender, sendParam, coinProvided, nativeFee, zroFee, refundAddress, validators, maxSimulationTimes) {
342
- const sendParamArg = isTransactionArgument(sendParam) ? sendParam : __privateMethod(this, _OFT_instances, buildSendParam_fn).call(this, tx, sendParam);
343
- const txSender = this.txSenderMoveCall(tx);
395
+ const sendParamArg = isTransactionArgument(sendParam) ? sendParam : await __privateMethod(this, _OFT_instances, buildSendParam_fn).call(this, tx, sendParam);
396
+ const txSender = await this.txSenderMoveCall(tx);
344
397
  const addressArg = isTransactionArgument(refundAddress) ? refundAddress : tx.pure.option("address", refundAddress);
345
398
  const transactionResult = tx.moveCall({
346
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "send"),
347
- typeArguments: [this.coinType],
399
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "send"),
400
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
348
401
  arguments: [
349
- tx.object(this.oftObjectId),
350
- tx.object(__privateMethod(this, _OFT_instances, oappObjectId_fn).call(this)),
402
+ tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)),
403
+ tx.object(await __privateMethod(this, _OFT_instances, oappObjectId_fn).call(this)),
351
404
  txSender,
352
405
  sendParamArg,
353
406
  asObject(tx, coinProvided),
@@ -371,11 +424,11 @@ var OFT = class {
371
424
  maxSimulationTimes
372
425
  );
373
426
  const confirmSendResult = tx.moveCall({
374
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "confirm_send"),
375
- typeArguments: [this.coinType],
427
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "confirm_send"),
428
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
376
429
  arguments: [
377
- tx.object(this.oftObjectId),
378
- tx.object(__privateMethod(this, _OFT_instances, oappObjectId_fn).call(this)),
430
+ tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)),
431
+ tx.object(await __privateMethod(this, _OFT_instances, oappObjectId_fn).call(this)),
379
432
  txSender,
380
433
  endpointCall,
381
434
  oftSendContext
@@ -400,13 +453,13 @@ var OFT = class {
400
453
  * @param call - LayerZero receive call containing the verified cross-chain message
401
454
  * @returns TransactionResult containing the processed transfer
402
455
  */
403
- lzReceiveMoveCall(tx, call) {
456
+ async lzReceiveMoveCall(tx, call) {
404
457
  return tx.moveCall({
405
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "lz_receive"),
406
- typeArguments: [this.coinType],
458
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "lz_receive"),
459
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
407
460
  arguments: [
408
- tx.object(this.oftObjectId),
409
- tx.object(__privateMethod(this, _OFT_instances, oappObjectId_fn).call(this)),
461
+ tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)),
462
+ tx.object(await __privateMethod(this, _OFT_instances, oappObjectId_fn).call(this)),
410
463
  asObject(tx, call),
411
464
  tx.object.clock()
412
465
  ]
@@ -420,13 +473,13 @@ var OFT = class {
420
473
  * @param call - LayerZero receive call containing the verified cross-chain message
421
474
  * @returns TransactionResult containing the processed transfer
422
475
  */
423
- lzReceiveWithComposeMoveCall(tx, composeQueue, composerManager, call) {
476
+ async lzReceiveWithComposeMoveCall(tx, composeQueue, composerManager, call) {
424
477
  return tx.moveCall({
425
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "lz_receive_with_compose"),
426
- typeArguments: [this.coinType],
478
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "lz_receive_with_compose"),
479
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
427
480
  arguments: [
428
- tx.object(this.oftObjectId),
429
- tx.object(__privateMethod(this, _OFT_instances, oappObjectId_fn).call(this)),
481
+ tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)),
482
+ tx.object(await __privateMethod(this, _OFT_instances, oappObjectId_fn).call(this)),
430
483
  asObject(tx, composeQueue),
431
484
  asObject(tx, composerManager),
432
485
  asObject(tx, call),
@@ -440,11 +493,15 @@ var OFT = class {
440
493
  * @param call - Completed Call object from quote_send() execution
441
494
  * @returns TransactionResult containing the messaging fee
442
495
  */
443
- confirmQuoteSendMoveCall(tx, call) {
496
+ async confirmQuoteSendMoveCall(tx, call) {
444
497
  return tx.moveCall({
445
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "confirm_quote_send"),
446
- typeArguments: [this.coinType],
447
- arguments: [tx.object(this.oftObjectId), tx.object(__privateMethod(this, _OFT_instances, oappObjectId_fn).call(this)), asObject(tx, call)]
498
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "confirm_quote_send"),
499
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
500
+ arguments: [
501
+ tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)),
502
+ tx.object(await __privateMethod(this, _OFT_instances, oappObjectId_fn).call(this)),
503
+ asObject(tx, call)
504
+ ]
448
505
  });
449
506
  }
450
507
  // ==========================================
@@ -459,12 +516,12 @@ var OFT = class {
459
516
  async quoteOft(sendParam) {
460
517
  return executeSimulate(
461
518
  this.client,
462
- (tx) => {
463
- const sendParamArg = isTransactionArgument(sendParam) ? sendParam : __privateMethod(this, _OFT_instances, buildSendParam_fn).call(this, tx, sendParam);
519
+ async (tx) => {
520
+ const sendParamArg = isTransactionArgument(sendParam) ? sendParam : await __privateMethod(this, _OFT_instances, buildSendParam_fn).call(this, tx, sendParam);
464
521
  tx.moveCall({
465
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "quote_oft"),
466
- typeArguments: [this.coinType],
467
- arguments: [tx.object(this.oftObjectId), sendParamArg, tx.object.clock()]
522
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "quote_oft"),
523
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
524
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)), sendParamArg, tx.object.clock()]
468
525
  });
469
526
  },
470
527
  (result) => {
@@ -481,17 +538,19 @@ var OFT = class {
481
538
  * @param sender - Sender address
482
539
  * @param sendParam - Send parameters for the OFT operation
483
540
  * @param payInZro - Whether to pay in ZRO tokens
541
+ * @param validators - Optional PTB validators for transaction validation
542
+ * @param maxSimulationTimes - Optional maximum number of simulation attempts
484
543
  * @returns Promise<MessagingFee> - The calculated messaging fees
485
544
  */
486
545
  async quoteSend(sender, sendParam, payInZro, validators, maxSimulationTimes) {
487
546
  const tx = new Transaction();
488
- const sendParamArg = isTransactionArgument(sendParam) ? sendParam : __privateMethod(this, _OFT_instances, buildSendParam_fn).call(this, tx, sendParam);
547
+ const sendParamArg = isTransactionArgument(sendParam) ? sendParam : await __privateMethod(this, _OFT_instances, buildSendParam_fn).call(this, tx, sendParam);
489
548
  const quoteCall = tx.moveCall({
490
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "quote_send"),
491
- typeArguments: [this.coinType],
549
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "quote_send"),
550
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
492
551
  arguments: [
493
- tx.object(this.oftObjectId),
494
- tx.object(__privateMethod(this, _OFT_instances, oappObjectId_fn).call(this)),
552
+ tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)),
553
+ tx.object(await __privateMethod(this, _OFT_instances, oappObjectId_fn).call(this)),
495
554
  asAddress(tx, sender),
496
555
  sendParamArg,
497
556
  asBool(tx, payInZro)
@@ -508,11 +567,11 @@ var OFT = class {
508
567
  * @param tx - The transaction to add the move call to
509
568
  * @returns Transaction result containing the upgrade version
510
569
  */
511
- upgradeVersionMoveCall(tx) {
570
+ async upgradeVersionMoveCall(tx) {
512
571
  return tx.moveCall({
513
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "upgrade_version"),
514
- typeArguments: [this.coinType],
515
- arguments: [tx.object(this.oftObjectId)]
572
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "upgrade_version"),
573
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
574
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this))]
516
575
  });
517
576
  }
518
577
  /**
@@ -522,8 +581,8 @@ var OFT = class {
522
581
  async upgradeVersion() {
523
582
  return executeSimulate(
524
583
  this.client,
525
- (tx) => {
526
- this.upgradeVersionMoveCall(tx);
584
+ async (tx) => {
585
+ await this.upgradeVersionMoveCall(tx);
527
586
  },
528
587
  (result) => BigInt(bcs.U64.parse(result[0].value))
529
588
  );
@@ -533,11 +592,11 @@ var OFT = class {
533
592
  * @param tx - The transaction to add the move call to
534
593
  * @returns Transaction result containing the OApp object address
535
594
  */
536
- oappObjectMoveCall(tx) {
595
+ async oappObjectMoveCall(tx) {
537
596
  return tx.moveCall({
538
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "oapp_object"),
539
- typeArguments: [this.coinType],
540
- arguments: [tx.object(this.oftObjectId)]
597
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "oapp_object"),
598
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
599
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this))]
541
600
  });
542
601
  }
543
602
  /**
@@ -547,8 +606,8 @@ var OFT = class {
547
606
  async oappObject() {
548
607
  return executeSimulate(
549
608
  this.client,
550
- (tx) => {
551
- this.oappObjectMoveCall(tx);
609
+ async (tx) => {
610
+ await this.oappObjectMoveCall(tx);
552
611
  },
553
612
  (result) => bcs.Address.parse(result[0].value)
554
613
  );
@@ -558,11 +617,11 @@ var OFT = class {
558
617
  * @param tx - The transaction to add the move call to
559
618
  * @returns Transaction result containing version information
560
619
  */
561
- oftVersionMoveCall(tx) {
620
+ async oftVersionMoveCall(tx) {
562
621
  return tx.moveCall({
563
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "oft_version"),
564
- typeArguments: [this.coinType],
565
- arguments: [tx.object(this.oftObjectId)]
622
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "oft_version"),
623
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
624
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this))]
566
625
  });
567
626
  }
568
627
  /**
@@ -572,8 +631,8 @@ var OFT = class {
572
631
  async oftVersion() {
573
632
  return executeSimulate(
574
633
  this.client,
575
- (tx) => {
576
- this.oftVersionMoveCall(tx);
634
+ async (tx) => {
635
+ await this.oftVersionMoveCall(tx);
577
636
  },
578
637
  (result) => {
579
638
  const major = Number(bcs.U64.parse(result[0].value));
@@ -582,17 +641,28 @@ var OFT = class {
582
641
  }
583
642
  );
584
643
  }
585
- oftCapIdMoveCall(tx) {
644
+ /**
645
+ * Get the OFT capability ID
646
+ * @param tx - The transaction to add the move call to
647
+ * @returns Transaction result containing the OFT capability ID
648
+ */
649
+ async oftCapIdMoveCall(tx) {
586
650
  return tx.moveCall({
587
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "oft_cap_id"),
588
- typeArguments: [this.coinType],
589
- arguments: [tx.object(this.oftObjectId)]
651
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "oft_cap_id"),
652
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
653
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this))]
590
654
  });
591
655
  }
656
+ /**
657
+ * Get the OFT capability ID
658
+ * @returns Promise<string> - The OFT capability ID
659
+ */
592
660
  async oftCapId() {
593
661
  return executeSimulate(
594
662
  this.client,
595
- (tx) => this.oftCapIdMoveCall(tx),
663
+ async (tx) => {
664
+ await this.oftCapIdMoveCall(tx);
665
+ },
596
666
  (result) => bcs.Address.parse(result[0].value)
597
667
  );
598
668
  }
@@ -601,11 +671,11 @@ var OFT = class {
601
671
  * @param tx - The transaction to add the move call to
602
672
  * @returns Transaction result containing the migration capability address
603
673
  */
604
- migrationCapMoveCall(tx) {
674
+ async migrationCapMoveCall(tx) {
605
675
  return tx.moveCall({
606
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "migration_cap"),
607
- typeArguments: [this.coinType],
608
- arguments: [tx.object(this.oftObjectId)]
676
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "migration_cap"),
677
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
678
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this))]
609
679
  });
610
680
  }
611
681
  /**
@@ -615,8 +685,8 @@ var OFT = class {
615
685
  async migrationCap() {
616
686
  return executeSimulate(
617
687
  this.client,
618
- (tx) => {
619
- this.migrationCapMoveCall(tx);
688
+ async (tx) => {
689
+ await this.migrationCapMoveCall(tx);
620
690
  },
621
691
  (result) => bcs.Address.parse(result[0].value)
622
692
  );
@@ -624,8 +694,8 @@ var OFT = class {
624
694
  async messagingChannel() {
625
695
  return executeSimulate(
626
696
  this.client,
627
- (tx) => {
628
- const oftCapId = this.oftCapIdMoveCall(tx);
697
+ async (tx) => {
698
+ const oftCapId = await this.oftCapIdMoveCall(tx);
629
699
  this.protocolSDK.getEndpoint().getMessagingChannelMoveCall(tx, oftCapId);
630
700
  },
631
701
  (result) => bcs.Address.parse(result[0].value)
@@ -636,11 +706,11 @@ var OFT = class {
636
706
  * @param tx - The transaction to add the move call to
637
707
  * @returns Transaction result containing coin metadata address
638
708
  */
639
- coinMetadataMoveCall(tx) {
709
+ async coinMetadataMoveCall(tx) {
640
710
  return tx.moveCall({
641
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "coin_metadata"),
642
- typeArguments: [this.coinType],
643
- arguments: [tx.object(this.oftObjectId)]
711
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "coin_metadata"),
712
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
713
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this))]
644
714
  });
645
715
  }
646
716
  /**
@@ -650,8 +720,8 @@ var OFT = class {
650
720
  async coinMetadata() {
651
721
  return executeSimulate(
652
722
  this.client,
653
- (tx) => {
654
- this.coinMetadataMoveCall(tx);
723
+ async (tx) => {
724
+ await this.coinMetadataMoveCall(tx);
655
725
  },
656
726
  (result) => bcs.Address.parse(result[0].value)
657
727
  );
@@ -661,11 +731,11 @@ var OFT = class {
661
731
  * @param tx - The transaction to add the move call to
662
732
  * @returns Transaction result containing the admin capability address
663
733
  */
664
- adminCapMoveCall(tx) {
734
+ async adminCapMoveCall(tx) {
665
735
  return tx.moveCall({
666
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "admin_cap"),
667
- typeArguments: [this.coinType],
668
- arguments: [tx.object(this.oftObjectId)]
736
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "admin_cap"),
737
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
738
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this))]
669
739
  });
670
740
  }
671
741
  /**
@@ -675,8 +745,8 @@ var OFT = class {
675
745
  async adminCap() {
676
746
  return executeSimulate(
677
747
  this.client,
678
- (tx) => {
679
- this.adminCapMoveCall(tx);
748
+ async (tx) => {
749
+ await this.adminCapMoveCall(tx);
680
750
  },
681
751
  (result) => bcs.Address.parse(result[0].value)
682
752
  );
@@ -686,11 +756,11 @@ var OFT = class {
686
756
  * @param tx - The transaction to add the move call to
687
757
  * @returns Transaction result containing shared decimals
688
758
  */
689
- sharedDecimalsMoveCall(tx) {
759
+ async sharedDecimalsMoveCall(tx) {
690
760
  return tx.moveCall({
691
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "shared_decimals"),
692
- typeArguments: [this.coinType],
693
- arguments: [tx.object(this.oftObjectId)]
761
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "shared_decimals"),
762
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
763
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this))]
694
764
  });
695
765
  }
696
766
  /**
@@ -700,8 +770,8 @@ var OFT = class {
700
770
  async sharedDecimals() {
701
771
  return executeSimulate(
702
772
  this.client,
703
- (tx) => {
704
- this.sharedDecimalsMoveCall(tx);
773
+ async (tx) => {
774
+ await this.sharedDecimalsMoveCall(tx);
705
775
  },
706
776
  (result) => bcs.U8.parse(result[0].value)
707
777
  );
@@ -711,11 +781,11 @@ var OFT = class {
711
781
  * @param tx - The transaction to add the move call to
712
782
  * @returns Transaction result containing the decimal conversion rate
713
783
  */
714
- decimalConversionRateMoveCall(tx) {
784
+ async decimalConversionRateMoveCall(tx) {
715
785
  return tx.moveCall({
716
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "decimal_conversion_rate"),
717
- typeArguments: [this.coinType],
718
- arguments: [tx.object(this.oftObjectId)]
786
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "decimal_conversion_rate"),
787
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
788
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this))]
719
789
  });
720
790
  }
721
791
  /**
@@ -725,8 +795,8 @@ var OFT = class {
725
795
  async decimalConversionRate() {
726
796
  return executeSimulate(
727
797
  this.client,
728
- (tx) => {
729
- this.decimalConversionRateMoveCall(tx);
798
+ async (tx) => {
799
+ await this.decimalConversionRateMoveCall(tx);
730
800
  },
731
801
  (result) => BigInt(bcs.U64.parse(result[0].value))
732
802
  );
@@ -736,11 +806,11 @@ var OFT = class {
736
806
  * @param tx - The transaction to add the move call to
737
807
  * @returns Transaction result containing the paused status
738
808
  */
739
- isPausedMoveCall(tx) {
809
+ async isPausedMoveCall(tx) {
740
810
  return tx.moveCall({
741
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "is_paused"),
742
- typeArguments: [this.coinType],
743
- arguments: [tx.object(this.oftObjectId)]
811
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "is_paused"),
812
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
813
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this))]
744
814
  });
745
815
  }
746
816
  /**
@@ -750,8 +820,8 @@ var OFT = class {
750
820
  async isPaused() {
751
821
  return executeSimulate(
752
822
  this.client,
753
- (tx) => {
754
- this.isPausedMoveCall(tx);
823
+ async (tx) => {
824
+ await this.isPausedMoveCall(tx);
755
825
  },
756
826
  (result) => bcs.Bool.parse(result[0].value)
757
827
  );
@@ -761,11 +831,11 @@ var OFT = class {
761
831
  * @param tx - The transaction to add the move call to
762
832
  * @returns Transaction result containing the adapter status
763
833
  */
764
- isAdapterMoveCall(tx) {
834
+ async isAdapterMoveCall(tx) {
765
835
  return tx.moveCall({
766
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "is_adapter"),
767
- typeArguments: [this.coinType],
768
- arguments: [tx.object(this.oftObjectId)]
836
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "is_adapter"),
837
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
838
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this))]
769
839
  });
770
840
  }
771
841
  /**
@@ -775,12 +845,38 @@ var OFT = class {
775
845
  async isAdapter() {
776
846
  return executeSimulate(
777
847
  this.client,
778
- (tx) => {
779
- this.isAdapterMoveCall(tx);
848
+ async (tx) => {
849
+ await this.isAdapterMoveCall(tx);
780
850
  },
781
851
  (result) => bcs.Bool.parse(result[0].value)
782
852
  );
783
853
  }
854
+ /**
855
+ * Decode OFTInfoV1 from encoded bytes
856
+ * @param tx - The transaction to add the move call to
857
+ * @param encodedBytes - The encoded OFTInfoV1 bytes to decode
858
+ * @returns Transaction result containing the decoded OFTInfoV1
859
+ */
860
+ decodeOftInfoV1MoveCall(tx, encodedBytes) {
861
+ return tx.moveCall({
862
+ target: `${this.oftCallCapId}::oft_info_v1::decode`,
863
+ arguments: [asBytes(tx, encodedBytes)]
864
+ });
865
+ }
866
+ /**
867
+ * Decode OFTInfoV1 from encoded bytes
868
+ * @param encodedBytes - The encoded OFTInfoV1 bytes to decode
869
+ * @returns Promise<OFTInfoV1> - The decoded OFTInfoV1 structure
870
+ */
871
+ async decodeOftInfoV1(encodedBytes) {
872
+ return executeSimulate(
873
+ this.client,
874
+ (tx) => {
875
+ this.decodeOftInfoV1MoveCall(tx, encodedBytes);
876
+ },
877
+ (result) => parseOFTInfoV1(result[0].value)
878
+ );
879
+ }
784
880
  // ==========================================
785
881
  // FEE VIEW FUNCTIONS
786
882
  // ==========================================
@@ -791,11 +887,11 @@ var OFT = class {
791
887
  * @param dstEid - Destination endpoint ID
792
888
  * @returns Transaction result containing whether fee exists
793
889
  */
794
- hasOftFeeMoveCall(tx, dstEid) {
890
+ async hasOftFeeMoveCall(tx, dstEid) {
795
891
  return tx.moveCall({
796
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "has_oft_fee"),
797
- typeArguments: [this.coinType],
798
- arguments: [tx.object(this.oftObjectId), asU32(tx, dstEid)]
892
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "has_oft_fee"),
893
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
894
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)), asU32(tx, dstEid)]
799
895
  });
800
896
  }
801
897
  /**
@@ -806,8 +902,8 @@ var OFT = class {
806
902
  async hasOftFee(dstEid) {
807
903
  return executeSimulate(
808
904
  this.client,
809
- (tx) => {
810
- this.hasOftFeeMoveCall(tx, dstEid);
905
+ async (tx) => {
906
+ await this.hasOftFeeMoveCall(tx, dstEid);
811
907
  },
812
908
  (result) => bcs.Bool.parse(result[0].value)
813
909
  );
@@ -818,11 +914,11 @@ var OFT = class {
818
914
  * @param dstEid - Destination endpoint ID
819
915
  * @returns Transaction result containing the effective fee basis points
820
916
  */
821
- effectiveFeeBpsMoveCall(tx, dstEid) {
917
+ async effectiveFeeBpsMoveCall(tx, dstEid) {
822
918
  return tx.moveCall({
823
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "effective_fee_bps"),
824
- typeArguments: [this.coinType],
825
- arguments: [tx.object(this.oftObjectId), asU32(tx, dstEid)]
919
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "effective_fee_bps"),
920
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
921
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)), asU32(tx, dstEid)]
826
922
  });
827
923
  }
828
924
  /**
@@ -833,8 +929,8 @@ var OFT = class {
833
929
  async effectiveFeeBps(dstEid) {
834
930
  return executeSimulate(
835
931
  this.client,
836
- (tx) => {
837
- this.effectiveFeeBpsMoveCall(tx, dstEid);
932
+ async (tx) => {
933
+ await this.effectiveFeeBpsMoveCall(tx, dstEid);
838
934
  },
839
935
  (result) => BigInt(bcs.U64.parse(result[0].value))
840
936
  );
@@ -844,11 +940,11 @@ var OFT = class {
844
940
  * @param tx - The transaction to add the move call to
845
941
  * @returns Transaction result containing the default fee basis points
846
942
  */
847
- defaultFeeBpsMoveCall(tx) {
943
+ async defaultFeeBpsMoveCall(tx) {
848
944
  return tx.moveCall({
849
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "default_fee_bps"),
850
- typeArguments: [this.coinType],
851
- arguments: [tx.object(this.oftObjectId)]
945
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "default_fee_bps"),
946
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
947
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this))]
852
948
  });
853
949
  }
854
950
  /**
@@ -858,8 +954,8 @@ var OFT = class {
858
954
  async defaultFeeBps() {
859
955
  return executeSimulate(
860
956
  this.client,
861
- (tx) => {
862
- this.defaultFeeBpsMoveCall(tx);
957
+ async (tx) => {
958
+ await this.defaultFeeBpsMoveCall(tx);
863
959
  },
864
960
  (result) => BigInt(bcs.U64.parse(result[0].value))
865
961
  );
@@ -870,11 +966,11 @@ var OFT = class {
870
966
  * @param dstEid - Destination endpoint ID
871
967
  * @returns Transaction result containing the fee basis points
872
968
  */
873
- feeBpsMoveCall(tx, dstEid) {
969
+ async feeBpsMoveCall(tx, dstEid) {
874
970
  return tx.moveCall({
875
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "fee_bps"),
876
- typeArguments: [this.coinType],
877
- arguments: [tx.object(this.oftObjectId), asU32(tx, dstEid)]
971
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "fee_bps"),
972
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
973
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)), asU32(tx, dstEid)]
878
974
  });
879
975
  }
880
976
  /**
@@ -885,8 +981,8 @@ var OFT = class {
885
981
  async feeBps(dstEid) {
886
982
  return executeSimulate(
887
983
  this.client,
888
- (tx) => {
889
- this.feeBpsMoveCall(tx, dstEid);
984
+ async (tx) => {
985
+ await this.feeBpsMoveCall(tx, dstEid);
890
986
  },
891
987
  (result) => BigInt(bcs.U64.parse(result[0].value))
892
988
  );
@@ -896,11 +992,11 @@ var OFT = class {
896
992
  * @param tx - The transaction to add the move call to
897
993
  * @returns Transaction result containing the fee deposit address
898
994
  */
899
- feeDepositAddressMoveCall(tx) {
995
+ async feeDepositAddressMoveCall(tx) {
900
996
  return tx.moveCall({
901
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "fee_deposit_address"),
902
- typeArguments: [this.coinType],
903
- arguments: [tx.object(this.oftObjectId)]
997
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "fee_deposit_address"),
998
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
999
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this))]
904
1000
  });
905
1001
  }
906
1002
  /**
@@ -910,8 +1006,8 @@ var OFT = class {
910
1006
  async feeDepositAddress() {
911
1007
  return executeSimulate(
912
1008
  this.client,
913
- (tx) => {
914
- this.feeDepositAddressMoveCall(tx);
1009
+ async (tx) => {
1010
+ await this.feeDepositAddressMoveCall(tx);
915
1011
  },
916
1012
  (result) => bcs.Address.parse(result[0].value)
917
1013
  );
@@ -927,11 +1023,11 @@ var OFT = class {
927
1023
  * @param inbound - Whether this is for inbound or outbound transfers
928
1024
  * @returns Transaction result containing rate limit configuration
929
1025
  */
930
- rateLimitConfigMoveCall(tx, eid, inbound) {
1026
+ async rateLimitConfigMoveCall(tx, eid, inbound) {
931
1027
  return tx.moveCall({
932
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "rate_limit_config"),
933
- typeArguments: [this.coinType],
934
- arguments: [tx.object(this.oftObjectId), asU32(tx, eid), asBool(tx, inbound)]
1028
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "rate_limit_config"),
1029
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
1030
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)), asU32(tx, eid), asBool(tx, inbound)]
935
1031
  });
936
1032
  }
937
1033
  /**
@@ -943,8 +1039,8 @@ var OFT = class {
943
1039
  async rateLimitConfig(eid, inbound) {
944
1040
  return executeSimulate(
945
1041
  this.client,
946
- (tx) => {
947
- this.rateLimitConfigMoveCall(tx, eid, inbound);
1042
+ async (tx) => {
1043
+ await this.rateLimitConfigMoveCall(tx, eid, inbound);
948
1044
  },
949
1045
  (result) => {
950
1046
  const limit = BigInt(bcs.U64.parse(result[0].value));
@@ -960,11 +1056,11 @@ var OFT = class {
960
1056
  * @param inbound - Whether this is for inbound or outbound transfers
961
1057
  * @returns Transaction result containing in-flight amount
962
1058
  */
963
- rateLimitInFlightMoveCall(tx, eid, inbound) {
1059
+ async rateLimitInFlightMoveCall(tx, eid, inbound) {
964
1060
  return tx.moveCall({
965
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "rate_limit_in_flight"),
966
- typeArguments: [this.coinType],
967
- arguments: [tx.object(this.oftObjectId), asU32(tx, eid), asBool(tx, inbound), tx.object.clock()]
1061
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "rate_limit_in_flight"),
1062
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
1063
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)), asU32(tx, eid), asBool(tx, inbound), tx.object.clock()]
968
1064
  });
969
1065
  }
970
1066
  /**
@@ -976,8 +1072,8 @@ var OFT = class {
976
1072
  async rateLimitInFlight(eid, inbound) {
977
1073
  return executeSimulate(
978
1074
  this.client,
979
- (tx) => {
980
- this.rateLimitInFlightMoveCall(tx, eid, inbound);
1075
+ async (tx) => {
1076
+ await this.rateLimitInFlightMoveCall(tx, eid, inbound);
981
1077
  },
982
1078
  (result) => BigInt(bcs.U64.parse(result[0].value))
983
1079
  );
@@ -989,11 +1085,11 @@ var OFT = class {
989
1085
  * @param inbound - Whether this is for inbound or outbound transfers
990
1086
  * @returns Transaction result containing rate limit capacity
991
1087
  */
992
- rateLimitCapacityMoveCall(tx, eid, inbound) {
1088
+ async rateLimitCapacityMoveCall(tx, eid, inbound) {
993
1089
  return tx.moveCall({
994
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "rate_limit_capacity"),
995
- typeArguments: [this.coinType],
996
- arguments: [tx.object(this.oftObjectId), asU32(tx, eid), asBool(tx, inbound), tx.object.clock()]
1090
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "rate_limit_capacity"),
1091
+ typeArguments: [await __privateMethod(this, _OFT_instances, coinType_fn).call(this)],
1092
+ arguments: [tx.object(await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this)), asU32(tx, eid), asBool(tx, inbound), tx.object.clock()]
997
1093
  });
998
1094
  }
999
1095
  /**
@@ -1005,8 +1101,8 @@ var OFT = class {
1005
1101
  async rateLimitCapacity(eid, inbound) {
1006
1102
  return executeSimulate(
1007
1103
  this.client,
1008
- (tx) => {
1009
- this.rateLimitCapacityMoveCall(tx, eid, inbound);
1104
+ async (tx) => {
1105
+ await this.rateLimitCapacityMoveCall(tx, eid, inbound);
1010
1106
  },
1011
1107
  (result) => BigInt(bcs.U64.parse(result[0].value))
1012
1108
  );
@@ -1014,27 +1110,21 @@ var OFT = class {
1014
1110
  // ==========================================
1015
1111
  // OFT SENDER
1016
1112
  // ==========================================
1017
- txSenderMoveCall(tx) {
1113
+ /**
1114
+ * Create a transaction sender object for OFT operations
1115
+ * @param tx - The transaction to add the move call to
1116
+ * @returns Transaction result containing the transaction sender object
1117
+ */
1118
+ async txSenderMoveCall(tx) {
1018
1119
  return tx.moveCall({
1019
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "tx_sender", OFT_SENDER_MODULE_NAME)
1120
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "tx_sender", OFT_SENDER_MODULE_NAME)
1020
1121
  });
1021
1122
  }
1022
1123
  };
1023
1124
  _OFT_instances = new WeakSet();
1024
- // ==========================================
1025
- // PRIVATE HELPER FUNCTIONS
1026
- // ==========================================
1027
- // Internal utility functions for OFT operations
1028
- /**
1029
- * Build SendParam struct for OFT operations
1030
- * @param tx - The transaction to add the move call to
1031
- * @param param - Send parameters to build
1032
- * @returns Transaction result containing the SendParam struct
1033
- * @private
1034
- */
1035
- buildSendParam_fn = function(tx, param) {
1125
+ buildSendParam_fn = async function(tx, param) {
1036
1126
  return tx.moveCall({
1037
- target: __privateMethod(this, _OFT_instances, target_fn).call(this, "create", "send_param"),
1127
+ target: await __privateMethod(this, _OFT_instances, target_fn).call(this, "create", "send_param"),
1038
1128
  arguments: [
1039
1129
  asU32(tx, param.dstEid),
1040
1130
  asBytes32(tx, param.to, this.protocolSDK.getUtils()),
@@ -1046,40 +1136,74 @@ buildSendParam_fn = function(tx, param) {
1046
1136
  ]
1047
1137
  });
1048
1138
  };
1049
- /**
1050
- * Generate the full target path for move calls
1051
- * @param name - The function name to call
1052
- * @param module_name - The module name (defaults to 'oft')
1053
- * @returns The full module path for the move call
1054
- * @private
1055
- */
1056
- target_fn = function(name, module_name = MODULE_NAME) {
1057
- return `${this.oftPackageId}::${module_name}::${name}`;
1139
+ target_fn = async function(name, module_name = MODULE_NAME) {
1140
+ return `${await __privateMethod(this, _OFT_instances, oftPackageId_fn).call(this)}::${module_name}::${name}`;
1058
1141
  };
1059
- /**
1060
- * Get the OApp object ID, throwing an error if not available
1061
- * @returns The OApp object ID
1062
- * @throws Error if OApp object ID was not set
1063
- * @private
1064
- */
1065
- oappObjectId_fn = function() {
1066
- if (this.oappObjectId === "") {
1067
- throw new Error("OApp object ID not found");
1142
+ oappObjectId_fn = async function() {
1143
+ if (this.oappObjectId === void 0) {
1144
+ const oappSdk = this.protocolSDK.getOApp(this.oftCallCapId);
1145
+ const oappInfo = await oappSdk.getOAppInfoV1();
1146
+ this.oappObjectId = oappInfo.oapp_object;
1068
1147
  }
1069
1148
  return this.oappObjectId;
1070
1149
  };
1071
- /**
1072
- * Get the admin capability ID, throwing an error if not available
1073
- * @returns The admin capability ID
1074
- * @throws Error if admin capability ID was not provided during construction
1075
- * @private
1076
- */
1077
- adminCapId_fn = function() {
1150
+ oftObjectId_fn = async function() {
1151
+ if (this.oftObjectId === void 0) {
1152
+ const oftInfo = await __privateMethod(this, _OFT_instances, OftInfo_fn).call(this);
1153
+ this.oftObjectId = oftInfo.oftObject;
1154
+ }
1155
+ return this.oftObjectId;
1156
+ };
1157
+ adminCapId_fn = async function() {
1078
1158
  if (this.adminCapId === void 0) {
1079
- throw new Error("Admin cap ID not found");
1159
+ this.adminCapId = await this.adminCap();
1080
1160
  }
1081
1161
  return this.adminCapId;
1082
1162
  };
1163
+ coinType_fn = async function() {
1164
+ if (this.coinType === void 0) {
1165
+ const oftInfo = await this.client.getObject({
1166
+ id: await __privateMethod(this, _OFT_instances, oftObjectId_fn).call(this),
1167
+ options: {
1168
+ showContent: true
1169
+ }
1170
+ });
1171
+ const content = oftInfo.data?.content;
1172
+ if (content?.dataType !== "moveObject" || content.type == null || content.type.length === 0) {
1173
+ throw new Error("Invalid OFT object data or missing type field");
1174
+ }
1175
+ const typeStr = content.type;
1176
+ const angleBracketMatch = typeStr.match(/<([^>]+)>/);
1177
+ const coinType = angleBracketMatch?.[1];
1178
+ if (coinType === void 0 || coinType === "") {
1179
+ throw new Error("Failed to extract coinType from object type");
1180
+ }
1181
+ this.coinType = coinType;
1182
+ }
1183
+ return this.coinType;
1184
+ };
1185
+ OftInfo_fn = async function() {
1186
+ if (!this.oftInfo) {
1187
+ const oappSdk = this.protocolSDK.getOApp(this.oftCallCapId);
1188
+ this.oftInfo = await executeSimulate(
1189
+ this.client,
1190
+ (tx) => {
1191
+ const oappInfo = oappSdk.getOAppInfoV1MoveCall(tx);
1192
+ const extraInfo = oappSdk.getOAppInfoV1ExtraInfoMoveCall(tx, oappInfo);
1193
+ this.decodeOftInfoV1MoveCall(tx, extraInfo);
1194
+ },
1195
+ (result) => parseOFTInfoV1(result[0].value)
1196
+ );
1197
+ }
1198
+ return this.oftInfo;
1199
+ };
1200
+ oftPackageId_fn = async function() {
1201
+ if (this.oftPackageId === void 0) {
1202
+ const oftInfo = await __privateMethod(this, _OFT_instances, OftInfo_fn).call(this);
1203
+ this.oftPackageId = oftInfo.oftPackage;
1204
+ }
1205
+ return this.oftPackageId;
1206
+ };
1083
1207
  var OFTComposerManagerErrorCode = {
1084
1208
  // OFT Composer Manager related errors
1085
1209
  EComposeTransferNotFound: 1,
@@ -1183,6 +1307,6 @@ var OFTMsgType = {
1183
1307
  SEND_AND_CALL: 2
1184
1308
  };
1185
1309
 
1186
- export { OFT, OFTComposerManager, OFTComposerManagerErrorCode, OFTErrorCode, OFTFeeDetailBcs, OFTLimitBcs, OFTMsgType, OFTReceiptBcs, parseOFTFeeDetails, parseOFTLimit, parseOFTReceipt };
1310
+ export { OFT, OFTComposerManager, OFTComposerManagerErrorCode, OFTErrorCode, OFTFeeDetailBcs, OFTInfoV1Bcs, OFTLimitBcs, OFTMsgType, OFTReceiptBcs, parseOFTFeeDetails, parseOFTInfoV1, parseOFTLimit, parseOFTReceipt };
1187
1311
  //# sourceMappingURL=index.mjs.map
1188
1312
  //# sourceMappingURL=index.mjs.map