@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,295 @@
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 { ModuleManager } from '../../module-manager'
6
+ import { ObjectOptions } from '../../types'
7
+ import { asAddress, asBool, asU64, executeSimulate } from '../../utils'
8
+
9
+ const MODULE_NAME = 'treasury'
10
+
11
+ export const TreasuryErrorCode = {
12
+ // Treasury related errors (matching treasury.move)
13
+ TREASURY_EInvalidFeeRecipient: 1,
14
+ TREASURY_EInvalidNativeFeeBp: 2,
15
+ TREASURY_EZroNotEnabled: 3,
16
+ } as const
17
+
18
+ export class Treasury {
19
+ public packageId: string
20
+ public readonly client: IotaClient
21
+ private readonly objects: ObjectOptions
22
+
23
+ constructor(
24
+ packageId: string,
25
+ client: IotaClient,
26
+ objects: ObjectOptions,
27
+ private readonly moduleManager: ModuleManager
28
+ ) {
29
+ this.packageId = packageId
30
+ this.client = client
31
+ this.objects = objects
32
+ }
33
+
34
+ // === Set Functions ===
35
+
36
+ /**
37
+ * Set fee recipient address for treasury (admin only)
38
+ * @param tx - The transaction to add the move call to
39
+ * @param feeRecipient - The new fee recipient address or transaction argument
40
+ */
41
+ setFeeRecipientMoveCall(tx: Transaction, feeRecipient: string | TransactionArgument): void {
42
+ tx.moveCall({
43
+ target: this.#target('set_fee_recipient'),
44
+ arguments: [
45
+ tx.object(this.objects.treasury),
46
+ tx.object(this.objects.treasuryAdminCap),
47
+ asAddress(tx, feeRecipient),
48
+ ],
49
+ })
50
+ }
51
+
52
+ /**
53
+ * Set native fee basis points for treasury (admin only)
54
+ * @param tx - The transaction to add the move call to
55
+ * @param nativeFeeBp - The native fee in basis points or transaction argument
56
+ */
57
+ setNativeFeeBpMoveCall(tx: Transaction, nativeFeeBp: bigint | number | string | TransactionArgument): void {
58
+ tx.moveCall({
59
+ target: this.#target('set_native_fee_bp'),
60
+ arguments: [
61
+ tx.object(this.objects.treasury),
62
+ tx.object(this.objects.treasuryAdminCap),
63
+ asU64(tx, nativeFeeBp),
64
+ ],
65
+ })
66
+ }
67
+
68
+ /**
69
+ * Set ZRO token fee for treasury (admin only)
70
+ * @param tx - The transaction to add the move call to
71
+ * @param zroFee - The ZRO token fee amount or transaction argument
72
+ */
73
+ setZroFeeMoveCall(tx: Transaction, zroFee: bigint | number | string | TransactionArgument): void {
74
+ tx.moveCall({
75
+ target: this.#target('set_zro_fee'),
76
+ arguments: [tx.object(this.objects.treasury), tx.object(this.objects.treasuryAdminCap), asU64(tx, zroFee)],
77
+ })
78
+ }
79
+
80
+ /**
81
+ * Enable or disable ZRO token fees (admin only)
82
+ * @param tx - The transaction to add the move call to
83
+ * @param zroEnabled - Whether ZRO token fees are enabled or transaction argument
84
+ */
85
+ setZroEnabledMoveCall(tx: Transaction, zroEnabled: boolean | TransactionArgument): void {
86
+ tx.moveCall({
87
+ target: this.#target('set_zro_enabled'),
88
+ arguments: [
89
+ tx.object(this.objects.treasury),
90
+ tx.object(this.objects.treasuryAdminCap),
91
+ asBool(tx, zroEnabled),
92
+ ],
93
+ })
94
+ }
95
+
96
+ /**
97
+ * Enable or disable treasury fees (admin only)
98
+ * @param tx - The transaction to add the move call to
99
+ * @param feeEnabled - Whether treasury fees are enabled or transaction argument
100
+ */
101
+ setFeeEnabledMoveCall(tx: Transaction, feeEnabled: boolean | TransactionArgument): void {
102
+ tx.moveCall({
103
+ target: this.#target('set_fee_enabled'),
104
+ arguments: [
105
+ tx.object(this.objects.treasury),
106
+ tx.object(this.objects.treasuryAdminCap),
107
+ asBool(tx, feeEnabled),
108
+ ],
109
+ })
110
+ }
111
+
112
+ // === View Functions ===
113
+
114
+ /**
115
+ * Calculate treasury fees for a transaction
116
+ * @param tx - The transaction to add the move call to
117
+ * @param totalNativeFee - Total native fee amount or transaction argument
118
+ * @param payInZro - Whether to pay in ZRO tokens or transaction argument
119
+ * @returns Transaction result containing calculated fees
120
+ */
121
+ getFeeMoveCall(
122
+ tx: Transaction,
123
+ totalNativeFee: bigint | number | string | TransactionArgument,
124
+ payInZro: boolean | TransactionArgument
125
+ ): TransactionResult {
126
+ return tx.moveCall({
127
+ target: this.#target('get_fee'),
128
+ arguments: [tx.object(this.objects.treasury), asU64(tx, totalNativeFee), asBool(tx, payInZro)],
129
+ })
130
+ }
131
+
132
+ /**
133
+ * Calculate treasury fees for a transaction
134
+ * @param totalNativeFee - Total native fee amount
135
+ * @param payInZro - Whether to pay in ZRO tokens
136
+ * @returns Promise<[bigint, bigint]> - Tuple of [nativeFee, zroFee]
137
+ */
138
+ async getFee(totalNativeFee: bigint, payInZro: boolean): Promise<[bigint, bigint]> {
139
+ return executeSimulate(
140
+ this.client,
141
+ (tx) => {
142
+ this.getFeeMoveCall(tx, totalNativeFee, payInZro)
143
+ },
144
+ (result) => {
145
+ // Parse the tuple (u64, u64) returned by get_fee
146
+ const nativeFee = BigInt(bcs.U64.parse(result[0].value))
147
+ const zroFee = BigInt(bcs.U64.parse(result[1].value))
148
+ return [nativeFee, zroFee]
149
+ }
150
+ )
151
+ }
152
+
153
+ /**
154
+ * Get treasury fee recipient address
155
+ * @param tx - The transaction to add the move call to
156
+ * @returns Transaction result containing the fee recipient address
157
+ */
158
+ feeRecipientMoveCall(tx: Transaction): TransactionResult {
159
+ return tx.moveCall({
160
+ target: this.#target('fee_recipient'),
161
+ arguments: [tx.object(this.objects.treasury)],
162
+ })
163
+ }
164
+
165
+ /**
166
+ * Get treasury fee recipient address
167
+ * @returns Promise<string> - The fee recipient address
168
+ */
169
+ async feeRecipient(): Promise<string> {
170
+ return executeSimulate(
171
+ this.client,
172
+ (tx) => {
173
+ this.feeRecipientMoveCall(tx)
174
+ },
175
+ (result) => bcs.Address.parse(result[0].value)
176
+ )
177
+ }
178
+
179
+ /**
180
+ * Get native fee basis points
181
+ * @param tx - The transaction to add the move call to
182
+ * @returns Transaction result containing the native fee basis points
183
+ */
184
+ nativeFeeBpMoveCall(tx: Transaction): TransactionResult {
185
+ return tx.moveCall({
186
+ target: this.#target('native_fee_bp'),
187
+ arguments: [tx.object(this.objects.treasury)],
188
+ })
189
+ }
190
+
191
+ /**
192
+ * Get native fee basis points
193
+ * @returns Promise<bigint> - The native fee in basis points
194
+ */
195
+ async nativeFeeBp(): Promise<bigint> {
196
+ return executeSimulate(
197
+ this.client,
198
+ (tx) => {
199
+ this.nativeFeeBpMoveCall(tx)
200
+ },
201
+ (result) => BigInt(bcs.U64.parse(result[0].value))
202
+ )
203
+ }
204
+
205
+ /**
206
+ * Get ZRO token fee amount
207
+ * @param tx - The transaction to add the move call to
208
+ * @returns Transaction result containing the ZRO fee
209
+ */
210
+ zroFeeMoveCall(tx: Transaction): TransactionResult {
211
+ return tx.moveCall({
212
+ target: this.#target('zro_fee'),
213
+ arguments: [tx.object(this.objects.treasury)],
214
+ })
215
+ }
216
+
217
+ /**
218
+ * Get ZRO token fee amount
219
+ * @returns Promise<bigint> - The ZRO token fee
220
+ */
221
+ async zroFee(): Promise<bigint> {
222
+ return executeSimulate(
223
+ this.client,
224
+ (tx) => {
225
+ this.zroFeeMoveCall(tx)
226
+ },
227
+ (result) => BigInt(bcs.U64.parse(result[0].value))
228
+ )
229
+ }
230
+
231
+ /**
232
+ * Check if ZRO token fees are enabled
233
+ * @param tx - The transaction to add the move call to
234
+ * @returns Transaction result containing the ZRO enabled status
235
+ */
236
+ zroEnabledMoveCall(tx: Transaction): TransactionResult {
237
+ return tx.moveCall({
238
+ target: this.#target('zro_enabled'),
239
+ arguments: [tx.object(this.objects.treasury)],
240
+ })
241
+ }
242
+
243
+ /**
244
+ * Check if ZRO token fees are enabled
245
+ * @returns Promise<boolean> - True if ZRO fees are enabled
246
+ */
247
+ async zroEnabled(): Promise<boolean> {
248
+ return executeSimulate(
249
+ this.client,
250
+ (tx) => {
251
+ this.zroEnabledMoveCall(tx)
252
+ },
253
+ (result) => bcs.Bool.parse(result[0].value)
254
+ )
255
+ }
256
+
257
+ /**
258
+ * Check if treasury fees are enabled
259
+ * @param tx - The transaction to add the move call to
260
+ * @returns Transaction result containing the fee enabled status
261
+ */
262
+ feeEnabledMoveCall(tx: Transaction): TransactionResult {
263
+ return tx.moveCall({
264
+ target: this.#target('fee_enabled'),
265
+ arguments: [tx.object(this.objects.treasury)],
266
+ })
267
+ }
268
+
269
+ /**
270
+ * Check if treasury fees are enabled
271
+ * @returns Promise<boolean> - True if treasury fees are enabled
272
+ */
273
+ async feeEnabled(): Promise<boolean> {
274
+ return executeSimulate(
275
+ this.client,
276
+ (tx) => {
277
+ this.feeEnabledMoveCall(tx)
278
+ },
279
+ (result) => bcs.Bool.parse(result[0].value)
280
+ )
281
+ }
282
+
283
+ // === Private Functions ===
284
+
285
+ /**
286
+ * Generate the full target path for move calls
287
+ * @param name - The function name to call
288
+ * @param module_name - The module name (defaults to MODULE_NAME)
289
+ * @returns The full module path for the move call
290
+ * @private
291
+ */
292
+ #target(name: string, module_name: string = MODULE_NAME): string {
293
+ return `${this.packageId}::${module_name}::${name}`
294
+ }
295
+ }
@@ -0,0 +1,110 @@
1
+ import { IotaClient } from '@iota/iota-sdk/client'
2
+ import { Transaction, TransactionArgument, TransactionResult } from '@iota/iota-sdk/transactions'
3
+
4
+ import { ModuleManager } from '../../module-manager'
5
+ import { ObjectOptions } from '../../types'
6
+ import { asAddress, executeSimulate } from '../../utils'
7
+
8
+ const MODULE_NAME = 'worker_registry'
9
+
10
+ export const WorkerRegistryErrorCode = {
11
+ // WorkerRegistry related errors (matching worker_registry.move)
12
+ EWorkerInfoInvalid: 1,
13
+ EWorkerInfoNotFound: 2,
14
+ } as const
15
+
16
+ /**
17
+ * WorkerRegistry provides access to the worker registry contract functionality
18
+ * This module maintains mappings between worker addresses and their associated information.
19
+ */
20
+ export class WorkerRegistry {
21
+ public packageId: string
22
+ public readonly client: IotaClient
23
+ private readonly objects: ObjectOptions
24
+
25
+ /**
26
+ * Create a new WorkerRegistry instance
27
+ * @param packageId - The package ID of the worker registry contract
28
+ * @param client - The Iota client instance
29
+ * @param objects - Object options containing contract object IDs
30
+ * @param moduleManager - Module manager for handling dependencies
31
+ */
32
+ constructor(
33
+ packageId: string,
34
+ client: IotaClient,
35
+ objects: ObjectOptions,
36
+ private readonly moduleManager: ModuleManager
37
+ ) {
38
+ this.packageId = packageId
39
+ this.client = client
40
+ this.objects = objects
41
+ }
42
+
43
+ // === View Functions ===
44
+
45
+ /**
46
+ * Get worker info for a specific worker address (as a move call)
47
+ * This creates a move call that can be used in a PTB (Programmable Transaction Block)
48
+ * @param tx - The transaction to add the move call to
49
+ * @param worker - The worker address or transaction argument
50
+ * @returns TransactionResult - The move call result containing worker info bytes
51
+ * @throws Will throw an error if worker info is not found (EWorkerInfoNotFound)
52
+ */
53
+ getWorkerInfoMoveCall(tx: Transaction, worker: string | TransactionArgument): TransactionResult {
54
+ return tx.moveCall({
55
+ target: this.#target('get_worker_info'),
56
+ arguments: [tx.object(this.objects.workerRegistry), asAddress(tx, worker)],
57
+ })
58
+ }
59
+
60
+ /**
61
+ * Get worker info for a specific worker address
62
+ * Executes the get_worker_info function and returns the worker information bytes
63
+ * @param worker - The worker address to get info for
64
+ * @returns Promise<Uint8Array> - The worker information bytes containing encoded worker data
65
+ * @throws Will throw an error if worker info is not found (EWorkerInfoNotFound)
66
+ */
67
+ async getWorkerInfo(worker: string): Promise<Uint8Array> {
68
+ return executeSimulate(
69
+ this.client,
70
+ (tx) => {
71
+ this.getWorkerInfoMoveCall(tx, worker)
72
+ },
73
+ (result) => {
74
+ return result[0].value
75
+ }
76
+ )
77
+ }
78
+
79
+ /**
80
+ * Check if worker info exists for a specific worker address
81
+ * This is a convenience method that catches EWorkerInfoNotFound errors
82
+ * @param worker - The worker address to check
83
+ * @returns Promise<boolean> - True if worker info exists, false if not found
84
+ * @throws Will re-throw any errors other than EWorkerInfoNotFound
85
+ */
86
+ async hasWorkerInfo(worker: string): Promise<boolean> {
87
+ try {
88
+ await this.getWorkerInfo(worker)
89
+ return true
90
+ } catch (error) {
91
+ // If the error is EWorkerInfoNotFound, return false
92
+ if (error instanceof Error && error.message.includes('EWorkerInfoNotFound')) {
93
+ return false
94
+ }
95
+ // Re-throw other errors
96
+ throw error
97
+ }
98
+ }
99
+
100
+ // === Private Functions ===
101
+
102
+ /**
103
+ * Generate the target string for move calls
104
+ * @param functionName - The function name to call
105
+ * @returns The fully qualified target string for the move call
106
+ */
107
+ #target(functionName: string): string {
108
+ return `${this.packageId}::${MODULE_NAME}::${functionName}`
109
+ }
110
+ }
@@ -0,0 +1,94 @@
1
+ import { IotaClient } from '@iota/iota-sdk/client'
2
+ import { Transaction, TransactionArgument, TransactionResult } from '@iota/iota-sdk/transactions'
3
+
4
+ import { ModuleManager } from '../module-manager'
5
+
6
+ export class Zro {
7
+ public packageId: string
8
+ public readonly client: IotaClient
9
+ public zroType: string
10
+
11
+ constructor(
12
+ packageId: string,
13
+ client: IotaClient,
14
+ private readonly moduleManager: ModuleManager
15
+ ) {
16
+ this.packageId = packageId
17
+ this.client = client
18
+ this.zroType = `${this.packageId}::zro::ZRO`
19
+ }
20
+
21
+ // === Utils function ===
22
+
23
+ /**
24
+ * Split ZRO tokens and wrap in an Option type for use in LayerZero operations
25
+ * If value is 0, returns Option::None, otherwise returns Option::Some with the split tokens
26
+ * @param tx - The transaction to add the move call to
27
+ * @param userAddress - Address of the user whose ZRO tokens to split
28
+ * @param value - Amount of ZRO tokens to split (0 for None option)
29
+ * @param maxCoins - Maximum total number of coins to collect across all pages (default: 200)
30
+ * @param maxCoinsPerPage - Maximum number of coins to fetch per page (default: 50)
31
+ * @returns Promise resolving to transaction result containing Option<Coin<ZRO>>
32
+ * @throws Error if insufficient ZRO balance
33
+ */
34
+ async splitOptionZroTokenMoveCall(
35
+ tx: Transaction,
36
+ userAddress: string,
37
+ value: bigint,
38
+ maxCoins = 200,
39
+ maxCoinsPerPage = 50
40
+ ): Promise<TransactionResult> {
41
+ if (value === 0n) {
42
+ return this.noneOptionMoveCall(tx)
43
+ }
44
+ const zroCoin = await this.splitZroTokenMoveCall(tx, userAddress, value, maxCoins, maxCoinsPerPage)
45
+ return this.someOptionMoveCall(tx, zroCoin)
46
+ }
47
+
48
+ /**
49
+ * Splits specified amount of ZRO tokens from user's wallet
50
+ * This method fetches coins and merges them as needed to get sufficient balance
51
+ * @param tx - The transaction to add the move call to
52
+ * @param owner - Address of the user whose ZRO coins to split
53
+ * @param amount - Amount of ZRO tokens to split (in smallest units, considering 9 decimals)
54
+ * @param limit - Maximum total number of coins to collect across all pages (default: 200)
55
+ * @param pageSize - Maximum number of coins to fetch per page (default: 50)
56
+ * @returns Promise resolving to split ZRO coin as TransactionResult
57
+ * @throws Error if insufficient ZRO balance or no coins found
58
+ */
59
+ async splitZroTokenMoveCall(
60
+ tx: Transaction,
61
+ owner: string,
62
+ amount: bigint,
63
+ limit = 200,
64
+ pageSize = 50
65
+ ): Promise<TransactionResult> {
66
+ return this.moduleManager.getUtils().splitCoinMoveCall(tx, this.zroType, owner, amount, limit, pageSize)
67
+ }
68
+
69
+ /**
70
+ * Creates an Option::Some moveCall containing a ZRO coin
71
+ * @param tx - The transaction to add the move call to
72
+ * @param zroCoin - ZRO coin to wrap in Option or transaction argument
73
+ * @returns Transaction result containing Option<Coin<ZRO>> type with Some value
74
+ */
75
+ someOptionMoveCall(tx: Transaction, zroCoin: TransactionArgument): TransactionResult {
76
+ return tx.moveCall({
77
+ target: `0x1::option::some`,
78
+ typeArguments: [`0x2::coin::Coin<${this.zroType}>`],
79
+ arguments: [zroCoin],
80
+ })
81
+ }
82
+
83
+ /**
84
+ * Creates an Option::None moveCall for ZRO coin type
85
+ * @param tx - The transaction to add the move call to
86
+ * @returns Transaction result containing Option<Coin<ZRO>> type with None value
87
+ */
88
+ noneOptionMoveCall(tx: Transaction): TransactionResult {
89
+ return tx.moveCall({
90
+ target: `0x1::option::none`,
91
+ typeArguments: [`0x2::coin::Coin<${this.zroType}>`],
92
+ })
93
+ }
94
+ }
@@ -0,0 +1,104 @@
1
+ import { Stage } from '@layerzerolabs/lz-definitions'
2
+
3
+ import * as AddressConstants from './generated/addresses'
4
+ import { ObjectOptions, PackageOptions } from './types'
5
+
6
+ /**
7
+ * Address mapping configuration for packages
8
+ */
9
+ const PACKAGE_ADDRESS_MAP: { [K in keyof PackageOptions]: Partial<{ [S in Stage]: string }> } = {
10
+ utils: AddressConstants.PACKAGE_UTILS_ADDRESS,
11
+ endpointV2: AddressConstants.PACKAGE_ENDPOINT_V2_ADDRESS,
12
+ counterV2: AddressConstants.PACKAGE_COUNTER_V2_ADDRESS,
13
+ simpleMessageLib: AddressConstants.PACKAGE_SIMPLE_MESSAGE_LIB_ADDRESS,
14
+ uln302: AddressConstants.PACKAGE_ULN_302_ADDRESS,
15
+ uln302PtbBuilder: AddressConstants.PACKAGE_ULN_302_PTB_BUILDER_ADDRESS,
16
+ blockedMessageLib: AddressConstants.PACKAGE_BLOCKED_MESSAGE_LIB_ADDRESS,
17
+ blockedMessageLibPtbBuilder: AddressConstants.PACKAGE_BLOCKED_MESSAGE_LIB_PTB_BUILDER_ADDRESS,
18
+ dvnPtbBuilder: AddressConstants.PACKAGE_DVN_PTB_BUILDER_ADDRESS,
19
+ executorPtbBuilder: AddressConstants.PACKAGE_EXECUTOR_PTB_BUILDER_ADDRESS,
20
+ executor: AddressConstants.PACKAGE_EXECUTOR_ADDRESS,
21
+ zro: AddressConstants.PACKAGE_ZRO_ADDRESS,
22
+ call: AddressConstants.PACKAGE_CALL_ADDRESS,
23
+ endpointPtbBuilder: AddressConstants.PACKAGE_ENDPOINT_PTB_BUILDER_ADDRESS,
24
+ simpleMessageLibPtbBuilder: AddressConstants.PACKAGE_SIMPLE_MESSAGE_LIB_PTB_BUILDER_ADDRESS,
25
+ ptbMoveCall: AddressConstants.PACKAGE_PTB_MOVE_CALL_ADDRESS,
26
+ dvn: AddressConstants.PACKAGE_DVN_ADDRESS,
27
+ dvnFeeLib: AddressConstants.PACKAGE_DVN_FEE_LIB_ADDRESS,
28
+ dvnLayerzero: AddressConstants.PACKAGE_DVN_LAYERZERO_ADDRESS,
29
+ executorFeeLib: AddressConstants.PACKAGE_EXECUTOR_FEE_LIB_ADDRESS,
30
+ executorLayerzero: AddressConstants.PACKAGE_EXECUTOR_LAYERZERO_ADDRESS,
31
+ priceFeed: AddressConstants.PACKAGE_PRICE_FEED_ADDRESS,
32
+ treasury: AddressConstants.PACKAGE_TREASURY_ADDRESS,
33
+ oapp: AddressConstants.PACKAGE_OAPP_ADDRESS,
34
+ layerzeroViews: AddressConstants.PACKAGE_LAYERZERO_VIEWS_ADDRESS,
35
+ packageWhitelistValidator: AddressConstants.PACKAGE_PACKAGE_WHITELIST_VALIDATOR_ADDRESS,
36
+ workerRegistry: AddressConstants.PACKAGE_WORKER_REGISTRY_ADDRESS,
37
+ workerCommon: AddressConstants.PACKAGE_WORKER_COMMON_ADDRESS,
38
+ }
39
+
40
+ /**
41
+ * Address mapping configuration for objects
42
+ */
43
+ const OBJECT_ADDRESS_MAP: { [K in keyof ObjectOptions]: Partial<{ [S in Stage]: string }> } = {
44
+ endpointV2: AddressConstants.OBJECT_ENDPOINT_V2_ADDRESS,
45
+ simpleMessageLib: AddressConstants.OBJECT_SIMPLE_MESSAGE_LIB_ADDRESS,
46
+ simpleMessageLibAdminCap: AddressConstants.OBJECT_SIMPLE_MESSAGE_LIB_ADMIN_CAP_ADDRESS,
47
+ simpleMessageLibPtbBuilder: AddressConstants.OBJECT_SIMPLE_MESSAGE_LIB_PTB_BUILDER_ADDRESS,
48
+ uln302: AddressConstants.OBJECT_ULN_302_ADDRESS,
49
+ uln302AdminCap: AddressConstants.OBJECT_ULN_302_ADMIN_CAP_ADDRESS,
50
+ uln302PtbBuilder: AddressConstants.OBJECT_ULN_302_PTB_BUILDER_ADDRESS,
51
+ uln302Verification: AddressConstants.OBJECT_ULN_302_VERIFICATION_ADDRESS,
52
+ treasury: AddressConstants.OBJECT_TREASURY_ADDRESS,
53
+ treasuryAdminCap: AddressConstants.OBJECT_TREASURY_ADMIN_CAP_ADDRESS,
54
+ blockedMessageLib: AddressConstants.OBJECT_BLOCKED_MESSAGE_LIB_ADDRESS,
55
+ blockedMessageLibPtbBuilder: AddressConstants.OBJECT_BLOCKED_MESSAGE_LIB_PTB_BUILDER_ADDRESS,
56
+ counter: AddressConstants.OBJECT_COUNTER_ADDRESS,
57
+ counterOapp: AddressConstants.OBJECT_COUNTER_OAPP_ADDRESS,
58
+ counterAdminCap: AddressConstants.OBJECT_COUNTER_ADMIN_CAP_ADDRESS,
59
+ endpointAdminCap: AddressConstants.OBJECT_ENDPOINT_ADMIN_CAP_ADDRESS,
60
+ endpointPtbBuilder: AddressConstants.OBJECT_ENDPOINT_PTB_BUILDER_ADDRESS,
61
+ endpointPtbBuilderAdminCap: AddressConstants.OBJECT_ENDPOINT_PTB_BUILDER_ADMIN_CAP_ADDRESS,
62
+ dvn: AddressConstants.OBJECT_DVN_ADDRESS,
63
+ dvnCap: AddressConstants.OBJECT_DVN_CAP_ADDRESS,
64
+ dvnFeeLib: AddressConstants.OBJECT_DVN_FEE_LIB_ADDRESS,
65
+ executor: AddressConstants.OBJECT_EXECUTOR_ADDRESS,
66
+ executorCap: AddressConstants.OBJECT_EXECUTOR_CAP_ADDRESS,
67
+ executorOwnerCap: AddressConstants.OBJECT_EXECUTOR_OWNER_CAP_ADDRESS,
68
+ executorFeeLib: AddressConstants.OBJECT_EXECUTOR_FEE_LIB_ADDRESS,
69
+ priceFeed: AddressConstants.OBJECT_PRICE_FEED_ADDRESS,
70
+ priceFeedOwnerCap: AddressConstants.OBJECT_PRICE_FEED_OWNER_CAP_ADDRESS,
71
+ packageWhitelistValidator: AddressConstants.OBJECT_PACKAGE_WHITELIST_VALIDATOR_ADDRESS,
72
+ workerRegistry: AddressConstants.OBJECT_WORKER_REGISTRY_ADDRESS,
73
+ }
74
+
75
+ /**
76
+ * Simple Resource Manager for address resolution
77
+ */
78
+ export class ResourceManager {
79
+ /**
80
+ * Build package configuration with address mappings for a given stage
81
+ */
82
+ static mergeDefaultPackageConfig(stage: Stage, customPackages?: Partial<PackageOptions>): PackageOptions {
83
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
84
+ const config = {} as PackageOptions
85
+ for (const [key, stageMap] of Object.entries(PACKAGE_ADDRESS_MAP)) {
86
+ const typedKey = key as keyof PackageOptions
87
+ config[typedKey] = stageMap[stage] ?? ''
88
+ }
89
+ return { ...config, ...customPackages }
90
+ }
91
+
92
+ /**
93
+ * Build object configuration with address mappings for a given stage
94
+ */
95
+ static mergeDefaultObjectConfig(stage: Stage, customObjects?: Partial<ObjectOptions>): ObjectOptions {
96
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
97
+ const config = {} as ObjectOptions
98
+ for (const [key, stageMap] of Object.entries(OBJECT_ADDRESS_MAP)) {
99
+ const typedKey = key as keyof ObjectOptions
100
+ config[typedKey] = stageMap[stage] ?? ''
101
+ }
102
+ return { ...config, ...customObjects }
103
+ }
104
+ }