@layerzerolabs/lz-sui-sdk-v2 3.0.134 → 3.0.135-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.
Files changed (164) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/deployments/sui-sandbox-local/blocked_message_lib.json +18 -18
  3. package/deployments/sui-sandbox-local/blocked_msglib_ptb_builder.json +22 -22
  4. package/deployments/sui-sandbox-local/call.json +18 -19
  5. package/deployments/sui-sandbox-local/counter.json +79 -44
  6. package/deployments/sui-sandbox-local/dvn.json +15 -14
  7. package/deployments/sui-sandbox-local/dvn_call_type.json +28 -28
  8. package/deployments/sui-sandbox-local/dvn_fee_lib.json +27 -27
  9. package/deployments/sui-sandbox-local/dvn_layerzero.json +19 -19
  10. package/deployments/sui-sandbox-local/dvn_ptb_builder.json +14 -14
  11. package/deployments/sui-sandbox-local/endpoint_ptb_builder.json +31 -31
  12. package/deployments/sui-sandbox-local/endpoint_v2.json +26 -26
  13. package/deployments/sui-sandbox-local/executor.json +23 -22
  14. package/deployments/sui-sandbox-local/executor_call_type.json +28 -28
  15. package/deployments/sui-sandbox-local/executor_fee_lib.json +32 -32
  16. package/deployments/sui-sandbox-local/executor_layerzero.json +25 -25
  17. package/deployments/sui-sandbox-local/executor_ptb_builder.json +21 -21
  18. package/deployments/sui-sandbox-local/layerzero_views.json +21 -21
  19. package/deployments/sui-sandbox-local/message_lib_common.json +21 -21
  20. package/deployments/sui-sandbox-local/msglib_ptb_builder_call_types.json +13 -13
  21. package/deployments/sui-sandbox-local/multi_call.json +45 -0
  22. package/deployments/sui-sandbox-local/oapp.json +23 -21
  23. package/deployments/sui-sandbox-local/object-BlockedMessageLib.json +5 -5
  24. package/deployments/sui-sandbox-local/object-BlockedMsglibPtbBuilder.json +5 -5
  25. package/deployments/sui-sandbox-local/object-Counter.json +5 -5
  26. package/deployments/sui-sandbox-local/object-CounterAdminCap.json +5 -5
  27. package/deployments/sui-sandbox-local/object-CounterOApp.json +5 -5
  28. package/deployments/sui-sandbox-local/object-DVN.json +2 -2
  29. package/deployments/sui-sandbox-local/object-DVNCap.json +5 -5
  30. package/deployments/sui-sandbox-local/object-DVNFeeLib.json +5 -5
  31. package/deployments/sui-sandbox-local/object-EndpointPtbBuilder.json +5 -5
  32. package/deployments/sui-sandbox-local/object-EndpointPtbBuilderAdminCap.json +5 -5
  33. package/deployments/sui-sandbox-local/object-EndpointV2.json +5 -5
  34. package/deployments/sui-sandbox-local/object-EndpointV2AdminCap.json +5 -5
  35. package/deployments/sui-sandbox-local/object-Executor.json +2 -2
  36. package/deployments/sui-sandbox-local/object-ExecutorCap.json +5 -5
  37. package/deployments/sui-sandbox-local/object-ExecutorFeeLib.json +5 -5
  38. package/deployments/sui-sandbox-local/object-ExecutorOwnerCap.json +2 -2
  39. package/deployments/sui-sandbox-local/object-PackageWhitelistValidator.json +5 -5
  40. package/deployments/sui-sandbox-local/object-PriceFeed.json +5 -5
  41. package/deployments/sui-sandbox-local/object-PriceFeedOwnerCap.json +5 -5
  42. package/deployments/sui-sandbox-local/object-SimpleMessageLib.json +5 -5
  43. package/deployments/sui-sandbox-local/object-SimpleMessageLibAdminCap.json +5 -5
  44. package/deployments/sui-sandbox-local/object-SmlPtbBuilder.json +5 -5
  45. package/deployments/sui-sandbox-local/object-Treasury.json +5 -5
  46. package/deployments/sui-sandbox-local/object-TreasuryAdminCap.json +5 -5
  47. package/deployments/sui-sandbox-local/object-ULN302.json +5 -5
  48. package/deployments/sui-sandbox-local/object-ULN302AdminCap.json +5 -5
  49. package/deployments/sui-sandbox-local/object-Uln302PtbBuilder.json +5 -5
  50. package/deployments/sui-sandbox-local/object-Uln302Verification.json +5 -5
  51. package/deployments/sui-sandbox-local/object-WorkerRegistry.json +9 -0
  52. package/deployments/sui-sandbox-local/package_whitelist_validator.json +45 -45
  53. package/deployments/sui-sandbox-local/price_feed.json +39 -39
  54. package/deployments/sui-sandbox-local/price_feed_call_types.json +19 -19
  55. package/deployments/sui-sandbox-local/ptb_move_call.json +20 -20
  56. package/deployments/sui-sandbox-local/simple_message_lib.json +29 -29
  57. package/deployments/sui-sandbox-local/simple_msglib_ptb_builder.json +18 -18
  58. package/deployments/sui-sandbox-local/treasury.json +38 -38
  59. package/deployments/sui-sandbox-local/uln_302.json +43 -47
  60. package/deployments/sui-sandbox-local/uln_302_ptb_builder.json +25 -25
  61. package/deployments/sui-sandbox-local/uln_common.json +49 -0
  62. package/deployments/sui-sandbox-local/worker_common.json +21 -20
  63. package/deployments/sui-sandbox-local/worker_registry.json +58 -0
  64. package/deployments/sui-testnet/blocked_message_lib.json +25 -25
  65. package/deployments/sui-testnet/blocked_msglib_ptb_builder.json +25 -25
  66. package/deployments/sui-testnet/call.json +14 -15
  67. package/deployments/sui-testnet/counter.json +41 -34
  68. package/deployments/sui-testnet/dvn.json +22 -21
  69. package/deployments/sui-testnet/dvn_call_type.json +19 -19
  70. package/deployments/sui-testnet/dvn_fee_lib.json +26 -26
  71. package/deployments/sui-testnet/dvn_layerzero.json +24 -24
  72. package/deployments/sui-testnet/dvn_ptb_builder.json +13 -13
  73. package/deployments/sui-testnet/endpoint_ptb_builder.json +25 -25
  74. package/deployments/sui-testnet/endpoint_v2.json +30 -30
  75. package/deployments/sui-testnet/executor.json +14 -13
  76. package/deployments/sui-testnet/executor_call_type.json +12 -12
  77. package/deployments/sui-testnet/executor_fee_lib.json +26 -26
  78. package/deployments/sui-testnet/executor_layerzero.json +25 -25
  79. package/deployments/sui-testnet/executor_ptb_builder.json +13 -13
  80. package/deployments/sui-testnet/layerzero_views.json +13 -13
  81. package/deployments/sui-testnet/message_lib_common.json +21 -21
  82. package/deployments/sui-testnet/msglib_ptb_builder_call_types.json +13 -13
  83. package/deployments/sui-testnet/multi_call.json +45 -0
  84. package/deployments/sui-testnet/oapp.json +23 -21
  85. package/deployments/sui-testnet/object-BlockedMessageLib.json +5 -5
  86. package/deployments/sui-testnet/object-BlockedMsglibPtbBuilder.json +5 -5
  87. package/deployments/sui-testnet/object-Counter.json +5 -5
  88. package/deployments/sui-testnet/object-CounterAdminCap.json +5 -5
  89. package/deployments/sui-testnet/object-CounterOApp.json +5 -5
  90. package/deployments/sui-testnet/object-DVN.json +2 -2
  91. package/deployments/sui-testnet/object-DVNCap.json +5 -5
  92. package/deployments/sui-testnet/object-DVNFeeLib.json +5 -5
  93. package/deployments/sui-testnet/object-EndpointPtbBuilder.json +5 -5
  94. package/deployments/sui-testnet/object-EndpointPtbBuilderAdminCap.json +5 -5
  95. package/deployments/sui-testnet/object-EndpointV2.json +5 -5
  96. package/deployments/sui-testnet/object-EndpointV2AdminCap.json +5 -5
  97. package/deployments/sui-testnet/object-Executor.json +2 -2
  98. package/deployments/sui-testnet/object-ExecutorCap.json +5 -5
  99. package/deployments/sui-testnet/object-ExecutorFeeLib.json +5 -5
  100. package/deployments/sui-testnet/object-ExecutorOwnerCap.json +2 -2
  101. package/deployments/sui-testnet/object-PackageWhitelistValidator.json +5 -5
  102. package/deployments/sui-testnet/object-PriceFeed.json +5 -5
  103. package/deployments/sui-testnet/object-PriceFeedOwnerCap.json +5 -5
  104. package/deployments/sui-testnet/object-SimpleMessageLib.json +5 -5
  105. package/deployments/sui-testnet/object-SimpleMessageLibAdminCap.json +5 -5
  106. package/deployments/sui-testnet/object-SmlPtbBuilder.json +5 -5
  107. package/deployments/sui-testnet/object-Treasury.json +5 -5
  108. package/deployments/sui-testnet/object-TreasuryAdminCap.json +5 -5
  109. package/deployments/sui-testnet/object-ULN302.json +5 -5
  110. package/deployments/sui-testnet/object-ULN302AdminCap.json +5 -5
  111. package/deployments/sui-testnet/object-Uln302PtbBuilder.json +5 -5
  112. package/deployments/sui-testnet/object-Uln302Verification.json +5 -5
  113. package/deployments/sui-testnet/object-WorkerRegistry.json +9 -0
  114. package/deployments/sui-testnet/object-ZroCoinMetadata.json +5 -5
  115. package/deployments/sui-testnet/object-ZroTreasuryCap.json +5 -5
  116. package/deployments/sui-testnet/package_whitelist_validator.json +51 -51
  117. package/deployments/sui-testnet/price_feed.json +34 -34
  118. package/deployments/sui-testnet/price_feed_call_types.json +19 -19
  119. package/deployments/sui-testnet/ptb_move_call.json +21 -21
  120. package/deployments/sui-testnet/simple_message_lib.json +29 -29
  121. package/deployments/sui-testnet/simple_msglib_ptb_builder.json +22 -22
  122. package/deployments/sui-testnet/treasury.json +30 -58
  123. package/deployments/sui-testnet/uln_302.json +46 -50
  124. package/deployments/sui-testnet/uln_302_ptb_builder.json +25 -25
  125. package/deployments/sui-testnet/uln_common.json +49 -0
  126. package/deployments/sui-testnet/utils.json +20 -20
  127. package/deployments/sui-testnet/worker_common.json +21 -20
  128. package/deployments/sui-testnet/worker_registry.json +58 -0
  129. package/deployments/sui-testnet/zro.json +28 -28
  130. package/dist/index.cjs +1231 -464
  131. package/dist/index.cjs.map +1 -1
  132. package/dist/index.d.mts +728 -379
  133. package/dist/index.d.ts +728 -379
  134. package/dist/index.mjs +1220 -464
  135. package/dist/index.mjs.map +1 -1
  136. package/package.json +7 -7
  137. package/src/bcs/index.ts +2 -1
  138. package/src/bcs/oapp.ts +14 -0
  139. package/src/generated/addresses.ts +124 -106
  140. package/src/module-manager.ts +15 -3
  141. package/src/modules/call.ts +16 -6
  142. package/src/modules/endpoint.ts +54 -53
  143. package/src/modules/message-libs/simple-message-lib.ts +3 -2
  144. package/src/modules/message-libs/uln302.ts +28 -26
  145. package/src/modules/oapps/counter.ts +34 -53
  146. package/src/modules/oapps/oapp.ts +489 -74
  147. package/src/modules/ptb-builders/endpoint-ptb-builder.ts +9 -3
  148. package/src/modules/ptb-builders/ptb-builder.ts +19 -4
  149. package/src/modules/ptb-builders/uln302-ptb-builder.ts +5 -0
  150. package/src/modules/workers/dvn-layerzero.ts +9 -0
  151. package/src/modules/workers/dvn.ts +214 -6
  152. package/src/modules/workers/executor-fee-lib.ts +11 -3
  153. package/src/modules/workers/executor-layerzero.ts +9 -0
  154. package/src/modules/workers/executor.ts +115 -0
  155. package/src/modules/workers/index.ts +1 -0
  156. package/src/modules/workers/treasury.ts +4 -4
  157. package/src/modules/workers/worker-registry.ts +110 -0
  158. package/src/resource.ts +3 -0
  159. package/src/sdk.ts +7 -2
  160. package/src/types/endpoint.ts +2 -1
  161. package/src/types/modules.ts +1 -0
  162. package/src/types/oapp.ts +6 -0
  163. package/src/types/options.ts +15 -0
  164. package/src/utils/transaction.ts +3 -3
@@ -62,18 +62,23 @@ export const EndpointErrorCode = {
62
62
  MessagingChannel_ESendReentrancy: 10,
63
63
  MessagingChannel_EUninitializedChannel: 11,
64
64
 
65
+ // MessagingComposer related errors (with MessagingComposer_ prefix)
66
+ MessagingComposer_EComposeExists: 1,
67
+ MessagingComposer_EComposeMessageMismatch: 2,
68
+ MessagingComposer_EComposeNotFound: 3,
69
+ MessagingComposer_EComposerNotRegistered: 4,
70
+ MessagingComposer_EComposerRegistered: 5,
65
71
  // OAppRegistry related errors (with OAppRegistry_ prefix)
66
- OAppRegistry_EInvalidLZReceiveInfo: 1,
67
- OAppRegistry_EInvalidOriginalPackage: 2,
68
- OAppRegistry_EOAppNotRegistered: 3,
69
- OAppRegistry_EOAppRegistered: 4,
72
+ OAppRegistry_EOAppNotRegistered: 1,
73
+ OAppRegistry_EOAppRegistered: 2,
70
74
 
71
75
  // Endpoint related errors (with Endpoint_ prefix)
72
76
  Endpoint_EAlreadyInitialized: 1,
73
77
  Endpoint_EInvalidEid: 2,
74
78
  Endpoint_ENotInitialized: 3,
75
79
  Endpoint_ERefundAddressNotFound: 4,
76
- Endpoint_EUnauthorizedSendLibrary: 5,
80
+ Endpoint_EUnauthorizedOApp: 5,
81
+ Endpoint_EUnauthorizedSendLibrary: 6,
77
82
  } as const
78
83
 
79
84
  export class Endpoint {
@@ -112,16 +117,17 @@ export class Endpoint {
112
117
  * Register an OApp with the endpoint
113
118
  * @param tx - The transaction to add the move call to
114
119
  * @param oappCap - The OApp capability object ID or transaction argument
115
- * @param lzReceiveInfo - Transaction result containing LayerZero receive information
120
+ * @param oappInfo - OApp information including lz_receive execution information
121
+ * @returns Transaction result containing the messaging channel address
116
122
  */
117
123
  registerOAppMoveCall(
118
124
  tx: Transaction,
119
125
  oappCap: string | TransactionArgument,
120
- lzReceiveInfo: Uint8Array | TransactionArgument
121
- ): void {
122
- tx.moveCall({
126
+ oappInfo: Uint8Array | TransactionArgument
127
+ ): TransactionResult {
128
+ return tx.moveCall({
123
129
  target: this.#target('register_oapp'),
124
- arguments: [tx.object(this.objects.endpointV2), asObject(tx, oappCap), asBytes(tx, lzReceiveInfo)],
130
+ arguments: [tx.object(this.objects.endpointV2), asObject(tx, oappCap), asBytes(tx, oappInfo)],
125
131
  })
126
132
  }
127
133
 
@@ -143,25 +149,25 @@ export class Endpoint {
143
149
  }
144
150
 
145
151
  /**
146
- * Set LayerZero receive information for an OApp
152
+ * Set OApp information for an OApp
147
153
  * @param tx - The transaction to add the move call to
148
154
  * @param callerCap - The caller capability object ID or transaction argument
149
155
  * @param oapp - The OApp address or transaction argument
150
- * @param lzReceiveInfo - The LayerZero receive information as bytes or transaction argument
156
+ * @param oappInfo - The OApp information including lz_receive execution information as bytes or transaction argument
151
157
  */
152
- setLzReceiveInfoMoveCall(
158
+ setOappInfoMoveCall(
153
159
  tx: Transaction,
154
160
  callerCap: string | TransactionArgument,
155
161
  oapp: string | TransactionArgument,
156
- lzReceiveInfo: Uint8Array | TransactionArgument
162
+ oappInfo: Uint8Array | TransactionArgument
157
163
  ): void {
158
164
  tx.moveCall({
159
- target: this.#target('set_lz_receive_info'),
165
+ target: this.#target('set_oapp_info'),
160
166
  arguments: [
161
167
  tx.object(this.objects.endpointV2),
162
168
  asObject(tx, callerCap),
163
169
  asAddress(tx, oapp),
164
- asBytes(tx, lzReceiveInfo),
170
+ asBytes(tx, oappInfo),
165
171
  ],
166
172
  })
167
173
  }
@@ -547,33 +553,34 @@ export class Endpoint {
547
553
  * Register a composer with the endpoint
548
554
  * @param tx - The transaction to add the move call to
549
555
  * @param composerCap - The composer capability object ID or transaction argument
550
- * @param lzComposeInfo - LayerZero compose information as bytes
556
+ * @param composerInfo - Composer information including lz_compose execution information as bytes
557
+ * @returns Transaction result containing the compose queue address
551
558
  */
552
559
  registerComposerMoveCall(
553
560
  tx: Transaction,
554
561
  composerCap: string | TransactionArgument,
555
- lzComposeInfo: Uint8Array | TransactionArgument
556
- ): void {
557
- tx.moveCall({
562
+ composerInfo: Uint8Array | TransactionArgument
563
+ ): TransactionResult {
564
+ return tx.moveCall({
558
565
  target: this.#target('register_composer'),
559
- arguments: [tx.object(this.objects.endpointV2), asObject(tx, composerCap), asBytes(tx, lzComposeInfo)],
566
+ arguments: [tx.object(this.objects.endpointV2), asObject(tx, composerCap), asBytes(tx, composerInfo)],
560
567
  })
561
568
  }
562
569
 
563
570
  /**
564
- * Set LayerZero compose information for a composer
571
+ * Set composer information for a composer
565
572
  * @param tx - The transaction to add the move call to
566
573
  * @param composerCap - The composer capability object ID or transaction argument
567
- * @param lzComposeInfo - LayerZero compose information as bytes or transaction argument
574
+ * @param composerInfo - Composer information including lz_compose execution information as bytes or transaction argument
568
575
  */
569
- setLzComposeInfoMoveCall(
576
+ setComposerInfoMoveCall(
570
577
  tx: Transaction,
571
578
  composerCap: string | TransactionArgument,
572
- lzComposeInfo: Uint8Array | TransactionArgument
579
+ composerInfo: Uint8Array | TransactionArgument
573
580
  ): void {
574
581
  tx.moveCall({
575
- target: this.#target('set_lz_compose_info'),
576
- arguments: [tx.object(this.objects.endpointV2), asObject(tx, composerCap), asBytes(tx, lzComposeInfo)],
582
+ target: this.#target('set_composer_info'),
583
+ arguments: [tx.object(this.objects.endpointV2), asObject(tx, composerCap), asBytes(tx, composerInfo)],
577
584
  })
578
585
  }
579
586
 
@@ -1024,28 +1031,28 @@ export class Endpoint {
1024
1031
  }
1025
1032
 
1026
1033
  /**
1027
- * Get LayerZero receive information for an OApp
1034
+ * Get OApp information for an OApp
1028
1035
  * @param tx - The transaction to add the move call to
1029
1036
  * @param oapp - The OApp address or transaction argument
1030
- * @returns Transaction result containing the receive information
1037
+ * @returns Transaction result containing the OApp information including lz_receive execution information
1031
1038
  */
1032
- getLzReceiveInfoMoveCall(tx: Transaction, oapp: string | TransactionArgument): TransactionResult {
1039
+ getOappInfoMoveCall(tx: Transaction, oapp: string | TransactionArgument): TransactionResult {
1033
1040
  return tx.moveCall({
1034
- target: this.#target('get_lz_receive_info'),
1041
+ target: this.#target('get_oapp_info'),
1035
1042
  arguments: [tx.object(this.objects.endpointV2), asAddress(tx, oapp)],
1036
1043
  })
1037
1044
  }
1038
1045
 
1039
1046
  /**
1040
- * Get LayerZero receive information for an OApp
1047
+ * Get OApp information for an OApp
1041
1048
  * @param oapp - The OApp address
1042
- * @returns Promise<Uint8Array> - The receive information as bytes
1049
+ * @returns Promise<Uint8Array> - The OApp information including lz_receive execution information as bytes
1043
1050
  */
1044
- async getLzReceiveInfo(oapp: string): Promise<Uint8Array> {
1051
+ async getOappInfo(oapp: string): Promise<Uint8Array> {
1045
1052
  return executeSimulate(
1046
1053
  this.client,
1047
1054
  (tx) => {
1048
- return this.getLzReceiveInfoMoveCall(tx, oapp)
1055
+ return this.getOappInfoMoveCall(tx, oapp)
1049
1056
  },
1050
1057
  (result) => {
1051
1058
  const parsed = bcs.vector(bcs.u8()).parse(result[0].value)
@@ -1139,28 +1146,28 @@ export class Endpoint {
1139
1146
  }
1140
1147
 
1141
1148
  /**
1142
- * Get LayerZero compose information for a composer
1149
+ * Get composer information for a registered composer
1143
1150
  * @param tx - The transaction to add the move call to
1144
1151
  * @param composer - The composer address or transaction argument
1145
- * @returns Transaction result containing the compose information
1152
+ * @returns Transaction result containing the composer information
1146
1153
  */
1147
- getLzComposeInfoMoveCall(tx: Transaction, composer: string | TransactionArgument): TransactionResult {
1154
+ getComposerInfoMoveCall(tx: Transaction, composer: string | TransactionArgument): TransactionResult {
1148
1155
  return tx.moveCall({
1149
- target: this.#target('get_lz_compose_info'),
1156
+ target: this.#target('get_composer_info'),
1150
1157
  arguments: [tx.object(this.objects.endpointV2), asAddress(tx, composer)],
1151
1158
  })
1152
1159
  }
1153
1160
 
1154
1161
  /**
1155
- * Get LayerZero compose information for a composer
1162
+ * Get composer information for a registered composer
1156
1163
  * @param composer - The composer address
1157
- * @returns Promise<Uint8Array> - The compose information as bytes
1164
+ * @returns Promise<Uint8Array> - The composer information as bytes
1158
1165
  */
1159
- async getLzComposeInfo(composer: string): Promise<Uint8Array> {
1166
+ async getComposerInfo(composer: string): Promise<Uint8Array> {
1160
1167
  return executeSimulate(
1161
1168
  this.client,
1162
1169
  (tx) => {
1163
- this.getLzComposeInfoMoveCall(tx, composer)
1170
+ this.getComposerInfoMoveCall(tx, composer)
1164
1171
  },
1165
1172
  (result) => {
1166
1173
  const parsed = bcs.vector(bcs.u8()).parse(result[0].value)
@@ -2309,16 +2316,13 @@ export class Endpoint {
2309
2316
  async populateLzReceiveTransaction(
2310
2317
  tx: Transaction,
2311
2318
  lzReceiveCall: TransactionResult,
2312
- oapp: string, // receiver oapp
2319
+ oapp: string | TransactionArgument, // receiver oapp
2313
2320
  sender: string | undefined = undefined,
2314
2321
  validators: IPTBValidator[] = [],
2315
2322
  maxSimulationTimes = DEFAULT_SIMULATION_TIMES
2316
2323
  ): Promise<MoveCall[]> {
2317
2324
  const simulateTx = Transaction.from(tx)
2318
- simulateTx.moveCall({
2319
- target: this.#target('get_lz_receive_info'),
2320
- arguments: [simulateTx.object(this.objects.endpointV2), simulateTx.pure.address(oapp)],
2321
- })
2325
+ this.getOappInfoMoveCall(simulateTx, oapp)
2322
2326
  const moveCalls = await this.moduleManager.getPtbBuilder().simulateLzReceivePtb(simulateTx, sender)
2323
2327
 
2324
2328
  const [_, finalMoveCalls] = await this.moduleManager
@@ -2353,16 +2357,13 @@ export class Endpoint {
2353
2357
  async populateLzComposeTransaction(
2354
2358
  tx: Transaction,
2355
2359
  endpointLzComposeCall: TransactionResult,
2356
- composer: string,
2360
+ composer: string | TransactionArgument,
2357
2361
  sender: string | undefined = undefined,
2358
2362
  validators: IPTBValidator[] = [],
2359
2363
  maxSimulationTimes = DEFAULT_SIMULATION_TIMES
2360
2364
  ): Promise<MoveCall[]> {
2361
2365
  const simulateTx = Transaction.from(tx)
2362
- simulateTx.moveCall({
2363
- target: this.#target('get_lz_compose_info'),
2364
- arguments: [simulateTx.object(this.objects.endpointV2), simulateTx.pure.address(composer)],
2365
- })
2366
+ this.getComposerInfoMoveCall(simulateTx, composer)
2366
2367
  const moveCalls = await this.moduleManager.getPtbBuilder().simulateLzComposePtb(simulateTx, sender)
2367
2368
 
2368
2369
  const [_, finalMoveCalls] = await this.moduleManager
@@ -9,9 +9,10 @@ import { asAddress, asBytes, asBytes32, asObject, asU64, executeSimulate } from
9
9
  const MODULE_NAME = 'simple_message_lib'
10
10
 
11
11
  export const SimpleMessageLibErrorCode = {
12
- // SimpleMessageLib related errors (with SimpleMessageLib_ prefix)
13
- SimpleMessageLib_EConfigNotFound: 1,
12
+ // SimpleMessageLib related errors (matching simple_message_lib.move)
13
+ SimpleMessageLib_ENotImplemented: 1,
14
14
  SimpleMessageLib_EZROFeeNotEnabled: 2,
15
+ SimpleMessageLib_EInvalidEid: 3,
15
16
  } as const
16
17
 
17
18
  export class SimpleMessageLib {
@@ -19,7 +19,7 @@ import {
19
19
 
20
20
  const MODULE_NAME = 'uln_302'
21
21
 
22
- // ULN-302 specific error codes
22
+ // ULN-302 specific error codes (matching uln-302 contract files)
23
23
  export const Uln302ErrorCode = {
24
24
  SendUln302_EDefaultExecutorConfigNotFound: 1,
25
25
  SendUln302_EDefaultUlnConfigNotFound: 2,
@@ -33,10 +33,28 @@ export const Uln302ErrorCode = {
33
33
  ReceiveUln302_EOAppUlnConfigNotFound: 4,
34
34
  ReceiveUln302_EVerifying: 5,
35
35
 
36
- Uln302_EEndpointInitialized: 1,
37
- Uln302_EInvalidConfigType: 2,
38
- Uln302_EInvalidMessagingChannel: 3,
39
- Uln302_EUnsupportedEid: 4,
36
+ Uln302_EInvalidConfigType: 1,
37
+ Uln302_EInvalidMessagingChannel: 2,
38
+ Uln302_EUnsupportedEid: 3,
39
+
40
+ // UlnConfig related errors (matching uln_config.move)
41
+ UlnConfig_EAtLeastOneDVN: 1,
42
+ UlnConfig_EDuplicateOptionalDVNs: 2,
43
+ UlnConfig_EDuplicateRequiredDVNs: 3,
44
+ UlnConfig_EInvalidOptionalDVNCount: 4,
45
+ UlnConfig_EInvalidOptionalDVNThreshold: 5,
46
+ UlnConfig_EInvalidRequiredDVNCount: 6,
47
+ UlnConfig_EInvalidUlnConfigBytes: 7,
48
+
49
+ // OAppUlnConfig related errors (matching oapp_uln_config.move)
50
+ OAppUlnConfig_EInvalidConfirmations: 1,
51
+ OAppUlnConfig_EInvalidRequiredDVNs: 2,
52
+ OAppUlnConfig_EInvalidOptionalDVNs: 3,
53
+
54
+ // ExecutorConfig related errors (matching executor_config.move)
55
+ ExecutorConfig_EInvalidExecutorAddress: 1,
56
+ ExecutorConfig_EInvalidExecutorBytes: 2,
57
+ ExecutorConfig_EZeroMessageSize: 3,
40
58
  } as const
41
59
 
42
60
  export class Uln302 {
@@ -162,32 +180,16 @@ export class Uln302 {
162
180
  }
163
181
 
164
182
  /**
165
- * Verify packet move call with DVN signatures
166
- * Note: This is typically called by DVNs, not directly by users
183
+ * Verify packet move call with DVN call (new API)
184
+ * Note: This is typically called by DVNs via Call objects, not directly by users
167
185
  * @param tx - The transaction to add the move call to
168
186
  * @param verification - The verification object address or transaction argument
169
- * @param dvn - The DVN address performing verification or transaction argument
170
- * @param packetHeader - The packet header as bytes or transaction argument
171
- * @param payloadHash - The payload hash as bytes or transaction argument
172
- * @param confirmations - Required confirmations count or transaction argument
187
+ * @param call - The DVN verification call containing verification parameters
173
188
  */
174
- verifyMoveCall(
175
- tx: Transaction,
176
- verification: string | TransactionArgument,
177
- dvn: string | TransactionArgument,
178
- packetHeader: Uint8Array | TransactionArgument,
179
- payloadHash: Uint8Array | TransactionArgument,
180
- confirmations: bigint | TransactionArgument
181
- ): void {
189
+ verifyMoveCall(tx: Transaction, verification: string | TransactionArgument, call: TransactionArgument): void {
182
190
  tx.moveCall({
183
191
  target: this.#target('verify'),
184
- arguments: [
185
- asObject(tx, verification),
186
- asObject(tx, dvn),
187
- asBytes(tx, packetHeader),
188
- asBytes32(tx, payloadHash, this.moduleManager.getUtils()),
189
- asU64(tx, confirmations),
190
- ],
192
+ arguments: [tx.object(this.objects.uln302), asObject(tx, verification), call],
191
193
  })
192
194
  }
193
195
 
@@ -7,11 +7,11 @@ import { EndpointId } from '@layerzerolabs/lz-definitions'
7
7
  import { ModuleManager } from '../../module-manager'
8
8
  import { MessagingFee, ObjectOptions } from '../../types'
9
9
  import {
10
+ IPTBValidator,
10
11
  asAddress,
11
12
  asBool,
12
13
  asBytes,
13
14
  asBytes32,
14
- asObject,
15
15
  asU32,
16
16
  asU64,
17
17
  asU8,
@@ -22,15 +22,16 @@ import {
22
22
  const MODULE_NAME = 'counter'
23
23
 
24
24
  export const CounterErrorCode = {
25
- // Counter related errors
25
+ // Counter related errors (matching counter.move)
26
26
  Counter_EInvalidMsgType: 0,
27
27
  Counter_EInvalidValue: 1,
28
28
  Counter_EInvalidNonce: 2,
29
29
  Counter_EOnlyEndpoint: 3,
30
30
  Counter_ESelfComposeOnly: 4,
31
31
  Counter_EInvalidOApp: 5,
32
- Counter_EInvalidAdminCap: 6,
33
- Counter_EAlreadyInitialized: 7,
32
+
33
+ // OptionsBuilder related errors (matching options_builder.move)
34
+ OptionsBuilder_EInvalidSize: 1,
34
35
  } as const
35
36
 
36
37
  export class Counter {
@@ -83,7 +84,8 @@ export class Counter {
83
84
  dstEid: EndpointId | TransactionArgument,
84
85
  msgType: number | TransactionArgument,
85
86
  options: Uint8Array | TransactionArgument,
86
- payInZero: boolean | TransactionArgument
87
+ payInZero: boolean | TransactionArgument,
88
+ validators?: IPTBValidator[]
87
89
  ): Promise<MessagingFee> {
88
90
  const tx = new Transaction()
89
91
  const quoteCall = tx.moveCall({
@@ -97,7 +99,7 @@ export class Counter {
97
99
  asBool(tx, payInZero),
98
100
  ],
99
101
  })
100
- return this.moduleManager.getEndpoint().quote(tx, quoteCall)
102
+ return this.moduleManager.getEndpoint().quote(tx, quoteCall, undefined, validators)
101
103
  }
102
104
 
103
105
  /**
@@ -107,7 +109,6 @@ export class Counter {
107
109
  * @param dstEid - Destination endpoint ID
108
110
  * @param msgType - Message type (SEND or SEND_AND_CALL)
109
111
  * @param options - Execution options as bytes
110
- * @param sendValue - Value to send with the message
111
112
  * @param nativeFee - Native token fee amount
112
113
  * @param zroFee - ZRO token fee amount
113
114
  * @param refundAddress - Address for fee refunds
@@ -118,10 +119,10 @@ export class Counter {
118
119
  dstEid: EndpointId | TransactionArgument,
119
120
  msgType: number | TransactionArgument,
120
121
  options: Uint8Array | TransactionArgument,
121
- sendValue: bigint | TransactionArgument,
122
122
  nativeFee: bigint | TransactionArgument,
123
123
  zroFee: bigint | TransactionArgument,
124
- refundAddress: string | TransactionArgument
124
+ refundAddress: string | TransactionArgument,
125
+ validators?: IPTBValidator[]
125
126
  ): Promise<void> {
126
127
  const [nativeToken] = tx.splitCoins(tx.gas, [asU64(tx, nativeFee)])
127
128
  const zroToken = isTransactionArgument(zroFee)
@@ -135,80 +136,60 @@ export class Counter {
135
136
  asU32(tx, dstEid),
136
137
  asU8(tx, msgType),
137
138
  asBytes(tx, options),
138
- asU64(tx, sendValue),
139
139
  nativeToken,
140
140
  zroToken,
141
141
  asAddress(tx, refundAddress),
142
142
  ],
143
143
  })
144
- await this.moduleManager.getEndpoint().populateSendTransaction(tx, incrementCall, sender)
144
+ await this.moduleManager.getEndpoint().populateSendTransaction(tx, incrementCall, sender, validators)
145
145
  }
146
146
 
147
147
  /**
148
- * Set peer counter on another chain
148
+ * Set composer information for counter
149
149
  * @param tx - The transaction to add the move call to
150
- * @param messagingChannel - The messaging channel object ID or transaction argument
151
- * @param eid - The peer endpoint ID or transaction argument
152
- * @param peer - The peer counter address as bytes or transaction argument
150
+ * @param composerInfo - Composer information including lz_compose execution information as bytes
153
151
  */
154
- setPeerMoveCall(
155
- tx: Transaction,
156
- messagingChannel: string | TransactionArgument,
157
- eid: number | TransactionArgument,
158
- peer: Uint8Array | TransactionArgument
159
- ): void {
152
+ setComposerInfoMoveCall(tx: Transaction, composerInfo: Uint8Array | TransactionArgument): void {
160
153
  tx.moveCall({
161
- target: this.#target('set_peer'),
154
+ target: this.#target('set_composer_info'),
162
155
  arguments: [
163
156
  tx.object(this.objects.counter),
164
157
  tx.object(this.objects.counterOapp),
165
158
  tx.object(this.objects.counterAdminCap),
166
159
  tx.object(this.objects.endpointV2),
167
- asObject(tx, messagingChannel),
168
- asU32(tx, eid),
169
- asBytes32(tx, peer, this.moduleManager.getUtils()),
160
+ asBytes(tx, composerInfo),
170
161
  ],
171
162
  })
172
163
  }
173
164
 
165
+ // === View Functions ===
166
+
174
167
  /**
175
- * Set delegate for the counter
168
+ * Get counter EID
176
169
  * @param tx - The transaction to add the move call to
177
- * @param newDelegate - The new delegate address or transaction argument
170
+ * @returns Transaction result containing the counter EID
178
171
  */
179
- setDelegateMoveCall(tx: Transaction, newDelegate: string | TransactionArgument): void {
180
- tx.moveCall({
181
- target: this.#target('set_delegate'),
182
- arguments: [
183
- tx.object(this.objects.counter),
184
- tx.object(this.objects.counterOapp),
185
- tx.object(this.objects.counterAdminCap),
186
- tx.object(this.objects.endpointV2),
187
- asAddress(tx, newDelegate),
188
- ],
172
+ getEidMoveCall(tx: Transaction): TransactionResult {
173
+ return tx.moveCall({
174
+ target: this.#target('eid'),
175
+ arguments: [tx.object(this.objects.counter)],
189
176
  })
190
177
  }
191
178
 
192
179
  /**
193
- * Set LayerZero compose information for counter
194
- * @param tx - The transaction to add the move call to
195
- * @param lzComposeInfo - LayerZero compose information as bytes
180
+ * Get counter EID
181
+ * @returns Promise<number> - The counter EID
196
182
  */
197
- setLzComposeInfoMoveCall(tx: Transaction, lzComposeInfo: Uint8Array | TransactionArgument): void {
198
- tx.moveCall({
199
- target: this.#target('set_lz_compose_info'),
200
- arguments: [
201
- tx.object(this.objects.counter),
202
- tx.object(this.objects.counterOapp),
203
- tx.object(this.objects.counterAdminCap),
204
- tx.object(this.objects.endpointV2),
205
- asBytes(tx, lzComposeInfo),
206
- ],
207
- })
183
+ async getEid(): Promise<number> {
184
+ return executeSimulate(
185
+ this.client,
186
+ (tx) => {
187
+ this.getEidMoveCall(tx)
188
+ },
189
+ (result) => bcs.U32.parse(result[0].value)
190
+ )
208
191
  }
209
192
 
210
- // === View Functions ===
211
-
212
193
  /**
213
194
  * Get call capability address for counter
214
195
  * @param tx - The transaction to add the move call to