@layerzerolabs/lz-sui-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/CHANGELOG.md +8 -0
- package/deployments/sui-mainnet/blocked_message_lib.json +32 -32
- package/deployments/sui-mainnet/blocked_msglib_ptb_builder.json +32 -32
- package/deployments/sui-mainnet/call.json +20 -21
- package/deployments/sui-mainnet/counter.json +47 -47
- package/deployments/sui-mainnet/dvn.json +20 -19
- package/deployments/sui-mainnet/dvn_call_type.json +24 -24
- package/deployments/sui-mainnet/dvn_fee_lib.json +31 -31
- package/deployments/sui-mainnet/dvn_layerzero.json +25 -25
- package/deployments/sui-mainnet/dvn_ptb_builder.json +19 -19
- package/deployments/sui-mainnet/endpoint_ptb_builder.json +34 -34
- package/deployments/sui-mainnet/endpoint_v2.json +43 -43
- package/deployments/sui-mainnet/executor.json +20 -19
- package/deployments/sui-mainnet/executor_call_type.json +24 -24
- package/deployments/sui-mainnet/executor_fee_lib.json +25 -25
- package/deployments/sui-mainnet/executor_layerzero.json +32 -32
- package/deployments/sui-mainnet/executor_ptb_builder.json +19 -19
- package/deployments/sui-mainnet/layerzero_views.json +25 -25
- package/deployments/sui-mainnet/message_lib_common.json +25 -25
- package/deployments/sui-mainnet/msglib_ptb_builder_call_types.json +19 -19
- package/deployments/sui-mainnet/multi_call.json +45 -0
- package/deployments/sui-mainnet/oapp.json +27 -25
- package/deployments/sui-mainnet/object-BlockedMessageLib.json +5 -5
- package/deployments/sui-mainnet/object-BlockedMsglibPtbBuilder.json +5 -5
- package/deployments/sui-mainnet/object-Counter.json +5 -5
- package/deployments/sui-mainnet/object-CounterAdminCap.json +5 -5
- package/deployments/sui-mainnet/object-CounterOApp.json +5 -5
- package/deployments/sui-mainnet/object-DVN.json +2 -2
- package/deployments/sui-mainnet/object-DVNCap.json +5 -5
- package/deployments/sui-mainnet/object-DVNFeeLib.json +5 -5
- package/deployments/sui-mainnet/object-EndpointPtbBuilder.json +5 -5
- package/deployments/sui-mainnet/object-EndpointPtbBuilderAdminCap.json +5 -5
- package/deployments/sui-mainnet/object-EndpointV2.json +5 -5
- package/deployments/sui-mainnet/object-EndpointV2AdminCap.json +5 -5
- package/deployments/sui-mainnet/object-Executor.json +2 -2
- package/deployments/sui-mainnet/object-ExecutorCap.json +5 -5
- package/deployments/sui-mainnet/object-ExecutorFeeLib.json +5 -5
- package/deployments/sui-mainnet/object-ExecutorOwnerCap.json +2 -2
- package/deployments/sui-mainnet/object-PackageWhitelistValidator.json +5 -5
- package/deployments/sui-mainnet/object-PriceFeed.json +5 -5
- package/deployments/sui-mainnet/object-PriceFeedOwnerCap.json +5 -5
- package/deployments/sui-mainnet/object-SimpleMessageLib.json +5 -5
- package/deployments/sui-mainnet/object-SimpleMessageLibAdminCap.json +5 -5
- package/deployments/sui-mainnet/object-SmlPtbBuilder.json +5 -5
- package/deployments/sui-mainnet/object-Treasury.json +5 -5
- package/deployments/sui-mainnet/object-TreasuryAdminCap.json +5 -5
- package/deployments/sui-mainnet/object-ULN302.json +5 -5
- package/deployments/sui-mainnet/object-ULN302AdminCap.json +5 -5
- package/deployments/sui-mainnet/object-Uln302PtbBuilder.json +5 -5
- package/deployments/sui-mainnet/object-Uln302Verification.json +5 -5
- package/deployments/sui-mainnet/object-WorkerRegistry.json +9 -0
- package/deployments/sui-mainnet/object-ZroCoinMetadata.json +5 -5
- package/deployments/sui-mainnet/object-ZroTreasuryCap.json +5 -5
- package/deployments/sui-mainnet/package_whitelist_validator.json +54 -54
- package/deployments/sui-mainnet/price_feed.json +34 -34
- package/deployments/sui-mainnet/price_feed_call_types.json +24 -24
- package/deployments/sui-mainnet/ptb_move_call.json +19 -19
- package/deployments/sui-mainnet/simple_message_lib.json +39 -39
- package/deployments/sui-mainnet/simple_msglib_ptb_builder.json +32 -32
- package/deployments/sui-mainnet/treasury.json +40 -40
- package/deployments/sui-mainnet/uln_302.json +47 -51
- package/deployments/sui-mainnet/uln_302_ptb_builder.json +32 -32
- package/deployments/sui-mainnet/uln_common.json +49 -0
- package/deployments/sui-mainnet/utils.json +31 -24
- package/deployments/sui-mainnet/worker_common.json +21 -20
- package/deployments/sui-mainnet/worker_registry.json +58 -0
- package/deployments/sui-mainnet/zro.json +37 -37
- package/deployments/sui-sandbox-local/blocked_message_lib.json +19 -19
- package/deployments/sui-sandbox-local/blocked_msglib_ptb_builder.json +20 -20
- package/deployments/sui-sandbox-local/counter.json +60 -60
- package/deployments/sui-sandbox-local/dvn.json +22 -22
- package/deployments/sui-sandbox-local/dvn_call_type.json +28 -28
- package/deployments/sui-sandbox-local/dvn_fee_lib.json +27 -27
- package/deployments/sui-sandbox-local/dvn_layerzero.json +25 -25
- package/deployments/sui-sandbox-local/dvn_ptb_builder.json +21 -21
- package/deployments/sui-sandbox-local/endpoint_ptb_builder.json +24 -24
- package/deployments/sui-sandbox-local/executor.json +22 -22
- package/deployments/sui-sandbox-local/executor_call_type.json +21 -21
- package/deployments/sui-sandbox-local/executor_fee_lib.json +23 -23
- package/deployments/sui-sandbox-local/executor_layerzero.json +26 -26
- package/deployments/sui-sandbox-local/executor_ptb_builder.json +21 -21
- package/deployments/sui-sandbox-local/layerzero_views.json +10 -10
- package/deployments/sui-sandbox-local/msglib_ptb_builder_call_types.json +10 -10
- package/deployments/sui-sandbox-local/oapp.json +18 -18
- package/deployments/sui-sandbox-local/object-BlockedMessageLib.json +4 -4
- package/deployments/sui-sandbox-local/object-BlockedMsglibPtbBuilder.json +4 -4
- package/deployments/sui-sandbox-local/object-Counter.json +5 -5
- package/deployments/sui-sandbox-local/object-CounterAdminCap.json +5 -5
- package/deployments/sui-sandbox-local/object-CounterOApp.json +5 -5
- package/deployments/sui-sandbox-local/object-DVN.json +2 -2
- package/deployments/sui-sandbox-local/object-DVNCap.json +4 -4
- package/deployments/sui-sandbox-local/object-DVNFeeLib.json +5 -5
- package/deployments/sui-sandbox-local/object-EndpointPtbBuilder.json +4 -4
- package/deployments/sui-sandbox-local/object-EndpointPtbBuilderAdminCap.json +4 -4
- package/deployments/sui-sandbox-local/object-Executor.json +2 -2
- package/deployments/sui-sandbox-local/object-ExecutorCap.json +4 -4
- package/deployments/sui-sandbox-local/object-ExecutorFeeLib.json +5 -5
- package/deployments/sui-sandbox-local/object-ExecutorOwnerCap.json +1 -1
- package/deployments/sui-sandbox-local/object-PackageWhitelistValidator.json +4 -4
- package/deployments/sui-sandbox-local/object-PriceFeed.json +5 -5
- package/deployments/sui-sandbox-local/object-PriceFeedOwnerCap.json +5 -5
- package/deployments/sui-sandbox-local/object-SimpleMessageLib.json +4 -4
- package/deployments/sui-sandbox-local/object-SimpleMessageLibAdminCap.json +4 -4
- package/deployments/sui-sandbox-local/object-SmlPtbBuilder.json +4 -4
- package/deployments/sui-sandbox-local/object-Treasury.json +5 -5
- package/deployments/sui-sandbox-local/object-TreasuryAdminCap.json +5 -5
- package/deployments/sui-sandbox-local/object-ULN302.json +4 -4
- package/deployments/sui-sandbox-local/object-ULN302AdminCap.json +4 -4
- package/deployments/sui-sandbox-local/object-Uln302PtbBuilder.json +4 -4
- package/deployments/sui-sandbox-local/object-Uln302Verification.json +4 -4
- package/deployments/sui-sandbox-local/package_whitelist_validator.json +39 -39
- package/deployments/sui-sandbox-local/price_feed.json +37 -37
- package/deployments/sui-sandbox-local/ptb_move_call.json +18 -18
- package/deployments/sui-sandbox-local/simple_message_lib.json +27 -27
- package/deployments/sui-sandbox-local/simple_msglib_ptb_builder.json +20 -20
- package/deployments/sui-sandbox-local/treasury.json +41 -41
- package/deployments/sui-sandbox-local/uln_302.json +36 -36
- package/deployments/sui-sandbox-local/uln_302_ptb_builder.json +20 -20
- package/deployments/sui-testnet/object-OFT-TokenTwo.json +5 -0
- package/deployments/sui-testnet/object-OFTComposerManager.json +9 -0
- package/deployments/sui-testnet/object-OFTInitTicket-TokenTwo.json +9 -0
- package/deployments/sui-testnet/object-OFTOApp-TokenTwo.json +9 -0
- package/deployments/sui-testnet/object-TestCoinMetadata.json +9 -0
- package/deployments/sui-testnet/object-TestCoinTreasuryCap.json +9 -0
- package/deployments/sui-testnet/oft-TokenTwo.json +82 -0
- package/deployments/sui-testnet/oft_common.json +61 -0
- package/deployments/sui-testnet/test_coin.json +69 -0
- package/dist/index.cjs +140 -131
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +19 -16
- package/dist/index.d.ts +19 -16
- package/dist/index.mjs +140 -131
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/src/generated/addresses.ts +105 -105
- package/src/modules/oapps/oapp.ts +41 -27
|
@@ -64,17 +64,11 @@ export class OApp {
|
|
|
64
64
|
this.objects = objects
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
// setOAppInfo(oappInfo: OAppInfoV1): void {
|
|
68
|
-
// this.oappInfo = oappInfo
|
|
69
|
-
// }
|
|
70
|
-
|
|
71
67
|
// === Set Functions ===
|
|
72
68
|
|
|
73
69
|
/**
|
|
74
70
|
* Set enforced options for OApp messaging
|
|
75
71
|
* @param tx - The transaction to add the move call to
|
|
76
|
-
* @param oapp - The OApp object ID or transaction argument
|
|
77
|
-
* @param adminCap - The admin capability object ID or transaction argument
|
|
78
72
|
* @param eid - Endpoint ID or transaction argument
|
|
79
73
|
* @param msgType - Message type or transaction argument
|
|
80
74
|
* @param options - Enforced options as bytes or transaction argument
|
|
@@ -102,8 +96,6 @@ export class OApp {
|
|
|
102
96
|
/**
|
|
103
97
|
* Set peer OApp on another chain
|
|
104
98
|
* @param tx - The transaction to add the move call to
|
|
105
|
-
* @param oapp - The OApp object ID or transaction argument
|
|
106
|
-
* @param adminCap - The admin capability object ID or transaction argument
|
|
107
99
|
* @param eid - Peer endpoint ID or transaction argument
|
|
108
100
|
* @param peer - Peer OApp address as bytes or transaction argument
|
|
109
101
|
*/
|
|
@@ -161,7 +153,6 @@ export class OApp {
|
|
|
161
153
|
/**
|
|
162
154
|
* Get OApp CallCap identifier
|
|
163
155
|
* @param tx - The transaction to add the move call to
|
|
164
|
-
* @param oapp - The OApp object ID or transaction argument
|
|
165
156
|
* @returns Transaction result containing the OApp CallCap identifier
|
|
166
157
|
*/
|
|
167
158
|
async getOAppCapIdMoveCall(tx: Transaction): Promise<TransactionResult> {
|
|
@@ -174,7 +165,6 @@ export class OApp {
|
|
|
174
165
|
|
|
175
166
|
/**
|
|
176
167
|
* Get OApp CallCap identifier
|
|
177
|
-
* @param oapp - The OApp object ID (optional, uses configured oapp if not provided)
|
|
178
168
|
* @returns Promise<string> - The OApp CallCap identifier
|
|
179
169
|
*/
|
|
180
170
|
async getOAppCapId(): Promise<string> {
|
|
@@ -190,7 +180,6 @@ export class OApp {
|
|
|
190
180
|
/**
|
|
191
181
|
* Combine enforced options with extra options for message execution
|
|
192
182
|
* @param tx - The transaction to add the move call to
|
|
193
|
-
* @param oapp - The OApp object ID or transaction argument
|
|
194
183
|
* @param eid - Destination endpoint ID or transaction argument
|
|
195
184
|
* @param msgType - Message type or transaction argument
|
|
196
185
|
* @param extraOptions - Extra options to combine with enforced options or transaction argument
|
|
@@ -216,7 +205,6 @@ export class OApp {
|
|
|
216
205
|
|
|
217
206
|
/**
|
|
218
207
|
* Combine enforced options with extra options for message execution
|
|
219
|
-
* @param oapp - The OApp object ID
|
|
220
208
|
* @param eid - Destination endpoint ID
|
|
221
209
|
* @param msgType - Message type
|
|
222
210
|
* @param extraOptions - Extra options to combine with enforced options
|
|
@@ -235,7 +223,6 @@ export class OApp {
|
|
|
235
223
|
/**
|
|
236
224
|
* Get enforced options for a specific destination and message type
|
|
237
225
|
* @param tx - The transaction to add the move call to
|
|
238
|
-
* @param oapp - The OApp object ID or transaction argument
|
|
239
226
|
* @param eid - Destination endpoint ID or transaction argument
|
|
240
227
|
* @param msgType - Message type or transaction argument
|
|
241
228
|
* @returns Transaction result containing enforced options
|
|
@@ -254,7 +241,6 @@ export class OApp {
|
|
|
254
241
|
|
|
255
242
|
/**
|
|
256
243
|
* Get enforced options for a specific destination and message type
|
|
257
|
-
* @param oapp - The OApp object ID
|
|
258
244
|
* @param eid - Destination endpoint ID
|
|
259
245
|
* @param msgType - Message type
|
|
260
246
|
* @returns Promise<Uint8Array> - Enforced options as bytes
|
|
@@ -272,7 +258,6 @@ export class OApp {
|
|
|
272
258
|
/**
|
|
273
259
|
* Check if a peer is configured for a specific destination chain
|
|
274
260
|
* @param tx - The transaction to add the move call to
|
|
275
|
-
* @param oapp - The OApp object ID or transaction argument
|
|
276
261
|
* @param dstEid - Destination endpoint ID or transaction argument
|
|
277
262
|
* @returns Transaction result containing boolean result
|
|
278
263
|
*/
|
|
@@ -286,7 +271,6 @@ export class OApp {
|
|
|
286
271
|
|
|
287
272
|
/**
|
|
288
273
|
* Check if a peer is configured for a specific destination chain
|
|
289
|
-
* @param oapp - The OApp object ID
|
|
290
274
|
* @param dstEid - Destination endpoint ID
|
|
291
275
|
* @returns Promise<boolean> - True if peer is configured, false otherwise
|
|
292
276
|
*/
|
|
@@ -303,7 +287,6 @@ export class OApp {
|
|
|
303
287
|
/**
|
|
304
288
|
* Get the configured peer address for a specific destination chain
|
|
305
289
|
* @param tx - The transaction to add the move call to
|
|
306
|
-
* @param oapp - The OApp object ID or transaction argument
|
|
307
290
|
* @param dstEid - Destination endpoint ID or transaction argument
|
|
308
291
|
* @returns Transaction result containing peer address
|
|
309
292
|
*/
|
|
@@ -317,7 +300,6 @@ export class OApp {
|
|
|
317
300
|
|
|
318
301
|
/**
|
|
319
302
|
* Get the configured peer address for a specific destination chain
|
|
320
|
-
* @param oapp - The OApp object ID
|
|
321
303
|
* @param dstEid - Destination endpoint ID
|
|
322
304
|
* @returns Promise<Uint8Array> - Peer address as bytes32
|
|
323
305
|
*/
|
|
@@ -333,15 +315,24 @@ export class OApp {
|
|
|
333
315
|
)
|
|
334
316
|
}
|
|
335
317
|
|
|
318
|
+
/**
|
|
319
|
+
* Get OApp information V1 structure
|
|
320
|
+
* @param tx - The transaction to add the move call to
|
|
321
|
+
* @returns Transaction result containing the OApp information V1
|
|
322
|
+
*/
|
|
336
323
|
getOAppInfoV1MoveCall(tx: Transaction): TransactionResult {
|
|
337
324
|
const endpoint = this.moduleManager.getEndpoint()
|
|
338
325
|
const oappInfoRaw = endpoint.getOappInfoMoveCall(tx, this.oappCallCapId) // the new OAppInfo used to be named as lz_receive_info
|
|
339
326
|
return tx.moveCall({
|
|
340
|
-
target:
|
|
327
|
+
target: this.#target('decode', 'oapp_info_v1'),
|
|
341
328
|
arguments: [oappInfoRaw],
|
|
342
329
|
})
|
|
343
330
|
}
|
|
344
331
|
|
|
332
|
+
/**
|
|
333
|
+
* Get OApp information V1 structure
|
|
334
|
+
* @returns Promise<OAppInfoV1> - The OApp information V1
|
|
335
|
+
*/
|
|
345
336
|
async getOAppInfoV1(): Promise<OAppInfoV1> {
|
|
346
337
|
return executeSimulate(
|
|
347
338
|
this.client,
|
|
@@ -354,16 +345,25 @@ export class OApp {
|
|
|
354
345
|
)
|
|
355
346
|
}
|
|
356
347
|
|
|
348
|
+
getOAppInfoV1ExtraInfoMoveCall(tx: Transaction, oappInfo: string | TransactionArgument): TransactionResult {
|
|
349
|
+
return tx.moveCall({
|
|
350
|
+
target: this.#target('extra_info', 'oapp_info_v1'),
|
|
351
|
+
arguments: [asObject(tx, oappInfo)],
|
|
352
|
+
})
|
|
353
|
+
}
|
|
354
|
+
|
|
357
355
|
// === Endpoint Call Functions ===
|
|
358
356
|
|
|
359
357
|
/**
|
|
360
358
|
* Register OApp with the endpoint
|
|
361
359
|
* @param tx - The transaction to add the move call to
|
|
360
|
+
* @param oappObjectId - The OApp object ID
|
|
362
361
|
* @param oappInfo - OApp information as bytes (optional)
|
|
363
362
|
* @returns Transaction result containing the messaging channel address
|
|
364
363
|
*/
|
|
365
364
|
async registerOAppMoveCall(
|
|
366
365
|
tx: Transaction,
|
|
366
|
+
oappObjectId: string,
|
|
367
367
|
oappInfo?: Uint8Array | TransactionArgument
|
|
368
368
|
): Promise<TransactionResult> {
|
|
369
369
|
let oappInfoArg: TransactionArgument
|
|
@@ -376,13 +376,11 @@ export class OApp {
|
|
|
376
376
|
// For None
|
|
377
377
|
oappInfoArg = tx.pure.option('vector<u8>', null)
|
|
378
378
|
}
|
|
379
|
-
|
|
380
|
-
const oappInfoObj = await this.#oappInfo()
|
|
381
|
-
const adminCap = await this.getAdminCap(oappInfoObj.oapp_object)
|
|
379
|
+
const adminCap = await this.getAdminCap(oappObjectId)
|
|
382
380
|
return tx.moveCall({
|
|
383
381
|
target: this.#target('register_oapp', 'endpoint_calls'),
|
|
384
382
|
arguments: [
|
|
385
|
-
asObject(tx,
|
|
383
|
+
asObject(tx, oappObjectId),
|
|
386
384
|
asObject(tx, adminCap),
|
|
387
385
|
asObject(tx, this.objects.endpointV2),
|
|
388
386
|
oappInfoArg,
|
|
@@ -413,14 +411,22 @@ export class OApp {
|
|
|
413
411
|
* Set OApp information in the endpoint
|
|
414
412
|
* @param tx - The transaction to add the move call to
|
|
415
413
|
* @param oappInfo - OApp information as bytes
|
|
414
|
+
* @param oappObjectId - Optional OApp object ID (uses configured oapp if not provided)
|
|
416
415
|
*/
|
|
417
|
-
async setOAppInfoMoveCall(
|
|
418
|
-
|
|
419
|
-
|
|
416
|
+
async setOAppInfoMoveCall(
|
|
417
|
+
tx: Transaction,
|
|
418
|
+
oappInfo: Uint8Array | TransactionArgument,
|
|
419
|
+
oappObjectId?: string
|
|
420
|
+
): Promise<void> {
|
|
421
|
+
if (oappObjectId === undefined) {
|
|
422
|
+
const oappInfoObj = await this.#oappInfo()
|
|
423
|
+
oappObjectId = oappInfoObj.oapp_object
|
|
424
|
+
}
|
|
425
|
+
const adminCap = await this.getAdminCap(oappObjectId)
|
|
420
426
|
tx.moveCall({
|
|
421
427
|
target: this.#target('set_oapp_info', 'endpoint_calls'),
|
|
422
428
|
arguments: [
|
|
423
|
-
asObject(tx,
|
|
429
|
+
asObject(tx, oappObjectId),
|
|
424
430
|
asObject(tx, adminCap),
|
|
425
431
|
asObject(tx, this.objects.endpointV2),
|
|
426
432
|
asBytes(tx, oappInfo),
|
|
@@ -703,6 +709,14 @@ export class OApp {
|
|
|
703
709
|
})
|
|
704
710
|
}
|
|
705
711
|
|
|
712
|
+
/**
|
|
713
|
+
* Refresh the cached OApp information by fetching the latest data
|
|
714
|
+
* @returns Promise<void> - Completes when the OApp info is refreshed
|
|
715
|
+
*/
|
|
716
|
+
async refreshOAppInfo(): Promise<void> {
|
|
717
|
+
this.oappInfo = await this.getOAppInfoV1()
|
|
718
|
+
}
|
|
719
|
+
|
|
706
720
|
// === Private Functions ===
|
|
707
721
|
|
|
708
722
|
/**
|