@layerzerolabs/lz-sui-oft-sdk-v2 3.0.133 → 3.0.134-sui.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +412 -241
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +189 -134
- package/dist/index.d.ts +189 -134
- package/dist/index.mjs +412 -240
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/index.ts +1 -2
- package/src/modules/{oft-composer-registry.ts → oft-composer-manager.ts} +5 -5
- package/src/modules/oft.ts +449 -223
- package/src/modules/oft-ptb-builder.ts +0 -59
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { bcs } from '@mysten/sui/bcs';
|
|
2
2
|
import { Transaction } from '@mysten/sui/transactions';
|
|
3
|
-
import {
|
|
3
|
+
import { asObject, asU8, asBytes, asBool, asAddress, asU64, asU32, isTransactionArgument, asArgWithTx, asArgWithTxAsync, executeSimulate, asBytes32 } from '@layerzerolabs/lz-sui-sdk-v2';
|
|
4
4
|
|
|
5
5
|
var __typeError = (msg) => {
|
|
6
6
|
throw TypeError(msg);
|
|
@@ -50,18 +50,22 @@ function parseOFTReceipt(data) {
|
|
|
50
50
|
// src/modules/oft.ts
|
|
51
51
|
var MODULE_NAME = "oft";
|
|
52
52
|
var OFT_SENDER_MODULE_NAME = "oft_sender";
|
|
53
|
+
var OFT_IMPL_MODULE_NAME = "oft_impl";
|
|
54
|
+
var OFT_PTB_BUILDER_MODULE_NAME = "oft_ptb_builder";
|
|
53
55
|
var OFTErrorCode = {
|
|
54
56
|
// OFT related errors
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
EComposeMsgNotAllowed: 1,
|
|
58
|
+
EComposeMsgRequired: 2,
|
|
59
|
+
EInsufficientBalance: 3,
|
|
60
|
+
EInvalidAdminCap: 4,
|
|
61
|
+
EInvalidComposeQueue: 5,
|
|
62
|
+
EInvalidLocalDecimals: 6,
|
|
63
|
+
EInvalidMigrationCap: 7,
|
|
64
|
+
EInvalidSendContext: 8,
|
|
65
|
+
ESlippageExceeded: 9,
|
|
66
|
+
EWrongPackageVersion: 10
|
|
63
67
|
};
|
|
64
|
-
var _OFT_instances, buildSendParam_fn, target_fn, adminCapId_fn;
|
|
68
|
+
var _OFT_instances, buildSendParam_fn, target_fn, oappObjectId_fn, adminCapId_fn;
|
|
65
69
|
var OFT = class {
|
|
66
70
|
/**
|
|
67
71
|
* Creates a new OFT instance for interacting with an Omnichain Fungible Token
|
|
@@ -72,94 +76,110 @@ var OFT = class {
|
|
|
72
76
|
* @param coinType - The Sui coin type string (e.g., "0x123::mycoin::MYCOIN")
|
|
73
77
|
* @param adminCapId - Optional admin capability object ID for privileged operations (required for admin functions)
|
|
74
78
|
*/
|
|
75
|
-
constructor(protocolSDK, oftPackageId, oftObjectId, coinType, adminCapId) {
|
|
79
|
+
constructor(protocolSDK, oftPackageId, oftObjectId, coinType, oappObjectId, adminCapId) {
|
|
76
80
|
__privateAdd(this, _OFT_instances);
|
|
77
81
|
this.protocolSDK = protocolSDK;
|
|
78
82
|
this.oftPackageId = oftPackageId;
|
|
79
83
|
this.client = protocolSDK.client;
|
|
80
84
|
this.objects = protocolSDK.objects;
|
|
81
85
|
this.oftObjectId = oftObjectId;
|
|
86
|
+
this.oappObjectId = oappObjectId;
|
|
82
87
|
this.adminCapId = adminCapId;
|
|
83
88
|
this.coinType = coinType;
|
|
84
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Updates the associated OApp object ID
|
|
92
|
+
* @param oappObjectId - The new OApp object ID
|
|
93
|
+
*/
|
|
94
|
+
setOappObjectId(oappObjectId) {
|
|
95
|
+
this.oappObjectId = oappObjectId;
|
|
96
|
+
}
|
|
85
97
|
// ==========================================
|
|
86
|
-
//
|
|
98
|
+
// INITIALIZATION FUNCTIONS
|
|
87
99
|
// ==========================================
|
|
88
|
-
// These functions
|
|
89
|
-
// and management. They require the adminCapId to be provided during construction.
|
|
100
|
+
// These functions are used to initialize OFT instances from OFTCreationTicket
|
|
90
101
|
/**
|
|
91
|
-
*
|
|
102
|
+
* Initialize an OFT instance with a treasury capability
|
|
103
|
+
* Creates a new OFT that mints its own tokens
|
|
92
104
|
* @param tx - The transaction to add the move call to
|
|
93
|
-
* @param
|
|
94
|
-
* for
|
|
105
|
+
* @param ticket - The OFTCreationTicket object ID or TransactionArgument
|
|
106
|
+
* @param treasury - The TreasuryCap object ID or TransactionArgument for the coin type
|
|
107
|
+
* @param metadata - The CoinMetadata object ID or TransactionArgument for the coin type
|
|
108
|
+
* @param sharedDecimals - Number of decimals to use for cross-chain operations
|
|
109
|
+
* @returns TransactionResult array containing [AdminCap, MigrationCap] - MigrationCap must be transferred or stored
|
|
95
110
|
*/
|
|
96
|
-
|
|
97
|
-
tx.moveCall({
|
|
98
|
-
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "
|
|
111
|
+
initOftMoveCall(tx, ticket, oapp, treasury, metadata, sharedDecimals) {
|
|
112
|
+
return tx.moveCall({
|
|
113
|
+
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "init_oft", OFT_IMPL_MODULE_NAME),
|
|
99
114
|
typeArguments: [this.coinType],
|
|
100
115
|
arguments: [
|
|
101
|
-
tx
|
|
102
|
-
tx
|
|
103
|
-
tx
|
|
104
|
-
|
|
116
|
+
asObject(tx, ticket),
|
|
117
|
+
asObject(tx, oapp),
|
|
118
|
+
asObject(tx, treasury),
|
|
119
|
+
asObject(tx, metadata),
|
|
120
|
+
asU8(tx, sharedDecimals)
|
|
105
121
|
]
|
|
106
122
|
});
|
|
107
123
|
}
|
|
108
124
|
/**
|
|
109
|
-
*
|
|
125
|
+
* Initialize an OFT adapter instance
|
|
126
|
+
* Creates an OFT adapter that wraps an existing coin type
|
|
110
127
|
* @param tx - The transaction to add the move call to
|
|
111
|
-
* @param
|
|
112
|
-
* @param
|
|
113
|
-
* @param
|
|
128
|
+
* @param ticket - The OFTCreationTicket object ID or TransactionArgument
|
|
129
|
+
* @param metadata - The CoinMetadata object ID or TransactionArgument for the coin type
|
|
130
|
+
* @param sharedDecimals - Number of decimals to use for cross-chain operations
|
|
131
|
+
* @returns TransactionResult array containing [AdminCap, MigrationCap] - MigrationCap must be transferred or stored
|
|
114
132
|
*/
|
|
115
|
-
|
|
116
|
-
tx.moveCall({
|
|
117
|
-
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "
|
|
133
|
+
initOftAdapterMoveCall(tx, ticket, oapp, metadata, sharedDecimals) {
|
|
134
|
+
return tx.moveCall({
|
|
135
|
+
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "init_oft_adapter", OFT_IMPL_MODULE_NAME),
|
|
118
136
|
typeArguments: [this.coinType],
|
|
119
|
-
arguments: [
|
|
120
|
-
tx.object(this.oftObjectId),
|
|
121
|
-
tx.object(__privateMethod(this, _OFT_instances, adminCapId_fn).call(this)),
|
|
122
|
-
asU32(tx, eid),
|
|
123
|
-
asU16(tx, msgType),
|
|
124
|
-
asBytes(tx, options)
|
|
125
|
-
]
|
|
137
|
+
arguments: [asObject(tx, ticket), asObject(tx, oapp), asObject(tx, metadata), asU8(tx, sharedDecimals)]
|
|
126
138
|
});
|
|
127
139
|
}
|
|
140
|
+
// ==========================================
|
|
141
|
+
// ADMIN FUNCTIONS
|
|
142
|
+
// ==========================================
|
|
143
|
+
// These functions require admin privileges and are used for OFT configuration
|
|
144
|
+
// and management. They require the adminCapId to be provided during construction.
|
|
128
145
|
/**
|
|
129
|
-
*
|
|
146
|
+
* Get LayerZero receive information for OFT registration
|
|
147
|
+
*
|
|
148
|
+
* This function prepares the necessary metadata for registering an OFT
|
|
149
|
+
* with the LayerZero endpoint, enabling it to receive cross-chain messages.
|
|
150
|
+
*
|
|
130
151
|
* @param tx - The transaction to add the move call to
|
|
131
|
-
* @param
|
|
132
|
-
* @
|
|
133
|
-
* @param peer - Peer OFT address as bytes
|
|
152
|
+
* @param composerManager - The composer manager object ID for routing compose transfers
|
|
153
|
+
* @returns TransactionResult containing serialized execution metadata for endpoint registration
|
|
134
154
|
*/
|
|
135
|
-
|
|
136
|
-
tx.moveCall({
|
|
137
|
-
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "
|
|
155
|
+
lzReceiveInfoMoveCall(tx, composerManager) {
|
|
156
|
+
return tx.moveCall({
|
|
157
|
+
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "lz_receive_info", OFT_PTB_BUILDER_MODULE_NAME),
|
|
138
158
|
typeArguments: [this.coinType],
|
|
139
159
|
arguments: [
|
|
140
160
|
tx.object(this.oftObjectId),
|
|
141
|
-
tx.object(__privateMethod(this, _OFT_instances, adminCapId_fn).call(this)),
|
|
142
161
|
tx.object(this.objects.endpointV2),
|
|
143
|
-
asObject(tx,
|
|
144
|
-
|
|
145
|
-
asBytes32(tx, peer, this.protocolSDK.getUtils())
|
|
162
|
+
asObject(tx, composerManager),
|
|
163
|
+
tx.object.clock()
|
|
146
164
|
]
|
|
147
165
|
});
|
|
148
166
|
}
|
|
149
167
|
/**
|
|
150
|
-
*
|
|
168
|
+
* Register OFT as an OApp with LayerZero endpoint
|
|
151
169
|
* @param tx - The transaction to add the move call to
|
|
152
|
-
* @param
|
|
170
|
+
* @param lzReceiveInfo - PTB Builder lzReceiveInfoMoveCall result, used for protocol SDK to dynamically build the PTB
|
|
171
|
+
* for OFT's lzReceive operation
|
|
153
172
|
*/
|
|
154
|
-
|
|
173
|
+
registerOAppMoveCall(tx, lzReceiveInfo) {
|
|
155
174
|
tx.moveCall({
|
|
156
|
-
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "
|
|
175
|
+
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "register_oapp"),
|
|
157
176
|
typeArguments: [this.coinType],
|
|
158
177
|
arguments: [
|
|
159
178
|
tx.object(this.oftObjectId),
|
|
179
|
+
tx.object(__privateMethod(this, _OFT_instances, oappObjectId_fn).call(this)),
|
|
160
180
|
tx.object(__privateMethod(this, _OFT_instances, adminCapId_fn).call(this)),
|
|
161
181
|
tx.object(this.objects.endpointV2),
|
|
162
|
-
|
|
182
|
+
asBytes(tx, lzReceiveInfo)
|
|
163
183
|
]
|
|
164
184
|
});
|
|
165
185
|
}
|
|
@@ -191,16 +211,58 @@ var OFT = class {
|
|
|
191
211
|
arguments: [tx.object(this.oftObjectId), tx.object(__privateMethod(this, _OFT_instances, adminCapId_fn).call(this)), asAddress(tx, feeDepositAddress)]
|
|
192
212
|
});
|
|
193
213
|
}
|
|
214
|
+
setDefaultFeeBpsMoveCall(tx, feeBps) {
|
|
215
|
+
tx.moveCall({
|
|
216
|
+
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "set_default_fee_bps"),
|
|
217
|
+
typeArguments: [this.coinType],
|
|
218
|
+
arguments: [tx.object(this.oftObjectId), tx.object(__privateMethod(this, _OFT_instances, adminCapId_fn).call(this)), asU64(tx, feeBps)]
|
|
219
|
+
});
|
|
220
|
+
}
|
|
194
221
|
/**
|
|
195
|
-
* Set fee basis points for
|
|
222
|
+
* Set fee basis points for a specific destination chain
|
|
196
223
|
* @param tx - The transaction to add the move call to
|
|
197
|
-
* @param
|
|
224
|
+
* @param dstEid - Destination endpoint ID
|
|
225
|
+
* @param feeBps - Fee rate in basis points (0-10,000, where 10,000 = 100%)
|
|
198
226
|
*/
|
|
199
|
-
setFeeBpsMoveCall(tx, feeBps) {
|
|
227
|
+
setFeeBpsMoveCall(tx, dstEid, feeBps) {
|
|
200
228
|
tx.moveCall({
|
|
201
229
|
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "set_fee_bps"),
|
|
202
230
|
typeArguments: [this.coinType],
|
|
203
|
-
arguments: [
|
|
231
|
+
arguments: [
|
|
232
|
+
tx.object(this.oftObjectId),
|
|
233
|
+
tx.object(__privateMethod(this, _OFT_instances, adminCapId_fn).call(this)),
|
|
234
|
+
asU32(tx, dstEid),
|
|
235
|
+
asU64(tx, feeBps)
|
|
236
|
+
]
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Removes the fee rate for a specific destination chain
|
|
241
|
+
* @param tx - The transaction to add the move call to
|
|
242
|
+
* @param dstEid - Destination endpoint ID
|
|
243
|
+
*/
|
|
244
|
+
unsetFeeBpsMoveCall(tx, dstEid) {
|
|
245
|
+
tx.moveCall({
|
|
246
|
+
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "unset_fee_bps"),
|
|
247
|
+
typeArguments: [this.coinType],
|
|
248
|
+
arguments: [tx.object(this.oftObjectId), tx.object(__privateMethod(this, _OFT_instances, adminCapId_fn).call(this)), asU32(tx, dstEid)]
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
// ==========================================
|
|
252
|
+
// MIGRATION ADMIN FUNCTIONS
|
|
253
|
+
// ==========================================
|
|
254
|
+
// Handle OFT migration to new contracts
|
|
255
|
+
/**
|
|
256
|
+
* Migrate OFT instance to a new contract
|
|
257
|
+
* @param tx - The transaction to add the move call to
|
|
258
|
+
* @param migrationCap - Migration capability object ID or transaction argument
|
|
259
|
+
* @returns TransactionResult containing the migration ticket
|
|
260
|
+
*/
|
|
261
|
+
migrateMoveCall(tx, migrationCap) {
|
|
262
|
+
return tx.moveCall({
|
|
263
|
+
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "migrate"),
|
|
264
|
+
typeArguments: [this.coinType],
|
|
265
|
+
arguments: [tx.object(this.oftObjectId), asObject(tx, migrationCap)]
|
|
204
266
|
});
|
|
205
267
|
}
|
|
206
268
|
// ==========================================
|
|
@@ -285,6 +347,7 @@ var OFT = class {
|
|
|
285
347
|
typeArguments: [this.coinType],
|
|
286
348
|
arguments: [
|
|
287
349
|
tx.object(this.oftObjectId),
|
|
350
|
+
tx.object(__privateMethod(this, _OFT_instances, oappObjectId_fn).call(this)),
|
|
288
351
|
txSender,
|
|
289
352
|
sendParamArg,
|
|
290
353
|
asObject(tx, coinProvided),
|
|
@@ -310,7 +373,13 @@ var OFT = class {
|
|
|
310
373
|
const confirmSendResult = tx.moveCall({
|
|
311
374
|
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "confirm_send"),
|
|
312
375
|
typeArguments: [this.coinType],
|
|
313
|
-
arguments: [
|
|
376
|
+
arguments: [
|
|
377
|
+
tx.object(this.oftObjectId),
|
|
378
|
+
tx.object(__privateMethod(this, _OFT_instances, oappObjectId_fn).call(this)),
|
|
379
|
+
txSender,
|
|
380
|
+
endpointCall,
|
|
381
|
+
oftSendContext
|
|
382
|
+
]
|
|
314
383
|
});
|
|
315
384
|
const nativeCoin = confirmSendResult[2];
|
|
316
385
|
const zroCoin = confirmSendResult[3];
|
|
@@ -325,6 +394,59 @@ var OFT = class {
|
|
|
325
394
|
typeArguments: [`0x2::coin::Coin<${this.protocolSDK.getZro().zroType}>`]
|
|
326
395
|
});
|
|
327
396
|
}
|
|
397
|
+
/**
|
|
398
|
+
* Process inbound cross-chain token transfers
|
|
399
|
+
* @param tx - The transaction to add the move call to
|
|
400
|
+
* @param call - LayerZero receive call containing the verified cross-chain message
|
|
401
|
+
* @returns TransactionResult containing the processed transfer
|
|
402
|
+
*/
|
|
403
|
+
lzReceiveMoveCall(tx, call) {
|
|
404
|
+
return tx.moveCall({
|
|
405
|
+
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "lz_receive"),
|
|
406
|
+
typeArguments: [this.coinType],
|
|
407
|
+
arguments: [
|
|
408
|
+
tx.object(this.oftObjectId),
|
|
409
|
+
tx.object(__privateMethod(this, _OFT_instances, oappObjectId_fn).call(this)),
|
|
410
|
+
asObject(tx, call),
|
|
411
|
+
tx.object.clock()
|
|
412
|
+
]
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Process inbound cross-chain token transfers with compose functionality
|
|
417
|
+
* @param tx - The transaction to add the move call to
|
|
418
|
+
* @param composeQueue - The composer's message queue for sequencing operations
|
|
419
|
+
* @param composerManager - Manager managing token deposits for composers
|
|
420
|
+
* @param call - LayerZero receive call containing the verified cross-chain message
|
|
421
|
+
* @returns TransactionResult containing the processed transfer
|
|
422
|
+
*/
|
|
423
|
+
lzReceiveWithComposeMoveCall(tx, composeQueue, composerManager, call) {
|
|
424
|
+
return tx.moveCall({
|
|
425
|
+
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "lz_receive_with_compose"),
|
|
426
|
+
typeArguments: [this.coinType],
|
|
427
|
+
arguments: [
|
|
428
|
+
tx.object(this.oftObjectId),
|
|
429
|
+
tx.object(__privateMethod(this, _OFT_instances, oappObjectId_fn).call(this)),
|
|
430
|
+
asObject(tx, composeQueue),
|
|
431
|
+
asObject(tx, composerManager),
|
|
432
|
+
asObject(tx, call),
|
|
433
|
+
tx.object.clock()
|
|
434
|
+
]
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Confirms and extracts results from a quote operation
|
|
439
|
+
* @param tx - The transaction to add the move call to
|
|
440
|
+
* @param call - Completed Call object from quote_send() execution
|
|
441
|
+
* @returns TransactionResult containing the messaging fee
|
|
442
|
+
*/
|
|
443
|
+
confirmQuoteSendMoveCall(tx, call) {
|
|
444
|
+
return tx.moveCall({
|
|
445
|
+
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "confirm_quote_send"),
|
|
446
|
+
typeArguments: [this.coinType],
|
|
447
|
+
arguments: [tx.object(this.oftObjectId), tx.object(__privateMethod(this, _OFT_instances, oappObjectId_fn).call(this)), asObject(tx, call)]
|
|
448
|
+
});
|
|
449
|
+
}
|
|
328
450
|
// ==========================================
|
|
329
451
|
// QUOTE FUNCTIONS
|
|
330
452
|
// ==========================================
|
|
@@ -367,7 +489,13 @@ var OFT = class {
|
|
|
367
489
|
const quoteCall = tx.moveCall({
|
|
368
490
|
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "quote_send"),
|
|
369
491
|
typeArguments: [this.coinType],
|
|
370
|
-
arguments: [
|
|
492
|
+
arguments: [
|
|
493
|
+
tx.object(this.oftObjectId),
|
|
494
|
+
tx.object(__privateMethod(this, _OFT_instances, oappObjectId_fn).call(this)),
|
|
495
|
+
asAddress(tx, sender),
|
|
496
|
+
sendParamArg,
|
|
497
|
+
asBool(tx, payInZro)
|
|
498
|
+
]
|
|
371
499
|
});
|
|
372
500
|
return this.protocolSDK.getEndpoint().quote(tx, quoteCall, sender, validators, maxSimulationTimes);
|
|
373
501
|
}
|
|
@@ -375,6 +503,56 @@ var OFT = class {
|
|
|
375
503
|
// VIEW FUNCTIONS
|
|
376
504
|
// ==========================================
|
|
377
505
|
// Read-only functions to query OFT state and configuration
|
|
506
|
+
/**
|
|
507
|
+
* Get the upgrade version of this OFT instance
|
|
508
|
+
* @param tx - The transaction to add the move call to
|
|
509
|
+
* @returns Transaction result containing the upgrade version
|
|
510
|
+
*/
|
|
511
|
+
upgradeVersionMoveCall(tx) {
|
|
512
|
+
return tx.moveCall({
|
|
513
|
+
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "upgrade_version"),
|
|
514
|
+
typeArguments: [this.coinType],
|
|
515
|
+
arguments: [tx.object(this.oftObjectId)]
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Get the upgrade version of this OFT instance
|
|
520
|
+
* @returns Promise<bigint> - The upgrade version
|
|
521
|
+
*/
|
|
522
|
+
async upgradeVersion() {
|
|
523
|
+
return executeSimulate(
|
|
524
|
+
this.client,
|
|
525
|
+
(tx) => {
|
|
526
|
+
this.upgradeVersionMoveCall(tx);
|
|
527
|
+
},
|
|
528
|
+
(result) => BigInt(bcs.U64.parse(result[0].value))
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Get the associated OApp object address
|
|
533
|
+
* @param tx - The transaction to add the move call to
|
|
534
|
+
* @returns Transaction result containing the OApp object address
|
|
535
|
+
*/
|
|
536
|
+
oappObjectMoveCall(tx) {
|
|
537
|
+
return tx.moveCall({
|
|
538
|
+
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "oapp_object"),
|
|
539
|
+
typeArguments: [this.coinType],
|
|
540
|
+
arguments: [tx.object(this.oftObjectId)]
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Get the associated OApp object address
|
|
545
|
+
* @returns Promise<string> - The OApp object address
|
|
546
|
+
*/
|
|
547
|
+
async oappObject() {
|
|
548
|
+
return executeSimulate(
|
|
549
|
+
this.client,
|
|
550
|
+
(tx) => {
|
|
551
|
+
this.oappObjectMoveCall(tx);
|
|
552
|
+
},
|
|
553
|
+
(result) => bcs.Address.parse(result[0].value)
|
|
554
|
+
);
|
|
555
|
+
}
|
|
378
556
|
/**
|
|
379
557
|
* Get OFT version information
|
|
380
558
|
* @param tx - The transaction to add the move call to
|
|
@@ -404,17 +582,42 @@ var OFT = class {
|
|
|
404
582
|
}
|
|
405
583
|
);
|
|
406
584
|
}
|
|
407
|
-
|
|
585
|
+
oftCapIdMoveCall(tx) {
|
|
408
586
|
return tx.moveCall({
|
|
409
|
-
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "
|
|
587
|
+
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "oft_cap_id"),
|
|
410
588
|
typeArguments: [this.coinType],
|
|
411
589
|
arguments: [tx.object(this.oftObjectId)]
|
|
412
590
|
});
|
|
413
591
|
}
|
|
414
|
-
async
|
|
592
|
+
async oftCapId() {
|
|
415
593
|
return executeSimulate(
|
|
416
594
|
this.client,
|
|
417
|
-
(tx) => this.
|
|
595
|
+
(tx) => this.oftCapIdMoveCall(tx),
|
|
596
|
+
(result) => bcs.Address.parse(result[0].value)
|
|
597
|
+
);
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Get the migration capability address for this OFT
|
|
601
|
+
* @param tx - The transaction to add the move call to
|
|
602
|
+
* @returns Transaction result containing the migration capability address
|
|
603
|
+
*/
|
|
604
|
+
migrationCapMoveCall(tx) {
|
|
605
|
+
return tx.moveCall({
|
|
606
|
+
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "migration_cap"),
|
|
607
|
+
typeArguments: [this.coinType],
|
|
608
|
+
arguments: [tx.object(this.oftObjectId)]
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Get the migration capability address for this OFT
|
|
613
|
+
* @returns Promise<string> - The migration capability address
|
|
614
|
+
*/
|
|
615
|
+
async migrationCap() {
|
|
616
|
+
return executeSimulate(
|
|
617
|
+
this.client,
|
|
618
|
+
(tx) => {
|
|
619
|
+
this.migrationCapMoveCall(tx);
|
|
620
|
+
},
|
|
418
621
|
(result) => bcs.Address.parse(result[0].value)
|
|
419
622
|
);
|
|
420
623
|
}
|
|
@@ -422,8 +625,8 @@ var OFT = class {
|
|
|
422
625
|
return executeSimulate(
|
|
423
626
|
this.client,
|
|
424
627
|
(tx) => {
|
|
425
|
-
const
|
|
426
|
-
this.protocolSDK.getEndpoint().getMessagingChannelMoveCall(tx,
|
|
628
|
+
const oftCapId = this.oftCapIdMoveCall(tx);
|
|
629
|
+
this.protocolSDK.getEndpoint().getMessagingChannelMoveCall(tx, oftCapId);
|
|
427
630
|
},
|
|
428
631
|
(result) => bcs.Address.parse(result[0].value)
|
|
429
632
|
);
|
|
@@ -454,26 +657,26 @@ var OFT = class {
|
|
|
454
657
|
);
|
|
455
658
|
}
|
|
456
659
|
/**
|
|
457
|
-
* Get OFT admin address
|
|
660
|
+
* Get OFT admin capability address
|
|
458
661
|
* @param tx - The transaction to add the move call to
|
|
459
|
-
* @returns Transaction result containing the admin address
|
|
662
|
+
* @returns Transaction result containing the admin capability address
|
|
460
663
|
*/
|
|
461
|
-
|
|
664
|
+
adminCapMoveCall(tx) {
|
|
462
665
|
return tx.moveCall({
|
|
463
|
-
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "
|
|
666
|
+
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "admin_cap"),
|
|
464
667
|
typeArguments: [this.coinType],
|
|
465
668
|
arguments: [tx.object(this.oftObjectId)]
|
|
466
669
|
});
|
|
467
670
|
}
|
|
468
671
|
/**
|
|
469
|
-
* Get OFT admin address
|
|
470
|
-
* @returns Promise<string> - The admin address
|
|
672
|
+
* Get OFT admin capability address
|
|
673
|
+
* @returns Promise<string> - The admin capability address
|
|
471
674
|
*/
|
|
472
|
-
async
|
|
675
|
+
async adminCap() {
|
|
473
676
|
return executeSimulate(
|
|
474
677
|
this.client,
|
|
475
678
|
(tx) => {
|
|
476
|
-
this.
|
|
679
|
+
this.adminCapMoveCall(tx);
|
|
477
680
|
},
|
|
478
681
|
(result) => bcs.Address.parse(result[0].value)
|
|
479
682
|
);
|
|
@@ -503,6 +706,31 @@ var OFT = class {
|
|
|
503
706
|
(result) => bcs.U8.parse(result[0].value)
|
|
504
707
|
);
|
|
505
708
|
}
|
|
709
|
+
/**
|
|
710
|
+
* Get the decimal conversion rate for this OFT
|
|
711
|
+
* @param tx - The transaction to add the move call to
|
|
712
|
+
* @returns Transaction result containing the decimal conversion rate
|
|
713
|
+
*/
|
|
714
|
+
decimalConversionRateMoveCall(tx) {
|
|
715
|
+
return tx.moveCall({
|
|
716
|
+
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "decimal_conversion_rate"),
|
|
717
|
+
typeArguments: [this.coinType],
|
|
718
|
+
arguments: [tx.object(this.oftObjectId)]
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* Get the decimal conversion rate for this OFT
|
|
723
|
+
* @returns Promise<bigint> - The decimal conversion rate multiplier
|
|
724
|
+
*/
|
|
725
|
+
async decimalConversionRate() {
|
|
726
|
+
return executeSimulate(
|
|
727
|
+
this.client,
|
|
728
|
+
(tx) => {
|
|
729
|
+
this.decimalConversionRateMoveCall(tx);
|
|
730
|
+
},
|
|
731
|
+
(result) => BigInt(bcs.U64.parse(result[0].value))
|
|
732
|
+
);
|
|
733
|
+
}
|
|
506
734
|
/**
|
|
507
735
|
* Check if OFT is paused
|
|
508
736
|
* @param tx - The transaction to add the move call to
|
|
@@ -558,26 +786,107 @@ var OFT = class {
|
|
|
558
786
|
// ==========================================
|
|
559
787
|
// Query current fee configuration and settings
|
|
560
788
|
/**
|
|
561
|
-
*
|
|
789
|
+
* Check if the OFT has a fee rate greater than 0 for the specified destination
|
|
790
|
+
* @param tx - The transaction to add the move call to
|
|
791
|
+
* @param dstEid - Destination endpoint ID
|
|
792
|
+
* @returns Transaction result containing whether fee exists
|
|
793
|
+
*/
|
|
794
|
+
hasOftFeeMoveCall(tx, dstEid) {
|
|
795
|
+
return tx.moveCall({
|
|
796
|
+
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "has_oft_fee"),
|
|
797
|
+
typeArguments: [this.coinType],
|
|
798
|
+
arguments: [tx.object(this.oftObjectId), asU32(tx, dstEid)]
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* Check if the OFT has a fee rate greater than 0 for the specified destination
|
|
803
|
+
* @param dstEid - Destination endpoint ID
|
|
804
|
+
* @returns Promise<boolean> - True if fee exists
|
|
805
|
+
*/
|
|
806
|
+
async hasOftFee(dstEid) {
|
|
807
|
+
return executeSimulate(
|
|
808
|
+
this.client,
|
|
809
|
+
(tx) => {
|
|
810
|
+
this.hasOftFeeMoveCall(tx, dstEid);
|
|
811
|
+
},
|
|
812
|
+
(result) => bcs.Bool.parse(result[0].value)
|
|
813
|
+
);
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Get the effective fee rate for a specific destination chain
|
|
817
|
+
* @param tx - The transaction to add the move call to
|
|
818
|
+
* @param dstEid - Destination endpoint ID
|
|
819
|
+
* @returns Transaction result containing the effective fee basis points
|
|
820
|
+
*/
|
|
821
|
+
effectiveFeeBpsMoveCall(tx, dstEid) {
|
|
822
|
+
return tx.moveCall({
|
|
823
|
+
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "effective_fee_bps"),
|
|
824
|
+
typeArguments: [this.coinType],
|
|
825
|
+
arguments: [tx.object(this.oftObjectId), asU32(tx, dstEid)]
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* Get the effective fee rate for a specific destination chain
|
|
830
|
+
* @param dstEid - Destination endpoint ID
|
|
831
|
+
* @returns Promise<bigint> - The effective fee in basis points
|
|
832
|
+
*/
|
|
833
|
+
async effectiveFeeBps(dstEid) {
|
|
834
|
+
return executeSimulate(
|
|
835
|
+
this.client,
|
|
836
|
+
(tx) => {
|
|
837
|
+
this.effectiveFeeBpsMoveCall(tx, dstEid);
|
|
838
|
+
},
|
|
839
|
+
(result) => BigInt(bcs.U64.parse(result[0].value))
|
|
840
|
+
);
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* Get the default fee rate
|
|
562
844
|
* @param tx - The transaction to add the move call to
|
|
845
|
+
* @returns Transaction result containing the default fee basis points
|
|
846
|
+
*/
|
|
847
|
+
defaultFeeBpsMoveCall(tx) {
|
|
848
|
+
return tx.moveCall({
|
|
849
|
+
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "default_fee_bps"),
|
|
850
|
+
typeArguments: [this.coinType],
|
|
851
|
+
arguments: [tx.object(this.oftObjectId)]
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Get the default fee rate
|
|
856
|
+
* @returns Promise<bigint> - The default fee in basis points
|
|
857
|
+
*/
|
|
858
|
+
async defaultFeeBps() {
|
|
859
|
+
return executeSimulate(
|
|
860
|
+
this.client,
|
|
861
|
+
(tx) => {
|
|
862
|
+
this.defaultFeeBpsMoveCall(tx);
|
|
863
|
+
},
|
|
864
|
+
(result) => BigInt(bcs.U64.parse(result[0].value))
|
|
865
|
+
);
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Get fee basis points for a specific destination chain
|
|
869
|
+
* @param tx - The transaction to add the move call to
|
|
870
|
+
* @param dstEid - Destination endpoint ID
|
|
563
871
|
* @returns Transaction result containing the fee basis points
|
|
564
872
|
*/
|
|
565
|
-
feeBpsMoveCall(tx) {
|
|
873
|
+
feeBpsMoveCall(tx, dstEid) {
|
|
566
874
|
return tx.moveCall({
|
|
567
875
|
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "fee_bps"),
|
|
568
876
|
typeArguments: [this.coinType],
|
|
569
|
-
arguments: [tx.object(this.oftObjectId)]
|
|
877
|
+
arguments: [tx.object(this.oftObjectId), asU32(tx, dstEid)]
|
|
570
878
|
});
|
|
571
879
|
}
|
|
572
880
|
/**
|
|
573
|
-
* Get fee basis points for
|
|
881
|
+
* Get fee basis points for a specific destination chain
|
|
882
|
+
* @param dstEid - Destination endpoint ID
|
|
574
883
|
* @returns Promise<bigint> - The fee in basis points
|
|
575
884
|
*/
|
|
576
|
-
async feeBps() {
|
|
885
|
+
async feeBps(dstEid) {
|
|
577
886
|
return executeSimulate(
|
|
578
887
|
this.client,
|
|
579
888
|
(tx) => {
|
|
580
|
-
this.feeBpsMoveCall(tx);
|
|
889
|
+
this.feeBpsMoveCall(tx, dstEid);
|
|
581
890
|
},
|
|
582
891
|
(result) => BigInt(bcs.U64.parse(result[0].value))
|
|
583
892
|
);
|
|
@@ -702,122 +1011,6 @@ var OFT = class {
|
|
|
702
1011
|
(result) => BigInt(bcs.U64.parse(result[0].value))
|
|
703
1012
|
);
|
|
704
1013
|
}
|
|
705
|
-
/**
|
|
706
|
-
* Combine enforced options with extra options
|
|
707
|
-
* @param tx - The transaction to add the move call to
|
|
708
|
-
* @param eid - Endpoint ID
|
|
709
|
-
* @param msgType - Message type
|
|
710
|
-
* @param extraOptions - Extra options to combine with enforced options
|
|
711
|
-
* @returns Transaction result containing the combined options
|
|
712
|
-
*/
|
|
713
|
-
combineOptionsMoveCall(tx, eid, msgType, extraOptions) {
|
|
714
|
-
return tx.moveCall({
|
|
715
|
-
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "combine_options"),
|
|
716
|
-
typeArguments: [this.coinType],
|
|
717
|
-
arguments: [tx.object(this.oftObjectId), asU32(tx, eid), asU16(tx, msgType), asBytes(tx, extraOptions)]
|
|
718
|
-
});
|
|
719
|
-
}
|
|
720
|
-
/**
|
|
721
|
-
* Combine enforced options with extra options
|
|
722
|
-
* @param eid - Endpoint ID
|
|
723
|
-
* @param msgType - Message type
|
|
724
|
-
* @param extraOptions - Extra options to combine with enforced options
|
|
725
|
-
* @returns Promise<Uint8Array> - The combined options as bytes
|
|
726
|
-
*/
|
|
727
|
-
async combineOptions(eid, msgType, extraOptions) {
|
|
728
|
-
return executeSimulate(
|
|
729
|
-
this.client,
|
|
730
|
-
(tx) => {
|
|
731
|
-
this.combineOptionsMoveCall(tx, eid, msgType, extraOptions);
|
|
732
|
-
},
|
|
733
|
-
(result) => new Uint8Array(bcs.vector(bcs.u8()).parse(result[0].value))
|
|
734
|
-
);
|
|
735
|
-
}
|
|
736
|
-
/**
|
|
737
|
-
* Get enforced options for OFT messaging
|
|
738
|
-
* @param tx - The transaction to add the move call to
|
|
739
|
-
* @param eid - Endpoint ID
|
|
740
|
-
* @param msgType - Message type
|
|
741
|
-
* @returns Transaction result containing the enforced options
|
|
742
|
-
*/
|
|
743
|
-
getEnforcedOptionsMoveCall(tx, eid, msgType) {
|
|
744
|
-
return tx.moveCall({
|
|
745
|
-
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "get_enforced_options"),
|
|
746
|
-
typeArguments: [this.coinType],
|
|
747
|
-
arguments: [tx.object(this.oftObjectId), asU32(tx, eid), asU16(tx, msgType)]
|
|
748
|
-
});
|
|
749
|
-
}
|
|
750
|
-
/**
|
|
751
|
-
* Get enforced options for OFT messaging
|
|
752
|
-
* @param eid - Endpoint ID
|
|
753
|
-
* @param msgType - Message type
|
|
754
|
-
* @returns Promise<Uint8Array> - The enforced options as bytes
|
|
755
|
-
*/
|
|
756
|
-
async getEnforcedOptions(eid, msgType) {
|
|
757
|
-
return executeSimulate(
|
|
758
|
-
this.client,
|
|
759
|
-
(tx) => {
|
|
760
|
-
this.getEnforcedOptionsMoveCall(tx, eid, msgType);
|
|
761
|
-
},
|
|
762
|
-
(result) => new Uint8Array(bcs.vector(bcs.u8()).parse(result[0].value))
|
|
763
|
-
);
|
|
764
|
-
}
|
|
765
|
-
/**
|
|
766
|
-
* Check if OFT has a peer on specific endpoint
|
|
767
|
-
* @param tx - The transaction to add the move call to
|
|
768
|
-
* @param eid - Endpoint ID
|
|
769
|
-
* @returns Transaction result containing the peer existence status
|
|
770
|
-
*/
|
|
771
|
-
hasPeerMoveCall(tx, eid) {
|
|
772
|
-
return tx.moveCall({
|
|
773
|
-
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "has_peer"),
|
|
774
|
-
typeArguments: [this.coinType],
|
|
775
|
-
arguments: [tx.object(this.oftObjectId), asU32(tx, eid)]
|
|
776
|
-
});
|
|
777
|
-
}
|
|
778
|
-
/**
|
|
779
|
-
* Check if OFT has a peer on specific endpoint
|
|
780
|
-
* @param eid - Endpoint ID
|
|
781
|
-
* @returns Promise<boolean> - True if peer exists on the endpoint
|
|
782
|
-
*/
|
|
783
|
-
async hasPeer(eid) {
|
|
784
|
-
return executeSimulate(
|
|
785
|
-
this.client,
|
|
786
|
-
(tx) => {
|
|
787
|
-
this.hasPeerMoveCall(tx, eid);
|
|
788
|
-
},
|
|
789
|
-
(result) => bcs.Bool.parse(result[0].value)
|
|
790
|
-
);
|
|
791
|
-
}
|
|
792
|
-
/**
|
|
793
|
-
* Get peer OFT address on specific endpoint
|
|
794
|
-
* @param tx - The transaction to add the move call to
|
|
795
|
-
* @param eid - Endpoint ID
|
|
796
|
-
* @returns Transaction result containing the peer address
|
|
797
|
-
*/
|
|
798
|
-
getPeerMoveCall(tx, eid) {
|
|
799
|
-
return tx.moveCall({
|
|
800
|
-
target: __privateMethod(this, _OFT_instances, target_fn).call(this, "get_peer"),
|
|
801
|
-
typeArguments: [this.coinType],
|
|
802
|
-
arguments: [tx.object(this.oftObjectId), asU32(tx, eid)]
|
|
803
|
-
});
|
|
804
|
-
}
|
|
805
|
-
/**
|
|
806
|
-
* Get peer OFT address on specific endpoint
|
|
807
|
-
* @param eid - Endpoint ID
|
|
808
|
-
* @returns Promise<Uint8Array> - The peer address as bytes32
|
|
809
|
-
*/
|
|
810
|
-
async getPeer(eid) {
|
|
811
|
-
return executeSimulate(
|
|
812
|
-
this.client,
|
|
813
|
-
(tx) => {
|
|
814
|
-
this.getPeerMoveCall(tx, eid);
|
|
815
|
-
},
|
|
816
|
-
(result) => {
|
|
817
|
-
return new Uint8Array(bcs.vector(bcs.u8()).parse(result[0].value));
|
|
818
|
-
}
|
|
819
|
-
);
|
|
820
|
-
}
|
|
821
1014
|
// ==========================================
|
|
822
1015
|
// OFT SENDER
|
|
823
1016
|
// ==========================================
|
|
@@ -863,6 +1056,18 @@ buildSendParam_fn = function(tx, param) {
|
|
|
863
1056
|
target_fn = function(name, module_name = MODULE_NAME) {
|
|
864
1057
|
return `${this.oftPackageId}::${module_name}::${name}`;
|
|
865
1058
|
};
|
|
1059
|
+
/**
|
|
1060
|
+
* Get the OApp object ID, throwing an error if not available
|
|
1061
|
+
* @returns The OApp object ID
|
|
1062
|
+
* @throws Error if OApp object ID was not set
|
|
1063
|
+
* @private
|
|
1064
|
+
*/
|
|
1065
|
+
oappObjectId_fn = function() {
|
|
1066
|
+
if (this.oappObjectId === "") {
|
|
1067
|
+
throw new Error("OApp object ID not found");
|
|
1068
|
+
}
|
|
1069
|
+
return this.oappObjectId;
|
|
1070
|
+
};
|
|
866
1071
|
/**
|
|
867
1072
|
* Get the admin capability ID, throwing an error if not available
|
|
868
1073
|
* @returns The admin capability ID
|
|
@@ -875,15 +1080,15 @@ adminCapId_fn = function() {
|
|
|
875
1080
|
}
|
|
876
1081
|
return this.adminCapId;
|
|
877
1082
|
};
|
|
878
|
-
var
|
|
879
|
-
// OFT Composer
|
|
1083
|
+
var OFTComposerManagerErrorCode = {
|
|
1084
|
+
// OFT Composer Manager related errors
|
|
880
1085
|
EComposeTransferNotFound: 1,
|
|
881
1086
|
EDepositAddressNotFound: 2
|
|
882
1087
|
};
|
|
883
|
-
var
|
|
884
|
-
var
|
|
1088
|
+
var _OFTComposerManager_instances, target_fn2;
|
|
1089
|
+
var OFTComposerManager = class {
|
|
885
1090
|
constructor(protocolSDK, packageId, registryObjectId) {
|
|
886
|
-
__privateAdd(this,
|
|
1091
|
+
__privateAdd(this, _OFTComposerManager_instances);
|
|
887
1092
|
this.client = protocolSDK.client;
|
|
888
1093
|
this.protocolSDK = protocolSDK;
|
|
889
1094
|
this.packageId = packageId;
|
|
@@ -899,7 +1104,7 @@ var OFTComposerRegistry = class {
|
|
|
899
1104
|
*/
|
|
900
1105
|
setDepositAddressMoveCall(tx, composerCallCap, depositAddress) {
|
|
901
1106
|
return tx.moveCall({
|
|
902
|
-
target: __privateMethod(this,
|
|
1107
|
+
target: __privateMethod(this, _OFTComposerManager_instances, target_fn2).call(this, "set_deposit_address"),
|
|
903
1108
|
arguments: [tx.object(this.registryObjectId), asObject(tx, composerCallCap), asAddress(tx, depositAddress)]
|
|
904
1109
|
});
|
|
905
1110
|
}
|
|
@@ -912,7 +1117,7 @@ var OFTComposerRegistry = class {
|
|
|
912
1117
|
*/
|
|
913
1118
|
getDepositAddressMoveCall(tx, composer) {
|
|
914
1119
|
return tx.moveCall({
|
|
915
|
-
target: __privateMethod(this,
|
|
1120
|
+
target: __privateMethod(this, _OFTComposerManager_instances, target_fn2).call(this, "get_deposit_address"),
|
|
916
1121
|
arguments: [tx.object(this.registryObjectId), asAddress(tx, composer)]
|
|
917
1122
|
});
|
|
918
1123
|
}
|
|
@@ -926,7 +1131,7 @@ var OFTComposerRegistry = class {
|
|
|
926
1131
|
*/
|
|
927
1132
|
getComposeTransferMoveCall(tx, from, guid, composer) {
|
|
928
1133
|
return tx.moveCall({
|
|
929
|
-
target: __privateMethod(this,
|
|
1134
|
+
target: __privateMethod(this, _OFTComposerManager_instances, target_fn2).call(this, "get_compose_transfer"),
|
|
930
1135
|
arguments: [
|
|
931
1136
|
tx.object(this.registryObjectId),
|
|
932
1137
|
asAddress(tx, from),
|
|
@@ -960,7 +1165,7 @@ var OFTComposerRegistry = class {
|
|
|
960
1165
|
);
|
|
961
1166
|
}
|
|
962
1167
|
};
|
|
963
|
-
|
|
1168
|
+
_OFTComposerManager_instances = new WeakSet();
|
|
964
1169
|
// === Private Functions ===
|
|
965
1170
|
/**
|
|
966
1171
|
* Generate the full target path for move calls
|
|
@@ -969,40 +1174,7 @@ _OFTComposerRegistry_instances = new WeakSet();
|
|
|
969
1174
|
* @private
|
|
970
1175
|
*/
|
|
971
1176
|
target_fn2 = function(func) {
|
|
972
|
-
return `${this.packageId}::
|
|
973
|
-
};
|
|
974
|
-
var OFTPtbBuilder = class {
|
|
975
|
-
constructor(protocolSDK, packageId, objectId, client, coinType, oftObjectId) {
|
|
976
|
-
this.objects = protocolSDK.objects;
|
|
977
|
-
this.packageId = packageId;
|
|
978
|
-
this.objectId = objectId;
|
|
979
|
-
this.client = client;
|
|
980
|
-
this.coinType = coinType;
|
|
981
|
-
this.oftObjectId = oftObjectId;
|
|
982
|
-
}
|
|
983
|
-
/**
|
|
984
|
-
* Get LayerZero receive information for OFT registration
|
|
985
|
-
*
|
|
986
|
-
* This function prepares the necessary metadata for registering an OFT
|
|
987
|
-
* with the LayerZero endpoint, enabling it to receive cross-chain messages.
|
|
988
|
-
*
|
|
989
|
-
* @param tx - The transaction to add the move call to
|
|
990
|
-
* @param composerRegistry - The composer registry object ID for routing compose transfers
|
|
991
|
-
* @returns TransactionResult containing serialized execution metadata for endpoint registration
|
|
992
|
-
*/
|
|
993
|
-
lzReceiveInfoMoveCall(tx, composerRegistry) {
|
|
994
|
-
return tx.moveCall({
|
|
995
|
-
target: `${this.packageId}::oft_ptb_builder::lz_receive_info`,
|
|
996
|
-
typeArguments: [this.coinType],
|
|
997
|
-
arguments: [
|
|
998
|
-
tx.object(this.objectId),
|
|
999
|
-
tx.object(this.oftObjectId),
|
|
1000
|
-
tx.object(this.objects.endpointV2),
|
|
1001
|
-
asObject(tx, composerRegistry),
|
|
1002
|
-
tx.object.clock()
|
|
1003
|
-
]
|
|
1004
|
-
});
|
|
1005
|
-
}
|
|
1177
|
+
return `${this.packageId}::oft_composer_manager::${func}`;
|
|
1006
1178
|
};
|
|
1007
1179
|
|
|
1008
1180
|
// src/types.ts
|
|
@@ -1011,6 +1183,6 @@ var OFTMsgType = {
|
|
|
1011
1183
|
SEND_AND_CALL: 2
|
|
1012
1184
|
};
|
|
1013
1185
|
|
|
1014
|
-
export { OFT,
|
|
1186
|
+
export { OFT, OFTComposerManager, OFTComposerManagerErrorCode, OFTErrorCode, OFTFeeDetailBcs, OFTLimitBcs, OFTMsgType, OFTReceiptBcs, parseOFTFeeDetails, parseOFTLimit, parseOFTReceipt };
|
|
1015
1187
|
//# sourceMappingURL=index.mjs.map
|
|
1016
1188
|
//# sourceMappingURL=index.mjs.map
|