@layerzerolabs/lz-sui-sdk-v2 3.0.128 → 3.0.129-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.
- package/CHANGELOG.md +10 -0
- package/deployments/sui-mainnet/blocked_message_lib.json +58 -0
- package/deployments/sui-mainnet/blocked_msglib_ptb_builder.json +58 -0
- package/deployments/sui-mainnet/call.json +47 -0
- package/deployments/sui-mainnet/counter.json +85 -0
- package/deployments/sui-mainnet/dvn.json +48 -0
- package/deployments/sui-mainnet/dvn_call_type.json +45 -0
- package/deployments/sui-mainnet/dvn_fee_lib.json +59 -0
- package/deployments/sui-mainnet/dvn_layerzero.json +56 -0
- package/deployments/sui-mainnet/dvn_ptb_builder.json +45 -0
- package/deployments/sui-mainnet/endpoint_ptb_builder.json +70 -0
- package/deployments/sui-mainnet/endpoint_v2.json +86 -0
- package/deployments/sui-mainnet/executor.json +48 -0
- package/deployments/sui-mainnet/executor_call_type.json +45 -0
- package/deployments/sui-mainnet/executor_fee_lib.json +60 -0
- package/deployments/sui-mainnet/executor_layerzero.json +56 -0
- package/deployments/sui-mainnet/executor_ptb_builder.json +45 -0
- package/deployments/sui-mainnet/layerzero_views.json +46 -0
- package/deployments/sui-mainnet/message_lib_common.json +47 -0
- package/deployments/sui-mainnet/msglib_ptb_builder_call_types.json +45 -0
- package/deployments/sui-mainnet/oapp.json +48 -0
- package/deployments/sui-mainnet/object-BlockedMessageLib.json +9 -0
- package/deployments/sui-mainnet/object-BlockedMsglibPtbBuilder.json +9 -0
- package/deployments/sui-mainnet/object-Counter.json +9 -0
- package/deployments/sui-mainnet/object-CounterAdminCap.json +9 -0
- package/deployments/sui-mainnet/object-CounterOApp.json +9 -0
- package/deployments/sui-mainnet/object-DVN.json +5 -0
- package/deployments/sui-mainnet/object-DVNCap.json +9 -0
- package/deployments/sui-mainnet/object-DVNFeeLib.json +9 -0
- package/deployments/sui-mainnet/object-EndpointPtbBuilder.json +9 -0
- package/deployments/sui-mainnet/object-EndpointPtbBuilderAdminCap.json +9 -0
- package/deployments/sui-mainnet/object-EndpointV2.json +9 -0
- package/deployments/sui-mainnet/object-EndpointV2AdminCap.json +9 -0
- package/deployments/sui-mainnet/object-Executor.json +5 -0
- package/deployments/sui-mainnet/object-ExecutorCap.json +9 -0
- package/deployments/sui-mainnet/object-ExecutorFeeLib.json +9 -0
- package/deployments/sui-mainnet/object-ExecutorOwnerCap.json +5 -0
- package/deployments/sui-mainnet/object-PackageWhitelistValidator.json +9 -0
- package/deployments/sui-mainnet/object-PriceFeed.json +9 -0
- package/deployments/sui-mainnet/object-PriceFeedOwnerCap.json +9 -0
- package/deployments/sui-mainnet/object-SimpleMessageLib.json +9 -0
- package/deployments/sui-mainnet/object-SimpleMessageLibAdminCap.json +9 -0
- package/deployments/sui-mainnet/object-SmlPtbBuilder.json +9 -0
- package/deployments/sui-mainnet/object-Treasury.json +9 -0
- package/deployments/sui-mainnet/object-TreasuryAdminCap.json +9 -0
- package/deployments/sui-mainnet/object-ULN302.json +9 -0
- package/deployments/sui-mainnet/object-ULN302AdminCap.json +9 -0
- package/deployments/sui-mainnet/object-Uln302PtbBuilder.json +9 -0
- package/deployments/sui-mainnet/object-Uln302Verification.json +9 -0
- package/deployments/sui-mainnet/object-ZroCoinMetadata.json +9 -0
- package/deployments/sui-mainnet/object-ZroTreasuryCap.json +9 -0
- package/deployments/sui-mainnet/package_whitelist_validator.json +113 -0
- package/deployments/sui-mainnet/price_feed.json +70 -0
- package/deployments/sui-mainnet/price_feed_call_types.json +45 -0
- package/deployments/sui-mainnet/ptb_move_call.json +48 -0
- package/deployments/sui-mainnet/simple_message_lib.json +69 -0
- package/deployments/sui-mainnet/simple_msglib_ptb_builder.json +58 -0
- package/deployments/sui-mainnet/treasury.json +69 -0
- package/deployments/sui-mainnet/uln_302.json +91 -0
- package/deployments/sui-mainnet/uln_302_ptb_builder.json +58 -0
- package/deployments/sui-mainnet/utils.json +57 -0
- package/deployments/sui-mainnet/worker_common.json +45 -0
- package/deployments/sui-mainnet/zro.json +67 -0
- package/deployments/sui-sandbox-local/blocked_message_lib.json +58 -0
- package/deployments/sui-sandbox-local/blocked_msglib_ptb_builder.json +58 -0
- package/deployments/sui-sandbox-local/call.json +47 -0
- package/deployments/sui-sandbox-local/counter.json +113 -0
- package/deployments/sui-sandbox-local/dvn.json +48 -0
- package/deployments/sui-sandbox-local/dvn_call_type.json +73 -0
- package/deployments/sui-sandbox-local/dvn_fee_lib.json +59 -0
- package/deployments/sui-sandbox-local/dvn_layerzero.json +56 -0
- package/deployments/sui-sandbox-local/dvn_ptb_builder.json +45 -0
- package/deployments/sui-sandbox-local/endpoint_ptb_builder.json +70 -0
- package/deployments/sui-sandbox-local/endpoint_v2.json +86 -0
- package/deployments/sui-sandbox-local/executor.json +48 -0
- package/deployments/sui-sandbox-local/executor_call_type.json +73 -0
- package/deployments/sui-sandbox-local/executor_fee_lib.json +60 -0
- package/deployments/sui-sandbox-local/executor_layerzero.json +56 -0
- package/deployments/sui-sandbox-local/executor_ptb_builder.json +45 -0
- package/deployments/sui-sandbox-local/layerzero_views.json +46 -0
- package/deployments/sui-sandbox-local/message_lib_common.json +47 -0
- package/deployments/sui-sandbox-local/msglib_ptb_builder_call_types.json +45 -0
- package/deployments/sui-sandbox-local/oapp.json +48 -0
- package/deployments/sui-sandbox-local/object-BlockedMessageLib.json +9 -0
- package/deployments/sui-sandbox-local/object-BlockedMsglibPtbBuilder.json +9 -0
- package/deployments/sui-sandbox-local/object-Counter.json +9 -0
- package/deployments/sui-sandbox-local/object-CounterAdminCap.json +9 -0
- package/deployments/sui-sandbox-local/object-CounterOApp.json +9 -0
- package/deployments/sui-sandbox-local/object-DVN.json +5 -0
- package/deployments/sui-sandbox-local/object-DVNCap.json +9 -0
- package/deployments/sui-sandbox-local/object-DVNFeeLib.json +9 -0
- package/deployments/sui-sandbox-local/object-EndpointPtbBuilder.json +9 -0
- package/deployments/sui-sandbox-local/object-EndpointPtbBuilderAdminCap.json +9 -0
- package/deployments/sui-sandbox-local/object-EndpointV2.json +9 -0
- package/deployments/sui-sandbox-local/object-EndpointV2AdminCap.json +9 -0
- package/deployments/sui-sandbox-local/object-Executor.json +5 -0
- package/deployments/sui-sandbox-local/object-ExecutorCap.json +9 -0
- package/deployments/sui-sandbox-local/object-ExecutorFeeLib.json +9 -0
- package/deployments/sui-sandbox-local/object-ExecutorOwnerCap.json +5 -0
- package/deployments/sui-sandbox-local/object-PackageWhitelistValidator.json +9 -0
- package/deployments/sui-sandbox-local/object-PriceFeed.json +9 -0
- package/deployments/sui-sandbox-local/object-PriceFeedOwnerCap.json +9 -0
- package/deployments/sui-sandbox-local/object-SimpleMessageLib.json +9 -0
- package/deployments/sui-sandbox-local/object-SimpleMessageLibAdminCap.json +9 -0
- package/deployments/sui-sandbox-local/object-SmlPtbBuilder.json +9 -0
- package/deployments/sui-sandbox-local/object-Treasury.json +9 -0
- package/deployments/sui-sandbox-local/object-TreasuryAdminCap.json +9 -0
- package/deployments/sui-sandbox-local/object-ULN302.json +9 -0
- package/deployments/sui-sandbox-local/object-ULN302AdminCap.json +9 -0
- package/deployments/sui-sandbox-local/object-Uln302PtbBuilder.json +9 -0
- package/deployments/sui-sandbox-local/object-Uln302Verification.json +9 -0
- package/deployments/sui-sandbox-local/object-ZroCoinMetadata.json +9 -0
- package/deployments/sui-sandbox-local/object-ZroTreasuryCap.json +9 -0
- package/deployments/sui-sandbox-local/package_whitelist_validator.json +113 -0
- package/deployments/sui-sandbox-local/price_feed.json +98 -0
- package/deployments/sui-sandbox-local/price_feed_call_types.json +45 -0
- package/deployments/sui-sandbox-local/ptb_move_call.json +48 -0
- package/deployments/sui-sandbox-local/simple_message_lib.json +69 -0
- package/deployments/sui-sandbox-local/simple_msglib_ptb_builder.json +58 -0
- package/deployments/sui-sandbox-local/treasury.json +97 -0
- package/deployments/sui-sandbox-local/uln_302.json +91 -0
- package/deployments/sui-sandbox-local/uln_302_ptb_builder.json +58 -0
- package/deployments/sui-sandbox-local/utils.json +78 -0
- package/deployments/sui-sandbox-local/worker_common.json +45 -0
- package/deployments/sui-sandbox-local/zro.json +67 -0
- package/deployments/sui-testnet/counter.json +46 -39
- package/deployments/sui-testnet/dvn.json +22 -14
- package/deployments/sui-testnet/dvn_fee_lib.json +21 -20
- package/deployments/sui-testnet/dvn_layerzero.json +24 -24
- package/deployments/sui-testnet/dvn_ptb_builder.json +21 -21
- package/deployments/sui-testnet/executor.json +22 -14
- package/deployments/sui-testnet/executor_fee_lib.json +28 -27
- package/deployments/sui-testnet/executor_layerzero.json +19 -19
- package/deployments/sui-testnet/executor_ptb_builder.json +21 -21
- package/deployments/sui-testnet/oapp.json +21 -14
- package/deployments/sui-testnet/object-Counter.json +5 -5
- package/deployments/sui-testnet/object-CounterAdminCap.json +5 -5
- package/deployments/sui-testnet/object-CounterOApp.json +5 -5
- package/deployments/sui-testnet/object-DVN.json +2 -2
- package/deployments/sui-testnet/object-DVNCap.json +4 -4
- package/deployments/sui-testnet/object-DVNFeeLib.json +5 -5
- package/deployments/sui-testnet/object-Executor.json +2 -2
- package/deployments/sui-testnet/object-ExecutorCap.json +4 -4
- package/deployments/sui-testnet/object-ExecutorFeeLib.json +5 -5
- package/deployments/sui-testnet/object-ExecutorOwnerCap.json +2 -2
- package/deployments/sui-testnet/object-OFTAdapterExample-TokenTwo.json +9 -0
- package/deployments/sui-testnet/object-OFTAdapterExampleAdminCap-TokenTwo.json +9 -0
- package/deployments/sui-testnet/object-OFTAdapterExampleCoinMetadata-TokenTwo.json +9 -0
- package/deployments/sui-testnet/object-OFTAdapterExampleTreasuryCap-TokenTwo.json +9 -0
- package/deployments/sui-testnet/object-OFTComposerRegistry.json +9 -0
- package/deployments/sui-testnet/object-OFTPtbBuilder.json +9 -0
- package/deployments/sui-testnet/object-PackageWhitelistValidator.json +9 -0
- package/deployments/sui-testnet/object-PriceFeed.json +5 -5
- package/deployments/sui-testnet/object-PriceFeedOwnerCap.json +5 -5
- package/deployments/sui-testnet/oft.json +69 -0
- package/deployments/sui-testnet/oft_adapter_example-TokenTwo.json +93 -0
- package/deployments/sui-testnet/oft_composer_common.json +59 -0
- package/deployments/sui-testnet/oft_ptb_builder.json +58 -0
- package/deployments/sui-testnet/package_whitelist_validator.json +113 -0
- package/deployments/sui-testnet/price_feed.json +40 -32
- package/deployments/sui-testnet/worker_common.json +14 -14
- package/dist/index.cjs +1596 -514
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +612 -106
- package/dist/index.d.ts +612 -106
- package/dist/index.mjs +1589 -515
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -8
- package/src/generated/addresses.ts +133 -121
- package/src/module-manager.ts +149 -17
- package/src/modules/endpoint.ts +69 -25
- package/src/modules/ptb-builders/index.ts +1 -0
- package/src/modules/ptb-builders/package-whitelist-validator.ts +142 -0
- package/src/modules/ptb-builders/ptb-builder.ts +7 -60
- package/src/modules/utils.ts +57 -4
- package/src/modules/workers/dvn-fee-lib.ts +14 -0
- package/src/modules/workers/dvn.ts +506 -29
- package/src/modules/workers/executor-fee-lib.ts +14 -0
- package/src/modules/workers/executor.ts +226 -21
- package/src/modules/workers/price-feed.ts +74 -12
- package/src/resource.ts +2 -0
- package/src/sdk.ts +29 -87
- package/src/types/modules.ts +1 -0
- package/src/types/options.ts +10 -1
- package/src/types/ptb-builder.ts +0 -8
- package/src/utils/index.ts +5 -0
- package/src/utils/move-call-object-fetcher.ts +105 -0
- package/src/utils/non-sender-object-validator.ts +102 -0
- package/src/utils/package-allowlist-validator.ts +134 -0
- package/src/utils/ptb-validator.ts +14 -0
- package/src/utils/share-object-validator.ts +37 -0
- package/src/utils/validate-with-details.ts +50 -0
|
@@ -29,6 +29,20 @@ export class ExecutorFeeLib {
|
|
|
29
29
|
this.objects = objects
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
// === Witness Functions ===
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Create a LayerZero witness for Executor Fee Lib package whitelist registration
|
|
36
|
+
* @param tx - The transaction to add the move call to
|
|
37
|
+
* @returns Transaction result containing the LayerZero witness
|
|
38
|
+
*/
|
|
39
|
+
createLayerZeroWitnessMoveCall(tx: Transaction): TransactionResult {
|
|
40
|
+
return tx.moveCall({
|
|
41
|
+
target: `${this.packageId}::executor_fee_lib_witness::new`,
|
|
42
|
+
arguments: [],
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
32
46
|
// === Set Functions ===
|
|
33
47
|
|
|
34
48
|
/**
|
|
@@ -43,6 +43,20 @@ export class Executor {
|
|
|
43
43
|
this.objects = objects
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
// === Witness Functions ===
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Create a LayerZero witness for Executor package whitelist registration
|
|
50
|
+
* @param tx - The transaction to add the move call to
|
|
51
|
+
* @returns Transaction result containing the LayerZero witness
|
|
52
|
+
*/
|
|
53
|
+
createLayerZeroWitnessMoveCall(tx: Transaction): TransactionResult {
|
|
54
|
+
return tx.moveCall({
|
|
55
|
+
target: `${this.packageId}::executor_witness::new`,
|
|
56
|
+
arguments: [],
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
|
46
60
|
// Job Assignment and Fee Functions
|
|
47
61
|
|
|
48
62
|
/**
|
|
@@ -104,8 +118,9 @@ export class Executor {
|
|
|
104
118
|
// Execution Functions
|
|
105
119
|
|
|
106
120
|
/**
|
|
107
|
-
* Execute LayerZero receive operation
|
|
121
|
+
* Execute LayerZero receive operation (admin only)
|
|
108
122
|
* @param tx - The transaction to add the move call to
|
|
123
|
+
* @param adminCap - The admin capability object ID
|
|
109
124
|
* @param messagingChannel - The messaging channel object ID
|
|
110
125
|
* @param srcEid - Source endpoint ID
|
|
111
126
|
* @param sender - Sender address as bytes
|
|
@@ -118,6 +133,7 @@ export class Executor {
|
|
|
118
133
|
*/
|
|
119
134
|
executeLzReceiveMoveCall(
|
|
120
135
|
tx: Transaction,
|
|
136
|
+
adminCap: string | TransactionArgument,
|
|
121
137
|
messagingChannel: string | TransactionArgument,
|
|
122
138
|
srcEid: number | TransactionArgument,
|
|
123
139
|
sender: Uint8Array | TransactionArgument,
|
|
@@ -131,6 +147,7 @@ export class Executor {
|
|
|
131
147
|
target: this.#target('execute_lz_receive'),
|
|
132
148
|
arguments: [
|
|
133
149
|
tx.object(this.objects.executor),
|
|
150
|
+
asObject(tx, adminCap),
|
|
134
151
|
tx.object(this.objects.endpointV2),
|
|
135
152
|
asObject(tx, messagingChannel),
|
|
136
153
|
asU32(tx, srcEid),
|
|
@@ -145,8 +162,9 @@ export class Executor {
|
|
|
145
162
|
}
|
|
146
163
|
|
|
147
164
|
/**
|
|
148
|
-
* Execute LayerZero compose operation
|
|
165
|
+
* Execute LayerZero compose operation (admin only)
|
|
149
166
|
* @param tx - The transaction to add the move call to
|
|
167
|
+
* @param adminCap - The admin capability object ID
|
|
150
168
|
* @param composeQueue - The compose queue object ID
|
|
151
169
|
* @param from - Source address
|
|
152
170
|
* @param guid - Globally unique identifier as bytes
|
|
@@ -158,6 +176,7 @@ export class Executor {
|
|
|
158
176
|
*/
|
|
159
177
|
executeLzComposeMoveCall(
|
|
160
178
|
tx: Transaction,
|
|
179
|
+
adminCap: string | TransactionArgument,
|
|
161
180
|
composeQueue: string | TransactionArgument,
|
|
162
181
|
from: string | TransactionArgument,
|
|
163
182
|
guid: Uint8Array | TransactionArgument,
|
|
@@ -170,6 +189,7 @@ export class Executor {
|
|
|
170
189
|
target: this.#target('execute_lz_compose'),
|
|
171
190
|
arguments: [
|
|
172
191
|
tx.object(this.objects.executor),
|
|
192
|
+
asObject(tx, adminCap),
|
|
173
193
|
tx.object(this.objects.endpointV2),
|
|
174
194
|
asObject(tx, composeQueue),
|
|
175
195
|
asAddress(tx, from),
|
|
@@ -182,12 +202,108 @@ export class Executor {
|
|
|
182
202
|
})
|
|
183
203
|
}
|
|
184
204
|
|
|
205
|
+
// Alert Functions
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Record a failed lz_receive execution for off-chain processing (admin only)
|
|
209
|
+
* @param tx - The transaction to add the move call to
|
|
210
|
+
* @param adminCap - The admin capability object ID
|
|
211
|
+
* @param srcEid - Source endpoint ID
|
|
212
|
+
* @param sender - Sender address as bytes
|
|
213
|
+
* @param nonce - Message nonce
|
|
214
|
+
* @param receiver - Receiver address
|
|
215
|
+
* @param guid - Globally unique identifier as bytes
|
|
216
|
+
* @param gas - Gas limit used for the execution attempt
|
|
217
|
+
* @param value - Native token value included with the message
|
|
218
|
+
* @param message - Message payload as bytes
|
|
219
|
+
* @param extraData - Additional execution data
|
|
220
|
+
* @param reason - Error message or failure reason
|
|
221
|
+
*/
|
|
222
|
+
lzReceiveAlertMoveCall(
|
|
223
|
+
tx: Transaction,
|
|
224
|
+
adminCap: string | TransactionArgument,
|
|
225
|
+
srcEid: number | TransactionArgument,
|
|
226
|
+
sender: Uint8Array | TransactionArgument,
|
|
227
|
+
nonce: bigint | number | string | TransactionArgument,
|
|
228
|
+
receiver: string | TransactionArgument,
|
|
229
|
+
guid: Uint8Array | TransactionArgument,
|
|
230
|
+
gas: bigint | number | string | TransactionArgument,
|
|
231
|
+
value: bigint | number | string | TransactionArgument,
|
|
232
|
+
message: Uint8Array | TransactionArgument,
|
|
233
|
+
extraData: Uint8Array | TransactionArgument,
|
|
234
|
+
reason: string | TransactionArgument
|
|
235
|
+
): void {
|
|
236
|
+
tx.moveCall({
|
|
237
|
+
target: this.#target('lz_receive_alert'),
|
|
238
|
+
arguments: [
|
|
239
|
+
tx.object(this.objects.executor),
|
|
240
|
+
asObject(tx, adminCap),
|
|
241
|
+
asU32(tx, srcEid),
|
|
242
|
+
asBytes32(tx, sender, this.moduleManager.getUtils()),
|
|
243
|
+
asU64(tx, nonce),
|
|
244
|
+
asAddress(tx, receiver),
|
|
245
|
+
asBytes32(tx, guid, this.moduleManager.getUtils()),
|
|
246
|
+
asU64(tx, gas),
|
|
247
|
+
asU64(tx, value),
|
|
248
|
+
asBytes(tx, message),
|
|
249
|
+
asBytes(tx, extraData),
|
|
250
|
+
asArgWithTx(tx, reason, (tx, val) => tx.pure.string(val)),
|
|
251
|
+
],
|
|
252
|
+
})
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Record a failed lz_compose execution for off-chain processing (admin only)
|
|
257
|
+
* @param tx - The transaction to add the move call to
|
|
258
|
+
* @param adminCap - The admin capability object ID
|
|
259
|
+
* @param from - Source address
|
|
260
|
+
* @param to - Destination address
|
|
261
|
+
* @param guid - Globally unique identifier as bytes
|
|
262
|
+
* @param index - Compose message index
|
|
263
|
+
* @param gas - Gas limit used for the execution attempt
|
|
264
|
+
* @param value - Native token value included with the compose
|
|
265
|
+
* @param message - Compose message payload as bytes
|
|
266
|
+
* @param extraData - Additional execution data
|
|
267
|
+
* @param reason - Error message or failure reason
|
|
268
|
+
*/
|
|
269
|
+
lzComposeAlertMoveCall(
|
|
270
|
+
tx: Transaction,
|
|
271
|
+
adminCap: string | TransactionArgument,
|
|
272
|
+
from: string | TransactionArgument,
|
|
273
|
+
to: string | TransactionArgument,
|
|
274
|
+
guid: Uint8Array | TransactionArgument,
|
|
275
|
+
index: number | TransactionArgument,
|
|
276
|
+
gas: bigint | number | string | TransactionArgument,
|
|
277
|
+
value: bigint | number | string | TransactionArgument,
|
|
278
|
+
message: Uint8Array | TransactionArgument,
|
|
279
|
+
extraData: Uint8Array | TransactionArgument,
|
|
280
|
+
reason: string | TransactionArgument
|
|
281
|
+
): void {
|
|
282
|
+
tx.moveCall({
|
|
283
|
+
target: this.#target('lz_compose_alert'),
|
|
284
|
+
arguments: [
|
|
285
|
+
tx.object(this.objects.executor),
|
|
286
|
+
asObject(tx, adminCap),
|
|
287
|
+
asAddress(tx, from),
|
|
288
|
+
asAddress(tx, to),
|
|
289
|
+
asBytes32(tx, guid, this.moduleManager.getUtils()),
|
|
290
|
+
asU16(tx, index),
|
|
291
|
+
asU64(tx, gas),
|
|
292
|
+
asU64(tx, value),
|
|
293
|
+
asBytes(tx, message),
|
|
294
|
+
asBytes(tx, extraData),
|
|
295
|
+
asArgWithTx(tx, reason, (tx, val) => tx.pure.string(val)),
|
|
296
|
+
],
|
|
297
|
+
})
|
|
298
|
+
}
|
|
299
|
+
|
|
185
300
|
// Native Drop Functions
|
|
186
301
|
|
|
187
302
|
/**
|
|
188
303
|
* Native drop function (admin only)
|
|
189
304
|
* Takes a Coin<SUI> from caller and distributes it to recipients according to params
|
|
190
305
|
* @param tx - The transaction to add the move call to
|
|
306
|
+
* @param adminCap - The admin capability object ID
|
|
191
307
|
* @param srcEid - Source endpoint ID
|
|
192
308
|
* @param sender - Sender address as bytes
|
|
193
309
|
* @param dstEid - Destination endpoint ID
|
|
@@ -198,6 +314,7 @@ export class Executor {
|
|
|
198
314
|
*/
|
|
199
315
|
nativeDropMoveCall(
|
|
200
316
|
tx: Transaction,
|
|
317
|
+
adminCap: string | TransactionArgument,
|
|
201
318
|
srcEid: number | TransactionArgument,
|
|
202
319
|
sender: Uint8Array | TransactionArgument,
|
|
203
320
|
dstEid: number | TransactionArgument,
|
|
@@ -218,6 +335,7 @@ export class Executor {
|
|
|
218
335
|
target: this.#target('native_drop'),
|
|
219
336
|
arguments: [
|
|
220
337
|
tx.object(this.objects.executor),
|
|
338
|
+
asObject(tx, adminCap),
|
|
221
339
|
asU32(tx, srcEid),
|
|
222
340
|
asBytes32(tx, sender, this.moduleManager.getUtils()),
|
|
223
341
|
asU32(tx, dstEid),
|
|
@@ -237,34 +355,50 @@ export class Executor {
|
|
|
237
355
|
/**
|
|
238
356
|
* Set default multiplier basis points for fee calculation (admin only)
|
|
239
357
|
* @param tx - The transaction to add the move call to
|
|
358
|
+
* @param adminCap - The admin capability object ID
|
|
240
359
|
* @param multiplierBps - The multiplier in basis points
|
|
241
360
|
*/
|
|
242
|
-
setDefaultMultiplierBpsMoveCall(
|
|
361
|
+
setDefaultMultiplierBpsMoveCall(
|
|
362
|
+
tx: Transaction,
|
|
363
|
+
adminCap: string | TransactionArgument,
|
|
364
|
+
multiplierBps: number | TransactionArgument
|
|
365
|
+
): void {
|
|
243
366
|
tx.moveCall({
|
|
244
367
|
target: this.#target('set_default_multiplier_bps'),
|
|
245
|
-
arguments: [tx.object(this.objects.executor), asU16(tx, multiplierBps)],
|
|
368
|
+
arguments: [tx.object(this.objects.executor), asObject(tx, adminCap), asU16(tx, multiplierBps)],
|
|
246
369
|
})
|
|
247
370
|
}
|
|
248
371
|
|
|
249
372
|
/**
|
|
250
373
|
* Set deposit address for executor fees (admin only)
|
|
251
374
|
* @param tx - The transaction to add the move call to
|
|
375
|
+
* @param adminCap - The admin capability object ID
|
|
252
376
|
* @param depositAddress - The new deposit address
|
|
253
377
|
*/
|
|
254
|
-
setDepositAddressMoveCall(
|
|
378
|
+
setDepositAddressMoveCall(
|
|
379
|
+
tx: Transaction,
|
|
380
|
+
adminCap: string | TransactionArgument,
|
|
381
|
+
depositAddress: string | TransactionArgument
|
|
382
|
+
): void {
|
|
255
383
|
tx.moveCall({
|
|
256
384
|
target: this.#target('set_deposit_address'),
|
|
257
|
-
arguments: [tx.object(this.objects.executor), asAddress(tx, depositAddress)],
|
|
385
|
+
arguments: [tx.object(this.objects.executor), asObject(tx, adminCap), asAddress(tx, depositAddress)],
|
|
258
386
|
})
|
|
259
387
|
}
|
|
260
388
|
|
|
261
389
|
/**
|
|
262
390
|
* Set destination configuration for executor (admin only)
|
|
263
391
|
* @param tx - The transaction to add the move call to
|
|
392
|
+
* @param adminCap - The admin capability object ID
|
|
264
393
|
* @param dstEid - Destination endpoint ID
|
|
265
394
|
* @param config - Destination configuration parameters
|
|
266
395
|
*/
|
|
267
|
-
setDstConfigMoveCall(
|
|
396
|
+
setDstConfigMoveCall(
|
|
397
|
+
tx: Transaction,
|
|
398
|
+
adminCap: string | TransactionArgument,
|
|
399
|
+
dstEid: number | TransactionArgument,
|
|
400
|
+
config: DstConfig
|
|
401
|
+
): void {
|
|
268
402
|
const configCall = tx.moveCall({
|
|
269
403
|
target: this.#target('create_dst_config', 'executor_type'),
|
|
270
404
|
arguments: [
|
|
@@ -277,25 +411,31 @@ export class Executor {
|
|
|
277
411
|
})
|
|
278
412
|
tx.moveCall({
|
|
279
413
|
target: this.#target('set_dst_config'),
|
|
280
|
-
arguments: [tx.object(this.objects.executor), asU32(tx, dstEid), configCall],
|
|
414
|
+
arguments: [tx.object(this.objects.executor), asObject(tx, adminCap), asU32(tx, dstEid), configCall],
|
|
281
415
|
})
|
|
282
416
|
}
|
|
283
417
|
|
|
284
418
|
/**
|
|
285
419
|
* Set price feed for executor (admin only)
|
|
286
420
|
* @param tx - The transaction to add the move call to
|
|
421
|
+
* @param adminCap - The admin capability object ID
|
|
287
422
|
* @param priceFeed - The price feed address
|
|
288
423
|
*/
|
|
289
|
-
setPriceFeedMoveCall(
|
|
424
|
+
setPriceFeedMoveCall(
|
|
425
|
+
tx: Transaction,
|
|
426
|
+
adminCap: string | TransactionArgument,
|
|
427
|
+
priceFeed: string | TransactionArgument
|
|
428
|
+
): void {
|
|
290
429
|
tx.moveCall({
|
|
291
430
|
target: this.#target('set_price_feed'),
|
|
292
|
-
arguments: [tx.object(this.objects.executor), asAddress(tx, priceFeed)],
|
|
431
|
+
arguments: [tx.object(this.objects.executor), asObject(tx, adminCap), asAddress(tx, priceFeed)],
|
|
293
432
|
})
|
|
294
433
|
}
|
|
295
434
|
|
|
296
435
|
/**
|
|
297
436
|
* Set PTB builder move calls for executor worker operations (admin only)
|
|
298
437
|
* @param tx - The transaction to add the move call to
|
|
438
|
+
* @param adminCap - The admin capability object ID
|
|
299
439
|
* @param targetPtbBuilder - Target PTB builder address
|
|
300
440
|
* @param getFeeMoveCalls - Get fee move calls transaction argument
|
|
301
441
|
* @param assignJobMoveCalls - Assign job move calls transaction argument
|
|
@@ -311,6 +451,7 @@ export class Executor {
|
|
|
311
451
|
target: this.#target('set_ptb_builder_move_calls'),
|
|
312
452
|
arguments: [
|
|
313
453
|
tx.object(this.objects.executor),
|
|
454
|
+
asObject(tx, this.objects.executorOwnerCap),
|
|
314
455
|
asAddress(tx, targetPtbBuilder),
|
|
315
456
|
getFeeMoveCalls, // First element of Executor PTB result tuple
|
|
316
457
|
assignJobMoveCalls, // Second element of Executor PTB result tuple
|
|
@@ -321,11 +462,13 @@ export class Executor {
|
|
|
321
462
|
/**
|
|
322
463
|
* Set supported option types for a destination EID (admin only)
|
|
323
464
|
* @param tx - The transaction to add the move call to
|
|
465
|
+
* @param adminCap - The admin capability object ID
|
|
324
466
|
* @param dstEid - Destination endpoint ID
|
|
325
467
|
* @param optionTypes - Array of supported option type values
|
|
326
468
|
*/
|
|
327
469
|
setSupportedOptionTypesMoveCall(
|
|
328
470
|
tx: Transaction,
|
|
471
|
+
adminCap: string | TransactionArgument,
|
|
329
472
|
dstEid: number | TransactionArgument,
|
|
330
473
|
optionTypes: number[]
|
|
331
474
|
): void {
|
|
@@ -333,6 +476,7 @@ export class Executor {
|
|
|
333
476
|
target: this.#target('set_supported_option_types'),
|
|
334
477
|
arguments: [
|
|
335
478
|
tx.object(this.objects.executor),
|
|
479
|
+
asObject(tx, adminCap),
|
|
336
480
|
asU32(tx, dstEid),
|
|
337
481
|
tx.pure(bcs.vector(bcs.u8()).serialize(optionTypes)),
|
|
338
482
|
],
|
|
@@ -342,12 +486,17 @@ export class Executor {
|
|
|
342
486
|
/**
|
|
343
487
|
* Set worker fee library for executor (admin only)
|
|
344
488
|
* @param tx - The transaction to add the move call to
|
|
489
|
+
* @param adminCap - The admin capability object ID
|
|
345
490
|
* @param workerFeeLib - The worker fee library address
|
|
346
491
|
*/
|
|
347
|
-
setWorkerFeeLibMoveCall(
|
|
492
|
+
setWorkerFeeLibMoveCall(
|
|
493
|
+
tx: Transaction,
|
|
494
|
+
adminCap: string | TransactionArgument,
|
|
495
|
+
workerFeeLib: string | TransactionArgument
|
|
496
|
+
): void {
|
|
348
497
|
tx.moveCall({
|
|
349
498
|
target: this.#target('set_worker_fee_lib'),
|
|
350
|
-
arguments: [tx.object(this.objects.executor), asAddress(tx, workerFeeLib)],
|
|
499
|
+
arguments: [tx.object(this.objects.executor), asObject(tx, adminCap), asAddress(tx, workerFeeLib)],
|
|
351
500
|
})
|
|
352
501
|
}
|
|
353
502
|
|
|
@@ -606,28 +755,56 @@ export class Executor {
|
|
|
606
755
|
}
|
|
607
756
|
|
|
608
757
|
/**
|
|
609
|
-
* Check if an
|
|
758
|
+
* Check if an admin cap is valid (sync Move call)
|
|
610
759
|
* @param tx - The transaction to add the move call to
|
|
611
|
-
* @param
|
|
760
|
+
* @param adminCap - The admin capability object ID to check
|
|
612
761
|
* @returns TransactionResult - Result containing admin status
|
|
613
762
|
*/
|
|
614
|
-
isAdminMoveCall(tx: Transaction,
|
|
763
|
+
isAdminMoveCall(tx: Transaction, adminCap: string | TransactionArgument): TransactionResult {
|
|
615
764
|
return tx.moveCall({
|
|
616
765
|
target: this.#target('is_admin'),
|
|
617
|
-
arguments: [tx.object(this.objects.executor),
|
|
766
|
+
arguments: [tx.object(this.objects.executor), asObject(tx, adminCap)],
|
|
618
767
|
})
|
|
619
768
|
}
|
|
620
769
|
|
|
621
770
|
/**
|
|
622
|
-
* Check if an
|
|
623
|
-
* @param
|
|
624
|
-
* @returns Promise<boolean> - True if the
|
|
771
|
+
* Check if an admin cap is valid (async simulation)
|
|
772
|
+
* @param adminCap - The admin capability object ID to check
|
|
773
|
+
* @returns Promise<boolean> - True if the admin cap is valid
|
|
625
774
|
*/
|
|
626
|
-
async isAdmin(
|
|
775
|
+
async isAdmin(adminCap: string): Promise<boolean> {
|
|
627
776
|
return executeSimulate(
|
|
628
777
|
this.client,
|
|
629
778
|
(tx) => {
|
|
630
|
-
this.isAdminMoveCall(tx,
|
|
779
|
+
this.isAdminMoveCall(tx, adminCap)
|
|
780
|
+
},
|
|
781
|
+
(result) => bcs.Bool.parse(result[0].value)
|
|
782
|
+
)
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* Check if an address is an admin
|
|
787
|
+
* @param tx - The transaction to add the move call to
|
|
788
|
+
* @param admin - The admin address to check
|
|
789
|
+
* @returns Transaction result containing the admin status
|
|
790
|
+
*/
|
|
791
|
+
isAdminAddressMoveCall(tx: Transaction, admin: string | TransactionArgument): TransactionResult {
|
|
792
|
+
return tx.moveCall({
|
|
793
|
+
target: this.#target('is_admin_address'),
|
|
794
|
+
arguments: [tx.object(this.objects.executor), asAddress(tx, admin)],
|
|
795
|
+
})
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* Check if an address is an admin
|
|
800
|
+
* @param admin - The admin address to check
|
|
801
|
+
* @returns Promise<boolean> - True if the address is an admin
|
|
802
|
+
*/
|
|
803
|
+
async isAdminAddress(admin: string): Promise<boolean> {
|
|
804
|
+
return executeSimulate(
|
|
805
|
+
this.client,
|
|
806
|
+
(tx) => {
|
|
807
|
+
this.isAdminAddressMoveCall(tx, admin)
|
|
631
808
|
},
|
|
632
809
|
(result) => bcs.Bool.parse(result[0].value)
|
|
633
810
|
)
|
|
@@ -824,6 +1001,34 @@ export class Executor {
|
|
|
824
1001
|
)
|
|
825
1002
|
}
|
|
826
1003
|
|
|
1004
|
+
/**
|
|
1005
|
+
* Get admin capability ID from admin address
|
|
1006
|
+
* @param tx - The transaction to add the move call to
|
|
1007
|
+
* @param admin - The admin address
|
|
1008
|
+
* @returns Transaction result containing the admin capability ID
|
|
1009
|
+
*/
|
|
1010
|
+
adminCapIdMoveCall(tx: Transaction, admin: string | TransactionArgument): TransactionResult {
|
|
1011
|
+
return tx.moveCall({
|
|
1012
|
+
target: this.#target('admin_cap_id'),
|
|
1013
|
+
arguments: [tx.object(this.objects.executor), asAddress(tx, admin)],
|
|
1014
|
+
})
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
/**
|
|
1018
|
+
* Get admin capability ID from admin address
|
|
1019
|
+
* @param admin - The admin address
|
|
1020
|
+
* @returns Promise<string> - The admin capability ID
|
|
1021
|
+
*/
|
|
1022
|
+
async adminCapId(admin: string): Promise<string> {
|
|
1023
|
+
return executeSimulate(
|
|
1024
|
+
this.client,
|
|
1025
|
+
(tx) => {
|
|
1026
|
+
this.adminCapIdMoveCall(tx, admin)
|
|
1027
|
+
},
|
|
1028
|
+
(result) => bcs.Address.parse(result[0].value)
|
|
1029
|
+
)
|
|
1030
|
+
}
|
|
1031
|
+
|
|
827
1032
|
// === Private Helper Functions ===
|
|
828
1033
|
|
|
829
1034
|
private parseDstConfig(data: Uint8Array): DstConfig {
|
|
@@ -5,15 +5,17 @@ import { Transaction, TransactionArgument, TransactionResult } from '@mysten/sui
|
|
|
5
5
|
import { ArbitrumPriceExtBcs, ModelTypeBcs, PriceBcs } from '../../bcs'
|
|
6
6
|
import { ModuleManager } from '../../module-manager'
|
|
7
7
|
import { ArbitrumPriceExt, ModelType, ObjectOptions, Price } from '../../types'
|
|
8
|
-
import { asAddress, asBool, asU128, asU32, asU64, executeSimulate } from '../../utils'
|
|
8
|
+
import { asAddress, asBool, asObject, asU128, asU32, asU64, executeSimulate } from '../../utils'
|
|
9
9
|
|
|
10
10
|
const MODULE_NAME = 'price_feed'
|
|
11
11
|
|
|
12
12
|
export const PriceFeedErrorCode = {
|
|
13
13
|
// PriceFeed related errors
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
PRICE_FEED_EInvalidDenominator: 1,
|
|
15
|
+
PRICE_FEED_ENoPrice: 2,
|
|
16
|
+
PRICE_FEED_ENotAnOPStack: 3,
|
|
17
|
+
PRICE_FEED_EOnlyPriceUpdater: 4,
|
|
18
|
+
PRICE_FEED_EPriceUpdaterCapNotFound: 5,
|
|
17
19
|
} as const
|
|
18
20
|
|
|
19
21
|
export class PriceFeed {
|
|
@@ -104,6 +106,7 @@ export class PriceFeed {
|
|
|
104
106
|
|
|
105
107
|
/**
|
|
106
108
|
* Set price updater role for an address (admin only)
|
|
109
|
+
* Note: This function will automatically create a price updater capability for new updaters
|
|
107
110
|
* @param tx - The transaction to add the move call to
|
|
108
111
|
* @param updater - The updater address or transaction argument
|
|
109
112
|
* @param active - Whether to activate or deactivate the updater role or transaction argument
|
|
@@ -126,8 +129,9 @@ export class PriceFeed {
|
|
|
126
129
|
|
|
127
130
|
/**
|
|
128
131
|
* Set price ratio denominator for price calculations (admin only)
|
|
132
|
+
* Note: denominator must be greater than 0, otherwise the transaction will fail
|
|
129
133
|
* @param tx - The transaction to add the move call to
|
|
130
|
-
* @param denominator - The price ratio denominator value or transaction argument
|
|
134
|
+
* @param denominator - The price ratio denominator value or transaction argument (must be > 0)
|
|
131
135
|
*/
|
|
132
136
|
setPriceRatioDenominatorMoveCall(
|
|
133
137
|
tx: Transaction,
|
|
@@ -183,29 +187,37 @@ export class PriceFeed {
|
|
|
183
187
|
}
|
|
184
188
|
|
|
185
189
|
/**
|
|
186
|
-
* Set price for a destination EID (price updater
|
|
190
|
+
* Set price for a destination EID (price updater capability required)
|
|
187
191
|
* @param tx - The transaction to add the move call to
|
|
192
|
+
* @param updaterCap - The price updater capability object or transaction argument
|
|
188
193
|
* @param dstEid - Destination endpoint ID or transaction argument
|
|
189
194
|
* @param price - The price configuration to set
|
|
190
195
|
*/
|
|
191
|
-
setPriceMoveCall(
|
|
196
|
+
setPriceMoveCall(
|
|
197
|
+
tx: Transaction,
|
|
198
|
+
updaterCap: string | TransactionArgument,
|
|
199
|
+
dstEid: number | TransactionArgument,
|
|
200
|
+
price: Price
|
|
201
|
+
): void {
|
|
192
202
|
const priceCall = this.createPriceMoveCall(tx, price.priceRatio, price.gasPriceInUnit, price.gasPerByte)
|
|
193
203
|
|
|
194
204
|
tx.moveCall({
|
|
195
205
|
target: this.#target('set_price'),
|
|
196
|
-
arguments: [tx.object(this.objects.priceFeed), asU32(tx, dstEid), priceCall],
|
|
206
|
+
arguments: [tx.object(this.objects.priceFeed), asObject(tx, updaterCap), asU32(tx, dstEid), priceCall],
|
|
197
207
|
})
|
|
198
208
|
}
|
|
199
209
|
|
|
200
210
|
/**
|
|
201
|
-
* Set price for Arbitrum with additional extension parameters (price updater
|
|
211
|
+
* Set price for Arbitrum with additional extension parameters (price updater capability required)
|
|
202
212
|
* @param tx - The transaction to add the move call to
|
|
213
|
+
* @param updaterCap - The price updater capability object or transaction argument
|
|
203
214
|
* @param dstEid - Destination endpoint ID
|
|
204
215
|
* @param price - The base price configuration
|
|
205
216
|
* @param arbitrumPriceExt - Additional Arbitrum-specific price parameters
|
|
206
217
|
*/
|
|
207
218
|
setPriceForArbitrumMoveCall(
|
|
208
219
|
tx: Transaction,
|
|
220
|
+
updaterCap: string | TransactionArgument,
|
|
209
221
|
dstEid: number | TransactionArgument,
|
|
210
222
|
price: Price,
|
|
211
223
|
arbitrumPriceExt: ArbitrumPriceExt
|
|
@@ -219,22 +231,44 @@ export class PriceFeed {
|
|
|
219
231
|
|
|
220
232
|
tx.moveCall({
|
|
221
233
|
target: this.#target('set_price_for_arbitrum'),
|
|
222
|
-
arguments: [
|
|
234
|
+
arguments: [
|
|
235
|
+
tx.object(this.objects.priceFeed),
|
|
236
|
+
asObject(tx, updaterCap),
|
|
237
|
+
asU32(tx, dstEid),
|
|
238
|
+
priceCall,
|
|
239
|
+
arbitrumPriceExtCall,
|
|
240
|
+
],
|
|
223
241
|
})
|
|
224
242
|
}
|
|
225
243
|
|
|
226
244
|
/**
|
|
227
|
-
* Set native token price in USD (price updater
|
|
245
|
+
* Set native token price in USD (price updater capability required)
|
|
228
246
|
* @param tx - The transaction to add the move call to
|
|
247
|
+
* @param updaterCap - The price updater capability object or transaction argument
|
|
229
248
|
* @param nativeTokenPriceUsd - The native token price in USD
|
|
230
249
|
*/
|
|
231
250
|
setNativeTokenPriceUsdMoveCall(
|
|
232
251
|
tx: Transaction,
|
|
252
|
+
updaterCap: string | TransactionArgument,
|
|
233
253
|
nativeTokenPriceUsd: bigint | number | string | TransactionArgument
|
|
234
254
|
): void {
|
|
235
255
|
tx.moveCall({
|
|
236
256
|
target: this.#target('set_native_token_price_usd'),
|
|
237
|
-
arguments: [tx.object(this.objects.priceFeed), asU128(tx, nativeTokenPriceUsd)],
|
|
257
|
+
arguments: [tx.object(this.objects.priceFeed), asObject(tx, updaterCap), asU128(tx, nativeTokenPriceUsd)],
|
|
258
|
+
})
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// === Witness Functions ===
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Create a LayerZero witness for PriceFeed package whitelist registration
|
|
265
|
+
* @param tx - The transaction to add the move call to
|
|
266
|
+
* @returns Transaction result containing the LayerZero witness
|
|
267
|
+
*/
|
|
268
|
+
createLayerZeroWitnessMoveCall(tx: Transaction): TransactionResult {
|
|
269
|
+
return tx.moveCall({
|
|
270
|
+
target: `${this.packageId}::price_feed_witness::new`,
|
|
271
|
+
arguments: [],
|
|
238
272
|
})
|
|
239
273
|
}
|
|
240
274
|
|
|
@@ -266,6 +300,19 @@ export class PriceFeed {
|
|
|
266
300
|
})
|
|
267
301
|
}
|
|
268
302
|
|
|
303
|
+
/**
|
|
304
|
+
* Get price updater capability address for a specific updater
|
|
305
|
+
* @param tx - The transaction to add the move call to
|
|
306
|
+
* @param updater - The updater address to get capability for
|
|
307
|
+
* @returns Transaction result containing the price updater capability address
|
|
308
|
+
*/
|
|
309
|
+
getPriceUpdaterCapMoveCall(tx: Transaction, updater: string | TransactionArgument): TransactionResult {
|
|
310
|
+
return tx.moveCall({
|
|
311
|
+
target: this.#target('get_price_updater_cap'),
|
|
312
|
+
arguments: [tx.object(this.objects.priceFeed), asAddress(tx, updater)],
|
|
313
|
+
})
|
|
314
|
+
}
|
|
315
|
+
|
|
269
316
|
/**
|
|
270
317
|
* Get the owner capability address of this PriceFeed
|
|
271
318
|
* @returns Promise<string> - The owner capability address
|
|
@@ -280,6 +327,21 @@ export class PriceFeed {
|
|
|
280
327
|
)
|
|
281
328
|
}
|
|
282
329
|
|
|
330
|
+
/**
|
|
331
|
+
* Get price updater capability address for a specific updater
|
|
332
|
+
* @param updater - The updater address to get capability for
|
|
333
|
+
* @returns Promise<string> - The price updater capability address
|
|
334
|
+
*/
|
|
335
|
+
async priceUpdaterCap(updater: string): Promise<string> {
|
|
336
|
+
return executeSimulate(
|
|
337
|
+
this.client,
|
|
338
|
+
(tx) => {
|
|
339
|
+
this.getPriceUpdaterCapMoveCall(tx, updater)
|
|
340
|
+
},
|
|
341
|
+
(result) => bcs.Address.parse(result[0].value)
|
|
342
|
+
)
|
|
343
|
+
}
|
|
344
|
+
|
|
283
345
|
/**
|
|
284
346
|
* Check if an address is a price updater
|
|
285
347
|
* @param tx - The transaction to add the move call to
|
package/src/resource.ts
CHANGED
|
@@ -30,6 +30,7 @@ const PACKAGE_ADDRESS_MAP: { [K in keyof PackageOptions]: Partial<{ [S in Stage]
|
|
|
30
30
|
treasury: AddressConstants.PACKAGE_TREASURY_ADDRESS,
|
|
31
31
|
oapp: AddressConstants.PACKAGE_OAPP_ADDRESS,
|
|
32
32
|
layerzeroViews: AddressConstants.PACKAGE_LAYERZERO_VIEWS_ADDRESS,
|
|
33
|
+
packageWhitelistValidator: AddressConstants.PACKAGE_PACKAGE_WHITELIST_VALIDATOR_ADDRESS,
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
/**
|
|
@@ -62,6 +63,7 @@ const OBJECT_ADDRESS_MAP: { [K in keyof ObjectOptions]: Partial<{ [S in Stage]:
|
|
|
62
63
|
executorFeeLib: AddressConstants.OBJECT_EXECUTOR_FEE_LIB_ADDRESS,
|
|
63
64
|
priceFeed: AddressConstants.OBJECT_PRICE_FEED_ADDRESS,
|
|
64
65
|
priceFeedOwnerCap: AddressConstants.OBJECT_PRICE_FEED_OWNER_CAP_ADDRESS,
|
|
66
|
+
packageWhitelistValidator: AddressConstants.OBJECT_PACKAGE_WHITELIST_VALIDATOR_ADDRESS,
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
/**
|