@jpool/bond-sdk 0.0.1-next.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/.env +6 -0
- package/.release-it.cjs +1 -0
- package/README.md +126 -0
- package/dist/index.d.mts +866 -0
- package/dist/index.d.ts +866 -0
- package/dist/index.js +1205 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1193 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +36 -0
- package/src/client.ts +568 -0
- package/src/common.ts +2 -0
- package/src/config.ts +35 -0
- package/src/helpers.ts +7 -0
- package/src/idl/jbond.json +707 -0
- package/src/index.ts +8 -0
- package/src/types/index.ts +96 -0
- package/src/types/jbond.ts +713 -0
- package/src/utils/wallet.ts +45 -0
- package/tsconfig.json +39 -0
- package/tsup.config.ts +19 -0
package/.env
ADDED
package/.release-it.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('release-it-config')
|
package/README.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# JBond CLI
|
|
2
|
+
|
|
3
|
+
Command-line interface for interacting with the JBond Solana contract.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
cd app
|
|
9
|
+
npm install
|
|
10
|
+
npm run build
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Configuration
|
|
14
|
+
|
|
15
|
+
1. Copy `.env.example` to `.env`:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
cp .env.example .env
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. Edit `.env` with your configuration:
|
|
22
|
+
|
|
23
|
+
- `SOLANA_RPC_URL`: Solana RPC endpoint
|
|
24
|
+
- `PROGRAM_ID`: JBond program ID
|
|
25
|
+
- `RESERVE_ADDRESS`: Reserve vault address
|
|
26
|
+
- `KEYPAIR_PATH`: Path to your Solana keypair (optional)
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
### Initialize Compensation Pool (First time setup)
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm run dev initialize
|
|
34
|
+
# or with custom keypair
|
|
35
|
+
npm run dev initialize --keypair /path/to/authority.json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Register Validator
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Register with vote account and 10 SOL initial collateral
|
|
42
|
+
npm run dev register-validator <vote-account-pubkey> 10
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Top Up Collateral
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Add 5 SOL to existing collateral
|
|
49
|
+
npm run dev topup-collateral <vote-account-pubkey> 5
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Withdraw Compensation (Oracle only)
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Withdraw 2 SOL from validator
|
|
56
|
+
npm run dev withdraw-compensation <validator-pubkey> <vote-account-pubkey> 2
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Check Validator Info
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Check validator boost account
|
|
63
|
+
npm run dev validator-info <vote-account-pubkey>
|
|
64
|
+
|
|
65
|
+
# Check specific validator
|
|
66
|
+
npm run dev validator-info <vote-account-pubkey> --validator <validator-pubkey>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Check Pool Info
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npm run dev pool-info
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Building for Production
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm run build
|
|
79
|
+
npm link # Make 'jbond' command available globally
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Then you can use:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
jbond validator-info <vote-account-pubkey>
|
|
86
|
+
jbond register-validator <vote-account-pubkey> 10
|
|
87
|
+
# etc...
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Project Structure
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
app/
|
|
94
|
+
├── src/
|
|
95
|
+
│ ├── cli.ts # Main CLI entry point
|
|
96
|
+
│ ├── client.ts # JBond client implementation
|
|
97
|
+
│ ├── config.ts # Configuration loader
|
|
98
|
+
│ ├── types/ # TypeScript types
|
|
99
|
+
│ └── idl/ # Contract IDL
|
|
100
|
+
├── package.json
|
|
101
|
+
├── tsconfig.json
|
|
102
|
+
├── .env.example
|
|
103
|
+
└── README.md
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Development
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Run in development mode
|
|
110
|
+
npm run dev <command>
|
|
111
|
+
|
|
112
|
+
# Build
|
|
113
|
+
npm run build
|
|
114
|
+
|
|
115
|
+
# Lint
|
|
116
|
+
npm run lint
|
|
117
|
+
|
|
118
|
+
# Format
|
|
119
|
+
npm run format
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Important Notes
|
|
123
|
+
|
|
124
|
+
1. Before registering a validator, make sure you have your vote account public key
|
|
125
|
+
2. The authority keypair is required for initialize and withdraw-compensation commands
|
|
126
|
+
3. Make sure to copy your program's IDL file to `src/idl/jbond.json` after building the Anchor program
|