@layerzerolabs/lz-corekit-solana 3.0.14 → 3.0.16

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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @layerzerolabs/lz-corekit-solana
2
2
 
3
+ ## 3.0.16
4
+
5
+ ### Patch Changes
6
+
7
+ - 87a4bc9: islander mainnet
8
+ - Updated dependencies [87a4bc9]
9
+ - @layerzerolabs/lz-core@3.0.16
10
+ - @layerzerolabs/lz-utilities@3.0.16
11
+
12
+ ## 3.0.15
13
+
14
+ ### Patch Changes
15
+
16
+ - 67856bd: endpoints
17
+ - Updated dependencies [67856bd]
18
+ - @layerzerolabs/lz-core@3.0.15
19
+
3
20
  ## 3.0.14
4
21
 
5
22
  ### Patch Changes
package/README.md CHANGED
@@ -1 +1,112 @@
1
- # @layerzerolabs/lz-corekit
1
+ # @layerzerolabs/lz-corekit-solana
2
+
3
+ The Solana CoreKit is a comprehensive SDK designed to interact with the Solana blockchain. It provides a set of utilities and modules to facilitate the development and integration of applications with the Solana blockchain.
4
+
5
+ ## Features
6
+
7
+ - **Retrieve Account Information**: Gets the balance of the specified address.
8
+ - **Retrieve Block Information**: Gets the block height, timestamp and related transactions of the specified block.
9
+ - **Transaction Management**: Get, build, sign, send and confirm transactions.
10
+
11
+ ## Installation
12
+
13
+ To install the Solana CoreKit, you can use npm or yarn:
14
+
15
+ ```sh
16
+ npm install @layerzerolabs/lz-corekit-solana
17
+ ```
18
+
19
+ or
20
+
21
+ ```sh
22
+ yarn add @layerzerolabs/lz-corekit-solana
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ### Initialization
28
+
29
+ ```typescript
30
+ import { SolanaProvider } from "@layerzerolabs/lz-corekit-solana";
31
+
32
+ // url is the Solana chain full node url
33
+ const url = "http://127.0.0.1:8899";
34
+ const provider = SolanaProvider.from(url);
35
+ ```
36
+
37
+ ### Retrieve Account Information
38
+
39
+ #### Get Account Balance
40
+
41
+ ```typescript
42
+ import { SolanaProvider } from "@layerzerolabs/lz-corekit-solana";
43
+
44
+ // url is the Solana chain full node url
45
+ const url = "http://127.0.0.1:8899";
46
+ const provider = SolanaProvider.from(url);
47
+
48
+ const address = "0x1";
49
+ const balance = await provider.getBalance(address);
50
+ ```
51
+
52
+ ### Retrieve Block Information
53
+
54
+ #### Get Latest Block Height
55
+
56
+ ```typescript
57
+ import { SolanaProvider } from "@layerzerolabs/lz-corekit-solana";
58
+
59
+ // url is the Solana chain full node url
60
+ const url = "http://127.0.0.1:8899";
61
+ const provider = SolanaProvider.from(url);
62
+
63
+ const number = await provider.getBlockNumber();
64
+ ```
65
+
66
+ #### Get Current Slot
67
+
68
+ Slot Introduction: https://www.helius.dev/blog/solana-slots-blocks-and-epochs
69
+
70
+ ```typescript
71
+ import { SolanaProvider } from "@layerzerolabs/lz-corekit-solana";
72
+
73
+ // url is the Solana chain full node url
74
+ const url = "http://127.0.0.1:8899";
75
+ const provider = SolanaProvider.from(url);
76
+
77
+ const number = await provider.getSlot();
78
+ ```
79
+
80
+ ### Transaction Management
81
+
82
+ #### Get Transaction by hash
83
+
84
+ ```typescript
85
+ import { SolanaProvider } from "@layerzerolabs/lz-corekit-solana";
86
+
87
+ // url is the Solana chain full node url
88
+ const url = "http://127.0.0.1:8899";
89
+ const provider = SolanaProvider.from(url);
90
+
91
+ const hash = "0x1";
92
+ const tx = await provider.getTransaction(hash);
93
+ ```
94
+
95
+ #### Sign, Send and Confirm Transaction
96
+
97
+ ```typescript
98
+ import { SolanaProvider, SolanaSigner } from '@layerzerolabs/lz-corekit-solana'
99
+ import { SignedTransaction, TransactionReceipt, TransactionRequest } from '@layerzerolabs/lz-core'
100
+
101
+ // url is the Solana chain full node url
102
+ const url = "http://127.0.0.1:8899"
103
+ const provider = SolanaProvider.from(url)
104
+
105
+ const privateKey = '0x1234'
106
+ const signer = SolanaSigner.from(privateKey)
107
+ signer.connect(provider)
108
+
109
+ const tx: TransactionRequest = ...
110
+ const stx: SignedTransaction = await signer.signTransaction(tx)
111
+ const receipt: TransactionReceipt = await signer.sendAndConfirm(stx)
112
+ ```