pump-kit 0.0.7 → 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 +83 -48
- package/dist/index.js +8 -8
- package/dist/types/ammsdk/bondingCurveMath.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/simple.d.ts +2 -2
- package/dist/types/swap/amm.d.ts +35 -0
- package/dist/types/swap/curve.d.ts +39 -0
- package/dist/types/swap.d.ts +21 -44
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -16,16 +16,24 @@
|
|
|
16
16
|
</a>
|
|
17
17
|
</p>
|
|
18
18
|
|
|
19
|
-
A
|
|
19
|
+
A TypeScript SDK for Pump.fun built on **Solana Kit 5.0**. Designed for high-performance applications including launch bots, bundlers, and low-latency trading systems using latest Solana best practices.
|
|
20
|
+
|
|
21
|
+
**Production-ready package coming soon.**
|
|
20
22
|
|
|
21
23
|
## Features
|
|
22
24
|
|
|
23
|
-
- **
|
|
25
|
+
- **Solana Kit 5.0** – Built on the latest Solana development framework
|
|
26
|
+
- **Modern transaction patterns** – Optimized for speed and reliability
|
|
27
|
+
- **Unified swaps** – `buy`/`sell` auto-route between bonding curves and AMM pools
|
|
28
|
+
- **Curve helpers** – Direct access to bonding-curve instructions when you need them (`curveBuy`, `curveSell`)
|
|
29
|
+
- **AMM helpers** – Deterministic AMM operations with percentage-aware selling (`ammBuy`, `ammSell`)
|
|
24
30
|
- **Automatic slippage protection** – Built-in guards for buy/sell operations
|
|
25
|
-
- **
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
- **Full TypeScript support** – Strongly typed throughout with complete type coverage
|
|
32
|
+
|
|
33
|
+
### Coming Soon
|
|
34
|
+
|
|
35
|
+
- **Launch & mint helpers** – Create and seed new Pump.fun tokens once integration is ready
|
|
36
|
+
- **Liquidity tooling** – Add/remove liquidity with tested helpers
|
|
29
37
|
|
|
30
38
|
---
|
|
31
39
|
|
|
@@ -47,12 +55,12 @@ import { createSolanaRpc } from "@solana/kit";
|
|
|
47
55
|
const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");
|
|
48
56
|
```
|
|
49
57
|
|
|
50
|
-
### Buy Tokens
|
|
58
|
+
### Buy Tokens (Curve)
|
|
51
59
|
|
|
52
60
|
```ts
|
|
53
|
-
import {
|
|
61
|
+
import { curveBuy } from "pump-kit";
|
|
54
62
|
|
|
55
|
-
await
|
|
63
|
+
await curveBuy({
|
|
56
64
|
user: myWallet,
|
|
57
65
|
mint: "TokenMintAddress",
|
|
58
66
|
solAmount: 0.5, // 0.5 SOL
|
|
@@ -61,13 +69,13 @@ await buy({
|
|
|
61
69
|
});
|
|
62
70
|
```
|
|
63
71
|
|
|
64
|
-
### Sell Tokens
|
|
72
|
+
### Sell Tokens (Curve)
|
|
65
73
|
|
|
66
74
|
```ts
|
|
67
|
-
import {
|
|
75
|
+
import { curveSell } from "pump-kit";
|
|
68
76
|
|
|
69
77
|
// Sell specific amount
|
|
70
|
-
await
|
|
78
|
+
await curveSell({
|
|
71
79
|
user: myWallet,
|
|
72
80
|
mint: "TokenMintAddress",
|
|
73
81
|
tokenAmount: 125_000,
|
|
@@ -75,7 +83,7 @@ await sell({
|
|
|
75
83
|
});
|
|
76
84
|
|
|
77
85
|
// Sell percentage of wallet
|
|
78
|
-
await
|
|
86
|
+
await curveSell({
|
|
79
87
|
user: myWallet,
|
|
80
88
|
mint: "TokenMintAddress",
|
|
81
89
|
useWalletPercentage: true,
|
|
@@ -84,68 +92,95 @@ await sell({
|
|
|
84
92
|
});
|
|
85
93
|
```
|
|
86
94
|
|
|
87
|
-
###
|
|
95
|
+
### Buy Tokens (AMM)
|
|
88
96
|
|
|
89
97
|
```ts
|
|
90
|
-
import {
|
|
91
|
-
import { generateKeyPair } from "@solana/kit";
|
|
92
|
-
|
|
93
|
-
const mintKeypair = await generateKeyPair();
|
|
98
|
+
import { buy } from "pump-kit";
|
|
94
99
|
|
|
95
|
-
|
|
100
|
+
await buy({
|
|
96
101
|
user: myWallet,
|
|
97
|
-
mint:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
uri: "https://arweave.net/metadata.json",
|
|
102
|
-
firstBuyTokenAmount: 1_000_000,
|
|
103
|
-
firstBuySolBudget: 1.0,
|
|
102
|
+
mint: "TokenMintAddress",
|
|
103
|
+
solAmount: 0.5,
|
|
104
|
+
route: "amm", // force AMM routing
|
|
105
|
+
poolCreator: "CreatorAddress", // optional if auto detection works
|
|
104
106
|
rpc,
|
|
105
107
|
});
|
|
106
108
|
```
|
|
107
109
|
|
|
108
|
-
|
|
110
|
+
> `route` defaults to `"auto"`, which prefers the bonding curve when available and falls back to the AMM after migration.
|
|
109
111
|
|
|
110
|
-
|
|
111
|
-
import { quickBuy, quickSell } from "pump-kit";
|
|
112
|
+
### Sell Tokens (AMM)
|
|
112
113
|
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
```ts
|
|
115
|
+
import { sell } from "pump-kit";
|
|
115
116
|
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
await sell({
|
|
118
|
+
user: myWallet,
|
|
119
|
+
mint: "TokenMintAddress",
|
|
120
|
+
useWalletPercentage: true,
|
|
121
|
+
walletPercentage: 50,
|
|
122
|
+
route: "amm",
|
|
123
|
+
poolCreator: "CreatorAddress",
|
|
124
|
+
rpc,
|
|
125
|
+
});
|
|
118
126
|
```
|
|
119
127
|
|
|
120
128
|
---
|
|
121
129
|
|
|
122
130
|
## API Reference
|
|
123
131
|
|
|
124
|
-
###
|
|
132
|
+
### Unified Swap Entry Points
|
|
125
133
|
|
|
126
134
|
```ts
|
|
127
|
-
//
|
|
128
|
-
buy({ user, mint, solAmount,
|
|
135
|
+
// Auto route (default)
|
|
136
|
+
buy({ user, mint, solAmount, rpc, ...options });
|
|
137
|
+
|
|
138
|
+
sell({ user, mint, tokenAmount?, useWalletPercentage?, rpc, ...options });
|
|
129
139
|
|
|
130
|
-
//
|
|
131
|
-
|
|
140
|
+
// Force AMM routing, optionally provide pool hints
|
|
141
|
+
buy({ user, mint, solAmount, rpc, route: "amm", poolCreator?, poolAddress?, quoteMint? });
|
|
142
|
+
sell({ user, mint, route: "amm", poolCreator?, poolAddress?, quoteMint?, useWalletPercentage? });
|
|
143
|
+
```
|
|
132
144
|
|
|
133
|
-
|
|
134
|
-
quickBuy(wallet, mint, solAmount, { rpc, ...options })
|
|
135
|
-
quickSell(wallet, mint, tokenAmount, { rpc, ...options })
|
|
145
|
+
### Curve Swap Helpers
|
|
136
146
|
|
|
137
|
-
|
|
138
|
-
|
|
147
|
+
```ts
|
|
148
|
+
// Buy tokens on the bonding curve
|
|
149
|
+
curveBuy({ user, mint, solAmount, slippageBps?, rpc, ... })
|
|
150
|
+
|
|
151
|
+
// Sell tokens on the bonding curve
|
|
152
|
+
curveSell({ user, mint, tokenAmount?, useWalletPercentage?, walletPercentage?, rpc, ... })
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### AMM Swap Helpers
|
|
156
|
+
|
|
157
|
+
```ts
|
|
158
|
+
// Buy tokens from the AMM pool using a SOL budget
|
|
159
|
+
ammBuy({ user, mint, solAmount, rpc, quoteMint?, poolCreator?, poolAddress? })
|
|
160
|
+
|
|
161
|
+
// Sell tokens into the AMM pool (supports percentage-based selling)
|
|
162
|
+
ammSell({
|
|
163
|
+
user,
|
|
164
|
+
mint,
|
|
165
|
+
tokenAmount?,
|
|
166
|
+
useWalletPercentage?,
|
|
167
|
+
walletPercentage?,
|
|
168
|
+
rpc,
|
|
169
|
+
quoteMint?,
|
|
170
|
+
poolCreator?,
|
|
171
|
+
poolAddress?,
|
|
172
|
+
})
|
|
139
173
|
```
|
|
140
174
|
|
|
141
|
-
###
|
|
175
|
+
### Coming Soon
|
|
142
176
|
|
|
143
177
|
```ts
|
|
144
|
-
//
|
|
145
|
-
|
|
178
|
+
// Create token with initial buy
|
|
179
|
+
mintWithFirstBuy({ ... })
|
|
146
180
|
|
|
147
|
-
//
|
|
148
|
-
|
|
181
|
+
// Liquidity helpers
|
|
182
|
+
addLiquidity({ ... })
|
|
183
|
+
removeLiquidity({ ... })
|
|
149
184
|
```
|
|
150
185
|
|
|
151
186
|
### Transaction Utilities
|