@layerzerolabs/lz-sui-oft-sdk-v2 3.0.132 → 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/CHANGELOG.md +9 -0
- 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
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { SuiClient } from '@mysten/sui/client'
|
|
2
|
-
import { Transaction, TransactionArgument, TransactionResult } from '@mysten/sui/dist/cjs/transactions'
|
|
3
|
-
|
|
4
|
-
import { ObjectOptions, SDK, asObject } from '@layerzerolabs/lz-sui-sdk-v2'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* OFT PTB (Programmable Transaction Block) Builder
|
|
8
|
-
*
|
|
9
|
-
* This class provides utility functions for building programmable transactions
|
|
10
|
-
* for OFT operations, particularly for LayerZero receive operations.
|
|
11
|
-
*/
|
|
12
|
-
export class OFTPtbBuilder {
|
|
13
|
-
public packageId: string
|
|
14
|
-
public objectId: string
|
|
15
|
-
public readonly client: SuiClient
|
|
16
|
-
public readonly coinType: string
|
|
17
|
-
public readonly oftObjectId: string
|
|
18
|
-
public readonly objects: ObjectOptions
|
|
19
|
-
|
|
20
|
-
constructor(
|
|
21
|
-
protocolSDK: SDK,
|
|
22
|
-
packageId: string,
|
|
23
|
-
objectId: string,
|
|
24
|
-
client: SuiClient,
|
|
25
|
-
coinType: string,
|
|
26
|
-
oftObjectId: string
|
|
27
|
-
) {
|
|
28
|
-
this.objects = protocolSDK.objects
|
|
29
|
-
this.packageId = packageId
|
|
30
|
-
this.objectId = objectId
|
|
31
|
-
this.client = client
|
|
32
|
-
this.coinType = coinType
|
|
33
|
-
this.oftObjectId = oftObjectId
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Get LayerZero receive information for OFT registration
|
|
38
|
-
*
|
|
39
|
-
* This function prepares the necessary metadata for registering an OFT
|
|
40
|
-
* with the LayerZero endpoint, enabling it to receive cross-chain messages.
|
|
41
|
-
*
|
|
42
|
-
* @param tx - The transaction to add the move call to
|
|
43
|
-
* @param composerRegistry - The composer registry object ID for routing compose transfers
|
|
44
|
-
* @returns TransactionResult containing serialized execution metadata for endpoint registration
|
|
45
|
-
*/
|
|
46
|
-
lzReceiveInfoMoveCall(tx: Transaction, composerRegistry: string | TransactionArgument): TransactionResult {
|
|
47
|
-
return tx.moveCall({
|
|
48
|
-
target: `${this.packageId}::oft_ptb_builder::lz_receive_info`,
|
|
49
|
-
typeArguments: [this.coinType],
|
|
50
|
-
arguments: [
|
|
51
|
-
tx.object(this.objectId),
|
|
52
|
-
tx.object(this.oftObjectId),
|
|
53
|
-
tx.object(this.objects.endpointV2),
|
|
54
|
-
asObject(tx, composerRegistry),
|
|
55
|
-
tx.object.clock(),
|
|
56
|
-
],
|
|
57
|
-
})
|
|
58
|
-
}
|
|
59
|
-
}
|