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

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