@layerzerolabs/lz-sui-sdk-v2 3.0.133 → 3.0.134-sui.1
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.
- package/CHANGELOG.md +8 -0
- package/deployments/sui-sandbox-local/blocked_message_lib.json +26 -26
- package/deployments/sui-sandbox-local/blocked_msglib_ptb_builder.json +29 -29
- package/deployments/sui-sandbox-local/counter.json +79 -44
- package/deployments/sui-sandbox-local/dvn.json +15 -14
- package/deployments/sui-sandbox-local/dvn_call_type.json +28 -28
- package/deployments/sui-sandbox-local/dvn_fee_lib.json +27 -27
- package/deployments/sui-sandbox-local/dvn_layerzero.json +24 -24
- package/deployments/sui-sandbox-local/dvn_ptb_builder.json +14 -14
- package/deployments/sui-sandbox-local/endpoint_ptb_builder.json +25 -25
- package/deployments/sui-sandbox-local/endpoint_v2.json +29 -29
- package/deployments/sui-sandbox-local/executor.json +12 -11
- package/deployments/sui-sandbox-local/executor_call_type.json +21 -21
- package/deployments/sui-sandbox-local/executor_fee_lib.json +19 -19
- package/deployments/sui-sandbox-local/executor_layerzero.json +22 -22
- package/deployments/sui-sandbox-local/executor_ptb_builder.json +11 -11
- package/deployments/sui-sandbox-local/layerzero_views.json +21 -21
- package/deployments/sui-sandbox-local/message_lib_common.json +13 -13
- package/deployments/sui-sandbox-local/msglib_ptb_builder_call_types.json +20 -20
- package/deployments/sui-sandbox-local/oapp.json +23 -21
- package/deployments/sui-sandbox-local/object-BlockedMessageLib.json +5 -5
- package/deployments/sui-sandbox-local/object-BlockedMsglibPtbBuilder.json +5 -5
- package/deployments/sui-sandbox-local/object-Counter.json +5 -5
- package/deployments/sui-sandbox-local/object-CounterAdminCap.json +5 -5
- package/deployments/sui-sandbox-local/object-CounterOApp.json +5 -5
- package/deployments/sui-sandbox-local/object-DVN.json +2 -2
- package/deployments/sui-sandbox-local/object-DVNCap.json +4 -4
- package/deployments/sui-sandbox-local/object-DVNFeeLib.json +5 -5
- package/deployments/sui-sandbox-local/object-EndpointPtbBuilder.json +5 -5
- package/deployments/sui-sandbox-local/object-EndpointPtbBuilderAdminCap.json +5 -5
- package/deployments/sui-sandbox-local/object-EndpointV2.json +5 -5
- package/deployments/sui-sandbox-local/object-EndpointV2AdminCap.json +5 -5
- package/deployments/sui-sandbox-local/object-Executor.json +2 -2
- package/deployments/sui-sandbox-local/object-ExecutorCap.json +3 -3
- package/deployments/sui-sandbox-local/object-ExecutorFeeLib.json +4 -4
- package/deployments/sui-sandbox-local/object-ExecutorOwnerCap.json +2 -2
- package/deployments/sui-sandbox-local/object-PackageWhitelistValidator.json +5 -5
- package/deployments/sui-sandbox-local/object-PriceFeed.json +4 -4
- package/deployments/sui-sandbox-local/object-PriceFeedOwnerCap.json +4 -4
- package/deployments/sui-sandbox-local/object-SimpleMessageLib.json +5 -5
- package/deployments/sui-sandbox-local/object-SimpleMessageLibAdminCap.json +5 -5
- package/deployments/sui-sandbox-local/object-SmlPtbBuilder.json +5 -5
- package/deployments/sui-sandbox-local/object-Treasury.json +5 -5
- package/deployments/sui-sandbox-local/object-TreasuryAdminCap.json +5 -5
- package/deployments/sui-sandbox-local/object-ULN302.json +5 -5
- package/deployments/sui-sandbox-local/object-ULN302AdminCap.json +5 -5
- package/deployments/sui-sandbox-local/object-Uln302PtbBuilder.json +5 -5
- package/deployments/sui-sandbox-local/object-Uln302Verification.json +5 -5
- package/deployments/sui-sandbox-local/object-WorkerRegistry.json +9 -0
- package/deployments/sui-sandbox-local/package_whitelist_validator.json +50 -50
- package/deployments/sui-sandbox-local/price_feed.json +26 -26
- package/deployments/sui-sandbox-local/price_feed_call_types.json +19 -19
- package/deployments/sui-sandbox-local/ptb_move_call.json +12 -12
- package/deployments/sui-sandbox-local/sequential_multi_call.json +45 -0
- package/deployments/sui-sandbox-local/simple_message_lib.json +30 -30
- package/deployments/sui-sandbox-local/simple_msglib_ptb_builder.json +26 -26
- package/deployments/sui-sandbox-local/treasury.json +39 -39
- package/deployments/sui-sandbox-local/uln_302.json +42 -42
- package/deployments/sui-sandbox-local/uln_302_ptb_builder.json +25 -25
- package/deployments/sui-sandbox-local/worker_common.json +21 -20
- package/deployments/sui-sandbox-local/worker_registry.json +58 -0
- package/dist/index.cjs +972 -341
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +636 -343
- package/dist/index.d.ts +636 -343
- package/dist/index.mjs +961 -341
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/src/bcs/index.ts +2 -1
- package/src/bcs/oapp.ts +14 -0
- package/src/generated/addresses.ts +69 -51
- package/src/module-manager.ts +15 -3
- package/src/modules/call.ts +16 -6
- package/src/modules/endpoint.ts +12 -4
- package/src/modules/message-libs/simple-message-lib.ts +3 -2
- package/src/modules/message-libs/uln302.ts +23 -5
- package/src/modules/oapps/counter.ts +34 -50
- package/src/modules/oapps/oapp.ts +489 -74
- package/src/modules/ptb-builders/endpoint-ptb-builder.ts +9 -3
- package/src/modules/ptb-builders/ptb-builder.ts +19 -4
- package/src/modules/ptb-builders/uln302-ptb-builder.ts +5 -0
- package/src/modules/workers/dvn-layerzero.ts +6 -0
- package/src/modules/workers/dvn.ts +74 -0
- package/src/modules/workers/executor-fee-lib.ts +11 -3
- package/src/modules/workers/executor-layerzero.ts +6 -0
- package/src/modules/workers/executor.ts +63 -0
- package/src/modules/workers/index.ts +1 -0
- package/src/modules/workers/treasury.ts +4 -4
- package/src/modules/workers/worker-registry.ts +110 -0
- package/src/resource.ts +3 -0
- package/src/sdk.ts +7 -2
- package/src/types/endpoint.ts +2 -1
- package/src/types/modules.ts +1 -0
- package/src/types/oapp.ts +6 -0
- package/src/types/options.ts +15 -0
- 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,
|
|
@@ -22,15 +22,16 @@ import {
|
|
|
22
22
|
const MODULE_NAME = 'counter'
|
|
23
23
|
|
|
24
24
|
export const CounterErrorCode = {
|
|
25
|
-
// Counter related errors
|
|
25
|
+
// Counter related errors (matching counter.move)
|
|
26
26
|
Counter_EInvalidMsgType: 0,
|
|
27
27
|
Counter_EInvalidValue: 1,
|
|
28
28
|
Counter_EInvalidNonce: 2,
|
|
29
29
|
Counter_EOnlyEndpoint: 3,
|
|
30
30
|
Counter_ESelfComposeOnly: 4,
|
|
31
31
|
Counter_EInvalidOApp: 5,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
|
|
33
|
+
// OptionsBuilder related errors (matching options_builder.move)
|
|
34
|
+
OptionsBuilder_EInvalidSize: 1,
|
|
34
35
|
} as const
|
|
35
36
|
|
|
36
37
|
export class Counter {
|
|
@@ -83,7 +84,8 @@ export class Counter {
|
|
|
83
84
|
dstEid: EndpointId | TransactionArgument,
|
|
84
85
|
msgType: number | TransactionArgument,
|
|
85
86
|
options: Uint8Array | TransactionArgument,
|
|
86
|
-
payInZero: boolean | TransactionArgument
|
|
87
|
+
payInZero: boolean | TransactionArgument,
|
|
88
|
+
validators?: IPTBValidator[]
|
|
87
89
|
): Promise<MessagingFee> {
|
|
88
90
|
const tx = new Transaction()
|
|
89
91
|
const quoteCall = tx.moveCall({
|
|
@@ -97,7 +99,7 @@ export class Counter {
|
|
|
97
99
|
asBool(tx, payInZero),
|
|
98
100
|
],
|
|
99
101
|
})
|
|
100
|
-
return this.moduleManager.getEndpoint().quote(tx, quoteCall)
|
|
102
|
+
return this.moduleManager.getEndpoint().quote(tx, quoteCall, undefined, validators)
|
|
101
103
|
}
|
|
102
104
|
|
|
103
105
|
/**
|
|
@@ -121,7 +123,8 @@ export class Counter {
|
|
|
121
123
|
sendValue: bigint | TransactionArgument,
|
|
122
124
|
nativeFee: bigint | TransactionArgument,
|
|
123
125
|
zroFee: bigint | TransactionArgument,
|
|
124
|
-
refundAddress: string | TransactionArgument
|
|
126
|
+
refundAddress: string | TransactionArgument,
|
|
127
|
+
validators?: IPTBValidator[]
|
|
125
128
|
): Promise<void> {
|
|
126
129
|
const [nativeToken] = tx.splitCoins(tx.gas, [asU64(tx, nativeFee)])
|
|
127
130
|
const zroToken = isTransactionArgument(zroFee)
|
|
@@ -141,74 +144,55 @@ export class Counter {
|
|
|
141
144
|
asAddress(tx, refundAddress),
|
|
142
145
|
],
|
|
143
146
|
})
|
|
144
|
-
await this.moduleManager.getEndpoint().populateSendTransaction(tx, incrementCall, sender)
|
|
147
|
+
await this.moduleManager.getEndpoint().populateSendTransaction(tx, incrementCall, sender, validators)
|
|
145
148
|
}
|
|
146
149
|
|
|
147
150
|
/**
|
|
148
|
-
* Set
|
|
151
|
+
* Set LayerZero compose information for counter
|
|
149
152
|
* @param tx - The transaction to add the move call to
|
|
150
|
-
* @param
|
|
151
|
-
* @param eid - The peer endpoint ID or transaction argument
|
|
152
|
-
* @param peer - The peer counter address as bytes or transaction argument
|
|
153
|
+
* @param lzComposeInfo - LayerZero compose information as bytes
|
|
153
154
|
*/
|
|
154
|
-
|
|
155
|
-
tx: Transaction,
|
|
156
|
-
messagingChannel: string | TransactionArgument,
|
|
157
|
-
eid: number | TransactionArgument,
|
|
158
|
-
peer: Uint8Array | TransactionArgument
|
|
159
|
-
): void {
|
|
155
|
+
setLzComposeInfoMoveCall(tx: Transaction, lzComposeInfo: Uint8Array | TransactionArgument): void {
|
|
160
156
|
tx.moveCall({
|
|
161
|
-
target: this.#target('
|
|
157
|
+
target: this.#target('set_lz_compose_info'),
|
|
162
158
|
arguments: [
|
|
163
159
|
tx.object(this.objects.counter),
|
|
164
160
|
tx.object(this.objects.counterOapp),
|
|
165
161
|
tx.object(this.objects.counterAdminCap),
|
|
166
162
|
tx.object(this.objects.endpointV2),
|
|
167
|
-
|
|
168
|
-
asU32(tx, eid),
|
|
169
|
-
asBytes32(tx, peer, this.moduleManager.getUtils()),
|
|
163
|
+
asBytes(tx, lzComposeInfo),
|
|
170
164
|
],
|
|
171
165
|
})
|
|
172
166
|
}
|
|
173
167
|
|
|
168
|
+
// === View Functions ===
|
|
169
|
+
|
|
174
170
|
/**
|
|
175
|
-
*
|
|
171
|
+
* Get counter EID
|
|
176
172
|
* @param tx - The transaction to add the move call to
|
|
177
|
-
* @
|
|
173
|
+
* @returns Transaction result containing the counter EID
|
|
178
174
|
*/
|
|
179
|
-
|
|
180
|
-
tx.moveCall({
|
|
181
|
-
target: this.#target('
|
|
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
|
-
],
|
|
175
|
+
getEidMoveCall(tx: Transaction): TransactionResult {
|
|
176
|
+
return tx.moveCall({
|
|
177
|
+
target: this.#target('eid'),
|
|
178
|
+
arguments: [tx.object(this.objects.counter)],
|
|
189
179
|
})
|
|
190
180
|
}
|
|
191
181
|
|
|
192
182
|
/**
|
|
193
|
-
*
|
|
194
|
-
* @
|
|
195
|
-
* @param lzComposeInfo - LayerZero compose information as bytes
|
|
183
|
+
* Get counter EID
|
|
184
|
+
* @returns Promise<number> - The counter EID
|
|
196
185
|
*/
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
asBytes(tx, lzComposeInfo),
|
|
206
|
-
],
|
|
207
|
-
})
|
|
186
|
+
async getEid(): Promise<number> {
|
|
187
|
+
return executeSimulate(
|
|
188
|
+
this.client,
|
|
189
|
+
(tx) => {
|
|
190
|
+
this.getEidMoveCall(tx)
|
|
191
|
+
},
|
|
192
|
+
(result) => bcs.U32.parse(result[0].value)
|
|
193
|
+
)
|
|
208
194
|
}
|
|
209
195
|
|
|
210
|
-
// === View Functions ===
|
|
211
|
-
|
|
212
196
|
/**
|
|
213
197
|
* Get call capability address for counter
|
|
214
198
|
* @param tx - The transaction to add the move call to
|