@layerzerolabs/lz-sui-sdk-v2 3.0.132 → 3.0.134-sui.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/deployments/sui-sandbox-local/blocked_message_lib.json +26 -26
  3. package/deployments/sui-sandbox-local/blocked_msglib_ptb_builder.json +26 -26
  4. package/deployments/sui-sandbox-local/call.json +20 -20
  5. package/deployments/sui-sandbox-local/counter.json +81 -46
  6. package/deployments/sui-sandbox-local/dvn.json +23 -22
  7. package/deployments/sui-sandbox-local/dvn_call_type.json +21 -21
  8. package/deployments/sui-sandbox-local/dvn_fee_lib.json +31 -31
  9. package/deployments/sui-sandbox-local/dvn_layerzero.json +25 -25
  10. package/deployments/sui-sandbox-local/dvn_ptb_builder.json +14 -14
  11. package/deployments/sui-sandbox-local/endpoint_ptb_builder.json +31 -31
  12. package/deployments/sui-sandbox-local/endpoint_v2.json +26 -26
  13. package/deployments/sui-sandbox-local/executor.json +21 -20
  14. package/deployments/sui-sandbox-local/executor_call_type.json +14 -14
  15. package/deployments/sui-sandbox-local/executor_fee_lib.json +27 -27
  16. package/deployments/sui-sandbox-local/executor_layerzero.json +22 -22
  17. package/deployments/sui-sandbox-local/executor_ptb_builder.json +14 -14
  18. package/deployments/sui-sandbox-local/layerzero_views.json +14 -14
  19. package/deployments/sui-sandbox-local/message_lib_common.json +22 -22
  20. package/deployments/sui-sandbox-local/msglib_ptb_builder_call_types.json +14 -14
  21. package/deployments/sui-sandbox-local/oapp.json +16 -14
  22. package/deployments/sui-sandbox-local/object-BlockedMessageLib.json +5 -5
  23. package/deployments/sui-sandbox-local/object-BlockedMsglibPtbBuilder.json +5 -5
  24. package/deployments/sui-sandbox-local/object-Counter.json +5 -5
  25. package/deployments/sui-sandbox-local/object-CounterAdminCap.json +5 -5
  26. package/deployments/sui-sandbox-local/object-CounterOApp.json +5 -5
  27. package/deployments/sui-sandbox-local/object-DVN.json +2 -2
  28. package/deployments/sui-sandbox-local/object-DVNCap.json +5 -5
  29. package/deployments/sui-sandbox-local/object-DVNFeeLib.json +5 -5
  30. package/deployments/sui-sandbox-local/object-EndpointPtbBuilder.json +5 -5
  31. package/deployments/sui-sandbox-local/object-EndpointPtbBuilderAdminCap.json +5 -5
  32. package/deployments/sui-sandbox-local/object-EndpointV2.json +4 -4
  33. package/deployments/sui-sandbox-local/object-EndpointV2AdminCap.json +4 -4
  34. package/deployments/sui-sandbox-local/object-Executor.json +2 -2
  35. package/deployments/sui-sandbox-local/object-ExecutorCap.json +4 -4
  36. package/deployments/sui-sandbox-local/object-ExecutorFeeLib.json +5 -5
  37. package/deployments/sui-sandbox-local/object-ExecutorOwnerCap.json +2 -2
  38. package/deployments/sui-sandbox-local/object-PackageWhitelistValidator.json +5 -5
  39. package/deployments/sui-sandbox-local/object-PriceFeed.json +5 -5
  40. package/deployments/sui-sandbox-local/object-PriceFeedOwnerCap.json +5 -5
  41. package/deployments/sui-sandbox-local/object-SimpleMessageLib.json +5 -5
  42. package/deployments/sui-sandbox-local/object-SimpleMessageLibAdminCap.json +5 -5
  43. package/deployments/sui-sandbox-local/object-SmlPtbBuilder.json +5 -5
  44. package/deployments/sui-sandbox-local/object-Treasury.json +5 -5
  45. package/deployments/sui-sandbox-local/object-TreasuryAdminCap.json +5 -5
  46. package/deployments/sui-sandbox-local/object-ULN302.json +5 -5
  47. package/deployments/sui-sandbox-local/object-ULN302AdminCap.json +5 -5
  48. package/deployments/sui-sandbox-local/object-Uln302PtbBuilder.json +5 -5
  49. package/deployments/sui-sandbox-local/object-Uln302Verification.json +5 -5
  50. package/deployments/sui-sandbox-local/object-WorkerRegistry.json +9 -0
  51. package/deployments/sui-sandbox-local/object-ZroCoinMetadata.json +4 -4
  52. package/deployments/sui-sandbox-local/object-ZroTreasuryCap.json +4 -4
  53. package/deployments/sui-sandbox-local/package_whitelist_validator.json +51 -51
  54. package/deployments/sui-sandbox-local/price_feed.json +42 -42
  55. package/deployments/sui-sandbox-local/price_feed_call_types.json +13 -13
  56. package/deployments/sui-sandbox-local/ptb_move_call.json +14 -14
  57. package/deployments/sui-sandbox-local/simple_message_lib.json +34 -34
  58. package/deployments/sui-sandbox-local/simple_msglib_ptb_builder.json +27 -27
  59. package/deployments/sui-sandbox-local/treasury.json +38 -38
  60. package/deployments/sui-sandbox-local/uln_302.json +29 -29
  61. package/deployments/sui-sandbox-local/uln_302_ptb_builder.json +26 -26
  62. package/deployments/sui-sandbox-local/utils.json +14 -14
  63. package/deployments/sui-sandbox-local/worker_common.json +16 -15
  64. package/deployments/sui-sandbox-local/worker_registry.json +58 -0
  65. package/deployments/sui-sandbox-local/zro.json +23 -23
  66. package/dist/index.cjs +840 -300
  67. package/dist/index.cjs.map +1 -1
  68. package/dist/index.d.mts +541 -316
  69. package/dist/index.d.ts +541 -316
  70. package/dist/index.mjs +834 -301
  71. package/dist/index.mjs.map +1 -1
  72. package/package.json +7 -7
  73. package/src/bcs/index.ts +2 -1
  74. package/src/bcs/oapp.ts +14 -0
  75. package/src/generated/addresses.ts +72 -54
  76. package/src/module-manager.ts +15 -3
  77. package/src/modules/endpoint.ts +2 -3
  78. package/src/modules/oapps/counter.ts +30 -47
  79. package/src/modules/oapps/oapp.ts +468 -62
  80. package/src/modules/ptb-builders/ptb-builder.ts +10 -4
  81. package/src/modules/workers/dvn-layerzero.ts +1 -0
  82. package/src/modules/workers/dvn.ts +59 -0
  83. package/src/modules/workers/executor-layerzero.ts +1 -0
  84. package/src/modules/workers/executor.ts +59 -0
  85. package/src/modules/workers/index.ts +1 -0
  86. package/src/modules/workers/worker-registry.ts +109 -0
  87. package/src/resource.ts +3 -0
  88. package/src/sdk.ts +7 -2
  89. package/src/types/endpoint.ts +2 -1
  90. package/src/types/modules.ts +1 -0
  91. package/src/types/oapp.ts +6 -0
  92. package/src/types/options.ts +15 -0
  93. package/src/utils/transaction.ts +3 -3
@@ -7,11 +7,11 @@ import { EndpointId } from '@layerzerolabs/lz-definitions'
7
7
  import { ModuleManager } from '../../module-manager'
8
8
  import { MessagingFee, ObjectOptions } from '../../types'
9
9
  import {
10
+ IPTBValidator,
10
11
  asAddress,
11
12
  asBool,
12
13
  asBytes,
13
14
  asBytes32,
14
- asObject,
15
15
  asU32,
16
16
  asU64,
17
17
  asU8,
@@ -83,7 +83,8 @@ export class Counter {
83
83
  dstEid: EndpointId | TransactionArgument,
84
84
  msgType: number | TransactionArgument,
85
85
  options: Uint8Array | TransactionArgument,
86
- payInZero: boolean | TransactionArgument
86
+ payInZero: boolean | TransactionArgument,
87
+ validators?: IPTBValidator[]
87
88
  ): Promise<MessagingFee> {
88
89
  const tx = new Transaction()
89
90
  const quoteCall = tx.moveCall({
@@ -97,7 +98,7 @@ export class Counter {
97
98
  asBool(tx, payInZero),
98
99
  ],
99
100
  })
100
- return this.moduleManager.getEndpoint().quote(tx, quoteCall)
101
+ return this.moduleManager.getEndpoint().quote(tx, quoteCall, undefined, validators)
101
102
  }
102
103
 
103
104
  /**
@@ -121,7 +122,8 @@ export class Counter {
121
122
  sendValue: bigint | TransactionArgument,
122
123
  nativeFee: bigint | TransactionArgument,
123
124
  zroFee: bigint | TransactionArgument,
124
- refundAddress: string | TransactionArgument
125
+ refundAddress: string | TransactionArgument,
126
+ validators?: IPTBValidator[]
125
127
  ): Promise<void> {
126
128
  const [nativeToken] = tx.splitCoins(tx.gas, [asU64(tx, nativeFee)])
127
129
  const zroToken = isTransactionArgument(zroFee)
@@ -141,74 +143,55 @@ export class Counter {
141
143
  asAddress(tx, refundAddress),
142
144
  ],
143
145
  })
144
- await this.moduleManager.getEndpoint().populateSendTransaction(tx, incrementCall, sender)
146
+ await this.moduleManager.getEndpoint().populateSendTransaction(tx, incrementCall, sender, validators)
145
147
  }
146
148
 
147
149
  /**
148
- * Set peer counter on another chain
150
+ * Set LayerZero compose information for counter
149
151
  * @param tx - The transaction to add the move call to
150
- * @param messagingChannel - The messaging channel object ID or transaction argument
151
- * @param eid - The peer endpoint ID or transaction argument
152
- * @param peer - The peer counter address as bytes or transaction argument
152
+ * @param lzComposeInfo - LayerZero compose information as bytes
153
153
  */
154
- setPeerMoveCall(
155
- tx: Transaction,
156
- messagingChannel: string | TransactionArgument,
157
- eid: number | TransactionArgument,
158
- peer: Uint8Array | TransactionArgument
159
- ): void {
154
+ setLzComposeInfoMoveCall(tx: Transaction, lzComposeInfo: Uint8Array | TransactionArgument): void {
160
155
  tx.moveCall({
161
- target: this.#target('set_peer'),
156
+ target: this.#target('set_lz_compose_info'),
162
157
  arguments: [
163
158
  tx.object(this.objects.counter),
164
159
  tx.object(this.objects.counterOapp),
165
160
  tx.object(this.objects.counterAdminCap),
166
161
  tx.object(this.objects.endpointV2),
167
- asObject(tx, messagingChannel),
168
- asU32(tx, eid),
169
- asBytes32(tx, peer, this.moduleManager.getUtils()),
162
+ asBytes(tx, lzComposeInfo),
170
163
  ],
171
164
  })
172
165
  }
173
166
 
167
+ // === View Functions ===
168
+
174
169
  /**
175
- * Set delegate for the counter
170
+ * Get counter EID
176
171
  * @param tx - The transaction to add the move call to
177
- * @param newDelegate - The new delegate address or transaction argument
172
+ * @returns Transaction result containing the counter EID
178
173
  */
179
- setDelegateMoveCall(tx: Transaction, newDelegate: string | TransactionArgument): void {
180
- tx.moveCall({
181
- target: this.#target('set_delegate'),
182
- arguments: [
183
- tx.object(this.objects.counter),
184
- tx.object(this.objects.counterOapp),
185
- tx.object(this.objects.counterAdminCap),
186
- tx.object(this.objects.endpointV2),
187
- asAddress(tx, newDelegate),
188
- ],
174
+ getEidMoveCall(tx: Transaction): TransactionResult {
175
+ return tx.moveCall({
176
+ target: this.#target('eid'),
177
+ arguments: [tx.object(this.objects.counter)],
189
178
  })
190
179
  }
191
180
 
192
181
  /**
193
- * Set LayerZero compose information for counter
194
- * @param tx - The transaction to add the move call to
195
- * @param lzComposeInfo - LayerZero compose information as bytes
182
+ * Get counter EID
183
+ * @returns Promise<number> - The counter EID
196
184
  */
197
- setLzComposeInfoMoveCall(tx: Transaction, lzComposeInfo: Uint8Array | TransactionArgument): void {
198
- tx.moveCall({
199
- target: this.#target('set_lz_compose_info'),
200
- arguments: [
201
- tx.object(this.objects.counter),
202
- tx.object(this.objects.counterOapp),
203
- tx.object(this.objects.counterAdminCap),
204
- tx.object(this.objects.endpointV2),
205
- asBytes(tx, lzComposeInfo),
206
- ],
207
- })
185
+ async getEid(): Promise<number> {
186
+ return executeSimulate(
187
+ this.client,
188
+ (tx) => {
189
+ this.getEidMoveCall(tx)
190
+ },
191
+ (result) => bcs.U32.parse(result[0].value)
192
+ )
208
193
  }
209
194
 
210
- // === View Functions ===
211
-
212
195
  /**
213
196
  * Get call capability address for counter
214
197
  * @param tx - The transaction to add the move call to