pump-kit 0.0.8 → 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 +77 -45
- 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
|
@@ -24,12 +24,17 @@ A TypeScript SDK for Pump.fun built on **Solana Kit 5.0**. Designed for high-per
|
|
|
24
24
|
|
|
25
25
|
- **Solana Kit 5.0** – Built on the latest Solana development framework
|
|
26
26
|
- **Modern transaction patterns** – Optimized for speed and reliability
|
|
27
|
-
- **
|
|
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`)
|
|
28
30
|
- **Automatic slippage protection** – Built-in guards for buy/sell operations
|
|
29
|
-
- **Launch capabilities** – Create and buy tokens in one atomic transaction
|
|
30
|
-
- **Liquidity operations** – Add/remove liquidity with simple helpers
|
|
31
31
|
- **Full TypeScript support** – Strongly typed throughout with complete type coverage
|
|
32
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
|
|
37
|
+
|
|
33
38
|
---
|
|
34
39
|
|
|
35
40
|
## Installation
|
|
@@ -50,12 +55,12 @@ import { createSolanaRpc } from "@solana/kit";
|
|
|
50
55
|
const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");
|
|
51
56
|
```
|
|
52
57
|
|
|
53
|
-
### Buy Tokens
|
|
58
|
+
### Buy Tokens (Curve)
|
|
54
59
|
|
|
55
60
|
```ts
|
|
56
|
-
import {
|
|
61
|
+
import { curveBuy } from "pump-kit";
|
|
57
62
|
|
|
58
|
-
await
|
|
63
|
+
await curveBuy({
|
|
59
64
|
user: myWallet,
|
|
60
65
|
mint: "TokenMintAddress",
|
|
61
66
|
solAmount: 0.5, // 0.5 SOL
|
|
@@ -64,13 +69,13 @@ await buy({
|
|
|
64
69
|
});
|
|
65
70
|
```
|
|
66
71
|
|
|
67
|
-
### Sell Tokens
|
|
72
|
+
### Sell Tokens (Curve)
|
|
68
73
|
|
|
69
74
|
```ts
|
|
70
|
-
import {
|
|
75
|
+
import { curveSell } from "pump-kit";
|
|
71
76
|
|
|
72
77
|
// Sell specific amount
|
|
73
|
-
await
|
|
78
|
+
await curveSell({
|
|
74
79
|
user: myWallet,
|
|
75
80
|
mint: "TokenMintAddress",
|
|
76
81
|
tokenAmount: 125_000,
|
|
@@ -78,7 +83,7 @@ await sell({
|
|
|
78
83
|
});
|
|
79
84
|
|
|
80
85
|
// Sell percentage of wallet
|
|
81
|
-
await
|
|
86
|
+
await curveSell({
|
|
82
87
|
user: myWallet,
|
|
83
88
|
mint: "TokenMintAddress",
|
|
84
89
|
useWalletPercentage: true,
|
|
@@ -87,68 +92,95 @@ await sell({
|
|
|
87
92
|
});
|
|
88
93
|
```
|
|
89
94
|
|
|
90
|
-
###
|
|
95
|
+
### Buy Tokens (AMM)
|
|
91
96
|
|
|
92
97
|
```ts
|
|
93
|
-
import {
|
|
94
|
-
import { generateKeyPair } from "@solana/kit";
|
|
95
|
-
|
|
96
|
-
const mintKeypair = await generateKeyPair();
|
|
98
|
+
import { buy } from "pump-kit";
|
|
97
99
|
|
|
98
|
-
|
|
100
|
+
await buy({
|
|
99
101
|
user: myWallet,
|
|
100
|
-
mint:
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
uri: "https://arweave.net/metadata.json",
|
|
105
|
-
firstBuyTokenAmount: 1_000_000,
|
|
106
|
-
firstBuySolBudget: 1.0,
|
|
102
|
+
mint: "TokenMintAddress",
|
|
103
|
+
solAmount: 0.5,
|
|
104
|
+
route: "amm", // force AMM routing
|
|
105
|
+
poolCreator: "CreatorAddress", // optional if auto detection works
|
|
107
106
|
rpc,
|
|
108
107
|
});
|
|
109
108
|
```
|
|
110
109
|
|
|
111
|
-
|
|
110
|
+
> `route` defaults to `"auto"`, which prefers the bonding curve when available and falls back to the AMM after migration.
|
|
112
111
|
|
|
113
|
-
|
|
114
|
-
import { quickBuy, quickSell } from "pump-kit";
|
|
112
|
+
### Sell Tokens (AMM)
|
|
115
113
|
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
```ts
|
|
115
|
+
import { sell } from "pump-kit";
|
|
118
116
|
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
await sell({
|
|
118
|
+
user: myWallet,
|
|
119
|
+
mint: "TokenMintAddress",
|
|
120
|
+
useWalletPercentage: true,
|
|
121
|
+
walletPercentage: 50,
|
|
122
|
+
route: "amm",
|
|
123
|
+
poolCreator: "CreatorAddress",
|
|
124
|
+
rpc,
|
|
125
|
+
});
|
|
121
126
|
```
|
|
122
127
|
|
|
123
128
|
---
|
|
124
129
|
|
|
125
130
|
## API Reference
|
|
126
131
|
|
|
127
|
-
###
|
|
132
|
+
### Unified Swap Entry Points
|
|
128
133
|
|
|
129
134
|
```ts
|
|
130
|
-
//
|
|
131
|
-
buy({ user, mint, solAmount,
|
|
135
|
+
// Auto route (default)
|
|
136
|
+
buy({ user, mint, solAmount, rpc, ...options });
|
|
132
137
|
|
|
133
|
-
|
|
134
|
-
sell({ user, mint, tokenAmount?, useWalletPercentage?, walletPercentage?, rpc, ... })
|
|
138
|
+
sell({ user, mint, tokenAmount?, useWalletPercentage?, rpc, ...options });
|
|
135
139
|
|
|
136
|
-
//
|
|
137
|
-
|
|
138
|
-
|
|
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
|
+
```
|
|
139
144
|
|
|
140
|
-
|
|
141
|
-
|
|
145
|
+
### Curve Swap Helpers
|
|
146
|
+
|
|
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, ... })
|
|
142
153
|
```
|
|
143
154
|
|
|
144
|
-
###
|
|
155
|
+
### AMM Swap Helpers
|
|
145
156
|
|
|
146
157
|
```ts
|
|
147
|
-
//
|
|
148
|
-
|
|
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
|
+
})
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Coming Soon
|
|
176
|
+
|
|
177
|
+
```ts
|
|
178
|
+
// Create token with initial buy
|
|
179
|
+
mintWithFirstBuy({ ... })
|
|
149
180
|
|
|
150
|
-
//
|
|
151
|
-
|
|
181
|
+
// Liquidity helpers
|
|
182
|
+
addLiquidity({ ... })
|
|
183
|
+
removeLiquidity({ ... })
|
|
152
184
|
```
|
|
153
185
|
|
|
154
186
|
### Transaction Utilities
|