@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,1170 @@
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 { DstConfigBcs } from '../../bcs'
6
+ import { ModuleManager } from '../../module-manager'
7
+ import { DstConfig, NativeDropParams, ObjectOptions } from '../../types'
8
+ import {
9
+ asAddress,
10
+ asArgWithTx,
11
+ asBool,
12
+ asBytes,
13
+ asBytes32,
14
+ asObject,
15
+ asU128,
16
+ asU16,
17
+ asU32,
18
+ asU64,
19
+ executeSimulate,
20
+ } from '../../utils'
21
+
22
+ const MODULE_NAME = 'executor_worker'
23
+
24
+ export const ExecutorErrorCode = {
25
+ // Executor related errors (with Executor_ prefix)
26
+ Executor_EEidNotSupported: 1,
27
+ Executor_EInvalidNativeDropAmount: 2,
28
+
29
+ // ExecutorInfoV1 related errors (matching executor_info_v1.move)
30
+ ExecutorInfoV1_EInvalidData: 1,
31
+ ExecutorInfoV1_EInvalidVersion: 2,
32
+ } as const
33
+
34
+ export class Executor {
35
+ public packageId: string
36
+ public readonly client: IotaClient
37
+ private readonly objects: ObjectOptions
38
+
39
+ constructor(
40
+ packageId: string,
41
+ client: IotaClient,
42
+ objects: ObjectOptions,
43
+ private readonly moduleManager: ModuleManager
44
+ ) {
45
+ this.packageId = packageId
46
+ this.client = client
47
+ this.objects = objects
48
+ }
49
+
50
+ // === Witness Functions ===
51
+
52
+ /**
53
+ * Create a LayerZero witness for Executor package whitelist registration
54
+ * @param tx - The transaction to add the move call to
55
+ * @returns Transaction result containing the LayerZero witness
56
+ */
57
+ createLayerZeroWitnessMoveCall(tx: Transaction): TransactionResult {
58
+ return tx.moveCall({
59
+ target: `${this.packageId}::executor_witness::new`,
60
+ arguments: [],
61
+ })
62
+ }
63
+
64
+ // Job Assignment and Fee Functions
65
+
66
+ /**
67
+ * Assign execution job for Executor (called via PTB with Call created by send function in ULN302)
68
+ * @param tx - The transaction to add the move call to
69
+ * @param call - The call transaction result from ULN302
70
+ * @returns Transaction result containing the job assignment call
71
+ */
72
+ assignJobMoveCall(tx: Transaction, call: TransactionArgument): TransactionResult {
73
+ return tx.moveCall({
74
+ target: this.#target('assign_job'),
75
+ arguments: [tx.object(this.objects.executor), call],
76
+ })
77
+ }
78
+
79
+ /**
80
+ * Confirm assign job operation with fee calculation
81
+ * @param tx - The transaction to add the move call to
82
+ * @param executorCall - The executor call transaction result
83
+ * @param feelibCall - The fee library call transaction result
84
+ */
85
+ confirmAssignJobMoveCall(
86
+ tx: Transaction,
87
+ executorCall: TransactionArgument,
88
+ feelibCall: TransactionArgument
89
+ ): void {
90
+ tx.moveCall({
91
+ target: this.#target('confirm_assign_job'),
92
+ arguments: [tx.object(this.objects.executor), executorCall, feelibCall],
93
+ })
94
+ }
95
+
96
+ /**
97
+ * Get fee for execution (using Call created by quote function in ULN302)
98
+ * @param tx - The transaction to add the move call to
99
+ * @param call - The call transaction result from ULN302
100
+ * @returns Transaction result containing the fee calculation call
101
+ */
102
+ getFeeMoveCall(tx: Transaction, call: TransactionArgument): TransactionResult {
103
+ return tx.moveCall({
104
+ target: this.#target('get_fee'),
105
+ arguments: [tx.object(this.objects.executor), call],
106
+ })
107
+ }
108
+
109
+ /**
110
+ * Confirm get fee operation with fee library
111
+ * @param tx - The transaction to add the move call to
112
+ * @param executorCall - The executor call transaction result
113
+ * @param feelibCall - The fee library call transaction result
114
+ */
115
+ confirmGetFeeMoveCall(tx: Transaction, executorCall: TransactionArgument, feelibCall: TransactionArgument): void {
116
+ tx.moveCall({
117
+ target: this.#target('confirm_get_fee'),
118
+ arguments: [tx.object(this.objects.executor), executorCall, feelibCall],
119
+ })
120
+ }
121
+
122
+ // Execution Functions
123
+
124
+ /**
125
+ * Execute LayerZero receive operation (admin only)
126
+ * @param tx - The transaction to add the move call to
127
+ * @param adminCap - The admin capability object ID
128
+ * @param messagingChannel - The messaging channel object ID
129
+ * @param srcEid - Source endpoint ID
130
+ * @param sender - Sender address as bytes
131
+ * @param nonce - Message nonce
132
+ * @param guid - Globally unique identifier as bytes
133
+ * @param message - Message payload as bytes
134
+ * @param extraData - Additional execution data (optional)
135
+ * @param value - Native token value to transfer
136
+ * @returns Transaction result containing the execution call capability
137
+ */
138
+ executeLzReceiveMoveCall(
139
+ tx: Transaction,
140
+ adminCap: string | TransactionArgument,
141
+ messagingChannel: string | TransactionArgument,
142
+ srcEid: number | TransactionArgument,
143
+ sender: Uint8Array | TransactionArgument,
144
+ nonce: bigint | number | string | TransactionArgument,
145
+ guid: Uint8Array | TransactionArgument,
146
+ message: Uint8Array | TransactionArgument,
147
+ extraData: Uint8Array | TransactionArgument = new Uint8Array(),
148
+ value = 0n
149
+ ): TransactionResult {
150
+ return tx.moveCall({
151
+ target: this.#target('execute_lz_receive'),
152
+ arguments: [
153
+ tx.object(this.objects.executor),
154
+ asObject(tx, adminCap),
155
+ tx.object(this.objects.endpointV2),
156
+ asObject(tx, messagingChannel),
157
+ asU32(tx, srcEid),
158
+ asBytes32(tx, sender, this.moduleManager.getUtils()),
159
+ asU64(tx, nonce),
160
+ asBytes32(tx, guid, this.moduleManager.getUtils()),
161
+ asBytes(tx, message),
162
+ asBytes(tx, extraData),
163
+ asArgWithTx(tx, value, (tx, val) => this.moduleManager.getUtils().createOptionIotaL1Call(tx, val)),
164
+ ],
165
+ })
166
+ }
167
+
168
+ /**
169
+ * Execute LayerZero compose operation (admin only)
170
+ * @param tx - The transaction to add the move call to
171
+ * @param adminCap - The admin capability object ID
172
+ * @param composeQueue - The compose queue object ID
173
+ * @param from - Source address
174
+ * @param guid - Globally unique identifier as bytes
175
+ * @param index - Compose message index
176
+ * @param message - Message payload as bytes
177
+ * @param extraData - Additional execution data (optional)
178
+ * @param value - Native token value to transfer
179
+ * @returns Transaction result containing the execution call capability
180
+ */
181
+ executeLzComposeMoveCall(
182
+ tx: Transaction,
183
+ adminCap: string | TransactionArgument,
184
+ composeQueue: string | TransactionArgument,
185
+ from: string | TransactionArgument,
186
+ guid: Uint8Array | TransactionArgument,
187
+ index: number | TransactionArgument,
188
+ message: Uint8Array | TransactionArgument,
189
+ extraData: Uint8Array | TransactionArgument = new Uint8Array(),
190
+ value = 0n
191
+ ): TransactionResult {
192
+ return tx.moveCall({
193
+ target: this.#target('execute_lz_compose'),
194
+ arguments: [
195
+ tx.object(this.objects.executor),
196
+ asObject(tx, adminCap),
197
+ tx.object(this.objects.endpointV2),
198
+ asObject(tx, composeQueue),
199
+ asAddress(tx, from),
200
+ asBytes32(tx, guid, this.moduleManager.getUtils()),
201
+ asU16(tx, index),
202
+ asBytes(tx, message),
203
+ asBytes(tx, extraData),
204
+ asArgWithTx(tx, value, (tx, val) => this.moduleManager.getUtils().createOptionIotaL1Call(tx, val)),
205
+ ],
206
+ })
207
+ }
208
+
209
+ // Alert Functions
210
+
211
+ /**
212
+ * Record a failed lz_receive execution for off-chain processing (admin only)
213
+ * @param tx - The transaction to add the move call to
214
+ * @param adminCap - The admin capability object ID
215
+ * @param srcEid - Source endpoint ID
216
+ * @param sender - Sender address as bytes
217
+ * @param nonce - Message nonce
218
+ * @param receiver - Receiver address
219
+ * @param guid - Globally unique identifier as bytes
220
+ * @param gas - Gas limit used for the execution attempt
221
+ * @param value - Native token value included with the message
222
+ * @param message - Message payload as bytes
223
+ * @param extraData - Additional execution data
224
+ * @param reason - Error message or failure reason
225
+ */
226
+ lzReceiveAlertMoveCall(
227
+ tx: Transaction,
228
+ adminCap: string | TransactionArgument,
229
+ srcEid: number | TransactionArgument,
230
+ sender: Uint8Array | TransactionArgument,
231
+ nonce: bigint | number | string | TransactionArgument,
232
+ receiver: string | TransactionArgument,
233
+ guid: Uint8Array | TransactionArgument,
234
+ gas: bigint | number | string | TransactionArgument,
235
+ value: bigint | number | string | TransactionArgument,
236
+ message: Uint8Array | TransactionArgument,
237
+ extraData: Uint8Array | TransactionArgument,
238
+ reason: string | TransactionArgument
239
+ ): void {
240
+ tx.moveCall({
241
+ target: this.#target('lz_receive_alert'),
242
+ arguments: [
243
+ tx.object(this.objects.executor),
244
+ asObject(tx, adminCap),
245
+ asU32(tx, srcEid),
246
+ asBytes32(tx, sender, this.moduleManager.getUtils()),
247
+ asU64(tx, nonce),
248
+ asAddress(tx, receiver),
249
+ asBytes32(tx, guid, this.moduleManager.getUtils()),
250
+ asU64(tx, gas),
251
+ asU64(tx, value),
252
+ asBytes(tx, message),
253
+ asBytes(tx, extraData),
254
+ asArgWithTx(tx, reason, (tx, val) => tx.pure.string(val)),
255
+ ],
256
+ })
257
+ }
258
+
259
+ /**
260
+ * Record a failed lz_compose execution for off-chain processing (admin only)
261
+ * @param tx - The transaction to add the move call to
262
+ * @param adminCap - The admin capability object ID
263
+ * @param from - Source address
264
+ * @param to - Destination address
265
+ * @param guid - Globally unique identifier as bytes
266
+ * @param index - Compose message index
267
+ * @param gas - Gas limit used for the execution attempt
268
+ * @param value - Native token value included with the compose
269
+ * @param message - Compose message payload as bytes
270
+ * @param extraData - Additional execution data
271
+ * @param reason - Error message or failure reason
272
+ */
273
+ lzComposeAlertMoveCall(
274
+ tx: Transaction,
275
+ adminCap: string | TransactionArgument,
276
+ from: string | TransactionArgument,
277
+ to: string | TransactionArgument,
278
+ guid: Uint8Array | TransactionArgument,
279
+ index: number | TransactionArgument,
280
+ gas: bigint | number | string | TransactionArgument,
281
+ value: bigint | number | string | TransactionArgument,
282
+ message: Uint8Array | TransactionArgument,
283
+ extraData: Uint8Array | TransactionArgument,
284
+ reason: string | TransactionArgument
285
+ ): void {
286
+ tx.moveCall({
287
+ target: this.#target('lz_compose_alert'),
288
+ arguments: [
289
+ tx.object(this.objects.executor),
290
+ asObject(tx, adminCap),
291
+ asAddress(tx, from),
292
+ asAddress(tx, to),
293
+ asBytes32(tx, guid, this.moduleManager.getUtils()),
294
+ asU16(tx, index),
295
+ asU64(tx, gas),
296
+ asU64(tx, value),
297
+ asBytes(tx, message),
298
+ asBytes(tx, extraData),
299
+ asArgWithTx(tx, reason, (tx, val) => tx.pure.string(val)),
300
+ ],
301
+ })
302
+ }
303
+
304
+ // Native Drop Functions
305
+
306
+ /**
307
+ * Native drop function (admin only)
308
+ * Takes a Coin<IOTA> from caller and distributes it to recipients according to params
309
+ * @param tx - The transaction to add the move call to
310
+ * @param adminCap - The admin capability object ID
311
+ * @param srcEid - Source endpoint ID
312
+ * @param sender - Sender address as bytes
313
+ * @param dstEid - Destination endpoint ID
314
+ * @param oapp - OApp address
315
+ * @param nonce - Message nonce
316
+ * @param nativeDropParams - Array of native drop parameters
317
+ * @param paymentCoin - Payment coin for the drop
318
+ */
319
+ nativeDropMoveCall(
320
+ tx: Transaction,
321
+ adminCap: string | TransactionArgument,
322
+ srcEid: number | TransactionArgument,
323
+ sender: Uint8Array | TransactionArgument,
324
+ dstEid: number | TransactionArgument,
325
+ oapp: string | TransactionArgument,
326
+ nonce: bigint | number | string | TransactionArgument,
327
+ nativeDropParams: NativeDropParams[],
328
+ paymentCoin: TransactionArgument
329
+ ): void {
330
+ // Create individual NativeDropParams move calls for each parameter
331
+ const dropParamCalls = nativeDropParams.map((param) =>
332
+ tx.moveCall({
333
+ target: this.#target('new_native_drop_params', 'native_drop_type'),
334
+ arguments: [asAddress(tx, param.receiver), asU64(tx, param.amount)],
335
+ })
336
+ )
337
+
338
+ tx.moveCall({
339
+ target: this.#target('native_drop'),
340
+ arguments: [
341
+ tx.object(this.objects.executor),
342
+ asObject(tx, adminCap),
343
+ asU32(tx, srcEid),
344
+ asBytes32(tx, sender, this.moduleManager.getUtils()),
345
+ asU32(tx, dstEid),
346
+ asAddress(tx, oapp),
347
+ asU64(tx, nonce),
348
+ tx.makeMoveVec({
349
+ type: `${this.packageId}::native_drop_type::NativeDropParams`,
350
+ elements: dropParamCalls,
351
+ }),
352
+ paymentCoin,
353
+ ],
354
+ })
355
+ }
356
+
357
+ // === Set Functions ===
358
+
359
+ /**
360
+ * Set default multiplier basis points for fee calculation (admin only)
361
+ * @param tx - The transaction to add the move call to
362
+ * @param adminCap - The admin capability object ID
363
+ * @param multiplierBps - The multiplier in basis points
364
+ */
365
+ setDefaultMultiplierBpsMoveCall(
366
+ tx: Transaction,
367
+ adminCap: string | TransactionArgument,
368
+ multiplierBps: number | TransactionArgument
369
+ ): void {
370
+ tx.moveCall({
371
+ target: this.#target('set_default_multiplier_bps'),
372
+ arguments: [tx.object(this.objects.executor), asObject(tx, adminCap), asU16(tx, multiplierBps)],
373
+ })
374
+ }
375
+
376
+ /**
377
+ * Set deposit address for executor fees (admin only)
378
+ * @param tx - The transaction to add the move call to
379
+ * @param adminCap - The admin capability object ID
380
+ * @param depositAddress - The new deposit address
381
+ */
382
+ setDepositAddressMoveCall(
383
+ tx: Transaction,
384
+ adminCap: string | TransactionArgument,
385
+ depositAddress: string | TransactionArgument
386
+ ): void {
387
+ tx.moveCall({
388
+ target: this.#target('set_deposit_address'),
389
+ arguments: [tx.object(this.objects.executor), asObject(tx, adminCap), asAddress(tx, depositAddress)],
390
+ })
391
+ }
392
+
393
+ /**
394
+ * Set destination configuration for executor (admin only)
395
+ * @param tx - The transaction to add the move call to
396
+ * @param adminCap - The admin capability object ID
397
+ * @param dstEid - Destination endpoint ID
398
+ * @param config - Destination configuration parameters
399
+ */
400
+ setDstConfigMoveCall(
401
+ tx: Transaction,
402
+ adminCap: string | TransactionArgument,
403
+ dstEid: number | TransactionArgument,
404
+ config: DstConfig
405
+ ): void {
406
+ const configCall = tx.moveCall({
407
+ target: this.#target('create_dst_config', 'executor_type'),
408
+ arguments: [
409
+ asU64(tx, config.lzReceiveBaseGas),
410
+ asU64(tx, config.lzComposeBaseGas),
411
+ asU16(tx, config.multiplierBps),
412
+ asU128(tx, config.floorMarginUsd),
413
+ asU128(tx, config.nativeCap),
414
+ ],
415
+ })
416
+ tx.moveCall({
417
+ target: this.#target('set_dst_config'),
418
+ arguments: [tx.object(this.objects.executor), asObject(tx, adminCap), asU32(tx, dstEid), configCall],
419
+ })
420
+ }
421
+
422
+ /**
423
+ * Set price feed for executor (admin only)
424
+ * @param tx - The transaction to add the move call to
425
+ * @param adminCap - The admin capability object ID
426
+ * @param priceFeed - The price feed address
427
+ */
428
+ setPriceFeedMoveCall(
429
+ tx: Transaction,
430
+ adminCap: string | TransactionArgument,
431
+ priceFeed: string | TransactionArgument
432
+ ): void {
433
+ tx.moveCall({
434
+ target: this.#target('set_price_feed'),
435
+ arguments: [tx.object(this.objects.executor), asObject(tx, adminCap), asAddress(tx, priceFeed)],
436
+ })
437
+ }
438
+
439
+ /**
440
+ * Set PTB builder move calls for executor worker operations (admin only)
441
+ * @param tx - The transaction to add the move call to
442
+ * @param adminCap - The admin capability object ID
443
+ * @param targetPtbBuilder - Target PTB builder address
444
+ * @param getFeeMoveCalls - Get fee move calls transaction argument
445
+ * @param assignJobMoveCalls - Assign job move calls transaction argument
446
+ * @returns Transaction result containing the set PTB builder call
447
+ */
448
+ setPtbBuilderMoveCallsMoveCall(
449
+ tx: Transaction,
450
+ targetPtbBuilder: string | TransactionArgument,
451
+ getFeeMoveCalls: TransactionArgument,
452
+ assignJobMoveCalls: TransactionArgument
453
+ ): TransactionResult {
454
+ return tx.moveCall({
455
+ target: this.#target('set_ptb_builder_move_calls'),
456
+ arguments: [
457
+ tx.object(this.objects.executor),
458
+ asObject(tx, this.objects.executorOwnerCap),
459
+ asAddress(tx, targetPtbBuilder),
460
+ getFeeMoveCalls, // First element of Executor PTB result tuple
461
+ assignJobMoveCalls, // Second element of Executor PTB result tuple
462
+ ],
463
+ })
464
+ }
465
+
466
+ /**
467
+ * Set supported option types for a destination EID (admin only)
468
+ * @param tx - The transaction to add the move call to
469
+ * @param adminCap - The admin capability object ID
470
+ * @param dstEid - Destination endpoint ID
471
+ * @param optionTypes - Array of supported option type values
472
+ */
473
+ setSupportedOptionTypesMoveCall(
474
+ tx: Transaction,
475
+ adminCap: string | TransactionArgument,
476
+ dstEid: number | TransactionArgument,
477
+ optionTypes: number[]
478
+ ): void {
479
+ tx.moveCall({
480
+ target: this.#target('set_supported_option_types'),
481
+ arguments: [
482
+ tx.object(this.objects.executor),
483
+ asObject(tx, adminCap),
484
+ asU32(tx, dstEid),
485
+ tx.pure(bcs.vector(bcs.u8()).serialize(optionTypes)),
486
+ ],
487
+ })
488
+ }
489
+
490
+ /**
491
+ * Set worker fee library for executor (admin only)
492
+ * @param tx - The transaction to add the move call to
493
+ * @param adminCap - The admin capability object ID
494
+ * @param workerFeeLib - The worker fee library address
495
+ */
496
+ setWorkerFeeLibMoveCall(
497
+ tx: Transaction,
498
+ adminCap: string | TransactionArgument,
499
+ workerFeeLib: string | TransactionArgument
500
+ ): void {
501
+ tx.moveCall({
502
+ target: this.#target('set_worker_fee_lib'),
503
+ arguments: [tx.object(this.objects.executor), asObject(tx, adminCap), asAddress(tx, workerFeeLib)],
504
+ })
505
+ }
506
+
507
+ /**
508
+ * Set admin role (grant or revoke) (owner only)
509
+ * @param tx - The transaction to add the move call to
510
+ * @param ownerCap - The owner capability object ID
511
+ * @param admin - The admin address
512
+ * @param active - Whether to grant or revoke admin role
513
+ */
514
+ setAdminMoveCall(
515
+ tx: Transaction,
516
+ ownerCap: string | TransactionArgument,
517
+ admin: string | TransactionArgument,
518
+ active: boolean | TransactionArgument
519
+ ): void {
520
+ tx.moveCall({
521
+ target: this.#target('set_admin'),
522
+ arguments: [
523
+ tx.object(this.objects.executor),
524
+ asObject(tx, ownerCap),
525
+ asAddress(tx, admin),
526
+ asBool(tx, active),
527
+ ],
528
+ })
529
+ }
530
+
531
+ /**
532
+ * Set supported message library (owner only)
533
+ * @param tx - The transaction to add the move call to
534
+ * @param ownerCap - The owner capability object ID
535
+ * @param messageLib - The message library address
536
+ * @param supported - Whether to support or remove support for the message library
537
+ */
538
+ setSupportedMessageLibMoveCall(
539
+ tx: Transaction,
540
+ ownerCap: string | TransactionArgument,
541
+ messageLib: string | TransactionArgument,
542
+ supported: boolean | TransactionArgument
543
+ ): void {
544
+ tx.moveCall({
545
+ target: this.#target('set_supported_message_lib'),
546
+ arguments: [
547
+ tx.object(this.objects.executor),
548
+ asObject(tx, ownerCap),
549
+ asAddress(tx, messageLib),
550
+ asBool(tx, supported),
551
+ ],
552
+ })
553
+ }
554
+
555
+ /**
556
+ * Set allowlist status for an OApp sender (owner only)
557
+ * @param tx - The transaction to add the move call to
558
+ * @param ownerCap - The owner capability object ID
559
+ * @param oapp - The OApp address
560
+ * @param allowed - Whether to allow or remove from allowlist
561
+ */
562
+ setAllowlistMoveCall(
563
+ tx: Transaction,
564
+ ownerCap: string | TransactionArgument,
565
+ oapp: string | TransactionArgument,
566
+ allowed: boolean | TransactionArgument
567
+ ): void {
568
+ tx.moveCall({
569
+ target: this.#target('set_allowlist'),
570
+ arguments: [
571
+ tx.object(this.objects.executor),
572
+ asObject(tx, ownerCap),
573
+ asAddress(tx, oapp),
574
+ asBool(tx, allowed),
575
+ ],
576
+ })
577
+ }
578
+
579
+ /**
580
+ * Set denylist status for an OApp sender (owner only)
581
+ * @param tx - The transaction to add the move call to
582
+ * @param ownerCap - The owner capability object ID
583
+ * @param oapp - The OApp address
584
+ * @param denied - Whether to deny or remove from denylist
585
+ */
586
+ setDenylistMoveCall(
587
+ tx: Transaction,
588
+ ownerCap: string | TransactionArgument,
589
+ oapp: string | TransactionArgument,
590
+ denied: boolean | TransactionArgument
591
+ ): void {
592
+ tx.moveCall({
593
+ target: this.#target('set_denylist'),
594
+ arguments: [
595
+ tx.object(this.objects.executor),
596
+ asObject(tx, ownerCap),
597
+ asAddress(tx, oapp),
598
+ asBool(tx, denied),
599
+ ],
600
+ })
601
+ }
602
+
603
+ /**
604
+ * Set worker paused state (owner only)
605
+ * @param tx - The transaction to add the move call to
606
+ * @param ownerCap - The owner capability object ID
607
+ * @param paused - Whether to pause or unpause the worker
608
+ */
609
+ setPausedMoveCall(
610
+ tx: Transaction,
611
+ ownerCap: string | TransactionArgument,
612
+ paused: boolean | TransactionArgument
613
+ ): void {
614
+ tx.moveCall({
615
+ target: this.#target('set_paused'),
616
+ arguments: [tx.object(this.objects.executor), asObject(tx, ownerCap), asBool(tx, paused)],
617
+ })
618
+ }
619
+
620
+ // === View Functions ===
621
+
622
+ /**
623
+ * Get the size of the allowlist
624
+ * @param tx - The transaction to add the move call to
625
+ * @returns Transaction result containing the allowlist size
626
+ */
627
+ allowlistSizeMoveCall(tx: Transaction): TransactionResult {
628
+ return tx.moveCall({
629
+ target: this.#target('allowlist_size'),
630
+ arguments: [tx.object(this.objects.executor)],
631
+ })
632
+ }
633
+
634
+ /**
635
+ * Get the size of the allowlist
636
+ * @returns Promise<bigint> - The number of addresses in the allowlist
637
+ */
638
+ async allowlistSize(): Promise<bigint> {
639
+ return executeSimulate(
640
+ this.client,
641
+ (tx) => {
642
+ this.allowlistSizeMoveCall(tx)
643
+ },
644
+ (result) => BigInt(bcs.U64.parse(result[0].value))
645
+ )
646
+ }
647
+
648
+ /**
649
+ * Get default multiplier basis points
650
+ * @param tx - The transaction to add the move call to
651
+ * @returns Transaction result containing the default multiplier bps
652
+ */
653
+ defaultMultiplierBpsMoveCall(tx: Transaction): TransactionResult {
654
+ return tx.moveCall({
655
+ target: this.#target('default_multiplier_bps'),
656
+ arguments: [tx.object(this.objects.executor)],
657
+ })
658
+ }
659
+
660
+ /**
661
+ * Get default multiplier basis points
662
+ * @returns Promise<number> - The default multiplier in basis points
663
+ */
664
+ async defaultMultiplierBps(): Promise<number> {
665
+ return executeSimulate(
666
+ this.client,
667
+ (tx) => {
668
+ this.defaultMultiplierBpsMoveCall(tx)
669
+ },
670
+ (result) => bcs.U16.parse(result[0].value)
671
+ )
672
+ }
673
+
674
+ /**
675
+ * Get executor deposit address for fee collection
676
+ * @param tx - The transaction to add the move call to
677
+ * @returns Transaction result containing the deposit address
678
+ */
679
+ depositAddressMoveCall(tx: Transaction): TransactionResult {
680
+ return tx.moveCall({
681
+ target: this.#target('deposit_address'),
682
+ arguments: [tx.object(this.objects.executor)],
683
+ })
684
+ }
685
+
686
+ /**
687
+ * Get executor deposit address for fee collection
688
+ * @returns Promise<string> - The deposit address
689
+ */
690
+ async depositAddress(): Promise<string> {
691
+ return executeSimulate(
692
+ this.client,
693
+ (tx) => {
694
+ this.depositAddressMoveCall(tx)
695
+ },
696
+ (result) => bcs.Address.parse(result[0].value)
697
+ )
698
+ }
699
+
700
+ /**
701
+ * Get destination configuration for executor
702
+ * @param tx - The transaction to add the move call to
703
+ * @param dstEid - Destination endpoint ID
704
+ * @returns Transaction result containing the destination configuration
705
+ */
706
+ dstConfigMoveCall(tx: Transaction, dstEid: number | TransactionArgument): TransactionResult {
707
+ return tx.moveCall({
708
+ target: this.#target('dst_config'),
709
+ arguments: [tx.object(this.objects.executor), asU32(tx, dstEid)],
710
+ })
711
+ }
712
+
713
+ /**
714
+ * Get destination configuration for executor
715
+ * @param dstEid - Destination endpoint ID
716
+ * @returns Promise<DstConfig> - The destination configuration
717
+ */
718
+ async dstConfig(dstEid: number): Promise<DstConfig> {
719
+ return executeSimulate(
720
+ this.client,
721
+ (tx) => {
722
+ this.dstConfigMoveCall(tx, dstEid)
723
+ },
724
+ (result) => this.parseDstConfig(result[0].value)
725
+ )
726
+ }
727
+
728
+ /**
729
+ * Check if an address has ACL (Access Control List) permission
730
+ * @param tx - The transaction to add the move call to
731
+ * @param account - The account address to check
732
+ * @returns Transaction result containing the ACL permission status
733
+ */
734
+ hasAclMoveCall(tx: Transaction, account: string): TransactionResult {
735
+ return tx.moveCall({
736
+ target: this.#target('has_acl'),
737
+ arguments: [tx.object(this.objects.executor), asAddress(tx, account)],
738
+ })
739
+ }
740
+
741
+ /**
742
+ * Check if an address has ACL (Access Control List) permission
743
+ * @param account - The account address to check
744
+ * @returns Promise<boolean> - True if the address has ACL permission
745
+ */
746
+ async hasAcl(account: string): Promise<boolean> {
747
+ return executeSimulate(
748
+ this.client,
749
+ (tx) => {
750
+ this.hasAclMoveCall(tx, account)
751
+ },
752
+ (result) => bcs.Bool.parse(result[0].value)
753
+ )
754
+ }
755
+
756
+ /**
757
+ * Get all registered executor admins
758
+ * @param tx - The transaction to add the move call to
759
+ * @returns Transaction result containing array of admin addresses
760
+ */
761
+ adminsMoveCall(tx: Transaction): TransactionResult {
762
+ return tx.moveCall({
763
+ target: this.#target('admins'),
764
+ arguments: [tx.object(this.objects.executor)],
765
+ })
766
+ }
767
+
768
+ /**
769
+ * Get all registered executor admins
770
+ * @returns Promise<string[]> - Array of admin addresses
771
+ */
772
+ async admins(): Promise<string[]> {
773
+ return executeSimulate(
774
+ this.client,
775
+ (tx) => {
776
+ this.adminsMoveCall(tx)
777
+ },
778
+ (result) => {
779
+ const parsed = bcs.vector(bcs.Address).parse(result[0].value)
780
+ return parsed
781
+ }
782
+ )
783
+ }
784
+
785
+ /**
786
+ * Check if an admin cap is valid (sync Move call)
787
+ * @param tx - The transaction to add the move call to
788
+ * @param adminCap - The admin capability object ID to check
789
+ * @returns TransactionResult - Result containing admin status
790
+ */
791
+ isAdminMoveCall(tx: Transaction, adminCap: string | TransactionArgument): TransactionResult {
792
+ return tx.moveCall({
793
+ target: this.#target('is_admin'),
794
+ arguments: [tx.object(this.objects.executor), asObject(tx, adminCap)],
795
+ })
796
+ }
797
+
798
+ /**
799
+ * Check if an admin cap is valid (async simulation)
800
+ * @param adminCap - The admin capability object ID to check
801
+ * @returns Promise<boolean> - True if the admin cap is valid
802
+ */
803
+ async isAdmin(adminCap: string): Promise<boolean> {
804
+ return executeSimulate(
805
+ this.client,
806
+ (tx) => {
807
+ this.isAdminMoveCall(tx, adminCap)
808
+ },
809
+ (result) => bcs.Bool.parse(result[0].value)
810
+ )
811
+ }
812
+
813
+ /**
814
+ * Check if an address is an admin
815
+ * @param tx - The transaction to add the move call to
816
+ * @param admin - The admin address to check
817
+ * @returns Transaction result containing the admin status
818
+ */
819
+ isAdminAddressMoveCall(tx: Transaction, admin: string | TransactionArgument): TransactionResult {
820
+ return tx.moveCall({
821
+ target: this.#target('is_admin_address'),
822
+ arguments: [tx.object(this.objects.executor), asAddress(tx, admin)],
823
+ })
824
+ }
825
+
826
+ /**
827
+ * Check if an address is an admin
828
+ * @param admin - The admin address to check
829
+ * @returns Promise<boolean> - True if the address is an admin
830
+ */
831
+ async isAdminAddress(admin: string): Promise<boolean> {
832
+ return executeSimulate(
833
+ this.client,
834
+ (tx) => {
835
+ this.isAdminAddressMoveCall(tx, admin)
836
+ },
837
+ (result) => bcs.Bool.parse(result[0].value)
838
+ )
839
+ }
840
+
841
+ /**
842
+ * Check if a message library is supported by this executor
843
+ * @param tx - The transaction to add the move call to
844
+ * @param messageLib - The message library address to check
845
+ * @returns Transaction result containing the support status
846
+ */
847
+ isSupportedMessageLibMoveCall(tx: Transaction, messageLib: string | TransactionArgument): TransactionResult {
848
+ return tx.moveCall({
849
+ target: this.#target('is_supported_message_lib'),
850
+ arguments: [tx.object(this.objects.executor), asAddress(tx, messageLib)],
851
+ })
852
+ }
853
+
854
+ /**
855
+ * Check if a message library is supported by this executor
856
+ * @param messageLib - The message library address to check
857
+ * @returns Promise<boolean> - True if the message library is supported
858
+ */
859
+ async isSupportedMessageLib(messageLib: string): Promise<boolean> {
860
+ return executeSimulate(
861
+ this.client,
862
+ (tx) => {
863
+ this.isSupportedMessageLibMoveCall(tx, messageLib)
864
+ },
865
+ (result) => bcs.Bool.parse(result[0].value)
866
+ )
867
+ }
868
+
869
+ /**
870
+ * Check if an address is allowlisted
871
+ * @param tx - The transaction to add the move call to
872
+ * @param account - The account address to check
873
+ * @returns Transaction result containing the allowlist status
874
+ */
875
+ isAllowlistedMoveCall(tx: Transaction, account: string | TransactionArgument): TransactionResult {
876
+ return tx.moveCall({
877
+ target: this.#target('is_allowlisted'),
878
+ arguments: [tx.object(this.objects.executor), asAddress(tx, account)],
879
+ })
880
+ }
881
+
882
+ /**
883
+ * Check if an address is in the allowlist
884
+ * @param account - The account address to check
885
+ * @returns Promise<boolean> - True if the address is allowlisted
886
+ */
887
+ async isAllowlisted(account: string): Promise<boolean> {
888
+ return executeSimulate(
889
+ this.client,
890
+ (tx) => {
891
+ this.isAllowlistedMoveCall(tx, account)
892
+ },
893
+ (result) => bcs.Bool.parse(result[0].value)
894
+ )
895
+ }
896
+
897
+ /**
898
+ * Check if an address is denylisted
899
+ * @param tx - The transaction to add the move call to
900
+ * @param account - The account address to check
901
+ * @returns Transaction result containing the denylist status
902
+ */
903
+ isDenylistedMoveCall(tx: Transaction, account: string | TransactionArgument): TransactionResult {
904
+ return tx.moveCall({
905
+ target: this.#target('is_denylisted'),
906
+ arguments: [tx.object(this.objects.executor), asAddress(tx, account)],
907
+ })
908
+ }
909
+
910
+ /**
911
+ * Check if an address is in the denylist
912
+ * @param account - The account address to check
913
+ * @returns Promise<boolean> - True if the address is denylisted
914
+ */
915
+ async isDenylisted(account: string): Promise<boolean> {
916
+ return executeSimulate(
917
+ this.client,
918
+ (tx) => {
919
+ this.isDenylistedMoveCall(tx, account)
920
+ },
921
+ (result) => bcs.Bool.parse(result[0].value)
922
+ )
923
+ }
924
+
925
+ /**
926
+ * Check if executor worker is paused
927
+ * @param tx - The transaction to add the move call to
928
+ * @returns Transaction result containing the paused status
929
+ */
930
+ isPausedMoveCall(tx: Transaction): TransactionResult {
931
+ return tx.moveCall({
932
+ target: this.#target('is_paused'),
933
+ arguments: [tx.object(this.objects.executor)],
934
+ })
935
+ }
936
+
937
+ /**
938
+ * Check if executor worker is paused
939
+ * @returns Promise<boolean> - True if the worker is paused
940
+ */
941
+ async isPaused(): Promise<boolean> {
942
+ return executeSimulate(
943
+ this.client,
944
+ (tx) => {
945
+ this.isPausedMoveCall(tx)
946
+ },
947
+ (result) => bcs.Bool.parse(result[0].value)
948
+ )
949
+ }
950
+
951
+ /**
952
+ * Get executor price feed address
953
+ * @param tx - The transaction to add the move call to
954
+ * @returns Transaction result containing the price feed address
955
+ */
956
+ priceFeedMoveCall(tx: Transaction): TransactionResult {
957
+ return tx.moveCall({
958
+ target: this.#target('price_feed'),
959
+ arguments: [tx.object(this.objects.executor)],
960
+ })
961
+ }
962
+
963
+ /**
964
+ * Get executor price feed address
965
+ * @returns Promise<string> - The price feed address
966
+ */
967
+ async priceFeed(): Promise<string> {
968
+ return executeSimulate(
969
+ this.client,
970
+ (tx) => {
971
+ this.priceFeedMoveCall(tx)
972
+ },
973
+ (result) => bcs.Address.parse(result[0].value)
974
+ )
975
+ }
976
+
977
+ /**
978
+ * Get supported option types for a destination EID
979
+ * @param tx - The transaction to add the move call to
980
+ * @param dstEid - Destination endpoint ID
981
+ * @returns Transaction result containing supported option types
982
+ */
983
+ supportedOptionTypesMoveCall(tx: Transaction, dstEid: number | TransactionArgument): TransactionResult {
984
+ return tx.moveCall({
985
+ target: this.#target('supported_option_types'),
986
+ arguments: [tx.object(this.objects.executor), asU32(tx, dstEid)],
987
+ })
988
+ }
989
+
990
+ /**
991
+ * Get supported option types for a destination EID
992
+ * @param dstEid - Destination endpoint ID
993
+ * @returns Promise<number[]> - Array of supported option types as bytes
994
+ */
995
+ async supportedOptionTypes(dstEid: number): Promise<number[]> {
996
+ return executeSimulate(
997
+ this.client,
998
+ (tx) => {
999
+ this.supportedOptionTypesMoveCall(tx, dstEid)
1000
+ },
1001
+ (result) => {
1002
+ const parsed = bcs.vector(bcs.u8()).parse(result[0].value)
1003
+ return Array.from(parsed)
1004
+ }
1005
+ )
1006
+ }
1007
+
1008
+ /**
1009
+ * Get executor worker capability address
1010
+ * @param tx - The transaction to add the move call to
1011
+ * @returns Transaction result containing the worker capability address
1012
+ */
1013
+ workerCapAddressMoveCall(tx: Transaction): TransactionResult {
1014
+ return tx.moveCall({
1015
+ target: this.#target('worker_cap_address'),
1016
+ arguments: [tx.object(this.objects.executor)],
1017
+ })
1018
+ }
1019
+
1020
+ /**
1021
+ * Get executor worker capability address
1022
+ * @returns Promise<string> - The worker capability address
1023
+ */
1024
+ async workerCapAddress(): Promise<string> {
1025
+ return executeSimulate(
1026
+ this.client,
1027
+ (tx) => {
1028
+ this.workerCapAddressMoveCall(tx)
1029
+ },
1030
+ (result) => bcs.Address.parse(result[0].value)
1031
+ )
1032
+ }
1033
+
1034
+ /**
1035
+ * Get executor worker fee library address
1036
+ * @param tx - The transaction to add the move call to
1037
+ * @returns Transaction result containing the worker fee library address
1038
+ */
1039
+ workerFeeLibMoveCall(tx: Transaction): TransactionResult {
1040
+ return tx.moveCall({
1041
+ target: this.#target('worker_fee_lib'),
1042
+ arguments: [tx.object(this.objects.executor)],
1043
+ })
1044
+ }
1045
+
1046
+ /**
1047
+ * Get executor worker fee library address
1048
+ * @returns Promise<string> - The worker fee library address
1049
+ */
1050
+ async workerFeeLib(): Promise<string> {
1051
+ return executeSimulate(
1052
+ this.client,
1053
+ (tx) => {
1054
+ this.workerFeeLibMoveCall(tx)
1055
+ },
1056
+ (result) => bcs.Address.parse(result[0].value)
1057
+ )
1058
+ }
1059
+
1060
+ /**
1061
+ * Get admin capability ID from admin address
1062
+ * @param tx - The transaction to add the move call to
1063
+ * @param admin - The admin address
1064
+ * @returns Transaction result containing the admin capability ID
1065
+ */
1066
+ adminCapIdMoveCall(tx: Transaction, admin: string | TransactionArgument): TransactionResult {
1067
+ return tx.moveCall({
1068
+ target: this.#target('admin_cap_id'),
1069
+ arguments: [tx.object(this.objects.executor), asAddress(tx, admin)],
1070
+ })
1071
+ }
1072
+
1073
+ /**
1074
+ * Get admin capability ID from admin address
1075
+ * @param admin - The admin address
1076
+ * @returns Promise<string> - The admin capability ID
1077
+ */
1078
+ async adminCapId(admin: string): Promise<string> {
1079
+ return executeSimulate(
1080
+ this.client,
1081
+ (tx) => {
1082
+ this.adminCapIdMoveCall(tx, admin)
1083
+ },
1084
+ (result) => bcs.Address.parse(result[0].value)
1085
+ )
1086
+ }
1087
+
1088
+ /**
1089
+ * Get Executor object address from worker registry using this Executor's worker capability (as a move call)
1090
+ * This function chains Move calls to decode worker info and extract the Executor object address
1091
+ * @param tx - The transaction to add the move call to
1092
+ * @returns Transaction result containing the Executor object address
1093
+ */
1094
+ getExecutorObjectAddressMoveCall(tx: Transaction): TransactionResult {
1095
+ // Step 1: Get this Executor's worker capability address
1096
+ const workerCapAddress = this.workerCapAddressMoveCall(tx)
1097
+
1098
+ // Step 2: Get worker info bytes from registry
1099
+ const workerInfoBytes = this.moduleManager
1100
+ .getWorkerRegistry(this.client)
1101
+ .getWorkerInfoMoveCall(tx, workerCapAddress)
1102
+
1103
+ // Step 3: Decode worker info using worker_common::worker_info_v1::decode
1104
+ const workerInfo = tx.moveCall({
1105
+ target: `${this.moduleManager.packages.workerCommon}::worker_info_v1::decode`,
1106
+ arguments: [workerInfoBytes],
1107
+ })
1108
+
1109
+ // Step 4: Extract worker_info field from decoded WorkerInfoV1
1110
+ const executorInfoBytes = tx.moveCall({
1111
+ target: `${this.moduleManager.packages.workerCommon}::worker_info_v1::worker_info`,
1112
+ arguments: [workerInfo],
1113
+ })
1114
+
1115
+ // Step 5: Decode Executor info using executor::executor_info_v1::decode
1116
+ const executorInfo = tx.moveCall({
1117
+ target: `${this.packageId}::executor_info_v1::decode`,
1118
+ arguments: [executorInfoBytes],
1119
+ })
1120
+
1121
+ // Step 6: Extract executor_object address from decoded ExecutorInfoV1
1122
+ return tx.moveCall({
1123
+ target: `${this.packageId}::executor_info_v1::executor_object`,
1124
+ arguments: [executorInfo],
1125
+ })
1126
+ }
1127
+
1128
+ /**
1129
+ * Get Executor object address from worker registry using this Executor's worker capability
1130
+ * This function uses Move calls to decode worker info and extract the Executor object address
1131
+ * @returns Promise<string> - The Executor object address
1132
+ * @throws Will throw an error if worker info is not found or if decoding fails
1133
+ */
1134
+ async getExecutorObjectAddress(): Promise<string> {
1135
+ return executeSimulate(
1136
+ this.client,
1137
+ (tx) => {
1138
+ this.getExecutorObjectAddressMoveCall(tx)
1139
+ },
1140
+ (result) => {
1141
+ // The result is the Executor object address directly from the Move call chain
1142
+ return bcs.Address.parse(result[0].value)
1143
+ }
1144
+ )
1145
+ }
1146
+
1147
+ // === Private Helper Functions ===
1148
+
1149
+ private parseDstConfig(data: Uint8Array): DstConfig {
1150
+ const config = DstConfigBcs.parse(data)
1151
+ return {
1152
+ lzReceiveBaseGas: BigInt(config.lz_receive_base_gas),
1153
+ lzComposeBaseGas: BigInt(config.lz_compose_base_gas),
1154
+ multiplierBps: config.multiplier_bps,
1155
+ floorMarginUsd: BigInt(config.floor_margin_usd),
1156
+ nativeCap: BigInt(config.native_cap),
1157
+ }
1158
+ }
1159
+
1160
+ /**
1161
+ * Generate the full target path for move calls
1162
+ * @param name - The function name to call
1163
+ * @param module_name - The module name (defaults to MODULE_NAME)
1164
+ * @returns The full module path for the move call
1165
+ * @private
1166
+ */
1167
+ #target(name: string, module_name = MODULE_NAME): string {
1168
+ return `${this.packageId}::${module_name}::${name}`
1169
+ }
1170
+ }