@layerzerolabs/lz-solana-sdk-v2 3.0.15 → 3.0.17
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 +132 -0
- package/deployments/solana-mainnet/dvn-paxos.json +9 -0
- package/deployments/solana-testnet/dvn-paxos.json +9 -0
- package/dist/index.cjs +1325 -265
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1940 -62
- package/dist/index.d.ts +1940 -62
- package/dist/index.mjs +1293 -233
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @layerzerolabs/lz-solana-sdk-v2
|
|
2
2
|
|
|
3
|
+
## 3.0.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 40f2269: islander mainnet
|
|
8
|
+
- 40f2269: testnets
|
|
9
|
+
- Updated dependencies [40f2269]
|
|
10
|
+
- Updated dependencies [40f2269]
|
|
11
|
+
- @layerzerolabs/lz-corekit-solana@3.0.17
|
|
12
|
+
- @layerzerolabs/lz-definitions@3.0.17
|
|
13
|
+
- @layerzerolabs/lz-foundation@3.0.17
|
|
14
|
+
- @layerzerolabs/lz-serdes@3.0.17
|
|
15
|
+
- @layerzerolabs/lz-utilities@3.0.17
|
|
16
|
+
- @layerzerolabs/lz-v2-utilities@3.0.17
|
|
17
|
+
|
|
18
|
+
## 3.0.16
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- 87a4bc9: islander mainnet
|
|
23
|
+
- Updated dependencies [87a4bc9]
|
|
24
|
+
- @layerzerolabs/lz-corekit-solana@3.0.16
|
|
25
|
+
- @layerzerolabs/lz-definitions@3.0.16
|
|
26
|
+
- @layerzerolabs/lz-foundation@3.0.16
|
|
27
|
+
- @layerzerolabs/lz-serdes@3.0.16
|
|
28
|
+
- @layerzerolabs/lz-utilities@3.0.16
|
|
29
|
+
- @layerzerolabs/lz-v2-utilities@3.0.16
|
|
30
|
+
|
|
3
31
|
## 3.0.15
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/README.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# @layerzerolabs/lz-solana-sdk-v2
|
|
2
|
+
|
|
3
|
+
The LayerZero Solana SDK V2 package provides a set of essential utilities and modules to facilitate the development and integration of applications with the Solana blockchain. It includes functions for managing deployments, handling wallets, interacting with contracts, and more.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Deployment Management**: Functions for reading, writing, and managing deployments.
|
|
8
|
+
- **Wallet Management**: Functions for handling Solana wallets.
|
|
9
|
+
- **Contract Interaction**: Functions for interacting with deployed contracts.
|
|
10
|
+
- **Event Extraction**: Functions for extracting events from transactions.
|
|
11
|
+
- **Price Feed Management**: Functions for managing price feeds.
|
|
12
|
+
- **Utility Functions**: Various utility functions for Solana development.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
To install the LayerZero Solana SDK V2 package, you can use npm or yarn:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npm install @layerzerolabs/lz-solana-sdk-v2
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
or
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
yarn add @layerzerolabs/lz-solana-sdk-v2
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
### Deployment Management
|
|
31
|
+
|
|
32
|
+
#### getProgramKeypair
|
|
33
|
+
|
|
34
|
+
Gets the program keypair for a specified network and program.
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { getProgramKeypair } from "@layerzerolabs/lz-solana-sdk-v2";
|
|
38
|
+
|
|
39
|
+
const network = "solana-sandbox-local";
|
|
40
|
+
const program = "endpoint";
|
|
41
|
+
|
|
42
|
+
const programKeypair = getProgramKeypair(network, program);
|
|
43
|
+
console.log(`Program Keypair: ${programKeypair.toBase58()}`);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Wallet Management
|
|
47
|
+
|
|
48
|
+
#### getChainWallet
|
|
49
|
+
|
|
50
|
+
Retrieves a chain wallet for a specified stage and name.
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import { getChainWallet } from "@layerzerolabs/lz-solana-sdk-v2";
|
|
54
|
+
|
|
55
|
+
const stage = "production";
|
|
56
|
+
const name = "oracle";
|
|
57
|
+
|
|
58
|
+
const wallet = getChainWallet(stage, name);
|
|
59
|
+
console.log(`Wallet Address: ${wallet.publicKey.toBase58()}`);
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Contract Interaction
|
|
63
|
+
|
|
64
|
+
#### initEndpoint
|
|
65
|
+
|
|
66
|
+
Initializes the endpoint settings, including eid and admin, and registers the blocked message library.
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import { Endpoint } from "@layerzerolabs/lz-solana-sdk-v2";
|
|
70
|
+
|
|
71
|
+
const endpointProgram = new Endpoint(programPublicKey);
|
|
72
|
+
const endpointId = 1;
|
|
73
|
+
const payer = new PublicKey("payerPublicKey");
|
|
74
|
+
const admin = new PublicKey("adminPublicKey");
|
|
75
|
+
|
|
76
|
+
const instruction = endpointProgram.initEndpoint(endpointId, payer, admin);
|
|
77
|
+
console.log(`Transaction Instruction: ${instruction}`);
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Event Extraction
|
|
81
|
+
|
|
82
|
+
#### extractSentPacketEventByTxHash
|
|
83
|
+
|
|
84
|
+
Extracts the sent packet event by transaction hash.
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
import { extractSentPacketEventByTxHash } from "@layerzerolabs/lz-solana-sdk-v2";
|
|
88
|
+
|
|
89
|
+
const connection = new Connection("https://api.mainnet-beta.solana.com");
|
|
90
|
+
const program = new PublicKey("programPublicKey");
|
|
91
|
+
const signature = "transactionSignature";
|
|
92
|
+
|
|
93
|
+
extractSentPacketEventByTxHash(connection, program, signature).then((events) => {
|
|
94
|
+
console.log(`Sent Packet Events: ${events}`);
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Price Feed Management
|
|
99
|
+
|
|
100
|
+
#### initPriceFeed
|
|
101
|
+
|
|
102
|
+
Initializes the price feed.
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
import { PriceFeed } from "@layerzerolabs/lz-solana-sdk-v2";
|
|
106
|
+
|
|
107
|
+
const priceFeedProgram = new PriceFeed(programPublicKey);
|
|
108
|
+
const connection = new Connection("https://api.mainnet-beta.solana.com");
|
|
109
|
+
const payer = new PublicKey("payerPublicKey");
|
|
110
|
+
const admin = new PublicKey("adminPublicKey");
|
|
111
|
+
const updaters = [new PublicKey("updaterPublicKey")];
|
|
112
|
+
|
|
113
|
+
priceFeedProgram.initPriceFeed(connection, payer, admin, updaters).then((instruction) => {
|
|
114
|
+
console.log(`Transaction Instruction: ${instruction}`);
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Utility Functions
|
|
119
|
+
|
|
120
|
+
#### deriveLzReceiveTypesAccountsPDA
|
|
121
|
+
|
|
122
|
+
Derives the LZ receive types accounts PDA.
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
import { deriveLzReceiveTypesAccountsPDA } from "@layerzerolabs/lz-solana-sdk-v2";
|
|
126
|
+
|
|
127
|
+
const program = new PublicKey("programPublicKey");
|
|
128
|
+
const oappId = new PublicKey("oappId");
|
|
129
|
+
|
|
130
|
+
const [pda, bump] = deriveLzReceiveTypesAccountsPDA(program, oappId);
|
|
131
|
+
console.log(`PDA: ${pda.toBase58()}, Bump: ${bump}`);
|
|
132
|
+
```
|