pump-kit 0.0.8 → 0.1.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.
Files changed (62) hide show
  1. package/README.md +60 -45
  2. package/dist/index.js +12 -12
  3. package/dist/types/ammsdk/bondingCurveMath.d.ts +1 -1
  4. package/dist/types/ammsdk/generated/accounts/globalConfig.d.ts +4 -6
  5. package/dist/types/ammsdk/generated/accounts/index.d.ts +0 -4
  6. package/dist/types/ammsdk/generated/accounts/pool.d.ts +0 -2
  7. package/dist/types/ammsdk/generated/errors/pumpAmm.d.ts +29 -55
  8. package/dist/types/ammsdk/generated/index.d.ts +1 -1
  9. package/dist/types/ammsdk/generated/instructions/buy.d.ts +14 -67
  10. package/dist/types/ammsdk/generated/instructions/createConfig.d.ts +5 -26
  11. package/dist/types/ammsdk/generated/instructions/createPool.d.ts +12 -42
  12. package/dist/types/ammsdk/generated/instructions/deposit.d.ts +10 -33
  13. package/dist/types/ammsdk/generated/instructions/disable.d.ts +2 -16
  14. package/dist/types/ammsdk/generated/instructions/extendAccount.d.ts +2 -12
  15. package/dist/types/ammsdk/generated/instructions/index.d.ts +0 -9
  16. package/dist/types/ammsdk/generated/instructions/sell.d.ts +14 -54
  17. package/dist/types/ammsdk/generated/instructions/updateAdmin.d.ts +2 -12
  18. package/dist/types/ammsdk/generated/instructions/updateFeeConfig.d.ts +2 -22
  19. package/dist/types/ammsdk/generated/instructions/withdraw.d.ts +10 -33
  20. package/dist/types/ammsdk/generated/programs/pumpAmm.d.ts +15 -46
  21. package/dist/types/ammsdk/generated/types/buyEvent.d.ts +4 -25
  22. package/dist/types/ammsdk/generated/types/createConfigEvent.d.ts +0 -4
  23. package/dist/types/ammsdk/generated/types/createPoolEvent.d.ts +0 -2
  24. package/dist/types/ammsdk/generated/types/globalConfig.d.ts +49 -0
  25. package/dist/types/ammsdk/generated/types/index.d.ts +2 -12
  26. package/dist/types/ammsdk/generated/types/pool.d.ts +35 -0
  27. package/dist/types/ammsdk/generated/types/sellEvent.d.ts +0 -6
  28. package/dist/types/ammsdk/generated/types/updateFeeConfigEvent.d.ts +0 -4
  29. package/dist/types/clients/amm.d.ts +10 -2
  30. package/dist/types/index.d.ts +2 -2
  31. package/dist/types/pda/pumpAmm.d.ts +4 -0
  32. package/dist/types/pumpsdk/generated/index.d.ts +1 -1
  33. package/dist/types/simple.d.ts +2 -2
  34. package/dist/types/swap/amm.d.ts +35 -0
  35. package/dist/types/swap/curve.d.ts +36 -0
  36. package/dist/types/swap.d.ts +10 -49
  37. package/package.json +3 -3
  38. package/dist/types/ammsdk/generated/accounts/bondingCurve.d.ts +0 -39
  39. package/dist/types/ammsdk/generated/accounts/feeConfig.d.ts +0 -33
  40. package/dist/types/ammsdk/generated/accounts/globalVolumeAccumulator.d.ts +0 -37
  41. package/dist/types/ammsdk/generated/accounts/userVolumeAccumulator.d.ts +0 -39
  42. package/dist/types/ammsdk/generated/instructions/adminSetCoinCreator.d.ts +0 -63
  43. package/dist/types/ammsdk/generated/instructions/adminUpdateTokenIncentives.d.ts +0 -99
  44. package/dist/types/ammsdk/generated/instructions/buyExactQuoteIn.d.ts +0 -144
  45. package/dist/types/ammsdk/generated/instructions/claimTokenIncentives.d.ts +0 -86
  46. package/dist/types/ammsdk/generated/instructions/closeUserVolumeAccumulator.d.ts +0 -54
  47. package/dist/types/ammsdk/generated/instructions/collectCoinCreatorFee.d.ts +0 -70
  48. package/dist/types/ammsdk/generated/instructions/initUserVolumeAccumulator.d.ts +0 -62
  49. package/dist/types/ammsdk/generated/instructions/setCoinCreator.d.ts +0 -58
  50. package/dist/types/ammsdk/generated/instructions/syncUserVolumeAccumulator.d.ts +0 -58
  51. package/dist/types/ammsdk/generated/types/adminSetCoinCreatorEvent.d.ts +0 -27
  52. package/dist/types/ammsdk/generated/types/adminUpdateTokenIncentivesEvent.d.ts +0 -29
  53. package/dist/types/ammsdk/generated/types/claimTokenIncentivesEvent.d.ts +0 -27
  54. package/dist/types/ammsdk/generated/types/closeUserVolumeAccumulatorEvent.d.ts +0 -27
  55. package/dist/types/ammsdk/generated/types/collectCoinCreatorFeeEvent.d.ts +0 -25
  56. package/dist/types/ammsdk/generated/types/feeTier.d.ts +0 -20
  57. package/dist/types/ammsdk/generated/types/fees.d.ts +0 -21
  58. package/dist/types/ammsdk/generated/types/initUserVolumeAccumulatorEvent.d.ts +0 -21
  59. package/dist/types/ammsdk/generated/types/optionBool.d.ts +0 -13
  60. package/dist/types/ammsdk/generated/types/setBondingCurveCoinCreatorEvent.d.ts +0 -25
  61. package/dist/types/ammsdk/generated/types/setMetaplexCoinCreatorEvent.d.ts +0 -25
  62. package/dist/types/ammsdk/generated/types/syncUserVolumeAccumulatorEvent.d.ts +0 -23
@@ -5,8 +5,7 @@
5
5
  *
6
6
  * @see https://github.com/codama-idl/codama
7
7
  */
8
- import { type Address, type Codec, type Decoder, type Encoder } from '@solana/kit';
9
- /** ix_name: "buy" | "buy_exact_quote_in" */
8
+ import { type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from '@solana/kit';
10
9
  export type BuyEvent = {
11
10
  timestamp: bigint;
12
11
  baseAmountOut: bigint;
@@ -28,16 +27,6 @@ export type BuyEvent = {
28
27
  userQuoteTokenAccount: Address;
29
28
  protocolFeeRecipient: Address;
30
29
  protocolFeeRecipientTokenAccount: Address;
31
- coinCreator: Address;
32
- coinCreatorFeeBasisPoints: bigint;
33
- coinCreatorFee: bigint;
34
- trackVolume: boolean;
35
- totalUnclaimedTokens: bigint;
36
- totalClaimedTokens: bigint;
37
- currentSolVolume: bigint;
38
- lastUpdateTimestamp: bigint;
39
- minBaseAmountOut: bigint;
40
- ixName: string;
41
30
  };
42
31
  export type BuyEventArgs = {
43
32
  timestamp: number | bigint;
@@ -60,17 +49,7 @@ export type BuyEventArgs = {
60
49
  userQuoteTokenAccount: Address;
61
50
  protocolFeeRecipient: Address;
62
51
  protocolFeeRecipientTokenAccount: Address;
63
- coinCreator: Address;
64
- coinCreatorFeeBasisPoints: number | bigint;
65
- coinCreatorFee: number | bigint;
66
- trackVolume: boolean;
67
- totalUnclaimedTokens: number | bigint;
68
- totalClaimedTokens: number | bigint;
69
- currentSolVolume: number | bigint;
70
- lastUpdateTimestamp: number | bigint;
71
- minBaseAmountOut: number | bigint;
72
- ixName: string;
73
52
  };
74
- export declare function getBuyEventEncoder(): Encoder<BuyEventArgs>;
75
- export declare function getBuyEventDecoder(): Decoder<BuyEvent>;
76
- export declare function getBuyEventCodec(): Codec<BuyEventArgs, BuyEvent>;
53
+ export declare function getBuyEventEncoder(): FixedSizeEncoder<BuyEventArgs>;
54
+ export declare function getBuyEventDecoder(): FixedSizeDecoder<BuyEvent>;
55
+ export declare function getBuyEventCodec(): FixedSizeCodec<BuyEventArgs, BuyEvent>;
@@ -12,8 +12,6 @@ export type CreateConfigEvent = {
12
12
  lpFeeBasisPoints: bigint;
13
13
  protocolFeeBasisPoints: bigint;
14
14
  protocolFeeRecipients: Array<Address>;
15
- coinCreatorFeeBasisPoints: bigint;
16
- adminSetCoinCreatorAuthority: Address;
17
15
  };
18
16
  export type CreateConfigEventArgs = {
19
17
  timestamp: number | bigint;
@@ -21,8 +19,6 @@ export type CreateConfigEventArgs = {
21
19
  lpFeeBasisPoints: number | bigint;
22
20
  protocolFeeBasisPoints: number | bigint;
23
21
  protocolFeeRecipients: Array<Address>;
24
- coinCreatorFeeBasisPoints: number | bigint;
25
- adminSetCoinCreatorAuthority: Address;
26
22
  };
27
23
  export declare function getCreateConfigEventEncoder(): FixedSizeEncoder<CreateConfigEventArgs>;
28
24
  export declare function getCreateConfigEventDecoder(): FixedSizeDecoder<CreateConfigEvent>;
@@ -26,7 +26,6 @@ export type CreatePoolEvent = {
26
26
  lpMint: Address;
27
27
  userBaseTokenAccount: Address;
28
28
  userQuoteTokenAccount: Address;
29
- coinCreator: Address;
30
29
  };
31
30
  export type CreatePoolEventArgs = {
32
31
  timestamp: number | bigint;
@@ -48,7 +47,6 @@ export type CreatePoolEventArgs = {
48
47
  lpMint: Address;
49
48
  userBaseTokenAccount: Address;
50
49
  userQuoteTokenAccount: Address;
51
- coinCreator: Address;
52
50
  };
53
51
  export declare function getCreatePoolEventEncoder(): FixedSizeEncoder<CreatePoolEventArgs>;
54
52
  export declare function getCreatePoolEventDecoder(): FixedSizeDecoder<CreatePoolEvent>;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+ import { type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from '@solana/kit';
9
+ export type GlobalConfig = {
10
+ /** The admin pubkey */
11
+ admin: Address;
12
+ /** The lp fee in basis points (0.01%) */
13
+ lpFeeBasisPoints: bigint;
14
+ /** The protocol fee in basis points (0.01%) */
15
+ protocolFeeBasisPoints: bigint;
16
+ /**
17
+ * Flags to disable certain functionality
18
+ * bit 0 - Disable create pool
19
+ * bit 1 - Disable deposit
20
+ * bit 2 - Disable withdraw
21
+ * bit 3 - Disable buy
22
+ * bit 4 - Disable sell
23
+ */
24
+ disableFlags: number;
25
+ /** Addresses of the protocol fee recipients */
26
+ protocolFeeRecipients: Array<Address>;
27
+ };
28
+ export type GlobalConfigArgs = {
29
+ /** The admin pubkey */
30
+ admin: Address;
31
+ /** The lp fee in basis points (0.01%) */
32
+ lpFeeBasisPoints: number | bigint;
33
+ /** The protocol fee in basis points (0.01%) */
34
+ protocolFeeBasisPoints: number | bigint;
35
+ /**
36
+ * Flags to disable certain functionality
37
+ * bit 0 - Disable create pool
38
+ * bit 1 - Disable deposit
39
+ * bit 2 - Disable withdraw
40
+ * bit 3 - Disable buy
41
+ * bit 4 - Disable sell
42
+ */
43
+ disableFlags: number;
44
+ /** Addresses of the protocol fee recipients */
45
+ protocolFeeRecipients: Array<Address>;
46
+ };
47
+ export declare function getGlobalConfigEncoder(): FixedSizeEncoder<GlobalConfigArgs>;
48
+ export declare function getGlobalConfigDecoder(): FixedSizeDecoder<GlobalConfig>;
49
+ export declare function getGlobalConfigCodec(): FixedSizeCodec<GlobalConfigArgs, GlobalConfig>;
@@ -5,25 +5,15 @@
5
5
  *
6
6
  * @see https://github.com/codama-idl/codama
7
7
  */
8
- export * from './adminSetCoinCreatorEvent';
9
- export * from './adminUpdateTokenIncentivesEvent';
10
8
  export * from './buyEvent';
11
- export * from './claimTokenIncentivesEvent';
12
- export * from './closeUserVolumeAccumulatorEvent';
13
- export * from './collectCoinCreatorFeeEvent';
14
9
  export * from './createConfigEvent';
15
10
  export * from './createPoolEvent';
16
11
  export * from './depositEvent';
17
12
  export * from './disableEvent';
18
13
  export * from './extendAccountEvent';
19
- export * from './fees';
20
- export * from './feeTier';
21
- export * from './initUserVolumeAccumulatorEvent';
22
- export * from './optionBool';
14
+ export * from './globalConfig';
15
+ export * from './pool';
23
16
  export * from './sellEvent';
24
- export * from './setBondingCurveCoinCreatorEvent';
25
- export * from './setMetaplexCoinCreatorEvent';
26
- export * from './syncUserVolumeAccumulatorEvent';
27
17
  export * from './updateAdminEvent';
28
18
  export * from './updateFeeConfigEvent';
29
19
  export * from './withdrawEvent';
@@ -0,0 +1,35 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+ import { type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from '@solana/kit';
9
+ export type Pool = {
10
+ poolBump: number;
11
+ index: number;
12
+ creator: Address;
13
+ baseMint: Address;
14
+ quoteMint: Address;
15
+ lpMint: Address;
16
+ poolBaseTokenAccount: Address;
17
+ poolQuoteTokenAccount: Address;
18
+ /** True circulating supply without burns and lock-ups */
19
+ lpSupply: bigint;
20
+ };
21
+ export type PoolArgs = {
22
+ poolBump: number;
23
+ index: number;
24
+ creator: Address;
25
+ baseMint: Address;
26
+ quoteMint: Address;
27
+ lpMint: Address;
28
+ poolBaseTokenAccount: Address;
29
+ poolQuoteTokenAccount: Address;
30
+ /** True circulating supply without burns and lock-ups */
31
+ lpSupply: number | bigint;
32
+ };
33
+ export declare function getPoolEncoder(): FixedSizeEncoder<PoolArgs>;
34
+ export declare function getPoolDecoder(): FixedSizeDecoder<Pool>;
35
+ export declare function getPoolCodec(): FixedSizeCodec<PoolArgs, Pool>;
@@ -27,9 +27,6 @@ export type SellEvent = {
27
27
  userQuoteTokenAccount: Address;
28
28
  protocolFeeRecipient: Address;
29
29
  protocolFeeRecipientTokenAccount: Address;
30
- coinCreator: Address;
31
- coinCreatorFeeBasisPoints: bigint;
32
- coinCreatorFee: bigint;
33
30
  };
34
31
  export type SellEventArgs = {
35
32
  timestamp: number | bigint;
@@ -52,9 +49,6 @@ export type SellEventArgs = {
52
49
  userQuoteTokenAccount: Address;
53
50
  protocolFeeRecipient: Address;
54
51
  protocolFeeRecipientTokenAccount: Address;
55
- coinCreator: Address;
56
- coinCreatorFeeBasisPoints: number | bigint;
57
- coinCreatorFee: number | bigint;
58
52
  };
59
53
  export declare function getSellEventEncoder(): FixedSizeEncoder<SellEventArgs>;
60
54
  export declare function getSellEventDecoder(): FixedSizeDecoder<SellEvent>;
@@ -12,8 +12,6 @@ export type UpdateFeeConfigEvent = {
12
12
  lpFeeBasisPoints: bigint;
13
13
  protocolFeeBasisPoints: bigint;
14
14
  protocolFeeRecipients: Array<Address>;
15
- coinCreatorFeeBasisPoints: bigint;
16
- adminSetCoinCreatorAuthority: Address;
17
15
  };
18
16
  export type UpdateFeeConfigEventArgs = {
19
17
  timestamp: number | bigint;
@@ -21,8 +19,6 @@ export type UpdateFeeConfigEventArgs = {
21
19
  lpFeeBasisPoints: number | bigint;
22
20
  protocolFeeBasisPoints: number | bigint;
23
21
  protocolFeeRecipients: Array<Address>;
24
- coinCreatorFeeBasisPoints: number | bigint;
25
- adminSetCoinCreatorAuthority: Address;
26
22
  };
27
23
  export declare function getUpdateFeeConfigEventEncoder(): FixedSizeEncoder<UpdateFeeConfigEventArgs>;
28
24
  export declare function getUpdateFeeConfigEventDecoder(): FixedSizeDecoder<UpdateFeeConfigEvent>;
@@ -87,7 +87,11 @@ export interface AmmBuyParams {
87
87
  *
88
88
  * TODO: Complete implementation once we verify the generated instruction signature.
89
89
  */
90
- export declare function ammBuy(params: AmmBuyParams): Promise<import("../ammsdk/generated").BuyInstruction<Address<"pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA">, string, string, string, string, string, string, string, string, string, string, string, "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", "11111111111111111111111111111111", "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL", string, "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA", string, string, string, string, string, "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ", []>>;
90
+ export declare function ammBuy(params: AmmBuyParams): Promise<{
91
+ programAddress: import("@solana/nominal-types").NominalType<"brand", "Address"> & import("@solana/nominal-types").NominalType<"stringEncoding", "base58"> & "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA";
92
+ accounts: import("@solana/instructions").AccountMeta<string>[];
93
+ data: import("@solana/kit").ReadonlyUint8Array;
94
+ }>;
91
95
  export interface AmmSellParams {
92
96
  user: TransactionSigner;
93
97
  baseMint: Address | string;
@@ -106,4 +110,8 @@ export interface AmmSellParams {
106
110
  *
107
111
  * TODO: Complete implementation once we verify the generated instruction signature.
108
112
  */
109
- export declare function ammSell(params: AmmSellParams): Promise<import("../ammsdk/generated").SellInstruction<Address<"pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA">, string, string, string, string, string, string, string, string, string, string, string, "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", "11111111111111111111111111111111", "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL", string, "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA", string, string, string, "pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ", []>>;
113
+ export declare function ammSell(params: AmmSellParams): Promise<{
114
+ programAddress: import("@solana/nominal-types").NominalType<"brand", "Address"> & import("@solana/nominal-types").NominalType<"stringEncoding", "base58"> & "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA";
115
+ accounts: import("@solana/instructions").AccountMeta<string>[];
116
+ data: import("@solana/kit").ReadonlyUint8Array;
117
+ }>;
@@ -4,8 +4,8 @@
4
4
  * Clean, minimal API - just buy, sell, mint, and manage liquidity.
5
5
  */
6
6
  import "./config/polyfills";
7
- export { buy, sell, quickBuy, quickSell } from "./swap";
8
- export type { BuyParams, SellParams } from "./swap";
7
+ export { buy, sell, curveBuy, curveSell, ammBuy, ammSell, } from "./swap";
8
+ export type { BuyParams, SellParams, CurveBuyParams, CurveSellParams, AmmBuyParams, AmmSellParams, } from "./swap";
9
9
  export { mintWithFirstBuy, validateMintParams, type MintWithFirstBuyParams, } from "./recipes/mintFirstBuy";
10
10
  export { createAndBuy, type CreateAndBuyOptions, type CreateAndBuyResult, type TokenMetadata, } from "./helpers/createAndBuy";
11
11
  export { addLiquidity, removeLiquidity, quickAddLiquidity, quickRemoveLiquidity, type AddLiquidityParams, type RemoveLiquidityParams, WSOL, } from "./liquidity";
@@ -44,6 +44,10 @@ export declare function userVolumeAccumulatorPda(user: Address | string): Promis
44
44
  * Seed: ["__event_authority"]
45
45
  */
46
46
  export declare function eventAuthorityPda(): Promise<Address>;
47
+ /**
48
+ * Derives the AMM fee config PDA using the Pump fee program and AMM program id.
49
+ */
50
+ export declare function ammFeeConfigPda(): Promise<Address>;
47
51
  /**
48
52
  * Derives the coin creator vault authority PDA.
49
53
  * Seed: ["creator_vault", coinCreator]
@@ -9,4 +9,4 @@ export * from './accounts';
9
9
  export * from './errors';
10
10
  export * from './instructions';
11
11
  export * from './programs';
12
- export * from './types';
12
+ export * as types from './types';
@@ -3,8 +3,8 @@
3
3
  * Everything you need, nothing you don't.
4
4
  */
5
5
  import "./config/polyfills";
6
- export { buy, sell, quickBuy, quickSell } from "./swap";
7
- export type { BuyParams, SellParams } from "./swap";
6
+ export { buy, sell, curveBuy, curveSell, } from "./swap";
7
+ export type { BuyParams, SellParams, CurveBuyParams, CurveSellParams, } from "./swap";
8
8
  export { mintWithFirstBuy, validateMintParams } from "./recipes/mintFirstBuy";
9
9
  export type { MintWithFirstBuyParams } from "./recipes/mintFirstBuy";
10
10
  export type { TransactionSigner, Instruction, Address } from "@solana/kit";
@@ -0,0 +1,35 @@
1
+ import type { Address, Instruction, TransactionSigner } from "@solana/kit";
2
+ import type { RpcClient } from "../config/connection";
3
+ export type CommitmentLevel = "processed" | "confirmed" | "finalized";
4
+ type AmmBaseParams = {
5
+ user: TransactionSigner;
6
+ mint: Address | string;
7
+ rpc: RpcClient;
8
+ commitment?: CommitmentLevel;
9
+ poolAddress?: Address | string;
10
+ poolCreator?: Address | string;
11
+ poolIndex?: number;
12
+ quoteMint?: Address | string;
13
+ allowTrackVolume?: boolean;
14
+ };
15
+ export type AmmBuyParams = AmmBaseParams & {
16
+ /** SOL budget (before slippage), expressed in SOL. */
17
+ solAmount: number;
18
+ /** Optional slippage tolerance applied to the SOL budget (default 0.5%). */
19
+ slippageBps?: number;
20
+ };
21
+ export type AmmSellParams = AmmBaseParams & {
22
+ /** Human-readable token amount to sell. */
23
+ tokenAmount?: number;
24
+ /** Optional decimals for the token (defaults to 6). */
25
+ tokenDecimals?: number;
26
+ /** Optional slippage tolerance applied to the SOL output floor (default 0.5%). */
27
+ slippageBps?: number;
28
+ /** Sell percentage of the wallet balance instead of a fixed amount. */
29
+ useWalletPercentage?: boolean;
30
+ /** Percentage of the wallet balance to sell (0-100]. */
31
+ walletPercentage?: number;
32
+ };
33
+ export declare function ammBuy(params: AmmBuyParams): Promise<Instruction>;
34
+ export declare function ammSell(params: AmmSellParams): Promise<Instruction>;
35
+ export {};
@@ -0,0 +1,36 @@
1
+ import type { Address, Instruction, TransactionSigner } from "@solana/kit";
2
+ import type { RpcClient } from "../config/connection";
3
+ import { type BondingCurveState, type FeeStructure } from "../ammsdk/bondingCurveMath";
4
+ export type CommitmentLevel = "processed" | "confirmed" | "finalized";
5
+ type WithRpcOptions = {
6
+ rpc: RpcClient;
7
+ commitment?: CommitmentLevel;
8
+ };
9
+ export type CurveBuyParams = WithRpcOptions & {
10
+ user: TransactionSigner;
11
+ mint: Address | string;
12
+ solAmount: number;
13
+ slippageBps?: number;
14
+ feeRecipient?: Address | string;
15
+ bondingCurveCreator?: Address | string;
16
+ trackVolume?: boolean;
17
+ curveStateOverride?: BondingCurveState;
18
+ feeStructureOverride?: FeeStructure;
19
+ allowAtaCreation?: boolean;
20
+ };
21
+ export type CurveSellParams = WithRpcOptions & {
22
+ user: TransactionSigner;
23
+ mint: Address | string;
24
+ tokenAmount?: number;
25
+ useWalletPercentage?: boolean;
26
+ walletPercentage?: number;
27
+ tokenDecimals?: number;
28
+ slippageBps?: number;
29
+ feeRecipient?: Address | string;
30
+ bondingCurveCreator?: Address | string;
31
+ curveStateOverride?: BondingCurveState;
32
+ feeStructureOverride?: FeeStructure;
33
+ };
34
+ export declare function curveBuy(params: CurveBuyParams): Promise<Instruction>;
35
+ export declare function curveSell(params: CurveSellParams): Promise<Instruction>;
36
+ export {};
@@ -1,49 +1,10 @@
1
- /**
2
- * Ultra-simple swap API - the cleanest way to trade on Pump.fun.
3
- * Users now provide input-side amounts (SOL for buys, tokens for sells) plus optional slippage.
4
- */
5
- import type { Address, Instruction, TransactionSigner } from "@solana/kit";
6
- import type { RpcClient } from "./config/connection";
7
- import { type FeeStructure, type BondingCurveState } from "./ammsdk/bondingCurveMath";
8
- export type CommitmentLevel = "processed" | "confirmed" | "finalized";
9
- type WithRpcOptions = {
10
- rpc: RpcClient;
11
- commitment?: CommitmentLevel;
12
- };
13
- export type BuyParams = WithRpcOptions & {
14
- user: TransactionSigner;
15
- mint: Address | string;
16
- /** SOL budget (before slippage), expressed in SOL. */
17
- solAmount: number;
18
- /** Optional slippage tolerance applied to the SOL budget (default 0.5%). */
19
- slippageBps?: number;
20
- feeRecipient?: Address | string;
21
- bondingCurveCreator?: Address | string;
22
- trackVolume?: boolean;
23
- curveStateOverride?: BondingCurveState;
24
- feeStructureOverride?: FeeStructure;
25
- };
26
- export type SellParams = WithRpcOptions & {
27
- user: TransactionSigner;
28
- mint: Address | string;
29
- /** Human-readable token amount to sell. */
30
- tokenAmount?: number;
31
- /** Use a percentage of the wallet balance instead of fixed token amount. */
32
- useWalletPercentage?: boolean;
33
- /** Percentage of the wallet balance to sell (0-100]. */
34
- walletPercentage?: number;
35
- /** Token decimals (defaults to 6). */
36
- tokenDecimals?: number;
37
- slippageBps?: number;
38
- feeRecipient?: Address | string;
39
- bondingCurveCreator?: Address | string;
40
- curveStateOverride?: BondingCurveState;
41
- feeStructureOverride?: FeeStructure;
42
- };
43
- export declare function buy(params: BuyParams): Promise<Instruction>;
44
- export declare function sell(params: SellParams): Promise<Instruction>;
45
- type QuickBuyOptions = Omit<BuyParams, "user" | "mint" | "solAmount">;
46
- type QuickSellOptions = Omit<SellParams, "user" | "mint" | "tokenAmount">;
47
- export declare function quickBuy(user: TransactionSigner, mint: Address | string, solAmount: number, options?: QuickBuyOptions): Promise<Instruction>;
48
- export declare function quickSell(user: TransactionSigner, mint: Address | string, tokenAmount: number, options?: QuickSellOptions): Promise<Instruction>;
49
- export {};
1
+ import { curveBuy, curveSell } from "./swap/curve";
2
+ import type { CurveBuyParams, CurveSellParams } from "./swap/curve";
3
+ export { curveBuy, curveSell } from "./swap/curve";
4
+ export { ammBuy, ammSell } from "./swap/amm";
5
+ export type { CurveBuyParams, CurveSellParams, CommitmentLevel, } from "./swap/curve";
6
+ export type { AmmBuyParams, AmmSellParams } from "./swap/amm";
7
+ export type BuyParams = CurveBuyParams;
8
+ export type SellParams = CurveSellParams;
9
+ export declare const buy: typeof curveBuy;
10
+ export declare const sell: typeof curveSell;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pump-kit",
3
- "version": "0.0.8",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -29,8 +29,8 @@
29
29
  "build:types": "tsc -p tsconfig.build.json",
30
30
  "build": "rm -rf dist && bun run build:js && bun run build:types",
31
31
  "release:prepare": "bun run build && bun run test",
32
- "release:publish": "npm publish --access public",
33
- "release:dry-run": "npm publish --access public --dry-run",
32
+ "release:publish": "bun run npm publish --access public",
33
+ "release:dry-run": "bun run npm publish --access public --dry-run",
34
34
  "codegen": "bun run scripts/codama-generate.ts",
35
35
  "test": "bun test",
36
36
  "test:unit": "bun test tests/unit",
@@ -1,39 +0,0 @@
1
- /**
2
- * This code was AUTOGENERATED using the Codama library.
3
- * Please DO NOT EDIT THIS FILE, instead use visitors
4
- * to add features, then rerun Codama to update it.
5
- *
6
- * @see https://github.com/codama-idl/codama
7
- */
8
- import { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type EncodedAccount, type FetchAccountConfig, type FetchAccountsConfig, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from '@solana/kit';
9
- export declare const BONDING_CURVE_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
10
- export declare function getBondingCurveDiscriminatorBytes(): ReadonlyUint8Array;
11
- export type BondingCurve = {
12
- discriminator: ReadonlyUint8Array;
13
- virtualTokenReserves: bigint;
14
- virtualSolReserves: bigint;
15
- realTokenReserves: bigint;
16
- realSolReserves: bigint;
17
- tokenTotalSupply: bigint;
18
- complete: boolean;
19
- creator: Address;
20
- };
21
- export type BondingCurveArgs = {
22
- virtualTokenReserves: number | bigint;
23
- virtualSolReserves: number | bigint;
24
- realTokenReserves: number | bigint;
25
- realSolReserves: number | bigint;
26
- tokenTotalSupply: number | bigint;
27
- complete: boolean;
28
- creator: Address;
29
- };
30
- export declare function getBondingCurveEncoder(): FixedSizeEncoder<BondingCurveArgs>;
31
- export declare function getBondingCurveDecoder(): FixedSizeDecoder<BondingCurve>;
32
- export declare function getBondingCurveCodec(): FixedSizeCodec<BondingCurveArgs, BondingCurve>;
33
- export declare function decodeBondingCurve<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<BondingCurve, TAddress>;
34
- export declare function decodeBondingCurve<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<BondingCurve, TAddress>;
35
- export declare function fetchBondingCurve<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<BondingCurve, TAddress>>;
36
- export declare function fetchMaybeBondingCurve<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<BondingCurve, TAddress>>;
37
- export declare function fetchAllBondingCurve(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<BondingCurve>[]>;
38
- export declare function fetchAllMaybeBondingCurve(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<BondingCurve>[]>;
39
- export declare function getBondingCurveSize(): number;
@@ -1,33 +0,0 @@
1
- /**
2
- * This code was AUTOGENERATED using the Codama library.
3
- * Please DO NOT EDIT THIS FILE, instead use visitors
4
- * to add features, then rerun Codama to update it.
5
- *
6
- * @see https://github.com/codama-idl/codama
7
- */
8
- import { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type Codec, type Decoder, type EncodedAccount, type Encoder, type FetchAccountConfig, type FetchAccountsConfig, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from '@solana/kit';
9
- import { type Fees, type FeesArgs, type FeeTier, type FeeTierArgs } from '../types';
10
- export declare const FEE_CONFIG_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
11
- export declare function getFeeConfigDiscriminatorBytes(): ReadonlyUint8Array;
12
- export type FeeConfig = {
13
- discriminator: ReadonlyUint8Array;
14
- bump: number;
15
- admin: Address;
16
- flatFees: Fees;
17
- feeTiers: Array<FeeTier>;
18
- };
19
- export type FeeConfigArgs = {
20
- bump: number;
21
- admin: Address;
22
- flatFees: FeesArgs;
23
- feeTiers: Array<FeeTierArgs>;
24
- };
25
- export declare function getFeeConfigEncoder(): Encoder<FeeConfigArgs>;
26
- export declare function getFeeConfigDecoder(): Decoder<FeeConfig>;
27
- export declare function getFeeConfigCodec(): Codec<FeeConfigArgs, FeeConfig>;
28
- export declare function decodeFeeConfig<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<FeeConfig, TAddress>;
29
- export declare function decodeFeeConfig<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<FeeConfig, TAddress>;
30
- export declare function fetchFeeConfig<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<FeeConfig, TAddress>>;
31
- export declare function fetchMaybeFeeConfig<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<FeeConfig, TAddress>>;
32
- export declare function fetchAllFeeConfig(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<FeeConfig>[]>;
33
- export declare function fetchAllMaybeFeeConfig(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<FeeConfig>[]>;
@@ -1,37 +0,0 @@
1
- /**
2
- * This code was AUTOGENERATED using the Codama library.
3
- * Please DO NOT EDIT THIS FILE, instead use visitors
4
- * to add features, then rerun Codama to update it.
5
- *
6
- * @see https://github.com/codama-idl/codama
7
- */
8
- import { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type EncodedAccount, type FetchAccountConfig, type FetchAccountsConfig, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from '@solana/kit';
9
- export declare const GLOBAL_VOLUME_ACCUMULATOR_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
10
- export declare function getGlobalVolumeAccumulatorDiscriminatorBytes(): ReadonlyUint8Array;
11
- export type GlobalVolumeAccumulator = {
12
- discriminator: ReadonlyUint8Array;
13
- startTime: bigint;
14
- endTime: bigint;
15
- secondsInADay: bigint;
16
- mint: Address;
17
- totalTokenSupply: Array<bigint>;
18
- solVolumes: Array<bigint>;
19
- };
20
- export type GlobalVolumeAccumulatorArgs = {
21
- startTime: number | bigint;
22
- endTime: number | bigint;
23
- secondsInADay: number | bigint;
24
- mint: Address;
25
- totalTokenSupply: Array<number | bigint>;
26
- solVolumes: Array<number | bigint>;
27
- };
28
- export declare function getGlobalVolumeAccumulatorEncoder(): FixedSizeEncoder<GlobalVolumeAccumulatorArgs>;
29
- export declare function getGlobalVolumeAccumulatorDecoder(): FixedSizeDecoder<GlobalVolumeAccumulator>;
30
- export declare function getGlobalVolumeAccumulatorCodec(): FixedSizeCodec<GlobalVolumeAccumulatorArgs, GlobalVolumeAccumulator>;
31
- export declare function decodeGlobalVolumeAccumulator<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<GlobalVolumeAccumulator, TAddress>;
32
- export declare function decodeGlobalVolumeAccumulator<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<GlobalVolumeAccumulator, TAddress>;
33
- export declare function fetchGlobalVolumeAccumulator<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<GlobalVolumeAccumulator, TAddress>>;
34
- export declare function fetchMaybeGlobalVolumeAccumulator<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<GlobalVolumeAccumulator, TAddress>>;
35
- export declare function fetchAllGlobalVolumeAccumulator(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<GlobalVolumeAccumulator>[]>;
36
- export declare function fetchAllMaybeGlobalVolumeAccumulator(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<GlobalVolumeAccumulator>[]>;
37
- export declare function getGlobalVolumeAccumulatorSize(): number;
@@ -1,39 +0,0 @@
1
- /**
2
- * This code was AUTOGENERATED using the Codama library.
3
- * Please DO NOT EDIT THIS FILE, instead use visitors
4
- * to add features, then rerun Codama to update it.
5
- *
6
- * @see https://github.com/codama-idl/codama
7
- */
8
- import { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type EncodedAccount, type FetchAccountConfig, type FetchAccountsConfig, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from '@solana/kit';
9
- export declare const USER_VOLUME_ACCUMULATOR_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
10
- export declare function getUserVolumeAccumulatorDiscriminatorBytes(): ReadonlyUint8Array;
11
- export type UserVolumeAccumulator = {
12
- discriminator: ReadonlyUint8Array;
13
- user: Address;
14
- needsClaim: boolean;
15
- totalUnclaimedTokens: bigint;
16
- totalClaimedTokens: bigint;
17
- currentSolVolume: bigint;
18
- lastUpdateTimestamp: bigint;
19
- hasTotalClaimedTokens: boolean;
20
- };
21
- export type UserVolumeAccumulatorArgs = {
22
- user: Address;
23
- needsClaim: boolean;
24
- totalUnclaimedTokens: number | bigint;
25
- totalClaimedTokens: number | bigint;
26
- currentSolVolume: number | bigint;
27
- lastUpdateTimestamp: number | bigint;
28
- hasTotalClaimedTokens: boolean;
29
- };
30
- export declare function getUserVolumeAccumulatorEncoder(): FixedSizeEncoder<UserVolumeAccumulatorArgs>;
31
- export declare function getUserVolumeAccumulatorDecoder(): FixedSizeDecoder<UserVolumeAccumulator>;
32
- export declare function getUserVolumeAccumulatorCodec(): FixedSizeCodec<UserVolumeAccumulatorArgs, UserVolumeAccumulator>;
33
- export declare function decodeUserVolumeAccumulator<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<UserVolumeAccumulator, TAddress>;
34
- export declare function decodeUserVolumeAccumulator<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<UserVolumeAccumulator, TAddress>;
35
- export declare function fetchUserVolumeAccumulator<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<UserVolumeAccumulator, TAddress>>;
36
- export declare function fetchMaybeUserVolumeAccumulator<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<UserVolumeAccumulator, TAddress>>;
37
- export declare function fetchAllUserVolumeAccumulator(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<UserVolumeAccumulator>[]>;
38
- export declare function fetchAllMaybeUserVolumeAccumulator(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<UserVolumeAccumulator>[]>;
39
- export declare function getUserVolumeAccumulatorSize(): number;