@pump-fun/pump-sdk 1.23.0 → 1.25.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 +10043 -320
- package/dist/index.d.mts +11853 -1496
- package/dist/index.d.ts +11853 -1496
- package/dist/index.js +10039 -317
- package/package.json +1 -1
- package/src/errors.ts +52 -0
- package/src/fees.ts +10 -0
- package/src/idl/pump.json +792 -31
- package/src/idl/pump.ts +792 -31
- package/src/idl/pump_amm.json +5878 -0
- package/src/idl/pump_amm.ts +5884 -0
- package/src/idl/pump_fees.json +2761 -0
- package/src/idl/pump_fees.ts +2767 -0
- package/src/index.ts +11 -0
- package/src/pda.ts +35 -3
- package/src/sdk.ts +395 -61
- package/src/state.ts +28 -0
package/package.json
CHANGED
package/src/errors.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom error types for the Pump SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export class NoShareholdersError extends Error {
|
|
6
|
+
constructor() {
|
|
7
|
+
super("No shareholders provided");
|
|
8
|
+
this.name = "NoShareholdersError";
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export class TooManyShareholdersError extends Error {
|
|
13
|
+
constructor(public count: number, public max: number) {
|
|
14
|
+
super(`Too many shareholders. Maximum allowed is ${max}, got ${count}`);
|
|
15
|
+
this.name = "TooManyShareholdersError";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class ZeroShareError extends Error {
|
|
20
|
+
constructor(public address: string) {
|
|
21
|
+
super(`Zero or negative share not allowed for address ${address}`);
|
|
22
|
+
this.name = "ZeroShareError";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export class ShareCalculationOverflowError extends Error {
|
|
27
|
+
constructor() {
|
|
28
|
+
super("Share calculation overflow - total shares exceed maximum value");
|
|
29
|
+
this.name = "ShareCalculationOverflowError";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export class InvalidShareTotalError extends Error {
|
|
34
|
+
constructor(public total: number) {
|
|
35
|
+
super(`Invalid share total. Must equal 10,000 basis points (100%). Got ${total}`);
|
|
36
|
+
this.name = "InvalidShareTotalError";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export class DuplicateShareholderError extends Error {
|
|
41
|
+
constructor() {
|
|
42
|
+
super("Duplicate shareholder addresses not allowed");
|
|
43
|
+
this.name = "DuplicateShareholderError";
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export class PoolRequiredForGraduatedError extends Error {
|
|
48
|
+
constructor() {
|
|
49
|
+
super("Pool parameter is required for graduated coins (bondingCurve.complete = true)");
|
|
50
|
+
this.name = "PoolRequiredForGraduatedError";
|
|
51
|
+
}
|
|
52
|
+
}
|
package/src/fees.ts
CHANGED
|
@@ -103,3 +103,13 @@ function fee(amount: BN, feeBasisPoints: BN): BN {
|
|
|
103
103
|
function ceilDiv(a: BN, b: BN): BN {
|
|
104
104
|
return a.add(b.subn(1)).div(b);
|
|
105
105
|
}
|
|
106
|
+
|
|
107
|
+
export function getFeeRecipient(global: Global, mayhemMode: boolean): PublicKey {
|
|
108
|
+
if (mayhemMode) {
|
|
109
|
+
const feeRecipients = [global.reservedFeeRecipient, ...global.reservedFeeRecipients];
|
|
110
|
+
return feeRecipients[Math.floor(Math.random() * feeRecipients.length)];
|
|
111
|
+
} else {
|
|
112
|
+
const feeRecipients = [global.feeRecipient, ...global.feeRecipients,];
|
|
113
|
+
return feeRecipients[Math.floor(Math.random() * feeRecipients.length)];
|
|
114
|
+
}
|
|
115
|
+
}
|