@layerzerolabs/lz-sui-oft-sdk-v2 3.0.127-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/README.md +95 -0
- package/dist/index.cjs +980 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +506 -0
- package/dist/index.d.ts +506 -0
- package/dist/index.mjs +967 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +58 -0
- package/src/bcs/oft.ts +55 -0
- package/src/index.ts +8 -0
- package/src/modules/oft-composer-registry.ts +128 -0
- package/src/modules/oft-ptb-builder.ts +59 -0
- package/src/modules/oft.ts +978 -0
- package/src/types.ts +31 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
import { SuiClient } from '@mysten/sui/client';
|
|
2
|
+
import { Transaction, TransactionArgument, TransactionResult } from '@mysten/sui/transactions';
|
|
3
|
+
import { SDK, MessagingFee, ObjectOptions } from '@layerzerolabs/lz-sui-sdk-v2';
|
|
4
|
+
import { Transaction as Transaction$1, TransactionArgument as TransactionArgument$1, TransactionResult as TransactionResult$1 } from '@mysten/sui/dist/cjs/transactions';
|
|
5
|
+
import * as _mysten_sui_dist_cjs_bcs from '@mysten/sui/dist/cjs/bcs';
|
|
6
|
+
|
|
7
|
+
declare const OFTMsgType: {
|
|
8
|
+
readonly SEND: 1;
|
|
9
|
+
readonly SEND_AND_CALL: 2;
|
|
10
|
+
};
|
|
11
|
+
interface SendParam {
|
|
12
|
+
dstEid: number;
|
|
13
|
+
to: Uint8Array;
|
|
14
|
+
amountLd: bigint;
|
|
15
|
+
minAmountLd: bigint;
|
|
16
|
+
extraOptions: Uint8Array;
|
|
17
|
+
composeMsg: Uint8Array;
|
|
18
|
+
oftCmd: Uint8Array;
|
|
19
|
+
}
|
|
20
|
+
interface OFTLimit {
|
|
21
|
+
minAmountLd: bigint;
|
|
22
|
+
maxAmountLd: bigint;
|
|
23
|
+
}
|
|
24
|
+
interface OFTFeeDetail {
|
|
25
|
+
feeAmountLd: bigint;
|
|
26
|
+
description: string;
|
|
27
|
+
}
|
|
28
|
+
interface OFTReceipt {
|
|
29
|
+
amountSentLd: bigint;
|
|
30
|
+
amountReceivedLd: bigint;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare const OFTErrorCode: {
|
|
34
|
+
readonly OFT_EComposeMsgNotAllowed: 1;
|
|
35
|
+
readonly OFT_EComposeMsgRequired: 2;
|
|
36
|
+
readonly OFT_EInvalidComposeQueue: 3;
|
|
37
|
+
readonly OFT_EInvalidLocalDecimals: 4;
|
|
38
|
+
readonly OFT_EPaused: 5;
|
|
39
|
+
readonly OFT_EPauseUnchanged: 6;
|
|
40
|
+
readonly OFT_ESlippageExceeded: 7;
|
|
41
|
+
readonly OFT_EInsufficientBalance: 8;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* OFT (Omnichain Fungible Token) Class
|
|
45
|
+
*
|
|
46
|
+
* The OFT class provides a comprehensive interface for interacting with LayerZero's
|
|
47
|
+
* Omnichain Fungible Token standard on the Sui blockchain. OFTs enable seamless
|
|
48
|
+
* cross-chain token transfers while maintaining fungibility across multiple networks.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* // Initialize OFT instance
|
|
53
|
+
* const oft = new OFT(protocolSDK, corePackageId, packageId, oftObjectId, coinType, adminCapId);
|
|
54
|
+
*
|
|
55
|
+
* // Send tokens cross-chain
|
|
56
|
+
* const tx = new Transaction();
|
|
57
|
+
* const coin = await oft.splitCoinMoveCall(tx, sender, amount);
|
|
58
|
+
* await oft.sendMoveCall(tx, sender, coin, sendParam, nativeFee, zroFee, refundAddress, messagingChannel);
|
|
59
|
+
* tx.transferObjects([coin], sender);
|
|
60
|
+
* ...
|
|
61
|
+
*
|
|
62
|
+
* // Quote transfer fees
|
|
63
|
+
* const fees = await oft.quoteSend(sender, sendParam, payInZro);
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
declare class OFT {
|
|
67
|
+
#private;
|
|
68
|
+
/** Sui client for blockchain interactions */
|
|
69
|
+
readonly client: SuiClient;
|
|
70
|
+
/** The package ID of the OFT implementation (specific token contract) */
|
|
71
|
+
packageId: string;
|
|
72
|
+
/** The package ID of the core OFT framework (shared OFT functionality) */
|
|
73
|
+
corePackageId: string;
|
|
74
|
+
/** LayerZero protocol object references (endpoint, messaging channels, etc.) */
|
|
75
|
+
private readonly objects;
|
|
76
|
+
/** The unique object ID of this OFT instance on Sui */
|
|
77
|
+
private readonly oftObjectId;
|
|
78
|
+
/** Admin capability object ID for privileged operations (optional for read-only usage) */
|
|
79
|
+
private readonly adminCapId?;
|
|
80
|
+
/** The Sui coin type this OFT represents (e.g., "0x123::mycoin::MYCOIN") */
|
|
81
|
+
private readonly coinType;
|
|
82
|
+
/** Reference to the LayerZero protocol SDK for cross-chain operations */
|
|
83
|
+
private readonly protocolSDK;
|
|
84
|
+
/**
|
|
85
|
+
* Creates a new OFT instance for interacting with an Omnichain Fungible Token
|
|
86
|
+
*
|
|
87
|
+
* @param protocolSDK - The LayerZero protocol SDK instance providing core cross-chain functionality
|
|
88
|
+
* @param corePackageId - The package ID of the core OFT framework (shared across all OFT implementations)
|
|
89
|
+
* @param packageId - The package ID of the specific OFT token implementation
|
|
90
|
+
* @param oftObjectId - The unique object ID of this OFT instance
|
|
91
|
+
* @param coinType - The Sui coin type string (e.g., "0x123::mycoin::MYCOIN")
|
|
92
|
+
* @param adminCapId - Optional admin capability object ID for privileged operations (required for admin functions)
|
|
93
|
+
*/
|
|
94
|
+
constructor(protocolSDK: SDK, corePackageId: string, // the OFT package id
|
|
95
|
+
packageId: string, // the Implementation's package id
|
|
96
|
+
oftObjectId: string, coinType: string, adminCapId?: string);
|
|
97
|
+
/**
|
|
98
|
+
* Register OFT as an OApp with LayerZero endpoint
|
|
99
|
+
* @param tx - The transaction to add the move call to
|
|
100
|
+
* @param lzReceiveInfo - PTB Builder lzReceiveInfoMoveCall result, used for protocol SDK to dynamically build the PTB
|
|
101
|
+
* for OFT's lzReceive operation
|
|
102
|
+
*/
|
|
103
|
+
registerOAppMoveCall(tx: Transaction, lzReceiveInfo: Uint8Array | TransactionArgument): void;
|
|
104
|
+
/**
|
|
105
|
+
* Set enforced options for OFT messaging to a destination
|
|
106
|
+
* @param tx - The transaction to add the move call to
|
|
107
|
+
* @param eid - Endpoint ID
|
|
108
|
+
* @param msgType - Message type (SEND or SEND_AND_CALL)
|
|
109
|
+
* @param options - Enforced options as bytes
|
|
110
|
+
*/
|
|
111
|
+
setEnforcedOptionsMoveCall(tx: Transaction, eid: number | TransactionArgument, msgType: number | TransactionArgument, options: Uint8Array | TransactionArgument): void;
|
|
112
|
+
/**
|
|
113
|
+
* Set peer OFT on another chain
|
|
114
|
+
* @param tx - The transaction to add the move call to
|
|
115
|
+
* @param messagingChannel - The messaging channel object ID
|
|
116
|
+
* @param eid - Peer endpoint ID
|
|
117
|
+
* @param peer - Peer OFT address as bytes
|
|
118
|
+
*/
|
|
119
|
+
setPeerMoveCall(tx: Transaction, messagingChannel: string | TransactionArgument, eid: number | TransactionArgument, peer: Uint8Array | TransactionArgument): void;
|
|
120
|
+
/**
|
|
121
|
+
* Set delegate for OFT
|
|
122
|
+
* @param tx - The transaction to add the move call to
|
|
123
|
+
* @param newDelegate - The new delegate address
|
|
124
|
+
*/
|
|
125
|
+
setDelegateMoveCall(tx: Transaction, newDelegate: string | TransactionArgument): void;
|
|
126
|
+
/**
|
|
127
|
+
* Set pause state for OFT operations
|
|
128
|
+
* @param tx - The transaction to add the move call to
|
|
129
|
+
* @param pause - Whether to pause or unpause operations
|
|
130
|
+
*/
|
|
131
|
+
setPauseMoveCall(tx: Transaction, pause: boolean | TransactionArgument): void;
|
|
132
|
+
/**
|
|
133
|
+
* Set fee deposit address for OFT fees
|
|
134
|
+
* @param tx - The transaction to add the move call to
|
|
135
|
+
* @param feeDepositAddress - The new fee deposit address
|
|
136
|
+
*/
|
|
137
|
+
setFeeDepositAddressMoveCall(tx: Transaction, feeDepositAddress: string | TransactionArgument): void;
|
|
138
|
+
/**
|
|
139
|
+
* Set fee basis points for OFT transfers
|
|
140
|
+
* @param tx - The transaction to add the move call to
|
|
141
|
+
* @param feeBps - The fee in basis points
|
|
142
|
+
*/
|
|
143
|
+
setFeeBpsMoveCall(tx: Transaction, feeBps: bigint | number | string | TransactionArgument): void;
|
|
144
|
+
/**
|
|
145
|
+
* Set rate limit for OFT transfers
|
|
146
|
+
* @param tx - The transaction to add the move call to
|
|
147
|
+
* @param eid - Endpoint ID
|
|
148
|
+
* @param inbound - Whether this is for inbound or outbound transfers
|
|
149
|
+
* @param rateLimit - Rate limit amount
|
|
150
|
+
* @param windowSeconds - Time window in seconds
|
|
151
|
+
*/
|
|
152
|
+
setRateLimitMoveCall(tx: Transaction, eid: number | TransactionArgument, inbound: boolean | TransactionArgument, rateLimit: bigint | number | string | TransactionArgument, windowSeconds: bigint | number | string | TransactionArgument): void;
|
|
153
|
+
/**
|
|
154
|
+
* Remove rate limit for OFT transfers
|
|
155
|
+
* @param tx - The transaction to add the move call to
|
|
156
|
+
* @param eid - Endpoint ID
|
|
157
|
+
* @param inbound - Whether this is for inbound or outbound transfers
|
|
158
|
+
*/
|
|
159
|
+
unsetRateLimitMoveCall(tx: Transaction, eid: number | TransactionArgument, inbound: boolean | TransactionArgument): void;
|
|
160
|
+
/**
|
|
161
|
+
* Splits specified amount of coins from user's wallet
|
|
162
|
+
* @param tx - The transaction to add the move call to
|
|
163
|
+
* @param owner - Address of the user whose coins to split
|
|
164
|
+
* @param amount - Amount of coins to split (in smallest units)
|
|
165
|
+
* @param limit - Maximum total number of coins to collect across all pages (default: 200)
|
|
166
|
+
* @param pageSize - Maximum number of coins to fetch per page (default: 50)
|
|
167
|
+
* @returns Promise resolving to split coin as TransactionResult
|
|
168
|
+
* @throws Error if insufficient coins balance or no coins found
|
|
169
|
+
*/
|
|
170
|
+
splitCoinMoveCall(tx: Transaction, owner: string, amount: bigint, limit?: number, pageSize?: number): Promise<TransactionResult>;
|
|
171
|
+
/**
|
|
172
|
+
* Send OFT tokens to destination chain
|
|
173
|
+
* @param tx - The transaction to add the move call to
|
|
174
|
+
* @param sender - Sender address for ZRO token operations
|
|
175
|
+
* @param coinProvided - Coin object ID or transaction result to send
|
|
176
|
+
* @param messagingChannel - The messaging channel object ID
|
|
177
|
+
* @param sendParam - Send parameters including destination and amounts
|
|
178
|
+
* @param nativeFee - Native token fee amount
|
|
179
|
+
* @param zroFee - ZRO token fee amount
|
|
180
|
+
* @param refundAddress - Address for fee refunds
|
|
181
|
+
* @returns Promise<TransactionResult> - Transaction result containing send operation and receipt objects
|
|
182
|
+
*/
|
|
183
|
+
sendMoveCall(tx: Transaction, sender: string, coinProvided: string | TransactionArgument, sendParam: SendParam | TransactionArgument, nativeFee: bigint | TransactionArgument, zroFee: bigint | TransactionArgument, refundAddress: string | TransactionArgument, messagingChannel?: string | undefined): Promise<void>;
|
|
184
|
+
/**
|
|
185
|
+
* Quote OFT sending operation with detailed fee breakdown
|
|
186
|
+
* @param sendParam - Send parameters for the OFT operation
|
|
187
|
+
* @returns Promise with limit, fee details, and receipt information
|
|
188
|
+
*/
|
|
189
|
+
quoteOft(sendParam: SendParam | TransactionArgument): Promise<{
|
|
190
|
+
limit: OFTLimit;
|
|
191
|
+
feeDetails: OFTFeeDetail[];
|
|
192
|
+
receipt: OFTReceipt;
|
|
193
|
+
}>;
|
|
194
|
+
/**
|
|
195
|
+
* Quote messaging fees for OFT sending
|
|
196
|
+
* @param sender - Sender address
|
|
197
|
+
* @param sendParam - Send parameters for the OFT operation
|
|
198
|
+
* @param payInZro - Whether to pay in ZRO tokens
|
|
199
|
+
* @returns Promise<MessagingFee> - The calculated messaging fees
|
|
200
|
+
*/
|
|
201
|
+
quoteSend(sender: string | TransactionArgument, sendParam: SendParam | TransactionArgument, payInZro: boolean | TransactionArgument): Promise<MessagingFee>;
|
|
202
|
+
/**
|
|
203
|
+
* Get OFT version information
|
|
204
|
+
* @param tx - The transaction to add the move call to
|
|
205
|
+
* @returns Transaction result containing version information
|
|
206
|
+
*/
|
|
207
|
+
oftVersionMoveCall(tx: Transaction): TransactionResult;
|
|
208
|
+
/**
|
|
209
|
+
* Get OFT version information
|
|
210
|
+
* @returns Promise<{ major: number; minor: number }> - The OFT version
|
|
211
|
+
*/
|
|
212
|
+
oftVersion(): Promise<{
|
|
213
|
+
major: number;
|
|
214
|
+
minor: number;
|
|
215
|
+
}>;
|
|
216
|
+
/**
|
|
217
|
+
* Get coin metadata address
|
|
218
|
+
* @param tx - The transaction to add the move call to
|
|
219
|
+
* @returns Transaction result containing coin metadata address
|
|
220
|
+
*/
|
|
221
|
+
coinMetadataMoveCall(tx: Transaction): TransactionResult;
|
|
222
|
+
/**
|
|
223
|
+
* Get coin metadata address
|
|
224
|
+
* @returns Promise<string> - The coin metadata address
|
|
225
|
+
*/
|
|
226
|
+
coinMetadata(): Promise<string>;
|
|
227
|
+
/**
|
|
228
|
+
* Get OFT admin address
|
|
229
|
+
* @param tx - The transaction to add the move call to
|
|
230
|
+
* @returns Transaction result containing the admin address
|
|
231
|
+
*/
|
|
232
|
+
adminMoveCall(tx: Transaction): TransactionResult;
|
|
233
|
+
/**
|
|
234
|
+
* Get OFT admin address
|
|
235
|
+
* @returns Promise<string> - The admin address
|
|
236
|
+
*/
|
|
237
|
+
admin(): Promise<string>;
|
|
238
|
+
/**
|
|
239
|
+
* Get shared decimals for cross-chain compatibility
|
|
240
|
+
* @param tx - The transaction to add the move call to
|
|
241
|
+
* @returns Transaction result containing shared decimals
|
|
242
|
+
*/
|
|
243
|
+
sharedDecimalsMoveCall(tx: Transaction): TransactionResult;
|
|
244
|
+
/**
|
|
245
|
+
* Get shared decimals for cross-chain compatibility
|
|
246
|
+
* @returns Promise<number> - The shared decimal precision
|
|
247
|
+
*/
|
|
248
|
+
sharedDecimals(): Promise<number>;
|
|
249
|
+
/**
|
|
250
|
+
* Check if OFT is paused
|
|
251
|
+
* @param tx - The transaction to add the move call to
|
|
252
|
+
* @returns Transaction result containing the paused status
|
|
253
|
+
*/
|
|
254
|
+
isPausedMoveCall(tx: Transaction): TransactionResult;
|
|
255
|
+
/**
|
|
256
|
+
* Check if OFT is paused
|
|
257
|
+
* @returns Promise<boolean> - True if OFT is paused
|
|
258
|
+
*/
|
|
259
|
+
isPaused(): Promise<boolean>;
|
|
260
|
+
/**
|
|
261
|
+
* Check if this OFT is an adapter (wraps existing token)
|
|
262
|
+
* @param tx - The transaction to add the move call to
|
|
263
|
+
* @returns Transaction result containing the adapter status
|
|
264
|
+
*/
|
|
265
|
+
isAdapterMoveCall(tx: Transaction): TransactionResult;
|
|
266
|
+
/**
|
|
267
|
+
* Check if this OFT is an adapter (wraps existing token)
|
|
268
|
+
* @returns Promise<boolean> - True if this is an OFT adapter
|
|
269
|
+
*/
|
|
270
|
+
isAdapter(): Promise<boolean>;
|
|
271
|
+
/**
|
|
272
|
+
* Get fee basis points for OFT transfers
|
|
273
|
+
* @param tx - The transaction to add the move call to
|
|
274
|
+
* @returns Transaction result containing the fee basis points
|
|
275
|
+
*/
|
|
276
|
+
feeBpsMoveCall(tx: Transaction): TransactionResult;
|
|
277
|
+
/**
|
|
278
|
+
* Get fee basis points for OFT transfers
|
|
279
|
+
* @returns Promise<bigint> - The fee in basis points
|
|
280
|
+
*/
|
|
281
|
+
feeBps(): Promise<bigint>;
|
|
282
|
+
/**
|
|
283
|
+
* Get fee deposit address for OFT
|
|
284
|
+
* @param tx - The transaction to add the move call to
|
|
285
|
+
* @returns Transaction result containing the fee deposit address
|
|
286
|
+
*/
|
|
287
|
+
feeDepositAddressMoveCall(tx: Transaction): TransactionResult;
|
|
288
|
+
/**
|
|
289
|
+
* Get fee deposit address for OFT
|
|
290
|
+
* @returns Promise<string> - The fee deposit address
|
|
291
|
+
*/
|
|
292
|
+
feeDepositAddress(): Promise<string>;
|
|
293
|
+
/**
|
|
294
|
+
* Get rate limit configuration for an endpoint
|
|
295
|
+
* @param tx - The transaction to add the move call to
|
|
296
|
+
* @param eid - Endpoint ID
|
|
297
|
+
* @param inbound - Whether this is for inbound or outbound transfers
|
|
298
|
+
* @returns Transaction result containing rate limit configuration
|
|
299
|
+
*/
|
|
300
|
+
rateLimitConfigMoveCall(tx: Transaction, eid: number | TransactionArgument, inbound: boolean | TransactionArgument): TransactionResult;
|
|
301
|
+
/**
|
|
302
|
+
* Get rate limit configuration for an endpoint
|
|
303
|
+
* @param eid - Endpoint ID
|
|
304
|
+
* @param inbound - Whether this is for inbound or outbound transfers
|
|
305
|
+
* @returns Promise<{ limit: bigint; windowSeconds: bigint }> - Rate limit configuration
|
|
306
|
+
*/
|
|
307
|
+
rateLimitConfig(eid: number, inbound: boolean): Promise<{
|
|
308
|
+
limit: bigint;
|
|
309
|
+
windowSeconds: bigint;
|
|
310
|
+
}>;
|
|
311
|
+
/**
|
|
312
|
+
* Get current in-flight amount for rate limiting
|
|
313
|
+
* @param tx - The transaction to add the move call to
|
|
314
|
+
* @param eid - Endpoint ID
|
|
315
|
+
* @param inbound - Whether this is for inbound or outbound transfers
|
|
316
|
+
* @returns Transaction result containing in-flight amount
|
|
317
|
+
*/
|
|
318
|
+
rateLimitInFlightMoveCall(tx: Transaction, eid: number | TransactionArgument, inbound: boolean | TransactionArgument): TransactionResult;
|
|
319
|
+
/**
|
|
320
|
+
* Get current in-flight amount for rate limiting
|
|
321
|
+
* @param eid - Endpoint ID
|
|
322
|
+
* @param inbound - Whether this is for inbound or outbound transfers
|
|
323
|
+
* @returns Promise<bigint> - Current in-flight amount
|
|
324
|
+
*/
|
|
325
|
+
rateLimitInFlight(eid: number, inbound: boolean): Promise<bigint>;
|
|
326
|
+
/**
|
|
327
|
+
* Get rate limit capacity (remaining available amount)
|
|
328
|
+
* @param tx - The transaction to add the move call to
|
|
329
|
+
* @param eid - Endpoint ID
|
|
330
|
+
* @param inbound - Whether this is for inbound or outbound transfers
|
|
331
|
+
* @returns Transaction result containing rate limit capacity
|
|
332
|
+
*/
|
|
333
|
+
rateLimitCapacityMoveCall(tx: Transaction, eid: number | TransactionArgument, inbound: boolean | TransactionArgument): TransactionResult;
|
|
334
|
+
/**
|
|
335
|
+
* Get rate limit capacity (remaining available amount)
|
|
336
|
+
* @param eid - Endpoint ID
|
|
337
|
+
* @param inbound - Whether this is for inbound or outbound transfers
|
|
338
|
+
* @returns Promise<bigint> - Remaining rate limit capacity
|
|
339
|
+
*/
|
|
340
|
+
rateLimitCapacity(eid: number, inbound: boolean): Promise<bigint>;
|
|
341
|
+
/**
|
|
342
|
+
* Combine enforced options with extra options
|
|
343
|
+
* @param tx - The transaction to add the move call to
|
|
344
|
+
* @param eid - Endpoint ID
|
|
345
|
+
* @param msgType - Message type
|
|
346
|
+
* @param extraOptions - Extra options to combine with enforced options
|
|
347
|
+
* @returns Transaction result containing the combined options
|
|
348
|
+
*/
|
|
349
|
+
combineOptionsMoveCall(tx: Transaction, eid: number | TransactionArgument, msgType: number | TransactionArgument, extraOptions: Uint8Array | TransactionArgument): TransactionResult;
|
|
350
|
+
/**
|
|
351
|
+
* Combine enforced options with extra options
|
|
352
|
+
* @param eid - Endpoint ID
|
|
353
|
+
* @param msgType - Message type
|
|
354
|
+
* @param extraOptions - Extra options to combine with enforced options
|
|
355
|
+
* @returns Promise<Uint8Array> - The combined options as bytes
|
|
356
|
+
*/
|
|
357
|
+
combineOptions(eid: number, msgType: number, extraOptions: Uint8Array): Promise<Uint8Array>;
|
|
358
|
+
/**
|
|
359
|
+
* Get enforced options for OFT messaging
|
|
360
|
+
* @param tx - The transaction to add the move call to
|
|
361
|
+
* @param eid - Endpoint ID
|
|
362
|
+
* @param msgType - Message type
|
|
363
|
+
* @returns Transaction result containing the enforced options
|
|
364
|
+
*/
|
|
365
|
+
getEnforcedOptionsMoveCall(tx: Transaction, eid: number | TransactionArgument, msgType: number | TransactionArgument): TransactionResult;
|
|
366
|
+
/**
|
|
367
|
+
* Get enforced options for OFT messaging
|
|
368
|
+
* @param eid - Endpoint ID
|
|
369
|
+
* @param msgType - Message type
|
|
370
|
+
* @returns Promise<Uint8Array> - The enforced options as bytes
|
|
371
|
+
*/
|
|
372
|
+
getEnforcedOptions(eid: number, msgType: number): Promise<Uint8Array>;
|
|
373
|
+
/**
|
|
374
|
+
* Check if OFT has a peer on specific endpoint
|
|
375
|
+
* @param tx - The transaction to add the move call to
|
|
376
|
+
* @param eid - Endpoint ID
|
|
377
|
+
* @returns Transaction result containing the peer existence status
|
|
378
|
+
*/
|
|
379
|
+
hasPeerMoveCall(tx: Transaction, eid: number | TransactionArgument): TransactionResult;
|
|
380
|
+
/**
|
|
381
|
+
* Check if OFT has a peer on specific endpoint
|
|
382
|
+
* @param eid - Endpoint ID
|
|
383
|
+
* @returns Promise<boolean> - True if peer exists on the endpoint
|
|
384
|
+
*/
|
|
385
|
+
hasPeer(eid: number): Promise<boolean>;
|
|
386
|
+
/**
|
|
387
|
+
* Get peer OFT address on specific endpoint
|
|
388
|
+
* @param tx - The transaction to add the move call to
|
|
389
|
+
* @param eid - Endpoint ID
|
|
390
|
+
* @returns Transaction result containing the peer address
|
|
391
|
+
*/
|
|
392
|
+
getPeerMoveCall(tx: Transaction, eid: number | TransactionArgument): TransactionResult;
|
|
393
|
+
/**
|
|
394
|
+
* Get peer OFT address on specific endpoint
|
|
395
|
+
* @param eid - Endpoint ID
|
|
396
|
+
* @returns Promise<Uint8Array> - The peer address as bytes32
|
|
397
|
+
*/
|
|
398
|
+
getPeer(eid: number): Promise<Uint8Array>;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
declare const OFTComposerRegistryErrorCode: {
|
|
402
|
+
readonly EComposeTransferNotFound: 1;
|
|
403
|
+
readonly EDepositAddressNotFound: 2;
|
|
404
|
+
};
|
|
405
|
+
/**
|
|
406
|
+
* OFT Composer Registry
|
|
407
|
+
*
|
|
408
|
+
* This class manages the registry for OFT Composer operations, including
|
|
409
|
+
* deposit addresses and compose transfer routing for cross-chain composition.
|
|
410
|
+
*/
|
|
411
|
+
declare class OFTComposerRegistry {
|
|
412
|
+
#private;
|
|
413
|
+
packageId: string;
|
|
414
|
+
readonly client: SuiClient;
|
|
415
|
+
readonly registryObjectId: string;
|
|
416
|
+
private readonly protocolSDK;
|
|
417
|
+
constructor(protocolSDK: SDK, packageId: string, registryObjectId: string);
|
|
418
|
+
/**
|
|
419
|
+
* Set deposit address for OFT composer
|
|
420
|
+
* @param tx - The transaction to add the move call to
|
|
421
|
+
* @param composerCallCap - The composer call capability transaction result
|
|
422
|
+
* @param depositAddress - The new deposit address
|
|
423
|
+
* @returns Transaction result containing the set operation
|
|
424
|
+
*/
|
|
425
|
+
setDepositAddressMoveCall(tx: Transaction, composerCallCap: string | TransactionArgument, depositAddress: string | TransactionArgument): TransactionResult;
|
|
426
|
+
/**
|
|
427
|
+
* Get deposit address for a composer
|
|
428
|
+
* @param tx - The transaction to add the move call to
|
|
429
|
+
* @param composer - The composer address
|
|
430
|
+
* @returns Transaction result containing the deposit address
|
|
431
|
+
*/
|
|
432
|
+
getDepositAddressMoveCall(tx: Transaction, composer: string | TransactionArgument): TransactionResult;
|
|
433
|
+
/**
|
|
434
|
+
* Get compose transfer object for composition operations
|
|
435
|
+
* @param tx - The transaction to add the move call to
|
|
436
|
+
* @param from - The sender address
|
|
437
|
+
* @param guid - The GUID transaction result
|
|
438
|
+
* @param composer - The composer address
|
|
439
|
+
* @returns Transaction result containing the compose transfer object
|
|
440
|
+
*/
|
|
441
|
+
getComposeTransferMoveCall(tx: Transaction, from: string | TransactionArgument, guid: Uint8Array | TransactionArgument, composer: string | TransactionArgument): TransactionResult;
|
|
442
|
+
/**
|
|
443
|
+
* Get compose transfer object address
|
|
444
|
+
* @param from - The sender address
|
|
445
|
+
* @param guid - The GUID as number array
|
|
446
|
+
* @param composer - The composer address
|
|
447
|
+
* @returns Promise<string> - The compose transfer object address
|
|
448
|
+
*/
|
|
449
|
+
getComposeTransfer(from: string, guid: Uint8Array, composer: string): Promise<string>;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* OFT PTB (Programmable Transaction Block) Builder
|
|
454
|
+
*
|
|
455
|
+
* This class provides utility functions for building programmable transactions
|
|
456
|
+
* for OFT operations, particularly for LayerZero receive operations.
|
|
457
|
+
*/
|
|
458
|
+
declare class OFTPtbBuilder {
|
|
459
|
+
packageId: string;
|
|
460
|
+
objectId: string;
|
|
461
|
+
readonly client: SuiClient;
|
|
462
|
+
readonly coinType: string;
|
|
463
|
+
readonly oftObjectId: string;
|
|
464
|
+
readonly objects: ObjectOptions;
|
|
465
|
+
constructor(protocolSDK: SDK, packageId: string, objectId: string, client: SuiClient, coinType: string, oftObjectId: string);
|
|
466
|
+
/**
|
|
467
|
+
* Get LayerZero receive information for OFT registration
|
|
468
|
+
*
|
|
469
|
+
* This function prepares the necessary metadata for registering an OFT
|
|
470
|
+
* with the LayerZero endpoint, enabling it to receive cross-chain messages.
|
|
471
|
+
*
|
|
472
|
+
* @param tx - The transaction to add the move call to
|
|
473
|
+
* @param composerRegistry - The composer registry object ID for routing compose transfers
|
|
474
|
+
* @returns TransactionResult containing serialized execution metadata for endpoint registration
|
|
475
|
+
*/
|
|
476
|
+
lzReceiveInfoMoveCall(tx: Transaction$1, composerRegistry: string | TransactionArgument$1): TransactionResult$1;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
declare const OFTLimitBcs: _mysten_sui_dist_cjs_bcs.BcsType<{
|
|
480
|
+
min_amount_ld: string;
|
|
481
|
+
max_amount_ld: string;
|
|
482
|
+
}, {
|
|
483
|
+
min_amount_ld: string | number | bigint;
|
|
484
|
+
max_amount_ld: string | number | bigint;
|
|
485
|
+
}>;
|
|
486
|
+
declare const OFTFeeDetailBcs: _mysten_sui_dist_cjs_bcs.BcsType<{
|
|
487
|
+
fee_amount_ld: string;
|
|
488
|
+
is_reward: boolean;
|
|
489
|
+
description: string;
|
|
490
|
+
}, {
|
|
491
|
+
fee_amount_ld: string | number | bigint;
|
|
492
|
+
is_reward: boolean;
|
|
493
|
+
description: string;
|
|
494
|
+
}>;
|
|
495
|
+
declare const OFTReceiptBcs: _mysten_sui_dist_cjs_bcs.BcsType<{
|
|
496
|
+
amount_sent_ld: string;
|
|
497
|
+
amount_received_ld: string;
|
|
498
|
+
}, {
|
|
499
|
+
amount_sent_ld: string | number | bigint;
|
|
500
|
+
amount_received_ld: string | number | bigint;
|
|
501
|
+
}>;
|
|
502
|
+
declare function parseOFTLimit(data: Uint8Array): OFTLimit;
|
|
503
|
+
declare function parseOFTFeeDetails(data: Uint8Array): OFTFeeDetail[];
|
|
504
|
+
declare function parseOFTReceipt(data: Uint8Array): OFTReceipt;
|
|
505
|
+
|
|
506
|
+
export { OFT, OFTComposerRegistry, OFTComposerRegistryErrorCode, OFTErrorCode, type OFTFeeDetail, OFTFeeDetailBcs, type OFTLimit, OFTLimitBcs, OFTMsgType, OFTPtbBuilder, type OFTReceipt, OFTReceiptBcs, type SendParam, parseOFTFeeDetails, parseOFTLimit, parseOFTReceipt };
|