@pump-fun/pump-sdk 1.27.0 → 1.28.0-devnet.2
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 +46 -0
- package/dist/esm/index.js +3774 -1724
- package/dist/index.d.mts +6769 -6592
- package/dist/index.d.ts +6769 -6592
- package/dist/index.js +3733 -1695
- 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 +9 -1
- package/src/onlineSdk.ts +52 -27
- package/src/pda.ts +37 -16
- package/src/sdk.ts +343 -80
- package/src/state.ts +37 -1
- package/src/tokenIncentives.ts +3 -2
package/src/state.ts
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
|
-
import BN from "bn.js";
|
|
2
1
|
import { PublicKey } from "@solana/web3.js";
|
|
2
|
+
import BN from "bn.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Platform identifiers for social handle mappings.
|
|
6
|
+
*/
|
|
7
|
+
export enum Platform {
|
|
8
|
+
Pump = 0,
|
|
9
|
+
X = 1,
|
|
10
|
+
GitHub = 2,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const SUPPORTED_SOCIAL_PLATFORMS = [Platform.GitHub];
|
|
14
|
+
|
|
15
|
+
export const stringToPlatform = (value: string): Platform => {
|
|
16
|
+
const normalized = value.trim().toUpperCase();
|
|
17
|
+
const entry = Object.entries(Platform).find(
|
|
18
|
+
([key, val]) => typeof val === "number" && key.toUpperCase() === normalized,
|
|
19
|
+
);
|
|
20
|
+
if (entry) {
|
|
21
|
+
return entry[1] as Platform;
|
|
22
|
+
}
|
|
23
|
+
const validNames = Object.entries(Platform)
|
|
24
|
+
.filter(([, val]) => typeof val === "number")
|
|
25
|
+
.map(([key]) => key.toUpperCase())
|
|
26
|
+
.join(", ");
|
|
27
|
+
throw new Error(
|
|
28
|
+
`Unknown platform "${value}". Expected one of: ${validNames}`,
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const platformToString = (platform: Platform): string => {
|
|
33
|
+
const name = Platform[platform];
|
|
34
|
+
if (name !== undefined) {
|
|
35
|
+
return name;
|
|
36
|
+
}
|
|
37
|
+
throw new Error(`Unknown platform value: ${platform}`);
|
|
38
|
+
};
|
|
3
39
|
|
|
4
40
|
export interface Global {
|
|
5
41
|
// unused
|
package/src/tokenIncentives.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import BN from "bn.js";
|
|
2
|
+
|
|
2
3
|
import { GlobalVolumeAccumulator, UserVolumeAccumulator } from "./state";
|
|
3
4
|
|
|
4
5
|
export function totalUnclaimedTokens(
|
|
@@ -17,7 +18,7 @@ export function totalUnclaimedTokens(
|
|
|
17
18
|
return result;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
const currentTimestampBn = new BN(currentTimestamp);
|
|
21
22
|
|
|
22
23
|
if (currentTimestampBn.lt(startTime)) {
|
|
23
24
|
return result;
|
|
@@ -74,7 +75,7 @@ export function currentDayTokens(
|
|
|
74
75
|
return new BN(0);
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
|
|
78
|
+
const currentTimestampBn = new BN(currentTimestamp);
|
|
78
79
|
|
|
79
80
|
if (currentTimestampBn.lt(startTime) || currentTimestampBn.gt(endTime)) {
|
|
80
81
|
return new BN(0);
|