@layerzerolabs/lz-iotal1-oft-sdk-v2 3.0.143
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +95 -0
- package/dist/index.cjs +1326 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +619 -0
- package/dist/index.d.ts +619 -0
- package/dist/index.mjs +1312 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +58 -0
- package/src/bcs/oft.ts +70 -0
- package/src/index.ts +7 -0
- package/src/modules/oft-composer-manager.ts +128 -0
- package/src/modules/oft.ts +1464 -0
- package/src/types.ts +36 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,619 @@
|
|
|
1
|
+
import { IotaClient } from '@iota/iota-sdk/client';
|
|
2
|
+
import { Transaction, TransactionArgument, TransactionResult } from '@iota/iota-sdk/transactions';
|
|
3
|
+
import { SDK, IPTBValidator, MessagingFee } from '@layerzerolabs/lz-iotal1-sdk-v2';
|
|
4
|
+
import * as _iota_iota_sdk_dist_cjs_bcs from '@iota/iota-sdk/dist/cjs/bcs';
|
|
5
|
+
|
|
6
|
+
declare const OFTMsgType: {
|
|
7
|
+
readonly SEND: 1;
|
|
8
|
+
readonly SEND_AND_CALL: 2;
|
|
9
|
+
};
|
|
10
|
+
interface SendParam {
|
|
11
|
+
dstEid: number;
|
|
12
|
+
to: Uint8Array;
|
|
13
|
+
amountLd: bigint;
|
|
14
|
+
minAmountLd: bigint;
|
|
15
|
+
extraOptions: Uint8Array;
|
|
16
|
+
composeMsg: Uint8Array;
|
|
17
|
+
oftCmd: Uint8Array;
|
|
18
|
+
}
|
|
19
|
+
interface OFTLimit {
|
|
20
|
+
minAmountLd: bigint;
|
|
21
|
+
maxAmountLd: bigint;
|
|
22
|
+
}
|
|
23
|
+
interface OFTFeeDetail {
|
|
24
|
+
feeAmountLd: bigint;
|
|
25
|
+
description: string;
|
|
26
|
+
}
|
|
27
|
+
interface OFTReceipt {
|
|
28
|
+
amountSentLd: bigint;
|
|
29
|
+
amountReceivedLd: bigint;
|
|
30
|
+
}
|
|
31
|
+
interface OFTInfoV1 {
|
|
32
|
+
oftPackage: string;
|
|
33
|
+
oftObject: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare const OFTErrorCode: {
|
|
37
|
+
readonly EComposeMsgNotAllowed: 1;
|
|
38
|
+
readonly EComposeMsgRequired: 2;
|
|
39
|
+
readonly EInsufficientBalance: 3;
|
|
40
|
+
readonly EInvalidAdminCap: 4;
|
|
41
|
+
readonly EInvalidComposeQueue: 5;
|
|
42
|
+
readonly EInvalidLocalDecimals: 6;
|
|
43
|
+
readonly EInvalidMigrationCap: 7;
|
|
44
|
+
readonly EInvalidSendContext: 8;
|
|
45
|
+
readonly ESlippageExceeded: 9;
|
|
46
|
+
readonly EWrongPackageVersion: 10;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* OFT (Omnichain Fungible Token) Class
|
|
50
|
+
*
|
|
51
|
+
* The OFT class provides a comprehensive interface for interacting with LayerZero's
|
|
52
|
+
* Omnichain Fungible Token standard on the Iota blockchain. OFTs enable seamless
|
|
53
|
+
* cross-chain token transfers while maintaining fungibility across multiple networks.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* // Initialize OFT instance
|
|
58
|
+
* const oft = new OFT(protocolSDK, oftCallCapId);
|
|
59
|
+
*
|
|
60
|
+
* // Send tokens cross-chain
|
|
61
|
+
* const tx = new Transaction();
|
|
62
|
+
* const coin = await oft.splitCoinMoveCall(tx, sender, amount);
|
|
63
|
+
* await oft.sendMoveCall(tx, sender, sendParam, coin, nativeFee, zroFee, refundAddress);
|
|
64
|
+
* tx.transferObjects([coin], sender);
|
|
65
|
+
* ...
|
|
66
|
+
*
|
|
67
|
+
* // Quote transfer fees
|
|
68
|
+
* const fees = await oft.quoteSend(sender, sendParam, payInZro);
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
declare class OFT {
|
|
72
|
+
#private;
|
|
73
|
+
/** Iota client for blockchain interactions */
|
|
74
|
+
readonly client: IotaClient;
|
|
75
|
+
/** The OFTCallCap ID */
|
|
76
|
+
readonly oftCallCapId: string;
|
|
77
|
+
/** The package ID of the OFT */
|
|
78
|
+
private oftPackageId?;
|
|
79
|
+
/** LayerZero protocol object references (endpoint, messaging channels, etc.) */
|
|
80
|
+
private readonly objects;
|
|
81
|
+
/** The unique object ID of this OFT instance on Iota */
|
|
82
|
+
private oftObjectId?;
|
|
83
|
+
/** Admin capability object ID for privileged operations (retrieved dynamically when needed) */
|
|
84
|
+
private adminCapId?;
|
|
85
|
+
/** The Iota coin type this OFT represents (e.g., "0x123::mycoin::MYCOIN") */
|
|
86
|
+
private coinType?;
|
|
87
|
+
/** The unique object ID of the associated OApp instance on Iota */
|
|
88
|
+
private oappObjectId?;
|
|
89
|
+
/** Reference to the LayerZero protocol SDK for cross-chain operations */
|
|
90
|
+
private readonly protocolSDK;
|
|
91
|
+
/** The OFTInfoV1 structure */
|
|
92
|
+
private oftInfo?;
|
|
93
|
+
/**
|
|
94
|
+
* Creates a new OFT instance for interacting with an Omnichain Fungible Token
|
|
95
|
+
*
|
|
96
|
+
* @param protocolSDK - The LayerZero protocol SDK instance providing core cross-chain functionality
|
|
97
|
+
* @param oftCallCapId - The OFT call capability ID used for OFT operations and accessing OFT information
|
|
98
|
+
* @param oftObjectId - Optional OFT object ID on Iota blockchain for direct OFT instance access
|
|
99
|
+
* @param coinType - Optional Iota coin type string (e.g., "0x123::mycoin::MYCOIN") that this OFT represents
|
|
100
|
+
* @param oappObjectId - Optional associated OApp object ID for cross-chain messaging operations
|
|
101
|
+
* @param adminCapId - Optional admin capability object ID for privileged operations
|
|
102
|
+
*/
|
|
103
|
+
constructor(protocolSDK: SDK, oftCallCapId: string, oftObjectId?: string, coinType?: string, oappObjectId?: string, // the associated oapp object id
|
|
104
|
+
adminCapId?: string);
|
|
105
|
+
/**
|
|
106
|
+
* Updates the associated OApp object ID
|
|
107
|
+
* @param oappObjectId - The new OApp object ID
|
|
108
|
+
*/
|
|
109
|
+
setOappObjectId(oappObjectId: string): void;
|
|
110
|
+
/**
|
|
111
|
+
* Initialize an OFT instance with a treasury capability
|
|
112
|
+
* Creates a new OFT that mints its own tokens
|
|
113
|
+
* @param tx - The transaction to add the move call to
|
|
114
|
+
* @param coinType - The Iota coin type string (e.g., "0x123::mycoin::MYCOIN")
|
|
115
|
+
* @param ticket - The OFTCreationTicket object ID or TransactionArgument
|
|
116
|
+
* @param oapp - The OApp object ID or TransactionArgument
|
|
117
|
+
* @param treasury - The TreasuryCap object ID or TransactionArgument for the coin type
|
|
118
|
+
* @param metadata - The CoinMetadata object ID or TransactionArgument for the coin type
|
|
119
|
+
* @param sharedDecimals - Number of decimals to use for cross-chain operations
|
|
120
|
+
* @returns TransactionResult array containing [AdminCap, MigrationCap] - MigrationCap must be transferred or stored
|
|
121
|
+
*/
|
|
122
|
+
initOftMoveCall(tx: Transaction, coinType: string, ticket: string | TransactionArgument, oapp: string | TransactionArgument, treasury: string | TransactionArgument, metadata: string | TransactionArgument, sharedDecimals: number | TransactionArgument): TransactionResult;
|
|
123
|
+
/**
|
|
124
|
+
* Initialize an OFT adapter instance
|
|
125
|
+
* Creates an OFT adapter that wraps an existing coin type
|
|
126
|
+
* @param tx - The transaction to add the move call to
|
|
127
|
+
* @param coinType - The Iota coin type string (e.g., "0x123::mycoin::MYCOIN")
|
|
128
|
+
* @param ticket - The OFTCreationTicket object ID or TransactionArgument
|
|
129
|
+
* @param oapp - The OApp object ID or TransactionArgument
|
|
130
|
+
* @param metadata - The CoinMetadata object ID or TransactionArgument for the coin type
|
|
131
|
+
* @param sharedDecimals - Number of decimals to use for cross-chain operations
|
|
132
|
+
* @returns TransactionResult array containing [AdminCap, MigrationCap] - MigrationCap must be transferred or stored
|
|
133
|
+
*/
|
|
134
|
+
initOftAdapterMoveCall(tx: Transaction, coinType: string, ticket: string | TransactionArgument, oapp: string | TransactionArgument, metadata: string | TransactionArgument, sharedDecimals: number | TransactionArgument): TransactionResult;
|
|
135
|
+
/**
|
|
136
|
+
* Get LayerZero receive information for OFT registration
|
|
137
|
+
*
|
|
138
|
+
* This function prepares the necessary metadata for registering an OFT
|
|
139
|
+
* with the LayerZero endpoint, enabling it to receive cross-chain messages.
|
|
140
|
+
*
|
|
141
|
+
* @param tx - The transaction to add the move call to
|
|
142
|
+
* @param composerManager - The composer manager object ID for routing compose transfers
|
|
143
|
+
* @returns TransactionResult containing serialized execution metadata for endpoint registration
|
|
144
|
+
*/
|
|
145
|
+
lzReceiveInfoMoveCall(tx: Transaction, composerManager: string | TransactionArgument): Promise<TransactionResult>;
|
|
146
|
+
/**
|
|
147
|
+
* Register OFT as an OApp with LayerZero endpoint
|
|
148
|
+
* @param tx - The transaction to add the move call to
|
|
149
|
+
* @param coinType - The Iota coin type string (e.g., "0x123::mycoin::MYCOIN")
|
|
150
|
+
* @param oftObjectId - The OFT object ID
|
|
151
|
+
* @param oappObjectId - The OApp object ID
|
|
152
|
+
* @param composerManager - The composer manager object ID or TransactionArgument
|
|
153
|
+
* @param lzReceiveInfo - Optional LayerZero receive info as Uint8Array or TransactionArgument
|
|
154
|
+
*/
|
|
155
|
+
registerOAppMoveCall(tx: Transaction, coinType: string, oftObjectId: string, oappObjectId: string, composerManager: string | TransactionArgument, lzReceiveInfo?: Uint8Array | TransactionArgument): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* Set pause state for OFT operations
|
|
158
|
+
* @param tx - The transaction to add the move call to
|
|
159
|
+
* @param pause - Whether to pause or unpause operations
|
|
160
|
+
*/
|
|
161
|
+
setPauseMoveCall(tx: Transaction, pause: boolean | TransactionArgument): Promise<void>;
|
|
162
|
+
/**
|
|
163
|
+
* Set fee deposit address for OFT fees
|
|
164
|
+
* @param tx - The transaction to add the move call to
|
|
165
|
+
* @param feeDepositAddress - The new fee deposit address
|
|
166
|
+
*/
|
|
167
|
+
setFeeDepositAddressMoveCall(tx: Transaction, feeDepositAddress: string | TransactionArgument): Promise<void>;
|
|
168
|
+
/**
|
|
169
|
+
* Set default fee basis points for OFT transfers
|
|
170
|
+
* @param tx - The transaction to add the move call to
|
|
171
|
+
* @param feeBps - Default fee rate in basis points (0-10,000, where 10,000 = 100%)
|
|
172
|
+
*/
|
|
173
|
+
setDefaultFeeBpsMoveCall(tx: Transaction, feeBps: bigint | number | string | TransactionArgument): Promise<void>;
|
|
174
|
+
/**
|
|
175
|
+
* Set fee basis points for a specific destination chain
|
|
176
|
+
* @param tx - The transaction to add the move call to
|
|
177
|
+
* @param dstEid - Destination endpoint ID
|
|
178
|
+
* @param feeBps - Fee rate in basis points (0-10,000, where 10,000 = 100%)
|
|
179
|
+
*/
|
|
180
|
+
setFeeBpsMoveCall(tx: Transaction, dstEid: number | TransactionArgument, feeBps: bigint | number | string | TransactionArgument): Promise<void>;
|
|
181
|
+
/**
|
|
182
|
+
* Removes the fee rate for a specific destination chain
|
|
183
|
+
* @param tx - The transaction to add the move call to
|
|
184
|
+
* @param dstEid - Destination endpoint ID
|
|
185
|
+
*/
|
|
186
|
+
unsetFeeBpsMoveCall(tx: Transaction, dstEid: number | TransactionArgument): Promise<void>;
|
|
187
|
+
/**
|
|
188
|
+
* Migrate OFT instance to a new contract
|
|
189
|
+
* @param tx - The transaction to add the move call to
|
|
190
|
+
* @param migrationCap - Migration capability object ID or transaction argument
|
|
191
|
+
* @returns TransactionResult containing the migration ticket
|
|
192
|
+
*/
|
|
193
|
+
migrateMoveCall(tx: Transaction, migrationCap: string | TransactionArgument): Promise<TransactionResult>;
|
|
194
|
+
/**
|
|
195
|
+
* Set rate limit for OFT transfers
|
|
196
|
+
* @param tx - The transaction to add the move call to
|
|
197
|
+
* @param eid - Endpoint ID
|
|
198
|
+
* @param inbound - Whether this is for inbound or outbound transfers
|
|
199
|
+
* @param rateLimit - Rate limit amount
|
|
200
|
+
* @param windowSeconds - Time window in seconds
|
|
201
|
+
*/
|
|
202
|
+
setRateLimitMoveCall(tx: Transaction, eid: number | TransactionArgument, inbound: boolean | TransactionArgument, rateLimit: bigint | number | string | TransactionArgument, windowSeconds: bigint | number | string | TransactionArgument): Promise<void>;
|
|
203
|
+
/**
|
|
204
|
+
* Remove rate limit for OFT transfers
|
|
205
|
+
* @param tx - The transaction to add the move call to
|
|
206
|
+
* @param eid - Endpoint ID
|
|
207
|
+
* @param inbound - Whether this is for inbound or outbound transfers
|
|
208
|
+
*/
|
|
209
|
+
unsetRateLimitMoveCall(tx: Transaction, eid: number | TransactionArgument, inbound: boolean | TransactionArgument): Promise<void>;
|
|
210
|
+
/**
|
|
211
|
+
* Splits specified amount of coins from user's wallet
|
|
212
|
+
* @param tx - The transaction to add the move call to
|
|
213
|
+
* @param owner - Address of the user whose coins to split
|
|
214
|
+
* @param amount - Amount of coins to split (in smallest units)
|
|
215
|
+
* @param limit - Maximum total number of coins to collect across all pages (default: 200)
|
|
216
|
+
* @param pageSize - Maximum number of coins to fetch per page (default: 50)
|
|
217
|
+
* @returns Promise resolving to split coin as TransactionResult
|
|
218
|
+
* @throws Error if insufficient coins balance or no coins found
|
|
219
|
+
*/
|
|
220
|
+
splitCoinMoveCall(tx: Transaction, owner: string, amount: bigint, limit?: number, pageSize?: number): Promise<TransactionResult>;
|
|
221
|
+
/**
|
|
222
|
+
* Send OFT tokens to destination chain
|
|
223
|
+
* @param tx - The transaction to add the move call to
|
|
224
|
+
* @param sender - Sender address for ZRO token operations
|
|
225
|
+
* @param sendParam - Send parameters including destination and amounts
|
|
226
|
+
* @param coinProvided - Coin object ID or transaction result to send
|
|
227
|
+
* @param nativeFee - Native token fee amount
|
|
228
|
+
* @param zroFee - ZRO token fee amount
|
|
229
|
+
* @param refundAddress - Address for fee refunds
|
|
230
|
+
* @param validators - Optional PTB validators for transaction validation
|
|
231
|
+
* @param maxSimulationTimes - Optional maximum number of simulation attempts
|
|
232
|
+
* @returns Promise<void> - Completes when the send operation is processed
|
|
233
|
+
*/
|
|
234
|
+
sendMoveCall(tx: Transaction, sender: string, sendParam: SendParam | TransactionArgument, coinProvided: string | TransactionArgument, nativeFee: bigint | TransactionArgument, zroFee: bigint | TransactionArgument, refundAddress: string | TransactionArgument, validators?: IPTBValidator[], maxSimulationTimes?: number): Promise<void>;
|
|
235
|
+
/**
|
|
236
|
+
* Process inbound cross-chain token transfers
|
|
237
|
+
* @param tx - The transaction to add the move call to
|
|
238
|
+
* @param call - LayerZero receive call containing the verified cross-chain message
|
|
239
|
+
* @returns TransactionResult containing the processed transfer
|
|
240
|
+
*/
|
|
241
|
+
lzReceiveMoveCall(tx: Transaction, call: string | TransactionArgument): Promise<TransactionResult>;
|
|
242
|
+
/**
|
|
243
|
+
* Process inbound cross-chain token transfers with compose functionality
|
|
244
|
+
* @param tx - The transaction to add the move call to
|
|
245
|
+
* @param composeQueue - The composer's message queue for sequencing operations
|
|
246
|
+
* @param composerManager - Manager managing token deposits for composers
|
|
247
|
+
* @param call - LayerZero receive call containing the verified cross-chain message
|
|
248
|
+
* @returns TransactionResult containing the processed transfer
|
|
249
|
+
*/
|
|
250
|
+
lzReceiveWithComposeMoveCall(tx: Transaction, composeQueue: string | TransactionArgument, composerManager: string | TransactionArgument, call: string | TransactionArgument): Promise<TransactionResult>;
|
|
251
|
+
/**
|
|
252
|
+
* Confirms and extracts results from a quote operation
|
|
253
|
+
* @param tx - The transaction to add the move call to
|
|
254
|
+
* @param call - Completed Call object from quote_send() execution
|
|
255
|
+
* @returns TransactionResult containing the messaging fee
|
|
256
|
+
*/
|
|
257
|
+
confirmQuoteSendMoveCall(tx: Transaction, call: string | TransactionArgument): Promise<TransactionResult>;
|
|
258
|
+
/**
|
|
259
|
+
* Quote OFT sending operation with detailed fee breakdown
|
|
260
|
+
* @param sendParam - Send parameters for the OFT operation
|
|
261
|
+
* @returns Promise with limit, fee details, and receipt information
|
|
262
|
+
*/
|
|
263
|
+
quoteOft(sendParam: SendParam | TransactionArgument): Promise<{
|
|
264
|
+
limit: OFTLimit;
|
|
265
|
+
feeDetails: OFTFeeDetail[];
|
|
266
|
+
receipt: OFTReceipt;
|
|
267
|
+
}>;
|
|
268
|
+
/**
|
|
269
|
+
* Quote messaging fees for OFT sending
|
|
270
|
+
* @param sender - Sender address
|
|
271
|
+
* @param sendParam - Send parameters for the OFT operation
|
|
272
|
+
* @param payInZro - Whether to pay in ZRO tokens
|
|
273
|
+
* @param validators - Optional PTB validators for transaction validation
|
|
274
|
+
* @param maxSimulationTimes - Optional maximum number of simulation attempts
|
|
275
|
+
* @returns Promise<MessagingFee> - The calculated messaging fees
|
|
276
|
+
*/
|
|
277
|
+
quoteSend(sender: string, sendParam: SendParam | TransactionArgument, payInZro: boolean | TransactionArgument, validators?: IPTBValidator[], maxSimulationTimes?: number): Promise<MessagingFee>;
|
|
278
|
+
/**
|
|
279
|
+
* Get the upgrade version of this OFT instance
|
|
280
|
+
* @param tx - The transaction to add the move call to
|
|
281
|
+
* @returns Transaction result containing the upgrade version
|
|
282
|
+
*/
|
|
283
|
+
upgradeVersionMoveCall(tx: Transaction): Promise<TransactionResult>;
|
|
284
|
+
/**
|
|
285
|
+
* Get the upgrade version of this OFT instance
|
|
286
|
+
* @returns Promise<bigint> - The upgrade version
|
|
287
|
+
*/
|
|
288
|
+
upgradeVersion(): Promise<bigint>;
|
|
289
|
+
/**
|
|
290
|
+
* Get the associated OApp object address
|
|
291
|
+
* @param tx - The transaction to add the move call to
|
|
292
|
+
* @returns Transaction result containing the OApp object address
|
|
293
|
+
*/
|
|
294
|
+
oappObjectMoveCall(tx: Transaction): Promise<TransactionResult>;
|
|
295
|
+
/**
|
|
296
|
+
* Get the associated OApp object address
|
|
297
|
+
* @returns Promise<string> - The OApp object address
|
|
298
|
+
*/
|
|
299
|
+
oappObject(): Promise<string>;
|
|
300
|
+
/**
|
|
301
|
+
* Get OFT version information
|
|
302
|
+
* @param tx - The transaction to add the move call to
|
|
303
|
+
* @returns Transaction result containing version information
|
|
304
|
+
*/
|
|
305
|
+
oftVersionMoveCall(tx: Transaction): Promise<TransactionResult>;
|
|
306
|
+
/**
|
|
307
|
+
* Get OFT version information
|
|
308
|
+
* @returns Promise<{ major: number; minor: number }> - The OFT version
|
|
309
|
+
*/
|
|
310
|
+
oftVersion(): Promise<{
|
|
311
|
+
major: number;
|
|
312
|
+
minor: number;
|
|
313
|
+
}>;
|
|
314
|
+
/**
|
|
315
|
+
* Get the OFT capability ID
|
|
316
|
+
* @param tx - The transaction to add the move call to
|
|
317
|
+
* @returns Transaction result containing the OFT capability ID
|
|
318
|
+
*/
|
|
319
|
+
oftCapIdMoveCall(tx: Transaction): Promise<TransactionResult>;
|
|
320
|
+
/**
|
|
321
|
+
* Get the OFT capability ID
|
|
322
|
+
* @returns Promise<string> - The OFT capability ID
|
|
323
|
+
*/
|
|
324
|
+
oftCapId(): Promise<string>;
|
|
325
|
+
/**
|
|
326
|
+
* Get the migration capability address for this OFT
|
|
327
|
+
* @param tx - The transaction to add the move call to
|
|
328
|
+
* @returns Transaction result containing the migration capability address
|
|
329
|
+
*/
|
|
330
|
+
migrationCapMoveCall(tx: Transaction): Promise<TransactionResult>;
|
|
331
|
+
/**
|
|
332
|
+
* Get the migration capability address for this OFT
|
|
333
|
+
* @returns Promise<string> - The migration capability address
|
|
334
|
+
*/
|
|
335
|
+
migrationCap(): Promise<string>;
|
|
336
|
+
messagingChannel(): Promise<string>;
|
|
337
|
+
/**
|
|
338
|
+
* Get coin metadata address
|
|
339
|
+
* @param tx - The transaction to add the move call to
|
|
340
|
+
* @returns Transaction result containing coin metadata address
|
|
341
|
+
*/
|
|
342
|
+
coinMetadataMoveCall(tx: Transaction): Promise<TransactionResult>;
|
|
343
|
+
/**
|
|
344
|
+
* Get coin metadata address
|
|
345
|
+
* @returns Promise<string> - The coin metadata address
|
|
346
|
+
*/
|
|
347
|
+
coinMetadata(): Promise<string>;
|
|
348
|
+
/**
|
|
349
|
+
* Get OFT admin capability address
|
|
350
|
+
* @param tx - The transaction to add the move call to
|
|
351
|
+
* @returns Transaction result containing the admin capability address
|
|
352
|
+
*/
|
|
353
|
+
adminCapMoveCall(tx: Transaction): Promise<TransactionResult>;
|
|
354
|
+
/**
|
|
355
|
+
* Get OFT admin capability address
|
|
356
|
+
* @returns Promise<string> - The admin capability address
|
|
357
|
+
*/
|
|
358
|
+
adminCap(): Promise<string>;
|
|
359
|
+
/**
|
|
360
|
+
* Get shared decimals for cross-chain compatibility
|
|
361
|
+
* @param tx - The transaction to add the move call to
|
|
362
|
+
* @returns Transaction result containing shared decimals
|
|
363
|
+
*/
|
|
364
|
+
sharedDecimalsMoveCall(tx: Transaction): Promise<TransactionResult>;
|
|
365
|
+
/**
|
|
366
|
+
* Get shared decimals for cross-chain compatibility
|
|
367
|
+
* @returns Promise<number> - The shared decimal precision
|
|
368
|
+
*/
|
|
369
|
+
sharedDecimals(): Promise<number>;
|
|
370
|
+
/**
|
|
371
|
+
* Get the decimal conversion rate for this OFT
|
|
372
|
+
* @param tx - The transaction to add the move call to
|
|
373
|
+
* @returns Transaction result containing the decimal conversion rate
|
|
374
|
+
*/
|
|
375
|
+
decimalConversionRateMoveCall(tx: Transaction): Promise<TransactionResult>;
|
|
376
|
+
/**
|
|
377
|
+
* Get the decimal conversion rate for this OFT
|
|
378
|
+
* @returns Promise<bigint> - The decimal conversion rate multiplier
|
|
379
|
+
*/
|
|
380
|
+
decimalConversionRate(): Promise<bigint>;
|
|
381
|
+
/**
|
|
382
|
+
* Check if OFT is paused
|
|
383
|
+
* @param tx - The transaction to add the move call to
|
|
384
|
+
* @returns Transaction result containing the paused status
|
|
385
|
+
*/
|
|
386
|
+
isPausedMoveCall(tx: Transaction): Promise<TransactionResult>;
|
|
387
|
+
/**
|
|
388
|
+
* Check if OFT is paused
|
|
389
|
+
* @returns Promise<boolean> - True if OFT is paused
|
|
390
|
+
*/
|
|
391
|
+
isPaused(): Promise<boolean>;
|
|
392
|
+
/**
|
|
393
|
+
* Check if this OFT is an adapter (wraps existing token)
|
|
394
|
+
* @param tx - The transaction to add the move call to
|
|
395
|
+
* @returns Transaction result containing the adapter status
|
|
396
|
+
*/
|
|
397
|
+
isAdapterMoveCall(tx: Transaction): Promise<TransactionResult>;
|
|
398
|
+
/**
|
|
399
|
+
* Check if this OFT is an adapter (wraps existing token)
|
|
400
|
+
* @returns Promise<boolean> - True if this is an OFT adapter
|
|
401
|
+
*/
|
|
402
|
+
isAdapter(): Promise<boolean>;
|
|
403
|
+
/**
|
|
404
|
+
* Decode OFTInfoV1 from encoded bytes
|
|
405
|
+
* @param tx - The transaction to add the move call to
|
|
406
|
+
* @param encodedBytes - The encoded OFTInfoV1 bytes to decode
|
|
407
|
+
* @returns Transaction result containing the decoded OFTInfoV1
|
|
408
|
+
*/
|
|
409
|
+
decodeOftInfoV1MoveCall(tx: Transaction, encodedBytes: Uint8Array | TransactionArgument): TransactionResult;
|
|
410
|
+
/**
|
|
411
|
+
* Decode OFTInfoV1 from encoded bytes
|
|
412
|
+
* @param encodedBytes - The encoded OFTInfoV1 bytes to decode
|
|
413
|
+
* @returns Promise<OFTInfoV1> - The decoded OFTInfoV1 structure
|
|
414
|
+
*/
|
|
415
|
+
decodeOftInfoV1(encodedBytes: Uint8Array): Promise<OFTInfoV1>;
|
|
416
|
+
/**
|
|
417
|
+
* Check if the OFT has a fee rate greater than 0 for the specified destination
|
|
418
|
+
* @param tx - The transaction to add the move call to
|
|
419
|
+
* @param dstEid - Destination endpoint ID
|
|
420
|
+
* @returns Transaction result containing whether fee exists
|
|
421
|
+
*/
|
|
422
|
+
hasOftFeeMoveCall(tx: Transaction, dstEid: number | TransactionArgument): Promise<TransactionResult>;
|
|
423
|
+
/**
|
|
424
|
+
* Check if the OFT has a fee rate greater than 0 for the specified destination
|
|
425
|
+
* @param dstEid - Destination endpoint ID
|
|
426
|
+
* @returns Promise<boolean> - True if fee exists
|
|
427
|
+
*/
|
|
428
|
+
hasOftFee(dstEid: number): Promise<boolean>;
|
|
429
|
+
/**
|
|
430
|
+
* Get the effective fee rate for a specific destination chain
|
|
431
|
+
* @param tx - The transaction to add the move call to
|
|
432
|
+
* @param dstEid - Destination endpoint ID
|
|
433
|
+
* @returns Transaction result containing the effective fee basis points
|
|
434
|
+
*/
|
|
435
|
+
effectiveFeeBpsMoveCall(tx: Transaction, dstEid: number | TransactionArgument): Promise<TransactionResult>;
|
|
436
|
+
/**
|
|
437
|
+
* Get the effective fee rate for a specific destination chain
|
|
438
|
+
* @param dstEid - Destination endpoint ID
|
|
439
|
+
* @returns Promise<bigint> - The effective fee in basis points
|
|
440
|
+
*/
|
|
441
|
+
effectiveFeeBps(dstEid: number): Promise<bigint>;
|
|
442
|
+
/**
|
|
443
|
+
* Get the default fee rate
|
|
444
|
+
* @param tx - The transaction to add the move call to
|
|
445
|
+
* @returns Transaction result containing the default fee basis points
|
|
446
|
+
*/
|
|
447
|
+
defaultFeeBpsMoveCall(tx: Transaction): Promise<TransactionResult>;
|
|
448
|
+
/**
|
|
449
|
+
* Get the default fee rate
|
|
450
|
+
* @returns Promise<bigint> - The default fee in basis points
|
|
451
|
+
*/
|
|
452
|
+
defaultFeeBps(): Promise<bigint>;
|
|
453
|
+
/**
|
|
454
|
+
* Get fee basis points for a specific destination chain
|
|
455
|
+
* @param tx - The transaction to add the move call to
|
|
456
|
+
* @param dstEid - Destination endpoint ID
|
|
457
|
+
* @returns Transaction result containing the fee basis points
|
|
458
|
+
*/
|
|
459
|
+
feeBpsMoveCall(tx: Transaction, dstEid: number | TransactionArgument): Promise<TransactionResult>;
|
|
460
|
+
/**
|
|
461
|
+
* Get fee basis points for a specific destination chain
|
|
462
|
+
* @param dstEid - Destination endpoint ID
|
|
463
|
+
* @returns Promise<bigint> - The fee in basis points
|
|
464
|
+
*/
|
|
465
|
+
feeBps(dstEid: number): Promise<bigint>;
|
|
466
|
+
/**
|
|
467
|
+
* Get fee deposit address for OFT
|
|
468
|
+
* @param tx - The transaction to add the move call to
|
|
469
|
+
* @returns Transaction result containing the fee deposit address
|
|
470
|
+
*/
|
|
471
|
+
feeDepositAddressMoveCall(tx: Transaction): Promise<TransactionResult>;
|
|
472
|
+
/**
|
|
473
|
+
* Get fee deposit address for OFT
|
|
474
|
+
* @returns Promise<string> - The fee deposit address
|
|
475
|
+
*/
|
|
476
|
+
feeDepositAddress(): Promise<string>;
|
|
477
|
+
/**
|
|
478
|
+
* Get rate limit configuration for an endpoint
|
|
479
|
+
* @param tx - The transaction to add the move call to
|
|
480
|
+
* @param eid - Endpoint ID
|
|
481
|
+
* @param inbound - Whether this is for inbound or outbound transfers
|
|
482
|
+
* @returns Transaction result containing rate limit configuration
|
|
483
|
+
*/
|
|
484
|
+
rateLimitConfigMoveCall(tx: Transaction, eid: number | TransactionArgument, inbound: boolean | TransactionArgument): Promise<TransactionResult>;
|
|
485
|
+
/**
|
|
486
|
+
* Get rate limit configuration for an endpoint
|
|
487
|
+
* @param eid - Endpoint ID
|
|
488
|
+
* @param inbound - Whether this is for inbound or outbound transfers
|
|
489
|
+
* @returns Promise<{ limit: bigint; windowSeconds: bigint }> - Rate limit configuration
|
|
490
|
+
*/
|
|
491
|
+
rateLimitConfig(eid: number, inbound: boolean): Promise<{
|
|
492
|
+
limit: bigint;
|
|
493
|
+
windowSeconds: bigint;
|
|
494
|
+
}>;
|
|
495
|
+
/**
|
|
496
|
+
* Get current in-flight amount for rate limiting
|
|
497
|
+
* @param tx - The transaction to add the move call to
|
|
498
|
+
* @param eid - Endpoint ID
|
|
499
|
+
* @param inbound - Whether this is for inbound or outbound transfers
|
|
500
|
+
* @returns Transaction result containing in-flight amount
|
|
501
|
+
*/
|
|
502
|
+
rateLimitInFlightMoveCall(tx: Transaction, eid: number | TransactionArgument, inbound: boolean | TransactionArgument): Promise<TransactionResult>;
|
|
503
|
+
/**
|
|
504
|
+
* Get current in-flight amount for rate limiting
|
|
505
|
+
* @param eid - Endpoint ID
|
|
506
|
+
* @param inbound - Whether this is for inbound or outbound transfers
|
|
507
|
+
* @returns Promise<bigint> - Current in-flight amount
|
|
508
|
+
*/
|
|
509
|
+
rateLimitInFlight(eid: number, inbound: boolean): Promise<bigint>;
|
|
510
|
+
/**
|
|
511
|
+
* Get rate limit capacity (remaining available amount)
|
|
512
|
+
* @param tx - The transaction to add the move call to
|
|
513
|
+
* @param eid - Endpoint ID
|
|
514
|
+
* @param inbound - Whether this is for inbound or outbound transfers
|
|
515
|
+
* @returns Transaction result containing rate limit capacity
|
|
516
|
+
*/
|
|
517
|
+
rateLimitCapacityMoveCall(tx: Transaction, eid: number | TransactionArgument, inbound: boolean | TransactionArgument): Promise<TransactionResult>;
|
|
518
|
+
/**
|
|
519
|
+
* Get rate limit capacity (remaining available amount)
|
|
520
|
+
* @param eid - Endpoint ID
|
|
521
|
+
* @param inbound - Whether this is for inbound or outbound transfers
|
|
522
|
+
* @returns Promise<bigint> - Remaining rate limit capacity
|
|
523
|
+
*/
|
|
524
|
+
rateLimitCapacity(eid: number, inbound: boolean): Promise<bigint>;
|
|
525
|
+
/**
|
|
526
|
+
* Create a transaction sender object for OFT operations
|
|
527
|
+
* @param tx - The transaction to add the move call to
|
|
528
|
+
* @returns Transaction result containing the transaction sender object
|
|
529
|
+
*/
|
|
530
|
+
txSenderMoveCall(tx: Transaction): Promise<TransactionResult>;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
declare const OFTComposerManagerErrorCode: {
|
|
534
|
+
readonly EComposeTransferNotFound: 1;
|
|
535
|
+
readonly EDepositAddressNotFound: 2;
|
|
536
|
+
};
|
|
537
|
+
/**
|
|
538
|
+
* OFT Composer Manager
|
|
539
|
+
*
|
|
540
|
+
* This class manages the registry for OFT Composer operations, including
|
|
541
|
+
* deposit addresses and compose transfer routing for cross-chain composition.
|
|
542
|
+
*/
|
|
543
|
+
declare class OFTComposerManager {
|
|
544
|
+
#private;
|
|
545
|
+
packageId: string;
|
|
546
|
+
readonly client: IotaClient;
|
|
547
|
+
readonly registryObjectId: string;
|
|
548
|
+
private readonly protocolSDK;
|
|
549
|
+
constructor(protocolSDK: SDK, packageId: string, registryObjectId: string);
|
|
550
|
+
/**
|
|
551
|
+
* Set deposit address for OFT composer
|
|
552
|
+
* @param tx - The transaction to add the move call to
|
|
553
|
+
* @param composerCallCap - The composer call capability transaction result
|
|
554
|
+
* @param depositAddress - The new deposit address
|
|
555
|
+
* @returns Transaction result containing the set operation
|
|
556
|
+
*/
|
|
557
|
+
setDepositAddressMoveCall(tx: Transaction, composerCallCap: string | TransactionArgument, depositAddress: string | TransactionArgument): TransactionResult;
|
|
558
|
+
/**
|
|
559
|
+
* Get deposit address for a composer
|
|
560
|
+
* @param tx - The transaction to add the move call to
|
|
561
|
+
* @param composer - The composer address
|
|
562
|
+
* @returns Transaction result containing the deposit address
|
|
563
|
+
*/
|
|
564
|
+
getDepositAddressMoveCall(tx: Transaction, composer: string | TransactionArgument): TransactionResult;
|
|
565
|
+
/**
|
|
566
|
+
* Get compose transfer object for composition operations
|
|
567
|
+
* @param tx - The transaction to add the move call to
|
|
568
|
+
* @param from - The sender address
|
|
569
|
+
* @param guid - The GUID transaction result
|
|
570
|
+
* @param composer - The composer address
|
|
571
|
+
* @returns Transaction result containing the compose transfer object
|
|
572
|
+
*/
|
|
573
|
+
getComposeTransferMoveCall(tx: Transaction, from: string | TransactionArgument, guid: Uint8Array | TransactionArgument, composer: string | TransactionArgument): TransactionResult;
|
|
574
|
+
/**
|
|
575
|
+
* Get compose transfer object address
|
|
576
|
+
* @param from - The sender address
|
|
577
|
+
* @param guid - The GUID as number array
|
|
578
|
+
* @param composer - The composer address
|
|
579
|
+
* @returns Promise<string> - The compose transfer object address
|
|
580
|
+
*/
|
|
581
|
+
getComposeTransfer(from: string, guid: Uint8Array, composer: string): Promise<string>;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
declare const OFTLimitBcs: _iota_iota_sdk_dist_cjs_bcs.BcsType<{
|
|
585
|
+
min_amount_ld: string;
|
|
586
|
+
max_amount_ld: string;
|
|
587
|
+
}, {
|
|
588
|
+
min_amount_ld: string | number | bigint;
|
|
589
|
+
max_amount_ld: string | number | bigint;
|
|
590
|
+
}>;
|
|
591
|
+
declare const OFTFeeDetailBcs: _iota_iota_sdk_dist_cjs_bcs.BcsType<{
|
|
592
|
+
fee_amount_ld: string;
|
|
593
|
+
is_reward: boolean;
|
|
594
|
+
description: string;
|
|
595
|
+
}, {
|
|
596
|
+
fee_amount_ld: string | number | bigint;
|
|
597
|
+
is_reward: boolean;
|
|
598
|
+
description: string;
|
|
599
|
+
}>;
|
|
600
|
+
declare const OFTReceiptBcs: _iota_iota_sdk_dist_cjs_bcs.BcsType<{
|
|
601
|
+
amount_sent_ld: string;
|
|
602
|
+
amount_received_ld: string;
|
|
603
|
+
}, {
|
|
604
|
+
amount_sent_ld: string | number | bigint;
|
|
605
|
+
amount_received_ld: string | number | bigint;
|
|
606
|
+
}>;
|
|
607
|
+
declare const OFTInfoV1Bcs: _iota_iota_sdk_dist_cjs_bcs.BcsType<{
|
|
608
|
+
oft_package: string;
|
|
609
|
+
oft_object: string;
|
|
610
|
+
}, {
|
|
611
|
+
oft_package: string | Uint8Array;
|
|
612
|
+
oft_object: string | Uint8Array;
|
|
613
|
+
}>;
|
|
614
|
+
declare function parseOFTLimit(data: Uint8Array): OFTLimit;
|
|
615
|
+
declare function parseOFTFeeDetails(data: Uint8Array): OFTFeeDetail[];
|
|
616
|
+
declare function parseOFTReceipt(data: Uint8Array): OFTReceipt;
|
|
617
|
+
declare function parseOFTInfoV1(data: Uint8Array): OFTInfoV1;
|
|
618
|
+
|
|
619
|
+
export { OFT, OFTComposerManager, OFTComposerManagerErrorCode, OFTErrorCode, type OFTFeeDetail, OFTFeeDetailBcs, type OFTInfoV1, OFTInfoV1Bcs, type OFTLimit, OFTLimitBcs, OFTMsgType, type OFTReceipt, OFTReceiptBcs, type SendParam, parseOFTFeeDetails, parseOFTInfoV1, parseOFTLimit, parseOFTReceipt };
|