pump-trader 1.1.5 → 1.1.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pump-trader",
3
- "version": "1.1.5",
3
+ "version": "1.1.9",
4
4
  "description": "PumpFun 交易库 - 自动判断 Token Program 和内盘/外盘",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,7 +8,6 @@ import { ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync, TOKEN_PROGR
8
8
  import { PumpTrader } from "../index";
9
9
 
10
10
  const SOL_MINT = new PublicKey("So11111111111111111111111111111111111111112");
11
- const USDC_MINT = new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
12
11
  const FEE_RECIPIENTS = [
13
12
  "5YxQFdt3Tr9zJLvkFccqXVUwhdTWJQc1fFg2YPbxvxeD",
14
13
  "9M4giFFMxmFGXtc3feFzRai56WbBqehoSeRE5GK7gf7",
@@ -208,94 +207,3 @@ test("amm sell places cashback accounts before poolV2 and fee recipient tail", (
208
207
  ).toBase58());
209
208
  assert.equal(instruction.keys.at(-1)?.isWritable, true);
210
209
  });
211
-
212
- test("loadBonding parses quote mint from v2 bonding curve accounts", async () => {
213
- const trader = createTrader() as any;
214
- const mint = Keypair.generate().publicKey;
215
- const creator = Keypair.generate().publicKey;
216
- const data = Buffer.alloc(115);
217
-
218
- let offset = 8;
219
- data.writeBigUInt64LE(11n, offset);
220
- offset += 8;
221
- data.writeBigUInt64LE(22n, offset);
222
- offset += 8;
223
- data.writeBigUInt64LE(33n, offset);
224
- offset += 8;
225
- data.writeBigUInt64LE(44n, offset);
226
- offset += 8;
227
- data.writeBigUInt64LE(55n, offset);
228
- offset += 8;
229
- data[offset] = 1;
230
- offset += 1;
231
- creator.toBuffer().copy(data, offset);
232
- offset += 32;
233
- USDC_MINT.toBuffer().copy(data, offset);
234
- offset += 32;
235
- data[offset] = 1;
236
- offset += 1;
237
- data[offset] = 0;
238
-
239
- trader.connection.getAccountInfo = async () => ({ data });
240
-
241
- const result = await trader.loadBonding(mint);
242
-
243
- assert.equal(result.creator.toBase58(), creator.toBase58());
244
- assert.equal(result.state.quoteMint?.toBase58(), USDC_MINT.toBase58());
245
- assert.equal(result.state.isMayhemMode, true);
246
- assert.equal(result.state.isCashbackCoin, false);
247
- });
248
-
249
- test("getPriceAndStatus uses quote mint decimals for incomplete bonding curves", async () => {
250
- const trader = createTrader() as any;
251
- trader.loadBonding = async () => ({
252
- bonding: Keypair.generate().publicKey,
253
- creator: Keypair.generate().publicKey,
254
- state: {
255
- complete: false,
256
- quoteMint: USDC_MINT
257
- }
258
- });
259
- trader.calcSell = () => 1_234_567n;
260
- trader.connection.getParsedAccountInfo = async () => ({
261
- value: {
262
- data: {
263
- parsed: {
264
- info: {
265
- decimals: 6
266
- }
267
- }
268
- }
269
- }
270
- });
271
-
272
- const result = await trader.getPriceAndStatus(Keypair.generate().publicKey.toBase58());
273
-
274
- assert.equal(result.completed, false);
275
- assert.equal(result.price, 1.234567);
276
- });
277
-
278
- test("getPriceAndStatus forwards quote mint to AMM pricing for completed curves", async () => {
279
- const trader = createTrader() as any;
280
- const calls: PublicKey[][] = [];
281
-
282
- trader.loadBonding = async () => ({
283
- bonding: Keypair.generate().publicKey,
284
- creator: Keypair.generate().publicKey,
285
- state: {
286
- complete: true,
287
- quoteMint: USDC_MINT
288
- }
289
- });
290
- trader.getAmmPrice = async (...args: PublicKey[]) => {
291
- calls.push(args);
292
- return 0.42;
293
- };
294
-
295
- const result = await trader.getPriceAndStatus(Keypair.generate().publicKey.toBase58());
296
-
297
- assert.equal(result.completed, true);
298
- assert.equal(result.price, 0.42);
299
- assert.equal(calls.length, 1);
300
- assert.equal(calls[0][1]?.toBase58(), USDC_MINT.toBase58());
301
- });