@layerzerolabs/lz-sui-sdk-v2 3.0.135 → 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 +16 -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 +20 -20
- package/deployments/sui-sandbox-local/blocked_msglib_ptb_builder.json +18 -18
- package/deployments/sui-sandbox-local/call.json +18 -19
- package/deployments/sui-sandbox-local/counter.json +29 -29
- package/deployments/sui-sandbox-local/dvn.json +14 -14
- package/deployments/sui-sandbox-local/dvn_call_type.json +28 -28
- package/deployments/sui-sandbox-local/dvn_fee_lib.json +19 -19
- 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 +26 -26
- package/deployments/sui-sandbox-local/endpoint_v2.json +16 -16
- 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 +27 -27
- package/deployments/sui-sandbox-local/executor_layerzero.json +25 -25
- 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/message_lib_common.json +10 -10
- package/deployments/sui-sandbox-local/msglib_ptb_builder_call_types.json +10 -10
- package/deployments/sui-sandbox-local/{sequential_multi_call.json → multi_call.json} +18 -18
- package/deployments/sui-sandbox-local/oapp.json +19 -19
- 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 +4 -4
- package/deployments/sui-sandbox-local/object-CounterAdminCap.json +4 -4
- package/deployments/sui-sandbox-local/object-CounterOApp.json +4 -4
- package/deployments/sui-sandbox-local/object-DVN.json +2 -2
- package/deployments/sui-sandbox-local/object-DVNCap.json +5 -5
- 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-EndpointV2.json +4 -4
- package/deployments/sui-sandbox-local/object-EndpointV2AdminCap.json +4 -4
- package/deployments/sui-sandbox-local/object-Executor.json +2 -2
- package/deployments/sui-sandbox-local/object-ExecutorCap.json +5 -5
- package/deployments/sui-sandbox-local/object-ExecutorFeeLib.json +5 -5
- package/deployments/sui-sandbox-local/object-ExecutorOwnerCap.json +2 -2
- 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/object-WorkerRegistry.json +4 -4
- package/deployments/sui-sandbox-local/package_whitelist_validator.json +42 -42
- package/deployments/sui-sandbox-local/price_feed.json +39 -39
- package/deployments/sui-sandbox-local/price_feed_call_types.json +9 -9
- package/deployments/sui-sandbox-local/ptb_move_call.json +18 -18
- package/deployments/sui-sandbox-local/simple_message_lib.json +24 -24
- package/deployments/sui-sandbox-local/simple_msglib_ptb_builder.json +22 -22
- package/deployments/sui-sandbox-local/treasury.json +37 -37
- 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-sandbox-local/uln_common.json +9 -9
- package/deployments/sui-sandbox-local/worker_common.json +18 -18
- package/deployments/sui-sandbox-local/worker_registry.json +23 -23
- package/deployments/sui-testnet/blocked_message_lib.json +26 -26
- package/deployments/sui-testnet/blocked_msglib_ptb_builder.json +22 -22
- package/deployments/sui-testnet/call.json +21 -22
- package/deployments/sui-testnet/counter.json +46 -39
- package/deployments/sui-testnet/dvn.json +13 -13
- package/deployments/sui-testnet/dvn_call_type.json +12 -12
- package/deployments/sui-testnet/dvn_fee_lib.json +22 -22
- package/deployments/sui-testnet/dvn_layerzero.json +17 -17
- package/deployments/sui-testnet/dvn_ptb_builder.json +20 -20
- package/deployments/sui-testnet/endpoint_ptb_builder.json +33 -33
- package/deployments/sui-testnet/endpoint_v2.json +30 -30
- package/deployments/sui-testnet/executor.json +21 -21
- package/deployments/sui-testnet/executor_call_type.json +19 -19
- package/deployments/sui-testnet/executor_fee_lib.json +26 -26
- package/deployments/sui-testnet/executor_layerzero.json +17 -17
- package/deployments/sui-testnet/executor_ptb_builder.json +20 -20
- package/deployments/sui-testnet/layerzero_views.json +13 -13
- package/deployments/sui-testnet/message_lib_common.json +13 -13
- package/deployments/sui-testnet/msglib_ptb_builder_call_types.json +13 -13
- package/deployments/sui-testnet/multi_call.json +45 -0
- package/deployments/sui-testnet/oapp.json +21 -21
- package/deployments/sui-testnet/object-BlockedMessageLib.json +5 -5
- package/deployments/sui-testnet/object-BlockedMsglibPtbBuilder.json +5 -5
- package/deployments/sui-testnet/object-Counter.json +5 -5
- package/deployments/sui-testnet/object-CounterAdminCap.json +5 -5
- package/deployments/sui-testnet/object-CounterOApp.json +5 -5
- package/deployments/sui-testnet/object-DVN.json +2 -2
- package/deployments/sui-testnet/object-DVNCap.json +5 -5
- package/deployments/sui-testnet/object-DVNFeeLib.json +5 -5
- package/deployments/sui-testnet/object-EndpointPtbBuilder.json +5 -5
- package/deployments/sui-testnet/object-EndpointPtbBuilderAdminCap.json +5 -5
- package/deployments/sui-testnet/object-EndpointV2.json +5 -5
- package/deployments/sui-testnet/object-EndpointV2AdminCap.json +5 -5
- package/deployments/sui-testnet/object-Executor.json +2 -2
- package/deployments/sui-testnet/object-ExecutorCap.json +5 -5
- package/deployments/sui-testnet/object-ExecutorFeeLib.json +5 -5
- package/deployments/sui-testnet/object-ExecutorOwnerCap.json +2 -2
- 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-PackageWhitelistValidator.json +5 -5
- package/deployments/sui-testnet/object-PriceFeed.json +5 -5
- package/deployments/sui-testnet/object-PriceFeedOwnerCap.json +5 -5
- package/deployments/sui-testnet/object-SimpleMessageLib.json +5 -5
- package/deployments/sui-testnet/object-SimpleMessageLibAdminCap.json +5 -5
- package/deployments/sui-testnet/object-SmlPtbBuilder.json +5 -5
- package/deployments/sui-testnet/object-TestCoinMetadata.json +9 -0
- package/deployments/sui-testnet/object-TestCoinTreasuryCap.json +9 -0
- package/deployments/sui-testnet/object-Treasury.json +5 -5
- package/deployments/sui-testnet/object-TreasuryAdminCap.json +5 -5
- package/deployments/sui-testnet/object-ULN302.json +5 -5
- package/deployments/sui-testnet/object-ULN302AdminCap.json +5 -5
- package/deployments/sui-testnet/object-Uln302PtbBuilder.json +5 -5
- package/deployments/sui-testnet/object-Uln302Verification.json +5 -5
- package/deployments/sui-testnet/object-WorkerRegistry.json +5 -5
- package/deployments/sui-testnet/object-ZroCoinMetadata.json +5 -5
- package/deployments/sui-testnet/object-ZroTreasuryCap.json +5 -5
- package/deployments/sui-testnet/oft-TokenTwo.json +82 -0
- package/deployments/sui-testnet/oft_common.json +61 -0
- package/deployments/sui-testnet/package_whitelist_validator.json +50 -50
- package/deployments/sui-testnet/price_feed.json +31 -31
- package/deployments/sui-testnet/price_feed_call_types.json +19 -19
- package/deployments/sui-testnet/ptb_move_call.json +13 -13
- package/deployments/sui-testnet/simple_message_lib.json +22 -22
- package/deployments/sui-testnet/simple_msglib_ptb_builder.json +25 -25
- package/deployments/sui-testnet/test_coin.json +69 -0
- package/deployments/sui-testnet/treasury.json +29 -29
- package/deployments/sui-testnet/uln_302.json +46 -46
- package/deployments/sui-testnet/uln_302_ptb_builder.json +18 -18
- package/deployments/sui-testnet/uln_common.json +21 -21
- package/deployments/sui-testnet/utils.json +20 -20
- package/deployments/sui-testnet/worker_common.json +13 -13
- package/deployments/sui-testnet/worker_registry.json +26 -26
- package/deployments/sui-testnet/zro.json +27 -27
- package/dist/index.cjs +253 -252
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +52 -50
- package/dist/index.d.ts +52 -50
- package/dist/index.mjs +253 -252
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/src/generated/addresses.ts +169 -169
- package/src/modules/call.ts +2 -2
- package/src/modules/endpoint.ts +46 -53
- package/src/modules/oapps/counter.ts +5 -8
- package/src/modules/oapps/oapp.ts +42 -28
- package/deployments/sui-testnet/sequential_multi_call.json +0 -45
package/src/modules/endpoint.ts
CHANGED
|
@@ -68,12 +68,9 @@ export const EndpointErrorCode = {
|
|
|
68
68
|
MessagingComposer_EComposeNotFound: 3,
|
|
69
69
|
MessagingComposer_EComposerNotRegistered: 4,
|
|
70
70
|
MessagingComposer_EComposerRegistered: 5,
|
|
71
|
-
MessagingComposer_EInvalidLZComposeInfo: 6,
|
|
72
|
-
|
|
73
71
|
// OAppRegistry related errors (with OAppRegistry_ prefix)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
OAppRegistry_EOAppRegistered: 3,
|
|
72
|
+
OAppRegistry_EOAppNotRegistered: 1,
|
|
73
|
+
OAppRegistry_EOAppRegistered: 2,
|
|
77
74
|
|
|
78
75
|
// Endpoint related errors (with Endpoint_ prefix)
|
|
79
76
|
Endpoint_EAlreadyInitialized: 1,
|
|
@@ -120,16 +117,17 @@ export class Endpoint {
|
|
|
120
117
|
* Register an OApp with the endpoint
|
|
121
118
|
* @param tx - The transaction to add the move call to
|
|
122
119
|
* @param oappCap - The OApp capability object ID or transaction argument
|
|
123
|
-
* @param
|
|
120
|
+
* @param oappInfo - OApp information including lz_receive execution information
|
|
121
|
+
* @returns Transaction result containing the messaging channel address
|
|
124
122
|
*/
|
|
125
123
|
registerOAppMoveCall(
|
|
126
124
|
tx: Transaction,
|
|
127
125
|
oappCap: string | TransactionArgument,
|
|
128
|
-
|
|
129
|
-
):
|
|
130
|
-
tx.moveCall({
|
|
126
|
+
oappInfo: Uint8Array | TransactionArgument
|
|
127
|
+
): TransactionResult {
|
|
128
|
+
return tx.moveCall({
|
|
131
129
|
target: this.#target('register_oapp'),
|
|
132
|
-
arguments: [tx.object(this.objects.endpointV2), asObject(tx, oappCap), asBytes(tx,
|
|
130
|
+
arguments: [tx.object(this.objects.endpointV2), asObject(tx, oappCap), asBytes(tx, oappInfo)],
|
|
133
131
|
})
|
|
134
132
|
}
|
|
135
133
|
|
|
@@ -151,25 +149,25 @@ export class Endpoint {
|
|
|
151
149
|
}
|
|
152
150
|
|
|
153
151
|
/**
|
|
154
|
-
* Set
|
|
152
|
+
* Set OApp information for an OApp
|
|
155
153
|
* @param tx - The transaction to add the move call to
|
|
156
154
|
* @param callerCap - The caller capability object ID or transaction argument
|
|
157
155
|
* @param oapp - The OApp address or transaction argument
|
|
158
|
-
* @param
|
|
156
|
+
* @param oappInfo - The OApp information including lz_receive execution information as bytes or transaction argument
|
|
159
157
|
*/
|
|
160
|
-
|
|
158
|
+
setOappInfoMoveCall(
|
|
161
159
|
tx: Transaction,
|
|
162
160
|
callerCap: string | TransactionArgument,
|
|
163
161
|
oapp: string | TransactionArgument,
|
|
164
|
-
|
|
162
|
+
oappInfo: Uint8Array | TransactionArgument
|
|
165
163
|
): void {
|
|
166
164
|
tx.moveCall({
|
|
167
|
-
target: this.#target('
|
|
165
|
+
target: this.#target('set_oapp_info'),
|
|
168
166
|
arguments: [
|
|
169
167
|
tx.object(this.objects.endpointV2),
|
|
170
168
|
asObject(tx, callerCap),
|
|
171
169
|
asAddress(tx, oapp),
|
|
172
|
-
asBytes(tx,
|
|
170
|
+
asBytes(tx, oappInfo),
|
|
173
171
|
],
|
|
174
172
|
})
|
|
175
173
|
}
|
|
@@ -555,33 +553,34 @@ export class Endpoint {
|
|
|
555
553
|
* Register a composer with the endpoint
|
|
556
554
|
* @param tx - The transaction to add the move call to
|
|
557
555
|
* @param composerCap - The composer capability object ID or transaction argument
|
|
558
|
-
* @param
|
|
556
|
+
* @param composerInfo - Composer information including lz_compose execution information as bytes
|
|
557
|
+
* @returns Transaction result containing the compose queue address
|
|
559
558
|
*/
|
|
560
559
|
registerComposerMoveCall(
|
|
561
560
|
tx: Transaction,
|
|
562
561
|
composerCap: string | TransactionArgument,
|
|
563
|
-
|
|
564
|
-
):
|
|
565
|
-
tx.moveCall({
|
|
562
|
+
composerInfo: Uint8Array | TransactionArgument
|
|
563
|
+
): TransactionResult {
|
|
564
|
+
return tx.moveCall({
|
|
566
565
|
target: this.#target('register_composer'),
|
|
567
|
-
arguments: [tx.object(this.objects.endpointV2), asObject(tx, composerCap), asBytes(tx,
|
|
566
|
+
arguments: [tx.object(this.objects.endpointV2), asObject(tx, composerCap), asBytes(tx, composerInfo)],
|
|
568
567
|
})
|
|
569
568
|
}
|
|
570
569
|
|
|
571
570
|
/**
|
|
572
|
-
* Set
|
|
571
|
+
* Set composer information for a composer
|
|
573
572
|
* @param tx - The transaction to add the move call to
|
|
574
573
|
* @param composerCap - The composer capability object ID or transaction argument
|
|
575
|
-
* @param
|
|
574
|
+
* @param composerInfo - Composer information including lz_compose execution information as bytes or transaction argument
|
|
576
575
|
*/
|
|
577
|
-
|
|
576
|
+
setComposerInfoMoveCall(
|
|
578
577
|
tx: Transaction,
|
|
579
578
|
composerCap: string | TransactionArgument,
|
|
580
|
-
|
|
579
|
+
composerInfo: Uint8Array | TransactionArgument
|
|
581
580
|
): void {
|
|
582
581
|
tx.moveCall({
|
|
583
|
-
target: this.#target('
|
|
584
|
-
arguments: [tx.object(this.objects.endpointV2), asObject(tx, composerCap), asBytes(tx,
|
|
582
|
+
target: this.#target('set_composer_info'),
|
|
583
|
+
arguments: [tx.object(this.objects.endpointV2), asObject(tx, composerCap), asBytes(tx, composerInfo)],
|
|
585
584
|
})
|
|
586
585
|
}
|
|
587
586
|
|
|
@@ -1032,28 +1031,28 @@ export class Endpoint {
|
|
|
1032
1031
|
}
|
|
1033
1032
|
|
|
1034
1033
|
/**
|
|
1035
|
-
* Get
|
|
1034
|
+
* Get OApp information for an OApp
|
|
1036
1035
|
* @param tx - The transaction to add the move call to
|
|
1037
1036
|
* @param oapp - The OApp address or transaction argument
|
|
1038
|
-
* @returns Transaction result containing the
|
|
1037
|
+
* @returns Transaction result containing the OApp information including lz_receive execution information
|
|
1039
1038
|
*/
|
|
1040
|
-
|
|
1039
|
+
getOappInfoMoveCall(tx: Transaction, oapp: string | TransactionArgument): TransactionResult {
|
|
1041
1040
|
return tx.moveCall({
|
|
1042
|
-
target: this.#target('
|
|
1041
|
+
target: this.#target('get_oapp_info'),
|
|
1043
1042
|
arguments: [tx.object(this.objects.endpointV2), asAddress(tx, oapp)],
|
|
1044
1043
|
})
|
|
1045
1044
|
}
|
|
1046
1045
|
|
|
1047
1046
|
/**
|
|
1048
|
-
* Get
|
|
1047
|
+
* Get OApp information for an OApp
|
|
1049
1048
|
* @param oapp - The OApp address
|
|
1050
|
-
* @returns Promise<Uint8Array> - The
|
|
1049
|
+
* @returns Promise<Uint8Array> - The OApp information including lz_receive execution information as bytes
|
|
1051
1050
|
*/
|
|
1052
|
-
async
|
|
1051
|
+
async getOappInfo(oapp: string): Promise<Uint8Array> {
|
|
1053
1052
|
return executeSimulate(
|
|
1054
1053
|
this.client,
|
|
1055
1054
|
(tx) => {
|
|
1056
|
-
return this.
|
|
1055
|
+
return this.getOappInfoMoveCall(tx, oapp)
|
|
1057
1056
|
},
|
|
1058
1057
|
(result) => {
|
|
1059
1058
|
const parsed = bcs.vector(bcs.u8()).parse(result[0].value)
|
|
@@ -1147,28 +1146,28 @@ export class Endpoint {
|
|
|
1147
1146
|
}
|
|
1148
1147
|
|
|
1149
1148
|
/**
|
|
1150
|
-
* Get
|
|
1149
|
+
* Get composer information for a registered composer
|
|
1151
1150
|
* @param tx - The transaction to add the move call to
|
|
1152
1151
|
* @param composer - The composer address or transaction argument
|
|
1153
|
-
* @returns Transaction result containing the
|
|
1152
|
+
* @returns Transaction result containing the composer information
|
|
1154
1153
|
*/
|
|
1155
|
-
|
|
1154
|
+
getComposerInfoMoveCall(tx: Transaction, composer: string | TransactionArgument): TransactionResult {
|
|
1156
1155
|
return tx.moveCall({
|
|
1157
|
-
target: this.#target('
|
|
1156
|
+
target: this.#target('get_composer_info'),
|
|
1158
1157
|
arguments: [tx.object(this.objects.endpointV2), asAddress(tx, composer)],
|
|
1159
1158
|
})
|
|
1160
1159
|
}
|
|
1161
1160
|
|
|
1162
1161
|
/**
|
|
1163
|
-
* Get
|
|
1162
|
+
* Get composer information for a registered composer
|
|
1164
1163
|
* @param composer - The composer address
|
|
1165
|
-
* @returns Promise<Uint8Array> - The
|
|
1164
|
+
* @returns Promise<Uint8Array> - The composer information as bytes
|
|
1166
1165
|
*/
|
|
1167
|
-
async
|
|
1166
|
+
async getComposerInfo(composer: string): Promise<Uint8Array> {
|
|
1168
1167
|
return executeSimulate(
|
|
1169
1168
|
this.client,
|
|
1170
1169
|
(tx) => {
|
|
1171
|
-
this.
|
|
1170
|
+
this.getComposerInfoMoveCall(tx, composer)
|
|
1172
1171
|
},
|
|
1173
1172
|
(result) => {
|
|
1174
1173
|
const parsed = bcs.vector(bcs.u8()).parse(result[0].value)
|
|
@@ -2317,16 +2316,13 @@ export class Endpoint {
|
|
|
2317
2316
|
async populateLzReceiveTransaction(
|
|
2318
2317
|
tx: Transaction,
|
|
2319
2318
|
lzReceiveCall: TransactionResult,
|
|
2320
|
-
oapp: string, // receiver oapp
|
|
2319
|
+
oapp: string | TransactionArgument, // receiver oapp
|
|
2321
2320
|
sender: string | undefined = undefined,
|
|
2322
2321
|
validators: IPTBValidator[] = [],
|
|
2323
2322
|
maxSimulationTimes = DEFAULT_SIMULATION_TIMES
|
|
2324
2323
|
): Promise<MoveCall[]> {
|
|
2325
2324
|
const simulateTx = Transaction.from(tx)
|
|
2326
|
-
|
|
2327
|
-
target: this.#target('get_lz_receive_info'),
|
|
2328
|
-
arguments: [simulateTx.object(this.objects.endpointV2), simulateTx.pure.address(oapp)],
|
|
2329
|
-
})
|
|
2325
|
+
this.getOappInfoMoveCall(simulateTx, oapp)
|
|
2330
2326
|
const moveCalls = await this.moduleManager.getPtbBuilder().simulateLzReceivePtb(simulateTx, sender)
|
|
2331
2327
|
|
|
2332
2328
|
const [_, finalMoveCalls] = await this.moduleManager
|
|
@@ -2361,16 +2357,13 @@ export class Endpoint {
|
|
|
2361
2357
|
async populateLzComposeTransaction(
|
|
2362
2358
|
tx: Transaction,
|
|
2363
2359
|
endpointLzComposeCall: TransactionResult,
|
|
2364
|
-
composer: string,
|
|
2360
|
+
composer: string | TransactionArgument,
|
|
2365
2361
|
sender: string | undefined = undefined,
|
|
2366
2362
|
validators: IPTBValidator[] = [],
|
|
2367
2363
|
maxSimulationTimes = DEFAULT_SIMULATION_TIMES
|
|
2368
2364
|
): Promise<MoveCall[]> {
|
|
2369
2365
|
const simulateTx = Transaction.from(tx)
|
|
2370
|
-
|
|
2371
|
-
target: this.#target('get_lz_compose_info'),
|
|
2372
|
-
arguments: [simulateTx.object(this.objects.endpointV2), simulateTx.pure.address(composer)],
|
|
2373
|
-
})
|
|
2366
|
+
this.getComposerInfoMoveCall(simulateTx, composer)
|
|
2374
2367
|
const moveCalls = await this.moduleManager.getPtbBuilder().simulateLzComposePtb(simulateTx, sender)
|
|
2375
2368
|
|
|
2376
2369
|
const [_, finalMoveCalls] = await this.moduleManager
|
|
@@ -109,7 +109,6 @@ export class Counter {
|
|
|
109
109
|
* @param dstEid - Destination endpoint ID
|
|
110
110
|
* @param msgType - Message type (SEND or SEND_AND_CALL)
|
|
111
111
|
* @param options - Execution options as bytes
|
|
112
|
-
* @param sendValue - Value to send with the message
|
|
113
112
|
* @param nativeFee - Native token fee amount
|
|
114
113
|
* @param zroFee - ZRO token fee amount
|
|
115
114
|
* @param refundAddress - Address for fee refunds
|
|
@@ -120,7 +119,6 @@ export class Counter {
|
|
|
120
119
|
dstEid: EndpointId | TransactionArgument,
|
|
121
120
|
msgType: number | TransactionArgument,
|
|
122
121
|
options: Uint8Array | TransactionArgument,
|
|
123
|
-
sendValue: bigint | TransactionArgument,
|
|
124
122
|
nativeFee: bigint | TransactionArgument,
|
|
125
123
|
zroFee: bigint | TransactionArgument,
|
|
126
124
|
refundAddress: string | TransactionArgument,
|
|
@@ -138,7 +136,6 @@ export class Counter {
|
|
|
138
136
|
asU32(tx, dstEid),
|
|
139
137
|
asU8(tx, msgType),
|
|
140
138
|
asBytes(tx, options),
|
|
141
|
-
asU64(tx, sendValue),
|
|
142
139
|
nativeToken,
|
|
143
140
|
zroToken,
|
|
144
141
|
asAddress(tx, refundAddress),
|
|
@@ -148,19 +145,19 @@ export class Counter {
|
|
|
148
145
|
}
|
|
149
146
|
|
|
150
147
|
/**
|
|
151
|
-
* Set
|
|
148
|
+
* Set composer information for counter
|
|
152
149
|
* @param tx - The transaction to add the move call to
|
|
153
|
-
* @param
|
|
150
|
+
* @param composerInfo - Composer information including lz_compose execution information as bytes
|
|
154
151
|
*/
|
|
155
|
-
|
|
152
|
+
setComposerInfoMoveCall(tx: Transaction, composerInfo: Uint8Array | TransactionArgument): void {
|
|
156
153
|
tx.moveCall({
|
|
157
|
-
target: this.#target('
|
|
154
|
+
target: this.#target('set_composer_info'),
|
|
158
155
|
arguments: [
|
|
159
156
|
tx.object(this.objects.counter),
|
|
160
157
|
tx.object(this.objects.counterOapp),
|
|
161
158
|
tx.object(this.objects.counterAdminCap),
|
|
162
159
|
tx.object(this.objects.endpointV2),
|
|
163
|
-
asBytes(tx,
|
|
160
|
+
asBytes(tx, composerInfo),
|
|
164
161
|
],
|
|
165
162
|
})
|
|
166
163
|
}
|
|
@@ -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
|
-
const oappInfoRaw = endpoint.
|
|
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
|
/**
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "sequential_multi_call",
|
|
3
|
-
"address": "0xd047c658acf4c7233f39f50f1de333e42604f30c2f78f823ed3f329cb8b439f9",
|
|
4
|
-
"originalAddress": "0xd047c658acf4c7233f39f50f1de333e42604f30c2f78f823ed3f329cb8b439f9",
|
|
5
|
-
"publishedVersion": "1",
|
|
6
|
-
"network": "sui-testnet",
|
|
7
|
-
"digest": "6d5dc218b057ca033f1066b6c02d6541d76e497b986bb06b8ee5a59759aae397",
|
|
8
|
-
"transactionHash": "HKfzq9GBKo3rcuWx56e2YJPqy6N1DRu5Tjhi9tsqH9wb",
|
|
9
|
-
"upgradeCapId": "0x6b31bfdfdbc9f035e5fd27426173c947fb6e58e738d56aed4ade5172f18f0308",
|
|
10
|
-
"deployer": "0xcf1ac8c5f6eda68c74a5c64027ab5eb8e1664a50f1248876e9464ee4fb60a16a",
|
|
11
|
-
"objectChanges": [
|
|
12
|
-
{
|
|
13
|
-
"type": "mutated",
|
|
14
|
-
"sender": "0xcf1ac8c5f6eda68c74a5c64027ab5eb8e1664a50f1248876e9464ee4fb60a16a",
|
|
15
|
-
"owner": {
|
|
16
|
-
"AddressOwner": "0xcf1ac8c5f6eda68c74a5c64027ab5eb8e1664a50f1248876e9464ee4fb60a16a"
|
|
17
|
-
},
|
|
18
|
-
"objectType": "0x2::coin::Coin<0x2::sui::SUI>",
|
|
19
|
-
"objectId": "0x83b783a49bdf7efbc2e18987fc7c45cd069f3452fd37c51549fdf8490374b2ae",
|
|
20
|
-
"version": "577853062",
|
|
21
|
-
"previousVersion": "577853061",
|
|
22
|
-
"digest": "6Rk7B8xdJJ2tFy1mwudE46jMeZxJvDMnDFsvjWf7JttQ"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"type": "created",
|
|
26
|
-
"sender": "0xcf1ac8c5f6eda68c74a5c64027ab5eb8e1664a50f1248876e9464ee4fb60a16a",
|
|
27
|
-
"owner": {
|
|
28
|
-
"AddressOwner": "0xcf1ac8c5f6eda68c74a5c64027ab5eb8e1664a50f1248876e9464ee4fb60a16a"
|
|
29
|
-
},
|
|
30
|
-
"objectType": "0x2::package::UpgradeCap",
|
|
31
|
-
"objectId": "0x6b31bfdfdbc9f035e5fd27426173c947fb6e58e738d56aed4ade5172f18f0308",
|
|
32
|
-
"version": "577853062",
|
|
33
|
-
"digest": "Fsuhz4apoMegERostJkrBemqX1Sd9cTVYn2E58o7XhZF"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"type": "published",
|
|
37
|
-
"packageId": "0xd047c658acf4c7233f39f50f1de333e42604f30c2f78f823ed3f329cb8b439f9",
|
|
38
|
-
"version": "1",
|
|
39
|
-
"digest": "CsRcHBi7mKv8NEJQYyTYZUD9TRcBXbizTVkx9Y9oqQ8v",
|
|
40
|
-
"modules": [
|
|
41
|
-
"sequential_multi_call"
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
}
|