@pump-fun/pump-sdk 1.27.0 → 1.28.0-devnet.1
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/dist/esm/index.js +3599 -1738
- package/dist/index.d.mts +6741 -6653
- package/dist/index.d.ts +6741 -6653
- package/dist/index.js +3066 -1217
- package/package.json +18 -3
- package/src/bondingCurve.ts +3 -2
- package/src/errors.ts +11 -4
- package/src/fees.ts +16 -9
- package/src/idl/pump.json +263 -1
- package/src/idl/pump.ts +3271 -3815
- package/src/idl/pump_amm.json +391 -1
- package/src/idl/pump_amm.ts +2899 -3154
- package/src/idl/pump_fees.json +1271 -114
- package/src/idl/pump_fees.ts +2208 -1586
- package/src/index.ts +5 -1
- package/src/onlineSdk.ts +52 -27
- package/src/pda.ts +29 -16
- package/src/sdk.ts +127 -78
- package/src/state.ts +1 -1
- package/src/tokenIncentives.ts +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pump-fun/pump-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.28.0-devnet.1",
|
|
4
4
|
"description": "Pump Bonding Curve SDK",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/pump-fun/pump-sdk#readme",
|
|
@@ -35,7 +35,9 @@
|
|
|
35
35
|
"build": "tsup --clean --dts",
|
|
36
36
|
"dev": "tsup --watch",
|
|
37
37
|
"clean": "rm -rf dist",
|
|
38
|
-
"test": "jest"
|
|
38
|
+
"test": "jest",
|
|
39
|
+
"lint": "eslint --cache --quiet \"${@:-.}\"",
|
|
40
|
+
"lint:fix": "eslint --cache --fix --quiet \"${@:-.}\""
|
|
39
41
|
},
|
|
40
42
|
"dependencies": {
|
|
41
43
|
"@coral-xyz/anchor": "^0.31.1",
|
|
@@ -57,7 +59,20 @@
|
|
|
57
59
|
"ts-jest": "^29.3.2",
|
|
58
60
|
"ts-node": "^10.9.2",
|
|
59
61
|
"tsup": "^8.0.0",
|
|
60
|
-
"typescript": "^5.0.0"
|
|
62
|
+
"typescript": "^5.0.0",
|
|
63
|
+
"@eslint/js": "^9.14.0",
|
|
64
|
+
"eslint-config-prettier": "^9.1.0",
|
|
65
|
+
"eslint-config-flat-gitignore": "^2.1.0",
|
|
66
|
+
"eslint-plugin-atomic-design-hierarchy": "^1.0.11",
|
|
67
|
+
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
68
|
+
"eslint-plugin-import": "^2.31.0",
|
|
69
|
+
"eslint-plugin-jest": "^28.11.0",
|
|
70
|
+
"eslint-plugin-jsdoc": "^50.6.11",
|
|
71
|
+
"eslint-plugin-no-barrel-files": "^1.2.2",
|
|
72
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
73
|
+
"eslint-plugin-unicorn": "^54.0.0",
|
|
74
|
+
"globals": "^15.12.0",
|
|
75
|
+
"typescript-eslint": "^8.29.1"
|
|
61
76
|
},
|
|
62
77
|
"publishConfig": {
|
|
63
78
|
"access": "public"
|
package/src/bondingCurve.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import BN from "bn.js";
|
|
2
1
|
import { PublicKey } from "@solana/web3.js";
|
|
3
|
-
import
|
|
2
|
+
import BN from "bn.js";
|
|
3
|
+
|
|
4
4
|
import { computeFeesBps, getFee } from "./fees";
|
|
5
|
+
import { BondingCurve, FeeConfig, Global } from "./state";
|
|
5
6
|
|
|
6
7
|
export function newBondingCurve(global: Global): BondingCurve {
|
|
7
8
|
return {
|
package/src/errors.ts
CHANGED
|
@@ -10,7 +10,10 @@ export class NoShareholdersError extends Error {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export class TooManyShareholdersError extends Error {
|
|
13
|
-
constructor(
|
|
13
|
+
constructor(
|
|
14
|
+
public count: number,
|
|
15
|
+
public max: number,
|
|
16
|
+
) {
|
|
14
17
|
super(`Too many shareholders. Maximum allowed is ${max}, got ${count}`);
|
|
15
18
|
this.name = "TooManyShareholdersError";
|
|
16
19
|
}
|
|
@@ -32,7 +35,9 @@ export class ShareCalculationOverflowError extends Error {
|
|
|
32
35
|
|
|
33
36
|
export class InvalidShareTotalError extends Error {
|
|
34
37
|
constructor(public total: number) {
|
|
35
|
-
super(
|
|
38
|
+
super(
|
|
39
|
+
`Invalid share total. Must equal 10,000 basis points (100%). Got ${total}`,
|
|
40
|
+
);
|
|
36
41
|
this.name = "InvalidShareTotalError";
|
|
37
42
|
}
|
|
38
43
|
}
|
|
@@ -46,7 +51,9 @@ export class DuplicateShareholderError extends Error {
|
|
|
46
51
|
|
|
47
52
|
export class PoolRequiredForGraduatedError extends Error {
|
|
48
53
|
constructor() {
|
|
49
|
-
super(
|
|
54
|
+
super(
|
|
55
|
+
"Pool parameter is required for graduated coins (bondingCurve.complete = true)",
|
|
56
|
+
);
|
|
50
57
|
this.name = "PoolRequiredForGraduatedError";
|
|
51
58
|
}
|
|
52
|
-
}
|
|
59
|
+
}
|
package/src/fees.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import BN from "bn.js";
|
|
2
1
|
import { PublicKey } from "@solana/web3.js";
|
|
3
|
-
import
|
|
2
|
+
import BN from "bn.js";
|
|
3
|
+
|
|
4
4
|
import { bondingCurveMarketCap } from "./bondingCurve";
|
|
5
|
+
import { FeeConfig, Global, Fees, BondingCurve, FeeTier } from "./state";
|
|
5
6
|
|
|
6
|
-
export const ONE_BILLION_SUPPLY = new BN(
|
|
7
|
+
export const ONE_BILLION_SUPPLY = new BN(1_000_000_000_000_000);
|
|
7
8
|
|
|
8
9
|
export interface CalculatedFeesBps {
|
|
9
10
|
protocolFeeBps: BN;
|
|
@@ -25,7 +26,8 @@ export function getFee({
|
|
|
25
26
|
amount: BN;
|
|
26
27
|
isNewBondingCurve: boolean;
|
|
27
28
|
}) {
|
|
28
|
-
const { virtualSolReserves, virtualTokenReserves, isMayhemMode } =
|
|
29
|
+
const { virtualSolReserves, virtualTokenReserves, isMayhemMode } =
|
|
30
|
+
bondingCurve;
|
|
29
31
|
const { protocolFeeBps, creatorFeeBps } = computeFeesBps({
|
|
30
32
|
global,
|
|
31
33
|
feeConfig,
|
|
@@ -104,12 +106,17 @@ function ceilDiv(a: BN, b: BN): BN {
|
|
|
104
106
|
return a.add(b.subn(1)).div(b);
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
export function getFeeRecipient(
|
|
109
|
+
export function getFeeRecipient(
|
|
110
|
+
global: Global,
|
|
111
|
+
mayhemMode: boolean,
|
|
112
|
+
): PublicKey {
|
|
108
113
|
if (mayhemMode) {
|
|
109
|
-
const feeRecipients = [
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
114
|
+
const feeRecipients = [
|
|
115
|
+
global.reservedFeeRecipient,
|
|
116
|
+
...global.reservedFeeRecipients,
|
|
117
|
+
];
|
|
113
118
|
return feeRecipients[Math.floor(Math.random() * feeRecipients.length)];
|
|
114
119
|
}
|
|
120
|
+
const feeRecipients = [global.feeRecipient, ...global.feeRecipients];
|
|
121
|
+
return feeRecipients[Math.floor(Math.random() * feeRecipients.length)];
|
|
115
122
|
}
|
package/src/idl/pump.json
CHANGED
|
@@ -1185,6 +1185,103 @@
|
|
|
1185
1185
|
}
|
|
1186
1186
|
]
|
|
1187
1187
|
},
|
|
1188
|
+
{
|
|
1189
|
+
"name": "claim_cashback",
|
|
1190
|
+
"discriminator": [
|
|
1191
|
+
37,
|
|
1192
|
+
58,
|
|
1193
|
+
35,
|
|
1194
|
+
126,
|
|
1195
|
+
190,
|
|
1196
|
+
53,
|
|
1197
|
+
228,
|
|
1198
|
+
197
|
|
1199
|
+
],
|
|
1200
|
+
"accounts": [
|
|
1201
|
+
{
|
|
1202
|
+
"name": "user",
|
|
1203
|
+
"writable": true
|
|
1204
|
+
},
|
|
1205
|
+
{
|
|
1206
|
+
"name": "user_volume_accumulator",
|
|
1207
|
+
"writable": true,
|
|
1208
|
+
"pda": {
|
|
1209
|
+
"seeds": [
|
|
1210
|
+
{
|
|
1211
|
+
"kind": "const",
|
|
1212
|
+
"value": [
|
|
1213
|
+
117,
|
|
1214
|
+
115,
|
|
1215
|
+
101,
|
|
1216
|
+
114,
|
|
1217
|
+
95,
|
|
1218
|
+
118,
|
|
1219
|
+
111,
|
|
1220
|
+
108,
|
|
1221
|
+
117,
|
|
1222
|
+
109,
|
|
1223
|
+
101,
|
|
1224
|
+
95,
|
|
1225
|
+
97,
|
|
1226
|
+
99,
|
|
1227
|
+
99,
|
|
1228
|
+
117,
|
|
1229
|
+
109,
|
|
1230
|
+
117,
|
|
1231
|
+
108,
|
|
1232
|
+
97,
|
|
1233
|
+
116,
|
|
1234
|
+
111,
|
|
1235
|
+
114
|
|
1236
|
+
]
|
|
1237
|
+
},
|
|
1238
|
+
{
|
|
1239
|
+
"kind": "account",
|
|
1240
|
+
"path": "user"
|
|
1241
|
+
}
|
|
1242
|
+
]
|
|
1243
|
+
}
|
|
1244
|
+
},
|
|
1245
|
+
{
|
|
1246
|
+
"name": "system_program",
|
|
1247
|
+
"address": "11111111111111111111111111111111"
|
|
1248
|
+
},
|
|
1249
|
+
{
|
|
1250
|
+
"name": "event_authority",
|
|
1251
|
+
"pda": {
|
|
1252
|
+
"seeds": [
|
|
1253
|
+
{
|
|
1254
|
+
"kind": "const",
|
|
1255
|
+
"value": [
|
|
1256
|
+
95,
|
|
1257
|
+
95,
|
|
1258
|
+
101,
|
|
1259
|
+
118,
|
|
1260
|
+
101,
|
|
1261
|
+
110,
|
|
1262
|
+
116,
|
|
1263
|
+
95,
|
|
1264
|
+
97,
|
|
1265
|
+
117,
|
|
1266
|
+
116,
|
|
1267
|
+
104,
|
|
1268
|
+
111,
|
|
1269
|
+
114,
|
|
1270
|
+
105,
|
|
1271
|
+
116,
|
|
1272
|
+
121
|
|
1273
|
+
]
|
|
1274
|
+
}
|
|
1275
|
+
]
|
|
1276
|
+
}
|
|
1277
|
+
},
|
|
1278
|
+
{
|
|
1279
|
+
"name": "program",
|
|
1280
|
+
"address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"
|
|
1281
|
+
}
|
|
1282
|
+
],
|
|
1283
|
+
"args": []
|
|
1284
|
+
},
|
|
1188
1285
|
{
|
|
1189
1286
|
"name": "claim_token_incentives",
|
|
1190
1287
|
"discriminator": [
|
|
@@ -2378,6 +2475,14 @@
|
|
|
2378
2475
|
{
|
|
2379
2476
|
"name": "is_mayhem_mode",
|
|
2380
2477
|
"type": "bool"
|
|
2478
|
+
},
|
|
2479
|
+
{
|
|
2480
|
+
"name": "is_cashback_enabled",
|
|
2481
|
+
"type": {
|
|
2482
|
+
"defined": {
|
|
2483
|
+
"name": "OptionBool"
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2381
2486
|
}
|
|
2382
2487
|
]
|
|
2383
2488
|
},
|
|
@@ -3578,7 +3683,10 @@
|
|
|
3578
3683
|
{
|
|
3579
3684
|
"name": "sell",
|
|
3580
3685
|
"docs": [
|
|
3581
|
-
"Sells tokens into a bonding curve."
|
|
3686
|
+
"Sells tokens into a bonding curve.",
|
|
3687
|
+
"For cashback coins, optionally pass user_volume_accumulator as remaining_accounts[0].",
|
|
3688
|
+
"If provided and valid, creator_fee goes to user_volume_accumulator.",
|
|
3689
|
+
"Otherwise, falls back to transferring creator_fee to creator_vault."
|
|
3582
3690
|
],
|
|
3583
3691
|
"discriminator": [
|
|
3584
3692
|
51,
|
|
@@ -4806,6 +4914,86 @@
|
|
|
4806
4914
|
],
|
|
4807
4915
|
"args": []
|
|
4808
4916
|
},
|
|
4917
|
+
{
|
|
4918
|
+
"name": "toggle_cashback_enabled",
|
|
4919
|
+
"discriminator": [
|
|
4920
|
+
115,
|
|
4921
|
+
103,
|
|
4922
|
+
224,
|
|
4923
|
+
255,
|
|
4924
|
+
189,
|
|
4925
|
+
89,
|
|
4926
|
+
86,
|
|
4927
|
+
195
|
|
4928
|
+
],
|
|
4929
|
+
"accounts": [
|
|
4930
|
+
{
|
|
4931
|
+
"name": "global",
|
|
4932
|
+
"writable": true,
|
|
4933
|
+
"pda": {
|
|
4934
|
+
"seeds": [
|
|
4935
|
+
{
|
|
4936
|
+
"kind": "const",
|
|
4937
|
+
"value": [
|
|
4938
|
+
103,
|
|
4939
|
+
108,
|
|
4940
|
+
111,
|
|
4941
|
+
98,
|
|
4942
|
+
97,
|
|
4943
|
+
108
|
|
4944
|
+
]
|
|
4945
|
+
}
|
|
4946
|
+
]
|
|
4947
|
+
}
|
|
4948
|
+
},
|
|
4949
|
+
{
|
|
4950
|
+
"name": "authority",
|
|
4951
|
+
"writable": true,
|
|
4952
|
+
"signer": true,
|
|
4953
|
+
"relations": [
|
|
4954
|
+
"global"
|
|
4955
|
+
]
|
|
4956
|
+
},
|
|
4957
|
+
{
|
|
4958
|
+
"name": "event_authority",
|
|
4959
|
+
"pda": {
|
|
4960
|
+
"seeds": [
|
|
4961
|
+
{
|
|
4962
|
+
"kind": "const",
|
|
4963
|
+
"value": [
|
|
4964
|
+
95,
|
|
4965
|
+
95,
|
|
4966
|
+
101,
|
|
4967
|
+
118,
|
|
4968
|
+
101,
|
|
4969
|
+
110,
|
|
4970
|
+
116,
|
|
4971
|
+
95,
|
|
4972
|
+
97,
|
|
4973
|
+
117,
|
|
4974
|
+
116,
|
|
4975
|
+
104,
|
|
4976
|
+
111,
|
|
4977
|
+
114,
|
|
4978
|
+
105,
|
|
4979
|
+
116,
|
|
4980
|
+
121
|
|
4981
|
+
]
|
|
4982
|
+
}
|
|
4983
|
+
]
|
|
4984
|
+
}
|
|
4985
|
+
},
|
|
4986
|
+
{
|
|
4987
|
+
"name": "program"
|
|
4988
|
+
}
|
|
4989
|
+
],
|
|
4990
|
+
"args": [
|
|
4991
|
+
{
|
|
4992
|
+
"name": "enabled",
|
|
4993
|
+
"type": "bool"
|
|
4994
|
+
}
|
|
4995
|
+
]
|
|
4996
|
+
},
|
|
4809
4997
|
{
|
|
4810
4998
|
"name": "toggle_create_v2",
|
|
4811
4999
|
"discriminator": [
|
|
@@ -5164,6 +5352,19 @@
|
|
|
5164
5352
|
222
|
|
5165
5353
|
]
|
|
5166
5354
|
},
|
|
5355
|
+
{
|
|
5356
|
+
"name": "ClaimCashbackEvent",
|
|
5357
|
+
"discriminator": [
|
|
5358
|
+
226,
|
|
5359
|
+
214,
|
|
5360
|
+
246,
|
|
5361
|
+
33,
|
|
5362
|
+
7,
|
|
5363
|
+
242,
|
|
5364
|
+
147,
|
|
5365
|
+
229
|
|
5366
|
+
]
|
|
5367
|
+
},
|
|
5167
5368
|
{
|
|
5168
5369
|
"name": "ClaimTokenIncentivesEvent",
|
|
5169
5370
|
"discriminator": [
|
|
@@ -5677,6 +5878,11 @@
|
|
|
5677
5878
|
"code": 6055,
|
|
5678
5879
|
"name": "InvalidShareBps",
|
|
5679
5880
|
"msg": "Share bps must be greater than 0"
|
|
5881
|
+
},
|
|
5882
|
+
{
|
|
5883
|
+
"code": 6056,
|
|
5884
|
+
"name": "CashbackNotEnabled",
|
|
5885
|
+
"msg": "Cashback is not enabled"
|
|
5680
5886
|
}
|
|
5681
5887
|
],
|
|
5682
5888
|
"types": [
|
|
@@ -5796,6 +6002,38 @@
|
|
|
5796
6002
|
{
|
|
5797
6003
|
"name": "is_mayhem_mode",
|
|
5798
6004
|
"type": "bool"
|
|
6005
|
+
},
|
|
6006
|
+
{
|
|
6007
|
+
"name": "is_cashback_coin",
|
|
6008
|
+
"type": "bool"
|
|
6009
|
+
}
|
|
6010
|
+
]
|
|
6011
|
+
}
|
|
6012
|
+
},
|
|
6013
|
+
{
|
|
6014
|
+
"name": "ClaimCashbackEvent",
|
|
6015
|
+
"type": {
|
|
6016
|
+
"kind": "struct",
|
|
6017
|
+
"fields": [
|
|
6018
|
+
{
|
|
6019
|
+
"name": "user",
|
|
6020
|
+
"type": "pubkey"
|
|
6021
|
+
},
|
|
6022
|
+
{
|
|
6023
|
+
"name": "amount",
|
|
6024
|
+
"type": "u64"
|
|
6025
|
+
},
|
|
6026
|
+
{
|
|
6027
|
+
"name": "timestamp",
|
|
6028
|
+
"type": "i64"
|
|
6029
|
+
},
|
|
6030
|
+
{
|
|
6031
|
+
"name": "total_claimed",
|
|
6032
|
+
"type": "u64"
|
|
6033
|
+
},
|
|
6034
|
+
{
|
|
6035
|
+
"name": "total_cashback_earned",
|
|
6036
|
+
"type": "u64"
|
|
5799
6037
|
}
|
|
5800
6038
|
]
|
|
5801
6039
|
}
|
|
@@ -6022,6 +6260,10 @@
|
|
|
6022
6260
|
{
|
|
6023
6261
|
"name": "is_mayhem_mode",
|
|
6024
6262
|
"type": "bool"
|
|
6263
|
+
},
|
|
6264
|
+
{
|
|
6265
|
+
"name": "is_cashback_enabled",
|
|
6266
|
+
"type": "bool"
|
|
6025
6267
|
}
|
|
6026
6268
|
]
|
|
6027
6269
|
}
|
|
@@ -6270,6 +6512,10 @@
|
|
|
6270
6512
|
7
|
|
6271
6513
|
]
|
|
6272
6514
|
}
|
|
6515
|
+
},
|
|
6516
|
+
{
|
|
6517
|
+
"name": "is_cashback_enabled",
|
|
6518
|
+
"type": "bool"
|
|
6273
6519
|
}
|
|
6274
6520
|
]
|
|
6275
6521
|
}
|
|
@@ -6728,6 +6974,14 @@
|
|
|
6728
6974
|
{
|
|
6729
6975
|
"name": "mayhem_mode",
|
|
6730
6976
|
"type": "bool"
|
|
6977
|
+
},
|
|
6978
|
+
{
|
|
6979
|
+
"name": "cashback_fee_basis_points",
|
|
6980
|
+
"type": "u64"
|
|
6981
|
+
},
|
|
6982
|
+
{
|
|
6983
|
+
"name": "cashback",
|
|
6984
|
+
"type": "u64"
|
|
6731
6985
|
}
|
|
6732
6986
|
]
|
|
6733
6987
|
}
|
|
@@ -6828,6 +7082,14 @@
|
|
|
6828
7082
|
{
|
|
6829
7083
|
"name": "has_total_claimed_tokens",
|
|
6830
7084
|
"type": "bool"
|
|
7085
|
+
},
|
|
7086
|
+
{
|
|
7087
|
+
"name": "cashback_earned",
|
|
7088
|
+
"type": "u64"
|
|
7089
|
+
},
|
|
7090
|
+
{
|
|
7091
|
+
"name": "total_cashback_claimed",
|
|
7092
|
+
"type": "u64"
|
|
6831
7093
|
}
|
|
6832
7094
|
]
|
|
6833
7095
|
}
|