multistake 0.1.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/README.md +50 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/multistake.json +790 -0
- package/dist/sdk.d.ts +88 -0
- package/dist/sdk.js +247 -0
- package/dist/types/multistake.d.ts +796 -0
- package/dist/types/multistake.js +1 -0
- package/dist/types.d.ts +49 -0
- package/dist/types.js +1 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# MultiStake SDK
|
|
2
|
+
|
|
3
|
+
单币质押系统的 TypeScript SDK
|
|
4
|
+
|
|
5
|
+
## 特性
|
|
6
|
+
|
|
7
|
+
- ✅ 完整的类型支持
|
|
8
|
+
- ✅ 内置 IDL,无需外部依赖
|
|
9
|
+
- ✅ 简洁的 API 设计
|
|
10
|
+
- ✅ 支持所有质押操作
|
|
11
|
+
|
|
12
|
+
## 安装
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @KM-studio/multistake-sdk @coral-xyz/anchor @solana/web3.js @solana/spl-token
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 快速开始
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { Connection, Keypair, PublicKey } from "@solana/web3.js";
|
|
22
|
+
import { Wallet } from "@coral-xyz/anchor";
|
|
23
|
+
import { MultiStakeSDK } from "@KM-studio/multistake-sdk";
|
|
24
|
+
|
|
25
|
+
// 初始化
|
|
26
|
+
const connection = new Connection("http://127.0.0.1:8899");
|
|
27
|
+
const wallet = new Wallet(Keypair.generate());
|
|
28
|
+
const programId = new PublicKey("2mgSDKAjDo8fQN6oms6YzczHhyeYEJunTzxjQgegYADf");
|
|
29
|
+
const sdk = new MultiStakeSDK(connection, wallet, programId);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## 主要功能
|
|
33
|
+
|
|
34
|
+
### 1. Pool 管理
|
|
35
|
+
|
|
36
|
+
#### 创建 Pool
|
|
37
|
+
```typescript
|
|
38
|
+
const { pool, signature } = await sdk.createPool(
|
|
39
|
+
mainTokenMint, // 主币 mint 地址
|
|
40
|
+
admin, // 管理员 Keypair
|
|
41
|
+
payer, // 支付账户 Keypair
|
|
42
|
+
config // Pool 配置(可选)
|
|
43
|
+
);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
#### 派生 PDA
|
|
47
|
+
```typescript
|
|
48
|
+
const [poolAuthority, bump1] = sdk.derivePoolAuthority(pool);
|
|
49
|
+
const [poolVault, bump2] = sdk.derivePoolVault(pool);
|
|
50
|
+
```
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED