@layerzerolabs/lz-iotal1-sdk-v2 3.0.143

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 (279) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +19 -0
  3. package/deployments/iotal1-mainnet/blocked_message_lib.json +58 -0
  4. package/deployments/iotal1-mainnet/blocked_msglib_ptb_builder.json +58 -0
  5. package/deployments/iotal1-mainnet/call.json +46 -0
  6. package/deployments/iotal1-mainnet/counter.json +85 -0
  7. package/deployments/iotal1-mainnet/dvn.json +49 -0
  8. package/deployments/iotal1-mainnet/dvn_call_type.json +45 -0
  9. package/deployments/iotal1-mainnet/dvn_fee_lib.json +59 -0
  10. package/deployments/iotal1-mainnet/dvn_layerzero.json +56 -0
  11. package/deployments/iotal1-mainnet/dvn_ptb_builder.json +45 -0
  12. package/deployments/iotal1-mainnet/endpoint_ptb_builder.json +70 -0
  13. package/deployments/iotal1-mainnet/endpoint_v2.json +86 -0
  14. package/deployments/iotal1-mainnet/executor.json +49 -0
  15. package/deployments/iotal1-mainnet/executor_call_type.json +45 -0
  16. package/deployments/iotal1-mainnet/executor_fee_lib.json +60 -0
  17. package/deployments/iotal1-mainnet/executor_layerzero.json +56 -0
  18. package/deployments/iotal1-mainnet/executor_ptb_builder.json +45 -0
  19. package/deployments/iotal1-mainnet/layerzero_views.json +46 -0
  20. package/deployments/iotal1-mainnet/message_lib_common.json +47 -0
  21. package/deployments/iotal1-mainnet/msglib_ptb_builder_call_types.json +45 -0
  22. package/deployments/iotal1-mainnet/multi_call.json +45 -0
  23. package/deployments/iotal1-mainnet/oapp.json +50 -0
  24. package/deployments/iotal1-mainnet/object-BlockedMessageLib.json +9 -0
  25. package/deployments/iotal1-mainnet/object-BlockedMsglibPtbBuilder.json +9 -0
  26. package/deployments/iotal1-mainnet/object-Counter.json +9 -0
  27. package/deployments/iotal1-mainnet/object-CounterAdminCap.json +9 -0
  28. package/deployments/iotal1-mainnet/object-CounterOApp.json +9 -0
  29. package/deployments/iotal1-mainnet/object-DVN.json +5 -0
  30. package/deployments/iotal1-mainnet/object-DVNCap.json +9 -0
  31. package/deployments/iotal1-mainnet/object-DVNFeeLib.json +9 -0
  32. package/deployments/iotal1-mainnet/object-EndpointPtbBuilder.json +9 -0
  33. package/deployments/iotal1-mainnet/object-EndpointPtbBuilderAdminCap.json +9 -0
  34. package/deployments/iotal1-mainnet/object-EndpointV2.json +9 -0
  35. package/deployments/iotal1-mainnet/object-EndpointV2AdminCap.json +9 -0
  36. package/deployments/iotal1-mainnet/object-Executor.json +5 -0
  37. package/deployments/iotal1-mainnet/object-ExecutorCap.json +9 -0
  38. package/deployments/iotal1-mainnet/object-ExecutorFeeLib.json +9 -0
  39. package/deployments/iotal1-mainnet/object-ExecutorOwnerCap.json +5 -0
  40. package/deployments/iotal1-mainnet/object-OFTComposerManager.json +9 -0
  41. package/deployments/iotal1-mainnet/object-PackageWhitelistValidator.json +9 -0
  42. package/deployments/iotal1-mainnet/object-PriceFeed.json +9 -0
  43. package/deployments/iotal1-mainnet/object-PriceFeedOwnerCap.json +9 -0
  44. package/deployments/iotal1-mainnet/object-SimpleMessageLib.json +9 -0
  45. package/deployments/iotal1-mainnet/object-SimpleMessageLibAdminCap.json +9 -0
  46. package/deployments/iotal1-mainnet/object-SmlPtbBuilder.json +9 -0
  47. package/deployments/iotal1-mainnet/object-Treasury.json +9 -0
  48. package/deployments/iotal1-mainnet/object-TreasuryAdminCap.json +9 -0
  49. package/deployments/iotal1-mainnet/object-ULN302.json +9 -0
  50. package/deployments/iotal1-mainnet/object-ULN302AdminCap.json +9 -0
  51. package/deployments/iotal1-mainnet/object-Uln302PtbBuilder.json +9 -0
  52. package/deployments/iotal1-mainnet/object-Uln302Verification.json +9 -0
  53. package/deployments/iotal1-mainnet/object-WorkerRegistry.json +9 -0
  54. package/deployments/iotal1-mainnet/object-ZroCoinMetadata.json +9 -0
  55. package/deployments/iotal1-mainnet/object-ZroTreasuryCap.json +9 -0
  56. package/deployments/iotal1-mainnet/oft_common.json +61 -0
  57. package/deployments/iotal1-mainnet/package_whitelist_validator.json +113 -0
  58. package/deployments/iotal1-mainnet/price_feed.json +70 -0
  59. package/deployments/iotal1-mainnet/price_feed_call_types.json +45 -0
  60. package/deployments/iotal1-mainnet/ptb_move_call.json +48 -0
  61. package/deployments/iotal1-mainnet/simple_message_lib.json +69 -0
  62. package/deployments/iotal1-mainnet/simple_msglib_ptb_builder.json +58 -0
  63. package/deployments/iotal1-mainnet/treasury.json +69 -0
  64. package/deployments/iotal1-mainnet/uln_302.json +87 -0
  65. package/deployments/iotal1-mainnet/uln_302_ptb_builder.json +58 -0
  66. package/deployments/iotal1-mainnet/uln_common.json +49 -0
  67. package/deployments/iotal1-mainnet/utils.json +57 -0
  68. package/deployments/iotal1-mainnet/worker_common.json +46 -0
  69. package/deployments/iotal1-mainnet/worker_registry.json +58 -0
  70. package/deployments/iotal1-mainnet/zro.json +67 -0
  71. package/deployments/iotal1-sandbox-local/blocked_message_lib.json +58 -0
  72. package/deployments/iotal1-sandbox-local/blocked_msglib_ptb_builder.json +58 -0
  73. package/deployments/iotal1-sandbox-local/call.json +46 -0
  74. package/deployments/iotal1-sandbox-local/counter.json +148 -0
  75. package/deployments/iotal1-sandbox-local/dvn.json +49 -0
  76. package/deployments/iotal1-sandbox-local/dvn_call_type.json +73 -0
  77. package/deployments/iotal1-sandbox-local/dvn_fee_lib.json +59 -0
  78. package/deployments/iotal1-sandbox-local/dvn_layerzero.json +56 -0
  79. package/deployments/iotal1-sandbox-local/dvn_ptb_builder.json +45 -0
  80. package/deployments/iotal1-sandbox-local/endpoint_ptb_builder.json +70 -0
  81. package/deployments/iotal1-sandbox-local/endpoint_v2.json +86 -0
  82. package/deployments/iotal1-sandbox-local/executor.json +49 -0
  83. package/deployments/iotal1-sandbox-local/executor_call_type.json +73 -0
  84. package/deployments/iotal1-sandbox-local/executor_fee_lib.json +60 -0
  85. package/deployments/iotal1-sandbox-local/executor_layerzero.json +56 -0
  86. package/deployments/iotal1-sandbox-local/executor_ptb_builder.json +45 -0
  87. package/deployments/iotal1-sandbox-local/layerzero_views.json +46 -0
  88. package/deployments/iotal1-sandbox-local/message_lib_common.json +47 -0
  89. package/deployments/iotal1-sandbox-local/msglib_ptb_builder_call_types.json +45 -0
  90. package/deployments/iotal1-sandbox-local/multi_call.json +45 -0
  91. package/deployments/iotal1-sandbox-local/oapp.json +50 -0
  92. package/deployments/iotal1-sandbox-local/object-BlockedMessageLib.json +9 -0
  93. package/deployments/iotal1-sandbox-local/object-BlockedMsglibPtbBuilder.json +9 -0
  94. package/deployments/iotal1-sandbox-local/object-Counter.json +9 -0
  95. package/deployments/iotal1-sandbox-local/object-CounterAdminCap.json +9 -0
  96. package/deployments/iotal1-sandbox-local/object-CounterOApp.json +9 -0
  97. package/deployments/iotal1-sandbox-local/object-DVN.json +5 -0
  98. package/deployments/iotal1-sandbox-local/object-DVNCap.json +9 -0
  99. package/deployments/iotal1-sandbox-local/object-DVNFeeLib.json +9 -0
  100. package/deployments/iotal1-sandbox-local/object-EndpointPtbBuilder.json +9 -0
  101. package/deployments/iotal1-sandbox-local/object-EndpointPtbBuilderAdminCap.json +9 -0
  102. package/deployments/iotal1-sandbox-local/object-EndpointV2.json +9 -0
  103. package/deployments/iotal1-sandbox-local/object-EndpointV2AdminCap.json +9 -0
  104. package/deployments/iotal1-sandbox-local/object-Executor.json +5 -0
  105. package/deployments/iotal1-sandbox-local/object-ExecutorCap.json +9 -0
  106. package/deployments/iotal1-sandbox-local/object-ExecutorFeeLib.json +9 -0
  107. package/deployments/iotal1-sandbox-local/object-ExecutorOwnerCap.json +5 -0
  108. package/deployments/iotal1-sandbox-local/object-PackageWhitelistValidator.json +9 -0
  109. package/deployments/iotal1-sandbox-local/object-PriceFeed.json +9 -0
  110. package/deployments/iotal1-sandbox-local/object-PriceFeedOwnerCap.json +9 -0
  111. package/deployments/iotal1-sandbox-local/object-SimpleMessageLib.json +9 -0
  112. package/deployments/iotal1-sandbox-local/object-SimpleMessageLibAdminCap.json +9 -0
  113. package/deployments/iotal1-sandbox-local/object-SmlPtbBuilder.json +9 -0
  114. package/deployments/iotal1-sandbox-local/object-Treasury.json +9 -0
  115. package/deployments/iotal1-sandbox-local/object-TreasuryAdminCap.json +9 -0
  116. package/deployments/iotal1-sandbox-local/object-ULN302.json +9 -0
  117. package/deployments/iotal1-sandbox-local/object-ULN302AdminCap.json +9 -0
  118. package/deployments/iotal1-sandbox-local/object-Uln302PtbBuilder.json +9 -0
  119. package/deployments/iotal1-sandbox-local/object-Uln302Verification.json +9 -0
  120. package/deployments/iotal1-sandbox-local/object-WorkerRegistry.json +9 -0
  121. package/deployments/iotal1-sandbox-local/object-ZroCoinMetadata.json +9 -0
  122. package/deployments/iotal1-sandbox-local/object-ZroTreasuryCap.json +9 -0
  123. package/deployments/iotal1-sandbox-local/package_whitelist_validator.json +113 -0
  124. package/deployments/iotal1-sandbox-local/price_feed.json +98 -0
  125. package/deployments/iotal1-sandbox-local/price_feed_call_types.json +45 -0
  126. package/deployments/iotal1-sandbox-local/ptb_move_call.json +48 -0
  127. package/deployments/iotal1-sandbox-local/simple_message_lib.json +69 -0
  128. package/deployments/iotal1-sandbox-local/simple_msglib_ptb_builder.json +58 -0
  129. package/deployments/iotal1-sandbox-local/treasury.json +97 -0
  130. package/deployments/iotal1-sandbox-local/uln_302.json +87 -0
  131. package/deployments/iotal1-sandbox-local/uln_302_ptb_builder.json +58 -0
  132. package/deployments/iotal1-sandbox-local/uln_common.json +49 -0
  133. package/deployments/iotal1-sandbox-local/utils.json +78 -0
  134. package/deployments/iotal1-sandbox-local/worker_common.json +46 -0
  135. package/deployments/iotal1-sandbox-local/worker_registry.json +58 -0
  136. package/deployments/iotal1-sandbox-local/zro.json +67 -0
  137. package/deployments/iotal1-testnet/blocked_message_lib.json +58 -0
  138. package/deployments/iotal1-testnet/blocked_msglib_ptb_builder.json +58 -0
  139. package/deployments/iotal1-testnet/call.json +46 -0
  140. package/deployments/iotal1-testnet/counter.json +85 -0
  141. package/deployments/iotal1-testnet/dvn.json +49 -0
  142. package/deployments/iotal1-testnet/dvn_call_type.json +45 -0
  143. package/deployments/iotal1-testnet/dvn_fee_lib.json +59 -0
  144. package/deployments/iotal1-testnet/dvn_layerzero.json +56 -0
  145. package/deployments/iotal1-testnet/dvn_ptb_builder.json +45 -0
  146. package/deployments/iotal1-testnet/endpoint_ptb_builder.json +70 -0
  147. package/deployments/iotal1-testnet/endpoint_v2.json +86 -0
  148. package/deployments/iotal1-testnet/executor.json +49 -0
  149. package/deployments/iotal1-testnet/executor_call_type.json +45 -0
  150. package/deployments/iotal1-testnet/executor_fee_lib.json +60 -0
  151. package/deployments/iotal1-testnet/executor_layerzero.json +56 -0
  152. package/deployments/iotal1-testnet/executor_ptb_builder.json +45 -0
  153. package/deployments/iotal1-testnet/layerzero_views.json +46 -0
  154. package/deployments/iotal1-testnet/message_lib_common.json +47 -0
  155. package/deployments/iotal1-testnet/msglib_ptb_builder_call_types.json +45 -0
  156. package/deployments/iotal1-testnet/multi_call.json +45 -0
  157. package/deployments/iotal1-testnet/oapp.json +50 -0
  158. package/deployments/iotal1-testnet/object-BlockedMessageLib.json +9 -0
  159. package/deployments/iotal1-testnet/object-BlockedMsglibPtbBuilder.json +9 -0
  160. package/deployments/iotal1-testnet/object-Counter.json +9 -0
  161. package/deployments/iotal1-testnet/object-CounterAdminCap.json +9 -0
  162. package/deployments/iotal1-testnet/object-CounterOApp.json +9 -0
  163. package/deployments/iotal1-testnet/object-DVN.json +5 -0
  164. package/deployments/iotal1-testnet/object-DVNCap.json +9 -0
  165. package/deployments/iotal1-testnet/object-DVNFeeLib.json +9 -0
  166. package/deployments/iotal1-testnet/object-EndpointPtbBuilder.json +9 -0
  167. package/deployments/iotal1-testnet/object-EndpointPtbBuilderAdminCap.json +9 -0
  168. package/deployments/iotal1-testnet/object-EndpointV2.json +9 -0
  169. package/deployments/iotal1-testnet/object-EndpointV2AdminCap.json +9 -0
  170. package/deployments/iotal1-testnet/object-Executor.json +5 -0
  171. package/deployments/iotal1-testnet/object-ExecutorCap.json +9 -0
  172. package/deployments/iotal1-testnet/object-ExecutorFeeLib.json +9 -0
  173. package/deployments/iotal1-testnet/object-ExecutorOwnerCap.json +5 -0
  174. package/deployments/iotal1-testnet/object-PackageWhitelistValidator.json +9 -0
  175. package/deployments/iotal1-testnet/object-PriceFeed.json +9 -0
  176. package/deployments/iotal1-testnet/object-PriceFeedOwnerCap.json +9 -0
  177. package/deployments/iotal1-testnet/object-SimpleMessageLib.json +9 -0
  178. package/deployments/iotal1-testnet/object-SimpleMessageLibAdminCap.json +9 -0
  179. package/deployments/iotal1-testnet/object-SmlPtbBuilder.json +9 -0
  180. package/deployments/iotal1-testnet/object-Treasury.json +9 -0
  181. package/deployments/iotal1-testnet/object-TreasuryAdminCap.json +9 -0
  182. package/deployments/iotal1-testnet/object-ULN302.json +9 -0
  183. package/deployments/iotal1-testnet/object-ULN302AdminCap.json +9 -0
  184. package/deployments/iotal1-testnet/object-Uln302PtbBuilder.json +9 -0
  185. package/deployments/iotal1-testnet/object-Uln302Verification.json +9 -0
  186. package/deployments/iotal1-testnet/object-WorkerRegistry.json +9 -0
  187. package/deployments/iotal1-testnet/object-ZroCoinMetadata.json +9 -0
  188. package/deployments/iotal1-testnet/object-ZroTreasuryCap.json +9 -0
  189. package/deployments/iotal1-testnet/package_whitelist_validator.json +113 -0
  190. package/deployments/iotal1-testnet/price_feed.json +70 -0
  191. package/deployments/iotal1-testnet/price_feed_call_types.json +45 -0
  192. package/deployments/iotal1-testnet/ptb_move_call.json +48 -0
  193. package/deployments/iotal1-testnet/simple_message_lib.json +69 -0
  194. package/deployments/iotal1-testnet/simple_msglib_ptb_builder.json +58 -0
  195. package/deployments/iotal1-testnet/treasury.json +69 -0
  196. package/deployments/iotal1-testnet/uln_302.json +87 -0
  197. package/deployments/iotal1-testnet/uln_302_ptb_builder.json +58 -0
  198. package/deployments/iotal1-testnet/uln_common.json +49 -0
  199. package/deployments/iotal1-testnet/utils.json +57 -0
  200. package/deployments/iotal1-testnet/worker_common.json +46 -0
  201. package/deployments/iotal1-testnet/worker_registry.json +58 -0
  202. package/deployments/iotal1-testnet/zro.json +67 -0
  203. package/dist/index.cjs +11279 -0
  204. package/dist/index.cjs.map +1 -0
  205. package/dist/index.d.mts +5824 -0
  206. package/dist/index.d.ts +5824 -0
  207. package/dist/index.mjs +11107 -0
  208. package/dist/index.mjs.map +1 -0
  209. package/package.json +68 -0
  210. package/src/bcs/dvn.ts +7 -0
  211. package/src/bcs/endpoint.ts +7 -0
  212. package/src/bcs/executor.ts +27 -0
  213. package/src/bcs/index.ts +8 -0
  214. package/src/bcs/messaging-fee.ts +6 -0
  215. package/src/bcs/move-call.ts +28 -0
  216. package/src/bcs/oapp.ts +14 -0
  217. package/src/bcs/price-feed.ts +21 -0
  218. package/src/bcs/uln.ts +15 -0
  219. package/src/generated/addresses.ts +344 -0
  220. package/src/index.ts +5 -0
  221. package/src/module-manager.ts +360 -0
  222. package/src/modules/call.ts +245 -0
  223. package/src/modules/endpoint.ts +2417 -0
  224. package/src/modules/index.ts +10 -0
  225. package/src/modules/layerzero-views.ts +205 -0
  226. package/src/modules/message-libs/blocked-message-lib.ts +112 -0
  227. package/src/modules/message-libs/index.ts +4 -0
  228. package/src/modules/message-libs/simple-message-lib.ts +270 -0
  229. package/src/modules/message-libs/uln302.ts +827 -0
  230. package/src/modules/oapps/counter.ts +458 -0
  231. package/src/modules/oapps/index.ts +3 -0
  232. package/src/modules/oapps/oapp.ts +744 -0
  233. package/src/modules/ptb-builders/blocked-message-lib-ptb-builder.ts +49 -0
  234. package/src/modules/ptb-builders/dvn-ptb-builder.ts +58 -0
  235. package/src/modules/ptb-builders/endpoint-ptb-builder.ts +520 -0
  236. package/src/modules/ptb-builders/executor-ptb-builder.ts +58 -0
  237. package/src/modules/ptb-builders/index.ts +9 -0
  238. package/src/modules/ptb-builders/package-whitelist-validator.ts +142 -0
  239. package/src/modules/ptb-builders/ptb-builder.ts +357 -0
  240. package/src/modules/ptb-builders/simple-message-lib-ptb-builder.ts +53 -0
  241. package/src/modules/ptb-builders/uln302-ptb-builder.ts +222 -0
  242. package/src/modules/utils.ts +902 -0
  243. package/src/modules/workers/dvn-fee-lib.ts +89 -0
  244. package/src/modules/workers/dvn-layerzero.ts +85 -0
  245. package/src/modules/workers/dvn.ts +1727 -0
  246. package/src/modules/workers/executor-fee-lib.ts +94 -0
  247. package/src/modules/workers/executor-layerzero.ts +79 -0
  248. package/src/modules/workers/executor.ts +1170 -0
  249. package/src/modules/workers/index.ts +10 -0
  250. package/src/modules/workers/price-feed.ts +575 -0
  251. package/src/modules/workers/treasury.ts +295 -0
  252. package/src/modules/workers/worker-registry.ts +110 -0
  253. package/src/modules/zro.ts +94 -0
  254. package/src/resource.ts +104 -0
  255. package/src/sdk.ts +183 -0
  256. package/src/types/dvn.ts +20 -0
  257. package/src/types/endpoint.ts +16 -0
  258. package/src/types/errors.ts +10 -0
  259. package/src/types/executor.ts +23 -0
  260. package/src/types/index.ts +13 -0
  261. package/src/types/layerzero-views.ts +59 -0
  262. package/src/types/message-lib.ts +38 -0
  263. package/src/types/modules.ts +36 -0
  264. package/src/types/move-types.ts +24 -0
  265. package/src/types/oapp.ts +6 -0
  266. package/src/types/options.ts +333 -0
  267. package/src/types/price-feed.ts +21 -0
  268. package/src/types/ptb-builder.ts +29 -0
  269. package/src/types/simulation.ts +8 -0
  270. package/src/utils/argument.ts +198 -0
  271. package/src/utils/index.ts +8 -0
  272. package/src/utils/move-call-object-fetcher.ts +105 -0
  273. package/src/utils/non-sender-object-validator.ts +102 -0
  274. package/src/utils/package-allowlist-validator.ts +134 -0
  275. package/src/utils/ptb-validator.ts +14 -0
  276. package/src/utils/share-object-validator.ts +37 -0
  277. package/src/utils/transaction.ts +157 -0
  278. package/src/utils/type-name.ts +99 -0
  279. package/src/utils/validate-with-details.ts +50 -0
@@ -0,0 +1,827 @@
1
+ import { bcs } from '@iota/iota-sdk/bcs'
2
+ import { IotaClient } from '@iota/iota-sdk/client'
3
+ import { Transaction, TransactionArgument, TransactionResult } from '@iota/iota-sdk/transactions'
4
+
5
+ import { ExecutorConfigBcs, OAppUlnConfigBcs, UlnConfigBcs } from '../../bcs'
6
+ import { ModuleManager } from '../../module-manager'
7
+ import { ExecutorConfig, OAppUlnConfig, ObjectOptions, UlnConfig, VersionInfo } from '../../types'
8
+ import {
9
+ asAddress,
10
+ asAddressVector,
11
+ asBytes,
12
+ asBytes32,
13
+ asObject,
14
+ asU32,
15
+ asU64,
16
+ asU8,
17
+ executeSimulate,
18
+ } from '../../utils'
19
+
20
+ const MODULE_NAME = 'uln_302'
21
+
22
+ // ULN-302 specific error codes (matching uln-302 contract files)
23
+ export const Uln302ErrorCode = {
24
+ SendUln302_EDefaultExecutorConfigNotFound: 1,
25
+ SendUln302_EDefaultUlnConfigNotFound: 2,
26
+ SendUln302_EInvalidMessageSize: 3,
27
+ SendUln302_EOAppExecutorConfigNotFound: 4,
28
+ SendUln302_EOAppUlnConfigNotFound: 5,
29
+
30
+ ReceiveUln302_EConfirmationsNotFound: 1,
31
+ ReceiveUln302_EDefaultUlnConfigNotFound: 2,
32
+ ReceiveUln302_EInvalidEid: 3,
33
+ ReceiveUln302_EOAppUlnConfigNotFound: 4,
34
+ ReceiveUln302_EVerifying: 5,
35
+
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,
58
+ } as const
59
+
60
+ export class Uln302 {
61
+ public packageId: string
62
+ public readonly client: IotaClient
63
+ private readonly objects: ObjectOptions
64
+
65
+ constructor(
66
+ packageId: string,
67
+ client: IotaClient,
68
+ objects: ObjectOptions,
69
+ private readonly moduleManager: ModuleManager
70
+ ) {
71
+ this.packageId = packageId
72
+ this.client = client
73
+ this.objects = objects
74
+ }
75
+
76
+ // === Set Functions ===
77
+
78
+ /**
79
+ * Create quote move call for message library
80
+ * Note: This is typically called by the endpoint, not directly by users
81
+ * @param tx - The transaction to add the move call to
82
+ * @param call - The call transaction result containing quote parameters
83
+ * @returns Transaction result containing the quote operation
84
+ */
85
+ quoteMoveCall(tx: Transaction, call: TransactionArgument): TransactionResult {
86
+ return tx.moveCall({
87
+ target: this.#target('quote'),
88
+ arguments: [tx.object(this.objects.uln302), call],
89
+ })
90
+ }
91
+
92
+ /**
93
+ * Confirm quote move call with worker fee calculations
94
+ * Note: This is typically called by the endpoint, not directly by users
95
+ * @param tx - The transaction to add the move call to
96
+ * @param treasury - Treasury object address
97
+ * @param messageLibCall - Message library call transaction result
98
+ * @param executorCall - Executor call transaction result
99
+ * @param dvnMultiCall - DVN multi-call transaction result
100
+ */
101
+ confirmQuoteMoveCall(
102
+ tx: Transaction,
103
+ treasury: string | TransactionArgument,
104
+ messageLibCall: TransactionArgument,
105
+ executorCall: TransactionArgument,
106
+ dvnMultiCall: TransactionArgument
107
+ ): void {
108
+ tx.moveCall({
109
+ target: this.#target('confirm_quote'),
110
+ arguments: [
111
+ tx.object(this.objects.uln302),
112
+ asObject(tx, treasury),
113
+ messageLibCall,
114
+ executorCall,
115
+ dvnMultiCall,
116
+ ],
117
+ })
118
+ }
119
+
120
+ /**
121
+ * Create send move call for message library
122
+ * Note: This is typically called by the endpoint, not directly by users
123
+ * @param tx - The transaction to add the move call to
124
+ * @param call - The call transaction result containing send parameters
125
+ * @returns Transaction result containing the send operation
126
+ */
127
+ sendMoveCall(tx: Transaction, call: TransactionArgument): TransactionResult {
128
+ return tx.moveCall({
129
+ target: this.#target('send'),
130
+ arguments: [tx.object(this.objects.uln302), call],
131
+ })
132
+ }
133
+
134
+ /**
135
+ * Confirm send move call with treasury and worker integration
136
+ * Note: This is typically called by the endpoint, not directly by users
137
+ * @param tx - The transaction to add the move call to
138
+ * @param treasury - Treasury object address
139
+ * @param messagingChannel - The messaging channel object ID
140
+ * @param endpointCall - The endpoint call transaction result
141
+ * @param messageLibCall - The message library call transaction result
142
+ * @param executorCall - The executor call transaction result
143
+ * @param dvnMultiCall - The DVN multi-call transaction result
144
+ */
145
+ confirmSendMoveCall(
146
+ tx: Transaction,
147
+ treasury: string | TransactionArgument,
148
+ messagingChannel: string | TransactionArgument,
149
+ endpointCall: TransactionArgument,
150
+ messageLibCall: TransactionArgument,
151
+ executorCall: TransactionArgument,
152
+ dvnMultiCall: TransactionArgument
153
+ ): void {
154
+ tx.moveCall({
155
+ target: this.#target('confirm_send'),
156
+ arguments: [
157
+ tx.object(this.objects.uln302),
158
+ tx.object(this.objects.endpointV2),
159
+ asObject(tx, treasury),
160
+ asObject(tx, messagingChannel),
161
+ endpointCall,
162
+ messageLibCall,
163
+ executorCall,
164
+ dvnMultiCall,
165
+ ],
166
+ })
167
+ }
168
+
169
+ /**
170
+ * Set configuration move call for ULN302
171
+ * Note: This is typically called by the endpoint, not directly by users
172
+ * @param tx - The transaction to add the move call to
173
+ * @param call - The call transaction result containing configuration
174
+ */
175
+ setConfigMoveCall(tx: Transaction, call: TransactionArgument): void {
176
+ tx.moveCall({
177
+ target: this.#target('set_config'),
178
+ arguments: [tx.object(this.objects.uln302), call],
179
+ })
180
+ }
181
+
182
+ /**
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
185
+ * @param tx - The transaction to add the move call to
186
+ * @param verification - The verification object address or transaction argument
187
+ * @param call - The DVN verification call containing verification parameters
188
+ */
189
+ verifyMoveCall(tx: Transaction, verification: string | TransactionArgument, call: TransactionArgument): void {
190
+ tx.moveCall({
191
+ target: this.#target('verify'),
192
+ arguments: [tx.object(this.objects.uln302), asObject(tx, verification), call],
193
+ })
194
+ }
195
+
196
+ /**
197
+ * Commit verification move call after all DVN verifications are complete
198
+ * Note: This is typically called by relayers/executors, not directly by users
199
+ * @param tx - The transaction to add the move call to
200
+ * @param verification - The verification object address
201
+ * @param messagingChannel - The messaging channel object ID
202
+ * @param packetHeader - The packet header as bytes
203
+ * @param payloadHash - The payload hash as bytes
204
+ */
205
+ commitVerificationMoveCall(
206
+ tx: Transaction,
207
+ verification: string | TransactionArgument,
208
+ messagingChannel: string | TransactionArgument,
209
+ packetHeader: Uint8Array | TransactionArgument,
210
+ payloadHash: Uint8Array | TransactionArgument
211
+ ): void {
212
+ tx.moveCall({
213
+ target: this.#target('commit_verification'),
214
+ arguments: [
215
+ tx.object(this.objects.uln302),
216
+ asObject(tx, verification),
217
+ tx.object(this.objects.endpointV2),
218
+ asObject(tx, messagingChannel),
219
+ asBytes(tx, packetHeader),
220
+ asBytes32(tx, payloadHash, this.moduleManager.getUtils()),
221
+ tx.object.clock(),
222
+ ],
223
+ })
224
+ }
225
+
226
+ /**
227
+ * Set default executor configuration for destination EID (admin only)
228
+ * @param tx - The transaction to add the move call to
229
+ * @param dstEid - Destination endpoint ID or transaction argument
230
+ * @param config - Executor configuration parameters
231
+ */
232
+ setDefaultExecutorConfigMoveCall(
233
+ tx: Transaction,
234
+ dstEid: number | TransactionArgument,
235
+ config: ExecutorConfig
236
+ ): void {
237
+ const executorConfig = this.createExecutorConfigMoveCall(tx, config)
238
+ tx.moveCall({
239
+ target: this.#target('set_default_executor_config'),
240
+ arguments: [
241
+ tx.object(this.objects.uln302),
242
+ tx.object(this.objects.uln302AdminCap),
243
+ asU32(tx, dstEid),
244
+ executorConfig,
245
+ ],
246
+ })
247
+ }
248
+
249
+ /**
250
+ * Set default send ULN configuration for destination EID (admin only)
251
+ * @param tx - The transaction to add the move call to
252
+ * @param dstEid - Destination endpoint ID or transaction argument
253
+ * @param config - ULN configuration parameters
254
+ */
255
+ setDefaultSendUlnConfigMoveCall(tx: Transaction, dstEid: number | TransactionArgument, config: UlnConfig): void {
256
+ const ulnConfig = this.createUlnConfigMoveCall(tx, config)
257
+ tx.moveCall({
258
+ target: this.#target('set_default_send_uln_config'),
259
+ arguments: [
260
+ tx.object(this.objects.uln302),
261
+ tx.object(this.objects.uln302AdminCap),
262
+ asU32(tx, dstEid),
263
+ ulnConfig,
264
+ ],
265
+ })
266
+ }
267
+
268
+ /**
269
+ * Set default receive ULN configuration for source EID (admin only)
270
+ * @param tx - The transaction to add the move call to
271
+ * @param srcEid - Source endpoint ID or transaction argument
272
+ * @param config - ULN configuration parameters
273
+ */
274
+ setDefaultReceiveUlnConfigMoveCall(tx: Transaction, srcEid: number | TransactionArgument, config: UlnConfig): void {
275
+ const ulnConfig = this.createUlnConfigMoveCall(tx, config)
276
+ tx.moveCall({
277
+ target: this.#target('set_default_receive_uln_config'),
278
+ arguments: [
279
+ tx.object(this.objects.uln302),
280
+ tx.object(this.objects.uln302AdminCap),
281
+ asU32(tx, srcEid),
282
+ ulnConfig,
283
+ ],
284
+ })
285
+ }
286
+
287
+ // === View Functions ===
288
+
289
+ /**
290
+ * Get ULN-302 version information
291
+ * @param tx - The transaction to add the move call to
292
+ * @returns Transaction result containing version information
293
+ */
294
+ versionMoveCall(tx: Transaction): TransactionResult {
295
+ return tx.moveCall({
296
+ target: this.#target('version'),
297
+ arguments: [],
298
+ })
299
+ }
300
+
301
+ /**
302
+ * Get ULN-302 version information
303
+ * @returns Promise<VersionInfo> - Version information with major, minor, and endpoint version
304
+ */
305
+ async version(): Promise<VersionInfo> {
306
+ return executeSimulate(
307
+ this.client,
308
+ (tx) => {
309
+ this.versionMoveCall(tx)
310
+ },
311
+ (result) => ({
312
+ major: BigInt(bcs.U64.parse(result[0].value)),
313
+ minor: bcs.U8.parse(result[1].value),
314
+ endpointVersion: bcs.U8.parse(result[2].value),
315
+ })
316
+ )
317
+ }
318
+
319
+ /**
320
+ * Check if endpoint ID is supported by ULN-302
321
+ * @param tx - The transaction to add the move call to
322
+ * @param eid - Endpoint ID to check
323
+ * @returns Transaction result containing support status
324
+ */
325
+ isSupportedEidMoveCall(tx: Transaction, eid: number | TransactionArgument): TransactionResult {
326
+ return tx.moveCall({
327
+ target: this.#target('is_supported_eid'),
328
+ arguments: [tx.object(this.objects.uln302), asU32(tx, eid)],
329
+ })
330
+ }
331
+
332
+ /**
333
+ * Check if endpoint ID is supported by ULN-302
334
+ * @param eid - Endpoint ID to check
335
+ * @returns Promise<boolean> - True if the endpoint ID is supported
336
+ */
337
+ async isSupportedEid(eid: number): Promise<boolean> {
338
+ return executeSimulate(
339
+ this.client,
340
+ (tx) => {
341
+ this.isSupportedEidMoveCall(tx, eid)
342
+ },
343
+ (result) => bcs.Bool.parse(result[0].value)
344
+ )
345
+ }
346
+
347
+ /**
348
+ * Get default executor configuration for destination EID
349
+ * @param tx - The transaction to add the move call to
350
+ * @param dstEid - Destination endpoint ID
351
+ * @returns Transaction result containing the executor configuration
352
+ */
353
+ getDefaultExecutorConfigMoveCall(tx: Transaction, dstEid: number | TransactionArgument): TransactionResult {
354
+ return tx.moveCall({
355
+ target: this.#target('get_default_executor_config'),
356
+ arguments: [tx.object(this.objects.uln302), asU32(tx, dstEid)],
357
+ })
358
+ }
359
+
360
+ /**
361
+ * Get default executor configuration for destination EID
362
+ */
363
+ async getDefaultExecutorConfig(dstEid: number): Promise<ExecutorConfig> {
364
+ return executeSimulate(
365
+ this.client,
366
+ (tx) => {
367
+ this.getDefaultExecutorConfigMoveCall(tx, dstEid)
368
+ },
369
+ (result) => this.parseExecutorConfig(result[0].value)
370
+ )
371
+ }
372
+
373
+ /**
374
+ * Get OApp-specific executor configuration
375
+ * @param tx - The transaction to add the move call to
376
+ * @param sender - The sender OApp address
377
+ * @param dstEid - Destination endpoint ID
378
+ * @returns Transaction result containing the executor configuration
379
+ */
380
+ getOAppExecutorConfigMoveCall(
381
+ tx: Transaction,
382
+ sender: string | TransactionArgument,
383
+ dstEid: number | TransactionArgument
384
+ ): TransactionResult {
385
+ return tx.moveCall({
386
+ target: this.#target('get_oapp_executor_config'),
387
+ arguments: [tx.object(this.objects.uln302), asAddress(tx, sender), asU32(tx, dstEid)],
388
+ })
389
+ }
390
+
391
+ /**
392
+ * Get OApp-specific executor configuration
393
+ */
394
+ async getOAppExecutorConfig(sender: string, dstEid: number): Promise<ExecutorConfig> {
395
+ return executeSimulate(
396
+ this.client,
397
+ (tx) => {
398
+ this.getOAppExecutorConfigMoveCall(tx, sender, dstEid)
399
+ },
400
+ (result) => this.parseExecutorConfig(result[0].value)
401
+ )
402
+ }
403
+
404
+ /**
405
+ * Get effective executor configuration (OApp-specific or default)
406
+ * @param tx - The transaction to add the move call to
407
+ * @param sender - The sender OApp address
408
+ * @param dstEid - Destination endpoint ID
409
+ * @returns Transaction result containing the effective executor configuration
410
+ */
411
+ getEffectiveExecutorConfigMoveCall(
412
+ tx: Transaction,
413
+ sender: string | TransactionArgument,
414
+ dstEid: number | TransactionArgument
415
+ ): TransactionResult {
416
+ return tx.moveCall({
417
+ target: this.#target('get_effective_executor_config'),
418
+ arguments: [tx.object(this.objects.uln302), asAddress(tx, sender), asU32(tx, dstEid)],
419
+ })
420
+ }
421
+
422
+ /**
423
+ * Get effective executor configuration (OApp-specific or default)
424
+ */
425
+ async getEffectiveExecutorConfig(sender: string, dstEid: number): Promise<ExecutorConfig> {
426
+ return executeSimulate(
427
+ this.client,
428
+ (tx) => {
429
+ this.getEffectiveExecutorConfigMoveCall(tx, sender, dstEid)
430
+ },
431
+ (result) => this.parseExecutorConfig(result[0].value)
432
+ )
433
+ }
434
+
435
+ /**
436
+ * Get default send ULN configuration for destination EID
437
+ * @param tx - The transaction to add the move call to
438
+ * @param dstEid - Destination endpoint ID
439
+ * @returns Transaction result containing the default send ULN configuration
440
+ */
441
+ getDefaultSendUlnConfigMoveCall(tx: Transaction, dstEid: number | TransactionArgument): TransactionResult {
442
+ return tx.moveCall({
443
+ target: this.#target('get_default_send_uln_config'),
444
+ arguments: [tx.object(this.objects.uln302), asU32(tx, dstEid)],
445
+ })
446
+ }
447
+
448
+ /**
449
+ * Get default ULN send configuration
450
+ */
451
+ async getDefaultSendUlnConfig(dstEid: number): Promise<UlnConfig> {
452
+ return executeSimulate(
453
+ this.client,
454
+ (tx) => {
455
+ this.getDefaultSendUlnConfigMoveCall(tx, dstEid)
456
+ },
457
+ (result) => this.parseUlnConfig(result[0].value)
458
+ )
459
+ }
460
+
461
+ /**
462
+ * Get OApp-specific send ULN configuration
463
+ * @param tx - The transaction to add the move call to
464
+ * @param sender - The sender OApp address
465
+ * @param dstEid - Destination endpoint ID
466
+ * @returns Transaction result containing the OApp send ULN configuration
467
+ */
468
+ getOAppSendUlnConfigMoveCall(
469
+ tx: Transaction,
470
+ sender: string | TransactionArgument,
471
+ dstEid: number | TransactionArgument
472
+ ): TransactionResult {
473
+ return tx.moveCall({
474
+ target: this.#target('get_oapp_send_uln_config'),
475
+ arguments: [tx.object(this.objects.uln302), asAddress(tx, sender), asU32(tx, dstEid)],
476
+ })
477
+ }
478
+
479
+ /**
480
+ * Get OApp-specific ULN send configuration
481
+ */
482
+ async getOAppSendUlnConfig(sender: string, dstEid: number): Promise<OAppUlnConfig> {
483
+ return executeSimulate(
484
+ this.client,
485
+ (tx) => {
486
+ this.getOAppSendUlnConfigMoveCall(tx, sender, dstEid)
487
+ },
488
+ (result) => this.parseOAppUlnConfig(result[0].value)
489
+ )
490
+ }
491
+
492
+ /**
493
+ * Get effective send ULN configuration (OApp-specific or default)
494
+ * @param tx - The transaction to add the move call to
495
+ * @param sender - The sender OApp address
496
+ * @param dstEid - Destination endpoint ID
497
+ * @returns Transaction result containing the effective send ULN configuration
498
+ */
499
+ getEffectiveSendUlnConfigMoveCall(
500
+ tx: Transaction,
501
+ sender: string | TransactionArgument,
502
+ dstEid: number | TransactionArgument
503
+ ): TransactionResult {
504
+ return tx.moveCall({
505
+ target: this.#target('get_effective_send_uln_config'),
506
+ arguments: [tx.object(this.objects.uln302), asAddress(tx, sender), asU32(tx, dstEid)],
507
+ })
508
+ }
509
+
510
+ /**
511
+ * Get effective ULN send configuration
512
+ */
513
+ async getEffectiveSendUlnConfig(sender: string, dstEid: number): Promise<UlnConfig> {
514
+ return executeSimulate(
515
+ this.client,
516
+ (tx) => {
517
+ this.getEffectiveSendUlnConfigMoveCall(tx, sender, dstEid)
518
+ },
519
+ (result) => this.parseUlnConfig(result[0].value)
520
+ )
521
+ }
522
+
523
+ /**
524
+ * Get default receive ULN configuration for source EID
525
+ * @param tx - The transaction to add the move call to
526
+ * @param srcEid - Source endpoint ID
527
+ * @returns Transaction result containing the default receive ULN configuration
528
+ */
529
+ getDefaultReceiveUlnConfigMoveCall(tx: Transaction, srcEid: number | TransactionArgument): TransactionResult {
530
+ return tx.moveCall({
531
+ target: this.#target('get_default_receive_uln_config'),
532
+ arguments: [tx.object(this.objects.uln302), asU32(tx, srcEid)],
533
+ })
534
+ }
535
+
536
+ /**
537
+ * Get default ULN receive configuration
538
+ */
539
+ async getDefaultReceiveUlnConfig(srcEid: number): Promise<UlnConfig> {
540
+ return executeSimulate(
541
+ this.client,
542
+ (tx) => {
543
+ this.getDefaultReceiveUlnConfigMoveCall(tx, srcEid)
544
+ },
545
+ (result) => this.parseUlnConfig(result[0].value)
546
+ )
547
+ }
548
+
549
+ /**
550
+ * Get OApp-specific receive ULN configuration
551
+ * @param tx - The transaction to add the move call to
552
+ * @param receiver - The receiver OApp address
553
+ * @param srcEid - Source endpoint ID
554
+ * @returns Transaction result containing the OApp receive ULN configuration
555
+ */
556
+ getOAppReceiveUlnConfigMoveCall(
557
+ tx: Transaction,
558
+ receiver: string | TransactionArgument,
559
+ srcEid: number | TransactionArgument
560
+ ): TransactionResult {
561
+ return tx.moveCall({
562
+ target: this.#target('get_oapp_receive_uln_config'),
563
+ arguments: [tx.object(this.objects.uln302), asAddress(tx, receiver), asU32(tx, srcEid)],
564
+ })
565
+ }
566
+
567
+ /**
568
+ * Get OApp-specific ULN receive configuration
569
+ */
570
+ async getOAppReceiveUlnConfig(receiver: string, srcEid: number): Promise<OAppUlnConfig> {
571
+ return executeSimulate(
572
+ this.client,
573
+ (tx) => {
574
+ this.getOAppReceiveUlnConfigMoveCall(tx, receiver, srcEid)
575
+ },
576
+ (result) => this.parseOAppUlnConfig(result[0].value)
577
+ )
578
+ }
579
+
580
+ /**
581
+ * Get effective receive ULN configuration (OApp-specific or default)
582
+ * @param tx - The transaction to add the move call to
583
+ * @param receiver - The receiver OApp address
584
+ * @param srcEid - Source endpoint ID
585
+ * @returns Transaction result containing the effective receive ULN configuration
586
+ */
587
+ getEffectiveReceiveUlnConfigMoveCall(
588
+ tx: Transaction,
589
+ receiver: string | TransactionArgument,
590
+ srcEid: number | TransactionArgument
591
+ ): TransactionResult {
592
+ return tx.moveCall({
593
+ target: this.#target('get_effective_receive_uln_config'),
594
+ arguments: [tx.object(this.objects.uln302), asAddress(tx, receiver), asU32(tx, srcEid)],
595
+ })
596
+ }
597
+
598
+ /**
599
+ * Get effective ULN receive configuration
600
+ */
601
+ async getEffectiveReceiveUlnConfig(receiver: string, srcEid: number): Promise<UlnConfig> {
602
+ return executeSimulate(
603
+ this.client,
604
+ (tx) => {
605
+ this.getEffectiveReceiveUlnConfigMoveCall(tx, receiver, srcEid)
606
+ },
607
+ (result) => this.parseUlnConfig(result[0].value)
608
+ )
609
+ }
610
+
611
+ /**
612
+ * Get verification object address for ULN-302
613
+ * @param tx - The transaction to add the move call to
614
+ * @returns Transaction result containing the verification object address
615
+ */
616
+ getVerificationMoveCall(tx: Transaction): TransactionResult {
617
+ return tx.moveCall({
618
+ target: this.#target('get_verification'),
619
+ arguments: [tx.object(this.objects.uln302)],
620
+ })
621
+ }
622
+
623
+ /**
624
+ * Get verification object address for ULN-302
625
+ * @returns Promise<string> - The verification object address
626
+ */
627
+ async getVerification(): Promise<string> {
628
+ return executeSimulate(
629
+ this.client,
630
+ (tx) => {
631
+ this.getVerificationMoveCall(tx)
632
+ },
633
+ (result) => bcs.Address.parse(result[0].value)
634
+ )
635
+ }
636
+
637
+ /**
638
+ * Check if packet is verifiable through ULN-302
639
+ * @param tx - The transaction to add the move call to
640
+ * @param verification - The verification object address
641
+ * @param packetHeader - The packet header as bytes
642
+ * @param payloadHash - The payload hash as bytes
643
+ * @returns Transaction result containing the verifiable status
644
+ */
645
+ verifiableMoveCall(
646
+ tx: Transaction,
647
+ verification: string | TransactionArgument,
648
+ packetHeader: Uint8Array | TransactionArgument,
649
+ payloadHash: Uint8Array | TransactionArgument
650
+ ): TransactionResult {
651
+ return tx.moveCall({
652
+ target: this.#target('verifiable'),
653
+ arguments: [
654
+ tx.object(this.objects.uln302),
655
+ asObject(tx, verification),
656
+ tx.object(this.objects.endpointV2),
657
+ asBytes(tx, packetHeader),
658
+ asBytes32(tx, payloadHash, this.moduleManager.getUtils()),
659
+ ],
660
+ })
661
+ }
662
+
663
+ /**
664
+ * Check if packet is verifiable through ULN-302
665
+ * @param verification - Verification object address
666
+ * @param packetHeader - Packet header as bytes
667
+ * @param payloadHash - Payload hash as bytes
668
+ * @returns Promise<boolean> - True if packet is verifiable
669
+ */
670
+ async verifiable(verification: string, packetHeader: Uint8Array, payloadHash: Uint8Array): Promise<boolean> {
671
+ return executeSimulate(
672
+ this.client,
673
+ (tx) => {
674
+ this.verifiableMoveCall(tx, verification, packetHeader, payloadHash)
675
+ },
676
+ (result) => bcs.Bool.parse(result[0].value)
677
+ )
678
+ }
679
+
680
+ /**
681
+ * Get confirmations for a specific DVN verification
682
+ * @param tx - The transaction to add the move call to
683
+ * @param verification - The verification object address
684
+ * @param dvn - The DVN address
685
+ * @param headerHash - The header hash as bytes
686
+ * @param payloadHash - The payload hash as bytes
687
+ * @returns Transaction result containing the confirmations count
688
+ */
689
+ getConfirmationsMoveCall(
690
+ tx: Transaction,
691
+ verification: string | TransactionArgument,
692
+ dvn: string | TransactionArgument,
693
+ headerHash: Uint8Array | TransactionArgument,
694
+ payloadHash: Uint8Array | TransactionArgument
695
+ ): TransactionResult {
696
+ return tx.moveCall({
697
+ target: this.#target('get_confirmations'),
698
+ arguments: [
699
+ asObject(tx, verification),
700
+ asAddress(tx, dvn),
701
+ asBytes32(tx, headerHash, this.moduleManager.getUtils()),
702
+ asBytes32(tx, payloadHash, this.moduleManager.getUtils()),
703
+ ],
704
+ })
705
+ }
706
+
707
+ /**
708
+ * Get confirmations for a specific DVN verification
709
+ * @param verification - The verification object address
710
+ * @param dvn - The DVN address
711
+ * @param headerHash - The header hash as bytes
712
+ * @param payloadHash - The payload hash as bytes
713
+ * @returns Promise<bigint> - The confirmations count
714
+ */
715
+ async getConfirmations(
716
+ verification: string,
717
+ dvn: string,
718
+ headerHash: Uint8Array,
719
+ payloadHash: Uint8Array
720
+ ): Promise<bigint> {
721
+ return executeSimulate(
722
+ this.client,
723
+ (tx) => {
724
+ this.getConfirmationsMoveCall(tx, verification, dvn, headerHash, payloadHash)
725
+ },
726
+ (result) => BigInt(bcs.U64.parse(result[0].value))
727
+ )
728
+ }
729
+
730
+ // === Private Functions ===
731
+
732
+ /**
733
+ * Create executor configuration move call
734
+ * @param tx - The transaction to add the move call to
735
+ * @param config - Executor configuration parameters
736
+ * @returns Transaction result containing the executor configuration
737
+ * @private
738
+ */
739
+ private createExecutorConfigMoveCall(tx: Transaction, config: ExecutorConfig): TransactionResult {
740
+ return tx.moveCall({
741
+ target: this.#target('create', 'executor_config'),
742
+ arguments: [asU64(tx, config.maxMessageSize), asAddress(tx, config.executor)],
743
+ })
744
+ }
745
+
746
+ /**
747
+ * Create ULN configuration move call
748
+ * @param tx - The transaction to add the move call to
749
+ * @param config - ULN configuration parameters
750
+ * @returns Transaction result containing the ULN configuration
751
+ * @private
752
+ */
753
+ private createUlnConfigMoveCall(tx: Transaction, config: UlnConfig): TransactionResult {
754
+ return tx.moveCall({
755
+ target: this.#target('create', 'uln_config'),
756
+ arguments: [
757
+ asU64(tx, config.confirmations),
758
+ asAddressVector(tx, config.requiredDvns),
759
+ asAddressVector(tx, config.optionalDvns),
760
+ asU8(tx, config.optionalDvnThreshold),
761
+ ],
762
+ })
763
+ }
764
+
765
+ /**
766
+ * Parse executor configuration from BCS data
767
+ * @param data - Raw BCS data to parse
768
+ * @returns ExecutorConfig - Parsed executor configuration
769
+ * @private
770
+ */
771
+ private parseExecutorConfig(data: Uint8Array): ExecutorConfig {
772
+ const config = ExecutorConfigBcs.parse(data)
773
+ return {
774
+ maxMessageSize: Number(config.max_message_size),
775
+ executor: config.executor,
776
+ }
777
+ }
778
+
779
+ /**
780
+ * Parse ULN configuration from BCS data
781
+ * @param data - Raw BCS data to parse
782
+ * @returns UlnConfig - Parsed ULN configuration
783
+ * @private
784
+ */
785
+ private parseUlnConfig(data: Uint8Array): UlnConfig {
786
+ const config = UlnConfigBcs.parse(data)
787
+ return {
788
+ confirmations: BigInt(config.confirmations),
789
+ requiredDvns: config.required_dvns,
790
+ optionalDvns: config.optional_dvns,
791
+ optionalDvnThreshold: config.optional_dvn_threshold,
792
+ }
793
+ }
794
+
795
+ /**
796
+ * Parse OApp ULN configuration from BCS data
797
+ * @param data - Raw BCS data to parse
798
+ * @returns OAppUlnConfig - Parsed OApp ULN configuration
799
+ * @private
800
+ */
801
+ private parseOAppUlnConfig(data: Uint8Array): OAppUlnConfig {
802
+ const config = OAppUlnConfigBcs.parse(data)
803
+ const ulnConfig = config.uln_config
804
+ return {
805
+ useDefaultConfirmations: config.use_default_confirmations,
806
+ useDefaultRequiredDvns: config.use_default_required_dvns,
807
+ useDefaultOptionalDvns: config.use_default_optional_dvns,
808
+ ulnConfig: {
809
+ confirmations: BigInt(ulnConfig.confirmations),
810
+ requiredDvns: ulnConfig.required_dvns,
811
+ optionalDvns: ulnConfig.optional_dvns,
812
+ optionalDvnThreshold: ulnConfig.optional_dvn_threshold,
813
+ },
814
+ }
815
+ }
816
+
817
+ /**
818
+ * Generate the full target path for move calls
819
+ * @param name - The function name to call
820
+ * @param module_name - The module name (defaults to MODULE_NAME)
821
+ * @returns The full module path for the move call
822
+ * @private
823
+ */
824
+ #target(name: string, module_name: string = MODULE_NAME): string {
825
+ return `${this.packageId}::${module_name}::${name}`
826
+ }
827
+ }