@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/CHANGELOG.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# @layerzerolabs/lz-iotal1-oft-sdk-v2
|
|
2
|
+
|
|
3
|
+
## 3.0.143
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2b9515d: endpoints: nexera, stable
|
|
8
|
+
- Updated dependencies [2b9515d]
|
|
9
|
+
- @layerzerolabs/lz-definitions@3.0.143
|
|
10
|
+
- @layerzerolabs/lz-iotal1-sdk-v2@3.0.143
|
|
11
|
+
|
|
12
|
+
## 3.0.142
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- ecf5da4: Update the Iota oft sdk
|
|
17
|
+
- Updated dependencies [ecf5da4]
|
|
18
|
+
- @layerzerolabs/lz-definitions@3.0.142
|
|
19
|
+
- @layerzerolabs/lz-iotal1-sdk-v2@3.0.142
|
|
20
|
+
|
|
21
|
+
## 3.0.140
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 6dd8a14: nexera testnet, injectiveevm mainnet
|
|
26
|
+
- Updated dependencies [6dd8a14]
|
|
27
|
+
- @layerzerolabs/lz-definitions@3.0.141
|
|
28
|
+
- @layerzerolabs/lz-iotal1-sdk-v2@3.0.141
|
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# @layerzerolabs/lz-iotal1-oft-sdk-v2
|
|
2
|
+
|
|
3
|
+
LayerZero V2 IOTA OFT (Omnichain Fungible Token) SDK
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This SDK provides TypeScript bindings for interacting with LayerZero V2 OFT contracts on the IOTA blockchain. It enables developers to create, manage, and transfer omnichain fungible tokens across different blockchains using the LayerZero protocol.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @layerzerolabs/lz-iotal1-oft-sdk-v2
|
|
13
|
+
# or
|
|
14
|
+
yarn add @layerzerolabs/lz-iotal1-oft-sdk-v2
|
|
15
|
+
# or
|
|
16
|
+
pnpm add @layerzerolabs/lz-iotal1-oft-sdk-v2
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- **Cross-chain Transfers**: Send tokens across different blockchains
|
|
22
|
+
- **OFT & OFT Adapter**: Interact with deployed OFT & OFT Adapter
|
|
23
|
+
- **OFT Composer**: Advanced composition functionality for complex cross-chain operations
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
### Basic OFT Operations
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { OFT } from "@layerzerolabs/lz-iotal1-oft-sdk-v2";
|
|
31
|
+
import { SDK } from "@layerzerolabs/lz-iotal1-sdk-v2";
|
|
32
|
+
|
|
33
|
+
// Initialize SDK
|
|
34
|
+
const sdk = new SDK({
|
|
35
|
+
client: iotaClient,
|
|
36
|
+
packages: packageOptions,
|
|
37
|
+
objects: objectOptions,
|
|
38
|
+
stage: Stage.MAINNET,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Create OFT instance
|
|
42
|
+
const oft = new OFT(
|
|
43
|
+
builderPackageId,
|
|
44
|
+
builderObjectId,
|
|
45
|
+
packageId,
|
|
46
|
+
iotaClient,
|
|
47
|
+
objects,
|
|
48
|
+
oftObjectId,
|
|
49
|
+
adminCapId,
|
|
50
|
+
coinType,
|
|
51
|
+
sdk.moduleManager,
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
// Send tokens to another chain
|
|
55
|
+
const sendParam = {
|
|
56
|
+
dstEid: destinationEndpointId,
|
|
57
|
+
to: recipientAddress,
|
|
58
|
+
amountLd: amount,
|
|
59
|
+
minAmountLd: minAmount,
|
|
60
|
+
extraOptions: options,
|
|
61
|
+
composeMsg: new Uint8Array(0),
|
|
62
|
+
oftCmd: new Uint8Array(0),
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const { nativeFee, zroFee } = await oft.quoteSend(sender, sendParam, false);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### OFT Composer
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { OFTComposer } from "@layerzerolabs/lz-iotal1-oft-sdk-v2";
|
|
72
|
+
|
|
73
|
+
const composer = new OFTComposer(
|
|
74
|
+
packageId,
|
|
75
|
+
iotaClient,
|
|
76
|
+
objects,
|
|
77
|
+
oftComposerObjectId,
|
|
78
|
+
adminCapId,
|
|
79
|
+
oftComposerRegistryId,
|
|
80
|
+
coinType,
|
|
81
|
+
moduleManager,
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
// Register composer with endpoint
|
|
85
|
+
const lzComposeInfo = await composer.lzComposeInfo();
|
|
86
|
+
composer.registerComposerMoveCall(tx, lzComposeInfo);
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Documentation
|
|
90
|
+
|
|
91
|
+
For detailed documentation and examples, please visit the [LayerZero documentation](https://docs.layerzero.network/).
|
|
92
|
+
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
MIT
|