@paul.lumberwork/bonding-curve-sdk 1.0.0 → 1.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.
@@ -10,8 +10,12 @@
10
10
  {
11
11
  "name": "admin_withdraw",
12
12
  "docs": [
13
- "Admin withdraw after curve is complete (80% filled)",
14
- "Withdraws all SOL and 20% LP tokens to admin wallet for DEX migration",
13
+ "Admin withdraw after curve is complete (70% filled)",
14
+ "Transfers:",
15
+ "- Accumulated fees (0.5% from trades) → treasury wallet",
16
+ "- 10% treasury tokens → treasury wallet",
17
+ "- LP SOL → admin wallet (for DEX)",
18
+ "- 20% LP tokens → admin wallet (for DEX)",
15
19
  "Only callable by hardcoded admin wallet"
16
20
  ],
17
21
  "discriminator": [
@@ -33,6 +37,30 @@
33
37
  "writable": true,
34
38
  "signer": true
35
39
  },
40
+ {
41
+ "name": "launchpad",
42
+ "docs": [
43
+ "Launchpad account (needed for treasury address)"
44
+ ],
45
+ "pda": {
46
+ "seeds": [
47
+ {
48
+ "kind": "const",
49
+ "value": [
50
+ 108,
51
+ 97,
52
+ 117,
53
+ 110,
54
+ 99,
55
+ 104,
56
+ 112,
57
+ 97,
58
+ 100
59
+ ]
60
+ }
61
+ ]
62
+ }
63
+ },
36
64
  {
37
65
  "name": "token_launch",
38
66
  "writable": true,
@@ -126,7 +154,7 @@
126
154
  {
127
155
  "name": "curve_token_account",
128
156
  "docs": [
129
- "Curve token account holding LP reserve tokens (20%)"
157
+ "Curve token account holding tokens (70% curve + 20% LP + 10% treasury)"
130
158
  ],
131
159
  "writable": true,
132
160
  "pda": {
@@ -219,7 +247,7 @@
219
247
  {
220
248
  "name": "admin_token_account",
221
249
  "docs": [
222
- "Admin's token account to receive LP tokens"
250
+ "Admin's token account to receive LP tokens (20%)"
223
251
  ],
224
252
  "writable": true,
225
253
  "pda": {
@@ -309,6 +337,106 @@
309
337
  }
310
338
  }
311
339
  },
340
+ {
341
+ "name": "treasury_wallet",
342
+ "docs": [
343
+ "Treasury wallet to receive accumulated fees"
344
+ ],
345
+ "writable": true
346
+ },
347
+ {
348
+ "name": "treasury_token_account",
349
+ "docs": [
350
+ "Treasury's token account to receive treasury tokens (10%)"
351
+ ],
352
+ "writable": true,
353
+ "pda": {
354
+ "seeds": [
355
+ {
356
+ "kind": "account",
357
+ "path": "treasury_wallet"
358
+ },
359
+ {
360
+ "kind": "const",
361
+ "value": [
362
+ 6,
363
+ 221,
364
+ 246,
365
+ 225,
366
+ 215,
367
+ 101,
368
+ 161,
369
+ 147,
370
+ 217,
371
+ 203,
372
+ 225,
373
+ 70,
374
+ 206,
375
+ 235,
376
+ 121,
377
+ 172,
378
+ 28,
379
+ 180,
380
+ 133,
381
+ 237,
382
+ 95,
383
+ 91,
384
+ 55,
385
+ 145,
386
+ 58,
387
+ 140,
388
+ 245,
389
+ 133,
390
+ 126,
391
+ 255,
392
+ 0,
393
+ 169
394
+ ]
395
+ },
396
+ {
397
+ "kind": "account",
398
+ "path": "mint"
399
+ }
400
+ ],
401
+ "program": {
402
+ "kind": "const",
403
+ "value": [
404
+ 140,
405
+ 151,
406
+ 37,
407
+ 143,
408
+ 78,
409
+ 36,
410
+ 137,
411
+ 241,
412
+ 187,
413
+ 61,
414
+ 16,
415
+ 41,
416
+ 20,
417
+ 142,
418
+ 13,
419
+ 131,
420
+ 11,
421
+ 90,
422
+ 19,
423
+ 153,
424
+ 218,
425
+ 255,
426
+ 16,
427
+ 132,
428
+ 4,
429
+ 142,
430
+ 123,
431
+ 216,
432
+ 219,
433
+ 233,
434
+ 248,
435
+ 89
436
+ ]
437
+ }
438
+ }
439
+ },
312
440
  {
313
441
  "name": "system_program",
314
442
  "address": "11111111111111111111111111111111"
@@ -328,7 +456,7 @@
328
456
  "name": "buy_tokens",
329
457
  "docs": [
330
458
  "Buy tokens on the bonding curve",
331
- "Trading fee: 1% (0.5% platform + 0.5% creator)"
459
+ "Trading fee: 1% (0.5% admin immediate + 0.5% accumulated)"
332
460
  ],
333
461
  "discriminator": [
334
462
  189,
@@ -368,13 +496,6 @@
368
496
  ]
369
497
  }
370
498
  },
371
- {
372
- "name": "creator_wallet",
373
- "docs": [
374
- "Creator wallet to receive creator fees (0.5%)"
375
- ],
376
- "writable": true
377
- },
378
499
  {
379
500
  "name": "admin_wallet",
380
501
  "docs": [
@@ -1043,7 +1164,7 @@
1043
1164
  "name": "complete_launch",
1044
1165
  "docs": [
1045
1166
  "Complete the launch and migrate to DEX",
1046
- "Requires: all 80% of curve tokens sold"
1167
+ "Requires: all 70% of curve tokens sold"
1047
1168
  ],
1048
1169
  "discriminator": [
1049
1170
  118,
@@ -1280,7 +1401,7 @@
1280
1401
  "docs": [
1281
1402
  "Create a new token launch with Linear Bonding Curve (like pump.fun)",
1282
1403
  "Formula: price = k × sold_supply",
1283
- "Simple model: 80% for bonding curve, 20% for LP, 1% trading fee",
1404
+ "Simple model: 70% for bonding curve, 20% for LP, 10% for treasury, 1% trading fee",
1284
1405
  "If initial_k = 0, auto-calculates k for 69 SOL target"
1285
1406
  ],
1286
1407
  "discriminator": [
@@ -1503,6 +1624,42 @@
1503
1624
  }
1504
1625
  }
1505
1626
  },
1627
+ {
1628
+ "name": "metadata",
1629
+ "docs": [
1630
+ "Metaplex metadata account (PDA derived from mint)"
1631
+ ],
1632
+ "writable": true,
1633
+ "pda": {
1634
+ "seeds": [
1635
+ {
1636
+ "kind": "const",
1637
+ "value": [
1638
+ 109,
1639
+ 101,
1640
+ 116,
1641
+ 97,
1642
+ 100,
1643
+ 97,
1644
+ 116,
1645
+ 97
1646
+ ]
1647
+ },
1648
+ {
1649
+ "kind": "account",
1650
+ "path": "metadata_program"
1651
+ },
1652
+ {
1653
+ "kind": "account",
1654
+ "path": "mint"
1655
+ }
1656
+ ],
1657
+ "program": {
1658
+ "kind": "account",
1659
+ "path": "metadata_program"
1660
+ }
1661
+ }
1662
+ },
1506
1663
  {
1507
1664
  "name": "token_program",
1508
1665
  "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
@@ -1511,9 +1668,17 @@
1511
1668
  "name": "associated_token_program",
1512
1669
  "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
1513
1670
  },
1671
+ {
1672
+ "name": "metadata_program",
1673
+ "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
1674
+ },
1514
1675
  {
1515
1676
  "name": "system_program",
1516
1677
  "address": "11111111111111111111111111111111"
1678
+ },
1679
+ {
1680
+ "name": "rent",
1681
+ "address": "SysvarRent111111111111111111111111111111111"
1517
1682
  }
1518
1683
  ],
1519
1684
  "args": [
@@ -1604,7 +1769,7 @@
1604
1769
  "name": "sell_tokens",
1605
1770
  "docs": [
1606
1771
  "Sell tokens on the bonding curve",
1607
- "Trading fee: 1% (0.5% platform + 0.5% creator)"
1772
+ "Trading fee: 1% (0.5% admin immediate + 0.5% accumulated)"
1608
1773
  ],
1609
1774
  "discriminator": [
1610
1775
  114,
@@ -1644,13 +1809,6 @@
1644
1809
  ]
1645
1810
  }
1646
1811
  },
1647
- {
1648
- "name": "creator_wallet",
1649
- "docs": [
1650
- "Creator wallet to receive creator fees (0.5%)"
1651
- ],
1652
- "writable": true
1653
- },
1654
1812
  {
1655
1813
  "name": "admin_wallet",
1656
1814
  "docs": [
@@ -2055,124 +2213,6 @@
2055
2213
  }
2056
2214
  }
2057
2215
  ]
2058
- },
2059
- {
2060
- "name": "withdraw_creator_fees",
2061
- "docs": [
2062
- "Withdraw accumulated creator trading fees",
2063
- "Creator gets 0.5% of each trade - can withdraw accumulated fees at any time"
2064
- ],
2065
- "discriminator": [
2066
- 8,
2067
- 30,
2068
- 213,
2069
- 18,
2070
- 121,
2071
- 105,
2072
- 129,
2073
- 222
2074
- ],
2075
- "accounts": [
2076
- {
2077
- "name": "creator",
2078
- "writable": true,
2079
- "signer": true
2080
- },
2081
- {
2082
- "name": "token_launch",
2083
- "writable": true,
2084
- "pda": {
2085
- "seeds": [
2086
- {
2087
- "kind": "const",
2088
- "value": [
2089
- 116,
2090
- 111,
2091
- 107,
2092
- 101,
2093
- 110,
2094
- 95,
2095
- 108,
2096
- 97,
2097
- 117,
2098
- 110,
2099
- 99,
2100
- 104
2101
- ]
2102
- },
2103
- {
2104
- "kind": "account",
2105
- "path": "mint"
2106
- }
2107
- ]
2108
- }
2109
- },
2110
- {
2111
- "name": "bonding_curve",
2112
- "pda": {
2113
- "seeds": [
2114
- {
2115
- "kind": "const",
2116
- "value": [
2117
- 98,
2118
- 111,
2119
- 110,
2120
- 100,
2121
- 105,
2122
- 110,
2123
- 103,
2124
- 95,
2125
- 99,
2126
- 117,
2127
- 114,
2128
- 118,
2129
- 101
2130
- ]
2131
- },
2132
- {
2133
- "kind": "account",
2134
- "path": "token_launch"
2135
- }
2136
- ]
2137
- }
2138
- },
2139
- {
2140
- "name": "mint",
2141
- "docs": [
2142
- "Token mint"
2143
- ]
2144
- },
2145
- {
2146
- "name": "vault",
2147
- "docs": [
2148
- "Vault holding SOL (including creator fees)"
2149
- ],
2150
- "writable": true,
2151
- "pda": {
2152
- "seeds": [
2153
- {
2154
- "kind": "const",
2155
- "value": [
2156
- 118,
2157
- 97,
2158
- 117,
2159
- 108,
2160
- 116
2161
- ]
2162
- },
2163
- {
2164
- "kind": "account",
2165
- "path": "token_launch"
2166
- }
2167
- ]
2168
- }
2169
- },
2170
- {
2171
- "name": "system_program",
2172
- "address": "11111111111111111111111111111111"
2173
- }
2174
- ],
2175
- "args": []
2176
2216
  }
2177
2217
  ],
2178
2218
  "accounts": [
@@ -2299,13 +2339,23 @@
2299
2339
  "errors": [
2300
2340
  {
2301
2341
  "code": 6000,
2302
- "name": "Overflow",
2303
- "msg": "Math overflow in linear curve calculation"
2342
+ "name": "MathOverflow",
2343
+ "msg": "Math overflow"
2304
2344
  },
2305
2345
  {
2306
2346
  "code": 6001,
2307
- "name": "DivisionByZero",
2308
- "msg": "Division by zero"
2347
+ "name": "InsufficientLiquidity",
2348
+ "msg": "Insufficient liquidity"
2349
+ },
2350
+ {
2351
+ "code": 6002,
2352
+ "name": "CurveComplete",
2353
+ "msg": "Curve is complete - migrate to DEX"
2354
+ },
2355
+ {
2356
+ "code": 6003,
2357
+ "name": "CurveNotComplete",
2358
+ "msg": "Curve is not complete"
2309
2359
  }
2310
2360
  ],
2311
2361
  "types": [
@@ -2327,7 +2377,7 @@
2327
2377
  {
2328
2378
  "name": "mint",
2329
2379
  "docs": [
2330
- "The mint address"
2380
+ "The mint address (token address)"
2331
2381
  ],
2332
2382
  "type": "pubkey"
2333
2383
  },
@@ -2338,17 +2388,45 @@
2338
2388
  ],
2339
2389
  "type": "pubkey"
2340
2390
  },
2391
+ {
2392
+ "name": "creator",
2393
+ "docs": [
2394
+ "The creator's wallet address"
2395
+ ],
2396
+ "type": "pubkey"
2397
+ },
2398
+ {
2399
+ "name": "treasury",
2400
+ "docs": [
2401
+ "The treasury wallet address"
2402
+ ],
2403
+ "type": "pubkey"
2404
+ },
2341
2405
  {
2342
2406
  "name": "sol_withdrawn",
2343
2407
  "docs": [
2344
- "SOL amount withdrawn (in lamports)"
2408
+ "SOL amount withdrawn for LP (in lamports)"
2345
2409
  ],
2346
2410
  "type": "u64"
2347
2411
  },
2348
2412
  {
2349
2413
  "name": "tokens_withdrawn",
2350
2414
  "docs": [
2351
- "LP tokens withdrawn"
2415
+ "LP tokens withdrawn (20%)"
2416
+ ],
2417
+ "type": "u64"
2418
+ },
2419
+ {
2420
+ "name": "fees_to_treasury",
2421
+ "docs": [
2422
+ "Accumulated fees sent to treasury (in lamports)"
2423
+ ],
2424
+ "type": "u64"
2425
+ },
2426
+ {
2427
+ "name": "treasury_tokens",
2428
+ "docs": [
2429
+ "Treasury tokens sent to treasury (10%)"
2352
2430
  ],
2353
2431
  "type": "u64"
2354
2432
  },
@@ -2384,9 +2462,10 @@
2384
2462
  "Price rises linearly as more tokens are sold",
2385
2463
  "",
2386
2464
  "Simple model:",
2387
- "- 80% of tokens available for trading on bonding curve",
2465
+ "- 70% of tokens available for trading on bonding curve",
2388
2466
  "- 20% reserved for DEX liquidity migration",
2389
- "- Trading continues until all 80% sold, then migrate to DEX"
2467
+ "- 10% reserved for treasury",
2468
+ "- Trading continues until all 70% sold, then migrate to DEX"
2390
2469
  ],
2391
2470
  "type": {
2392
2471
  "kind": "struct",
@@ -2436,17 +2515,31 @@
2436
2515
  ],
2437
2516
  "type": "u64"
2438
2517
  },
2518
+ {
2519
+ "name": "token_reserves_for_treasury",
2520
+ "docs": [
2521
+ "Amount of tokens reserved for treasury (10% of total)"
2522
+ ],
2523
+ "type": "u64"
2524
+ },
2439
2525
  {
2440
2526
  "name": "tokens_for_curve",
2441
2527
  "docs": [
2442
- "Maximum tokens available for sale on bonding curve (80% of total)"
2528
+ "Maximum tokens available for sale on bonding curve (70% of total)"
2529
+ ],
2530
+ "type": "u64"
2531
+ },
2532
+ {
2533
+ "name": "accumulated_fees",
2534
+ "docs": [
2535
+ "Accumulated trading fees (0.5% per trade, in lamports)"
2443
2536
  ],
2444
2537
  "type": "u64"
2445
2538
  },
2446
2539
  {
2447
2540
  "name": "complete",
2448
2541
  "docs": [
2449
- "Whether the curve is complete (all 80% sold, ready for migration)"
2542
+ "Whether the curve is complete (all 70% sold, ready for migration)"
2450
2543
  ],
2451
2544
  "type": "bool"
2452
2545
  },
@@ -2559,7 +2652,7 @@
2559
2652
  {
2560
2653
  "name": "curve_allocation",
2561
2654
  "docs": [
2562
- "Tokens allocated to bonding curve (80%)"
2655
+ "Tokens allocated to bonding curve (70%)"
2563
2656
  ],
2564
2657
  "type": "u64"
2565
2658
  },
@@ -2570,6 +2663,13 @@
2570
2663
  ],
2571
2664
  "type": "u64"
2572
2665
  },
2666
+ {
2667
+ "name": "treasury_allocation",
2668
+ "docs": [
2669
+ "Tokens reserved for treasury (10%)"
2670
+ ],
2671
+ "type": "u64"
2672
+ },
2573
2673
  {
2574
2674
  "name": "initial_k",
2575
2675
  "docs": [
@@ -2653,9 +2753,10 @@
2653
2753
  "docs": [
2654
2754
  "Token launch state - represents a single token launch",
2655
2755
  "Simple model:",
2656
- "- 80% supply available for bonding curve trading",
2756
+ "- 70% supply available for bonding curve trading",
2657
2757
  "- 20% supply reserved for DEX liquidity",
2658
- "- 1% trading fee (0.5% platform + 0.5% creator)"
2758
+ "- 10% supply reserved for treasury",
2759
+ "- 1% trading fee (0.5% admin immediate + 0.5% accumulated in curve)"
2659
2760
  ],
2660
2761
  "type": {
2661
2762
  "kind": "struct",
@@ -2698,7 +2799,7 @@
2698
2799
  {
2699
2800
  "name": "curve_allocation",
2700
2801
  "docs": [
2701
- "Tokens allocated for bonding curve (80%)"
2802
+ "Tokens allocated for bonding curve (70%)"
2702
2803
  ],
2703
2804
  "type": "u64"
2704
2805
  },
@@ -2710,16 +2811,16 @@
2710
2811
  "type": "u64"
2711
2812
  },
2712
2813
  {
2713
- "name": "total_sol_raised",
2814
+ "name": "treasury_allocation",
2714
2815
  "docs": [
2715
- "Total SOL raised during presale (after fees)"
2816
+ "Tokens reserved for treasury (10%)"
2716
2817
  ],
2717
2818
  "type": "u64"
2718
2819
  },
2719
2820
  {
2720
- "name": "accumulated_creator_fees",
2821
+ "name": "total_sol_raised",
2721
2822
  "docs": [
2722
- "Accumulated creator fees from trading (0.5% per trade)"
2823
+ "Total SOL raised during presale (after fees)"
2723
2824
  ],
2724
2825
  "type": "u64"
2725
2826
  },
@@ -2840,9 +2941,9 @@
2840
2941
  "type": "u64"
2841
2942
  },
2842
2943
  {
2843
- "name": "creator_fee",
2944
+ "name": "curve_fee",
2844
2945
  "docs": [
2845
- "Creator fee paid (in lamports)"
2946
+ "Curve fee accumulated (in lamports)"
2846
2947
  ],
2847
2948
  "type": "u64"
2848
2949
  },
@@ -2884,7 +2985,7 @@
2884
2985
  {
2885
2986
  "name": "is_curve_complete",
2886
2987
  "docs": [
2887
- "True if this buy completed the curve (reached 80% sold)"
2988
+ "True if this buy completed the curve (reached 70% sold)"
2888
2989
  ],
2889
2990
  "type": "bool"
2890
2991
  }
@@ -2942,9 +3043,9 @@
2942
3043
  "type": "u64"
2943
3044
  },
2944
3045
  {
2945
- "name": "creator_fee",
3046
+ "name": "curve_fee",
2946
3047
  "docs": [
2947
- "Creator fee deducted (in lamports)"
3048
+ "Curve fee accumulated (in lamports)"
2948
3049
  ],
2949
3050
  "type": "u64"
2950
3051
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paul.lumberwork/bonding-curve-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "SDK for Pump.fun clone - Solana bonding curve launchpad",
5
5
  "main": "dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -23,7 +23,8 @@
23
23
  "node": ">=18"
24
24
  },
25
25
  "scripts": {
26
- "build": "tsup",
26
+ "copy-idl": "cp pump_fun_program/target/idl/pump_fun_program.json idl/",
27
+ "build": "npm run copy-idl && tsup",
27
28
  "dev": "tsup --watch",
28
29
  "clean": "rm -rf dist",
29
30
  "typecheck": "tsc --noEmit",