pump-kit 0.0.4 → 0.0.6
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 +77 -68
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-

|
|
2
|
-
|
|
3
1
|
# Pump Kit
|
|
4
2
|
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="@pump-kit.png" alt="Pump Kit" width="600" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
5
7
|
<p align="center">
|
|
6
8
|
<a href="https://www.npmjs.com/package/pump-kit">
|
|
7
9
|
<img src="https://img.shields.io/npm/v/pump-kit.svg?logo=npm&label=npm" alt="npm version" />
|
|
8
10
|
</a>
|
|
9
|
-
<a href="https://www.npmjs.com/package/pump-kit">
|
|
10
|
-
<img src="https://img.shields.io/npm/dm/pump-kit.svg?logo=npm&label=downloads" alt="npm downloads" />
|
|
11
|
-
</a>
|
|
12
11
|
<a href="https://bun.sh">
|
|
13
12
|
<img src="https://img.shields.io/badge/bun-%3E%3D1.3.0-000000?logo=bun&logoColor=fff" alt="Bun >= 1.3.0" />
|
|
14
13
|
</a>
|
|
@@ -17,99 +16,75 @@
|
|
|
17
16
|
</a>
|
|
18
17
|
</p>
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
A lightweight TypeScript SDK for Pump.fun that handles all the lamport math for you. Work with human-readable SOL amounts, token counts, and wallet percentages.
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
## Features
|
|
23
22
|
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
23
|
+
- **Human-readable inputs** – Use SOL amounts and percentages instead of lamports
|
|
24
|
+
- **Automatic slippage protection** – Built-in guards for buy/sell operations
|
|
25
|
+
- **Token launches** – Create and buy tokens in one transaction
|
|
26
|
+
- **Liquidity management** – Add/remove liquidity with simple helpers
|
|
27
|
+
- **Full TypeScript support** – Strong types throughout
|
|
28
|
+
- **Bun-optimized** – Built and tested with Bun
|
|
28
29
|
|
|
29
30
|
---
|
|
30
31
|
|
|
31
32
|
## Installation
|
|
32
33
|
|
|
33
|
-
Install via npm:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
npm install pump-kit
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Or with Bun:
|
|
40
|
-
|
|
41
34
|
```bash
|
|
42
35
|
bun add pump-kit
|
|
43
36
|
```
|
|
44
37
|
|
|
45
|
-
Or with Yarn:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
yarn add pump-kit
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Or with pnpm:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
pnpm add pump-kit
|
|
55
|
-
```
|
|
56
|
-
|
|
57
38
|
---
|
|
58
39
|
|
|
59
40
|
## Quick Start
|
|
60
41
|
|
|
61
|
-
###
|
|
42
|
+
### Setup
|
|
62
43
|
|
|
63
44
|
```ts
|
|
64
|
-
import { buy } from "pump-kit";
|
|
65
45
|
import { createSolanaRpc } from "@solana/kit";
|
|
66
46
|
|
|
67
|
-
const rpc = createSolanaRpc("https://
|
|
47
|
+
const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Buy Tokens
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { buy } from "pump-kit";
|
|
68
54
|
|
|
69
55
|
await buy({
|
|
70
56
|
user: myWallet,
|
|
71
57
|
mint: "TokenMintAddress",
|
|
72
|
-
solAmount: 0.5,
|
|
73
|
-
slippageBps:
|
|
58
|
+
solAmount: 0.5, // 0.5 SOL
|
|
59
|
+
slippageBps: 50, // 0.5% slippage (optional)
|
|
74
60
|
rpc,
|
|
75
61
|
});
|
|
76
62
|
```
|
|
77
63
|
|
|
78
|
-
### Sell Tokens
|
|
64
|
+
### Sell Tokens
|
|
79
65
|
|
|
80
66
|
```ts
|
|
81
67
|
import { sell } from "pump-kit";
|
|
82
68
|
|
|
83
|
-
// Sell
|
|
69
|
+
// Sell specific amount
|
|
84
70
|
await sell({
|
|
85
71
|
user: myWallet,
|
|
86
72
|
mint: "TokenMintAddress",
|
|
87
|
-
tokenAmount: 125_000,
|
|
73
|
+
tokenAmount: 125_000,
|
|
88
74
|
rpc,
|
|
89
75
|
});
|
|
90
76
|
|
|
91
|
-
// Sell
|
|
77
|
+
// Sell percentage of wallet
|
|
92
78
|
await sell({
|
|
93
79
|
user: myWallet,
|
|
94
80
|
mint: "TokenMintAddress",
|
|
95
81
|
useWalletPercentage: true,
|
|
96
|
-
walletPercentage: 40,
|
|
82
|
+
walletPercentage: 40, // Sell 40% of holdings
|
|
97
83
|
rpc,
|
|
98
84
|
});
|
|
99
85
|
```
|
|
100
86
|
|
|
101
|
-
###
|
|
102
|
-
|
|
103
|
-
```ts
|
|
104
|
-
import { quickBuy, quickSell } from "pump-kit";
|
|
105
|
-
|
|
106
|
-
const buyInstruction = await quickBuy(myWallet, "TokenMint", 0.25, { rpc });
|
|
107
|
-
const sellInstruction = await quickSell(myWallet, "TokenMint", 100_000, { rpc });
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
> **Note:** The quick helpers require an RPC client. Always pass `{ rpc }` (and any optional overrides) as the final argument.
|
|
111
|
-
|
|
112
|
-
### Mint New Token
|
|
87
|
+
### Create and Buy Token
|
|
113
88
|
|
|
114
89
|
```ts
|
|
115
90
|
import { mintWithFirstBuy } from "pump-kit";
|
|
@@ -124,36 +99,70 @@ const { createInstruction, buyInstruction } = await mintWithFirstBuy({
|
|
|
124
99
|
name: "My Token",
|
|
125
100
|
symbol: "MTK",
|
|
126
101
|
uri: "https://arweave.net/metadata.json",
|
|
127
|
-
firstBuyTokenAmount: 1_000_000,
|
|
128
|
-
firstBuySolBudget: 1.
|
|
102
|
+
firstBuyTokenAmount: 1_000_000,
|
|
103
|
+
firstBuySolBudget: 1.0,
|
|
129
104
|
rpc,
|
|
130
105
|
});
|
|
131
106
|
```
|
|
132
107
|
|
|
133
|
-
|
|
108
|
+
### Quick Helpers
|
|
134
109
|
|
|
135
|
-
|
|
110
|
+
```ts
|
|
111
|
+
import { quickBuy, quickSell } from "pump-kit";
|
|
112
|
+
|
|
113
|
+
// Get buy instruction
|
|
114
|
+
const buyIx = await quickBuy(myWallet, "TokenMint", 0.25, { rpc });
|
|
136
115
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
- **Composable** – Works alongside your existing transaction flow; no global configuration
|
|
116
|
+
// Get sell instruction
|
|
117
|
+
const sellIx = await quickSell(myWallet, "TokenMint", 100_000, { rpc });
|
|
118
|
+
```
|
|
141
119
|
|
|
142
|
-
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## API Reference
|
|
123
|
+
|
|
124
|
+
### Core Functions
|
|
143
125
|
|
|
144
126
|
```ts
|
|
127
|
+
// Buy tokens
|
|
128
|
+
buy({ user, mint, solAmount, slippageBps?, rpc, ... })
|
|
129
|
+
|
|
130
|
+
// Sell tokens
|
|
131
|
+
sell({ user, mint, tokenAmount?, useWalletPercentage?, walletPercentage?, rpc, ... })
|
|
132
|
+
|
|
133
|
+
// Quick helpers (return instructions only)
|
|
145
134
|
quickBuy(wallet, mint, solAmount, { rpc, ...options })
|
|
146
135
|
quickSell(wallet, mint, tokenAmount, { rpc, ...options })
|
|
147
136
|
|
|
148
|
-
|
|
149
|
-
|
|
137
|
+
// Create token with initial buy
|
|
138
|
+
mintWithFirstBuy({ user, mint, name, symbol, uri, firstBuyTokenAmount, firstBuySolBudget, rpc, ... })
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Liquidity Management
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
// Add liquidity to pool
|
|
145
|
+
addLiquidity({ user, baseMint, quoteMint?, maxBaseAmountIn, maxQuoteAmountIn, rpc, ... })
|
|
146
|
+
|
|
147
|
+
// Remove liquidity from pool
|
|
148
|
+
removeLiquidity({ user, baseMint, quoteMint?, lpAmountIn, rpc, ... })
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Transaction Utilities
|
|
150
152
|
|
|
153
|
+
```ts
|
|
154
|
+
// Build transaction
|
|
151
155
|
buildTransaction({ instructions, payer, prependInstructions?, appendInstructions?, rpc })
|
|
156
|
+
|
|
157
|
+
// Send and confirm
|
|
152
158
|
sendAndConfirmTransaction({ instructions, payer, rpc, rpcSubscriptions, ... })
|
|
159
|
+
|
|
160
|
+
// Simulate transaction
|
|
153
161
|
simulateTransaction({ instructions, payer, rpc, options? })
|
|
162
|
+
```
|
|
154
163
|
|
|
155
|
-
|
|
156
|
-
removeLiquidity({ user, baseMint, quoteMint?, lpAmountIn, ... })
|
|
164
|
+
---
|
|
157
165
|
|
|
158
|
-
|
|
159
|
-
|
|
166
|
+
## License
|
|
167
|
+
|
|
168
|
+
MIT
|