├── example.env
├── .gitignore
├── imgs
├── wallet.png
├── transaction.png
└── token_account.png
├── tsconfig.json
├── src
├── constants
│ ├── constants.ts
│ └── idl.ts
├── index.ts
└── utils
│ ├── utils.ts
│ └── swapTransactions.ts
├── package.json
└── README.md
/example.env:
--------------------------------------------------------------------------------
1 | PRIVATE_KEY=
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | built/
3 | package-lock.json
4 | .env
--------------------------------------------------------------------------------
/imgs/wallet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techpond31/pump.fun_swap/HEAD/imgs/wallet.png
--------------------------------------------------------------------------------
/imgs/transaction.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techpond31/pump.fun_swap/HEAD/imgs/transaction.png
--------------------------------------------------------------------------------
/imgs/token_account.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/techpond31/pump.fun_swap/HEAD/imgs/token_account.png
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "outDir": "./built",
4 | "allowJs": true,
5 | "target": "es5",
6 | "esModuleInterop": true
7 | },
8 | "include": ["./src/**/*"]
9 | }
--------------------------------------------------------------------------------
/src/constants/constants.ts:
--------------------------------------------------------------------------------
1 | const PUMP_FUN_PROGRAM_ID = '6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P';
2 | const TOKEN_MINT_ADDRESS = '9LFUtDdTqtnT1cp4FAkeNeGMrkmfrCvWiqpJHUtkHPrG';
3 |
4 | export {
5 | PUMP_FUN_PROGRAM_ID,
6 | TOKEN_MINT_ADDRESS
7 | };
8 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "scripts": {
3 | "start": "tsc && node ./built/index.js"
4 | },
5 | "dependencies": {
6 | "@coral-xyz/anchor": "^0.26.0",
7 | "@project-serum/anchor": "^0.26.0",
8 | "@solana/spl-token": "^0.1.8",
9 | "@solana/web3.js": "^1.60.0",
10 | "bn.js": "^5.2.1",
11 | "dotenv": "^16.4.5",
12 | "source-map-loader": "^5.0.0",
13 | "ts-loader": "^9.5.1"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------
1 | import { PUMP_FUN_PROGRAM_ID, TOKEN_MINT_ADDRESS } from './constants/constants.js';
2 |
3 | import { config } from 'dotenv';
4 | import { buyTransaction, sellTransaction } from './utils/swapTransactions';
5 | config();
6 |
7 | const main = async() => {
8 | await buyTransaction(process.env.PRIVATE_KEY, TOKEN_MINT_ADDRESS);
9 | await sellTransaction(process.env.PRIVATE_KEY, TOKEN_MINT_ADDRESS);
10 | }
11 |
12 | main();
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Pump Fun Swap Transaction
2 | This test project aims to execute swap transaction on the pump.fun.
3 |
4 | Input Params:
5 | ```
6 | - Wallet secret Key (Save in the .env file so that it can't be shared with others. I added example.env and you can customize it.)
7 |
8 | - Token Mint Address (Token address you want to buy or sell)
9 | ```
10 |
11 | Running command:
12 | ```
13 | npm install
14 | npm start
15 | ```
16 |
17 | 1. Check the associated token is existed in my wallet.
18 | 2. Create associated token account within my wallet if not exist.
19 | 3. Invoke the buy or sell function on the IDL of pump.fun program.
20 |
21 | # Output
22 | Here, I would like to show the output of this project.
23 |
24 | 
25 | This is the image of my wallet (phantom)
26 |
27 |
28 | 
29 | This is the image of my account for tokens.
30 |
31 |
32 | 
33 | This is the image of transaction details
--------------------------------------------------------------------------------
/src/utils/utils.ts:
--------------------------------------------------------------------------------
1 | import { Keypair, PublicKey, Connection } from '@solana/web3.js';
2 | import { Token, TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID } from '@solana/spl-token';
3 |
4 | /**
5 | *
6 | * @param {*} connection : Connection
7 | * @param {*} walletPublicKey : PublicKey
8 | * @param {*} tokenMintAddress : PublicKey
9 | * @returns Boolean
10 | */
11 | const checkAssociatedTokenAcount = async (connection: Connection, walletPublicKey: PublicKey, tokenMintAddress: PublicKey) => {
12 | try {
13 | // Get the associated token address for your wallet and token mint
14 | const associatedTokenAddress = await Token.getAssociatedTokenAddress(
15 | ASSOCIATED_TOKEN_PROGRAM_ID,
16 | TOKEN_PROGRAM_ID,
17 | tokenMintAddress,
18 | walletPublicKey
19 | );
20 |
21 | // Get account info
22 | const accountInfo = await connection.getAccountInfo(associatedTokenAddress);
23 |
24 | if (accountInfo) {
25 | return associatedTokenAddress.toBase58();
26 | } else {
27 | return false;
28 | }
29 | } catch (error) {
30 | console.error('Error checking associated token account:', error);
31 | }
32 | };
33 |
34 | /**
35 | * Create Associated Token Account
36 | * @param {*} connection : Connection
37 | * @param {*} owner : Keypair
38 | * @returns {*} address : String
39 | */
40 | const createAssociatedTokenAccount = async (connection: Connection, owner: Keypair, mintPublicKey: PublicKey) => {
41 | // Get the associated token account address for the wallet
42 | const associatedTokenAddress = await Token.getAssociatedTokenAddress(
43 | ASSOCIATED_TOKEN_PROGRAM_ID,
44 | TOKEN_PROGRAM_ID,
45 | mintPublicKey,
46 | owner.publicKey
47 | );
48 |
49 | // Check if the associated token account already exists
50 | const associatedTokenAccountInfo = await connection.getAccountInfo(associatedTokenAddress);
51 | const mint = new Token(connection, mintPublicKey, TOKEN_PROGRAM_ID, owner );
52 |
53 | if (!associatedTokenAccountInfo) {
54 | // Create the associated token account if it doesn't exist
55 | await mint.createAssociatedTokenAccount(owner.publicKey);
56 | }
57 | return associatedTokenAddress.toBase58();
58 | };
59 |
60 | /**
61 | *
62 | * @param {*} walletAddress : PublicKey
63 | * @param {*} tokenMintAddress : PublicKey
64 | * @returns
65 | */
66 | const findAssociatedTokenAddress = (walletAddress: PublicKey, tokenMintAddress: PublicKey) => {
67 | const [result] = PublicKey.findProgramAddressSync([
68 | walletAddress.toBuffer(),
69 | TOKEN_PROGRAM_ID.toBuffer(),
70 | tokenMintAddress.toBuffer()
71 | ], ASSOCIATED_TOKEN_PROGRAM_ID);
72 | return result;
73 | };
74 |
75 | const getDetailsFromTokenMint = async (tokenMintAddress: string) => {
76 | const response = await fetch(`https://client-api-2-74b1891ee9f9.herokuapp.com/coins/${tokenMintAddress}`);
77 | const details = await response.json();
78 |
79 | return {
80 | bondingCurve: details.bonding_curve,
81 | associatedBondingCurve: details.associated_bonding_curve
82 | };
83 | }
84 |
85 | export {
86 | createAssociatedTokenAccount,
87 | findAssociatedTokenAddress,
88 | checkAssociatedTokenAcount,
89 | getDetailsFromTokenMint
90 | };
91 |
--------------------------------------------------------------------------------
/src/utils/swapTransactions.ts:
--------------------------------------------------------------------------------
1 | import { Program, AnchorProvider, setProvider, Wallet } from '@coral-xyz/anchor';
2 | import { Connection, Keypair, PublicKey, VersionedTransaction, TransactionMessage } from '@solana/web3.js';
3 | import base58 from "bs58";
4 | import { createAssociatedTokenAccount, findAssociatedTokenAddress, getDetailsFromTokenMint } from './utils';
5 | import { BN } from 'bn.js';
6 | import idl from '../constants/idl';
7 | import { PUMP_FUN_PROGRAM_ID, TOKEN_MINT_ADDRESS } from '../constants/constants';
8 |
9 | const buyTransaction = async (walletSecretKey: string, mintAddress: string) => {
10 | const programId = new PublicKey(PUMP_FUN_PROGRAM_ID);
11 | const secretKey = base58.decode(walletSecretKey);
12 | const owner = Keypair.fromSecretKey(secretKey);
13 | const wallet = new Wallet(Keypair.fromSecretKey(secretKey));
14 | const mint = new PublicKey(mintAddress);
15 |
16 | const {bondingCurve, associatedBondingCurve} = await getDetailsFromTokenMint(mintAddress);
17 |
18 | const r = findAssociatedTokenAddress(wallet.publicKey, mint);
19 |
20 | const connection = new Connection('https://api.mainnet-beta.solana.com');
21 | const provider = new AnchorProvider(connection, wallet, AnchorProvider.defaultOptions());
22 | setProvider(provider);
23 |
24 | const program = new Program(idl, programId, provider);
25 | const associatedAddress = await createAssociatedTokenAccount(connection, owner, mint);
26 | console.log(`Associated Address: ${associatedAddress}`);
27 |
28 | const instruction = await program.methods.buy(new BN(1500000), new BN(0)).accounts({
29 | global: new PublicKey("4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf"),
30 | feeRecipient: new PublicKey("CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM"),
31 | mint: mint,
32 | bondingCurve: new PublicKey(bondingCurve),
33 | associatedBondingCurve: new PublicKey(associatedBondingCurve),
34 | associatedUser: r,
35 | user: owner.publicKey,
36 | systemProgram: new PublicKey("11111111111111111111111111111111"),
37 | tokenProgram: new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
38 | rent: new PublicKey("SysvarRent111111111111111111111111111111111"),
39 | eventAuthority: PublicKey.findProgramAddressSync([Buffer.from("__event_authority")], programId)[0],
40 | program: programId
41 | }).instruction();
42 |
43 | const instructions = [];
44 | instructions.push(instruction);
45 | const blockhash = await connection.getLatestBlockhash("finalized");
46 | const final_tx = new VersionedTransaction(new TransactionMessage({
47 | payerKey: owner.publicKey,
48 | recentBlockhash: blockhash.blockhash,
49 | instructions: instructions
50 | }).compileToV0Message());
51 |
52 | final_tx.sign([wallet.payer]);
53 |
54 | const txid = await connection.sendTransaction(final_tx, {
55 | skipPreflight: true,
56 | });
57 |
58 | await connection.confirmTransaction(txid);
59 |
60 | console.log(txid);
61 | };
62 |
63 | const sellTransaction = async (walletSecretKey: string, mintAddress: string) => {
64 | const programId = new PublicKey(PUMP_FUN_PROGRAM_ID);
65 | const secretKey = base58.decode(walletSecretKey);
66 | const owner = Keypair.fromSecretKey(secretKey);
67 | const wallet = new Wallet(Keypair.fromSecretKey(secretKey));
68 | const mint = new PublicKey(mintAddress);
69 |
70 | const {bondingCurve, associatedBondingCurve} = await getDetailsFromTokenMint(mintAddress);
71 |
72 | const r = findAssociatedTokenAddress(wallet.publicKey, mint);
73 |
74 | const connection = new Connection('https://api.mainnet-beta.solana.com');
75 | const provider = new AnchorProvider(connection, wallet, AnchorProvider.defaultOptions());
76 | setProvider(provider);
77 |
78 | const program = new Program(idl, programId, provider);
79 | const associatedAddress = await createAssociatedTokenAccount(connection, owner, mint);
80 | console.log(`Associated Address: ${associatedAddress}`);
81 |
82 | const instruction = await program.methods.sell(new BN(1500000), new BN(0)).accounts({
83 | global: new PublicKey("4wTV1YmiEkRvAtNtsSGPtUrqRYQMe5SKy2uB4Jjaxnjf"),
84 | feeRecipient: new PublicKey("CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM"),
85 | mint: mint,
86 | bondingCurve: new PublicKey(bondingCurve),
87 | associatedBondingCurve: new PublicKey(associatedBondingCurve),
88 | associatedUser: r,
89 | user: owner.publicKey,
90 | systemProgram: new PublicKey("11111111111111111111111111111111"),
91 | tokenProgram: new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
92 | rent: new PublicKey("SysvarRent111111111111111111111111111111111"),
93 | eventAuthority: PublicKey.findProgramAddressSync([Buffer.from("__event_authority")], programId)[0],
94 | program: programId
95 | }).instruction();
96 |
97 | const instructions = [];
98 | instructions.push(instruction);
99 | const blockhash = await connection.getLatestBlockhash("finalized");
100 | const final_tx = new VersionedTransaction(new TransactionMessage({
101 | payerKey: owner.publicKey,
102 | recentBlockhash: blockhash.blockhash,
103 | instructions: instructions
104 | }).compileToV0Message());
105 |
106 | final_tx.sign([wallet.payer]);
107 |
108 | const txid = await connection.sendTransaction(final_tx, {
109 | skipPreflight: true,
110 | });
111 |
112 | await connection.confirmTransaction(txid);
113 |
114 | console.log(txid);
115 | };
116 |
117 | export {
118 | buyTransaction,
119 | sellTransaction
120 | }
--------------------------------------------------------------------------------
/src/constants/idl.ts:
--------------------------------------------------------------------------------
1 | import { Idl } from "@coral-xyz/anchor";
2 |
3 | const idl: Idl = {
4 | "version": "0.1.0",
5 | "name": "pump",
6 | "instructions": [
7 | {
8 | "name": "initialize",
9 | "docs": [
10 | "Creates the global state."
11 | ],
12 | "accounts": [
13 | {
14 | "name": "global",
15 | "isMut": true,
16 | "isSigner": false
17 | },
18 | {
19 | "name": "user",
20 | "isMut": true,
21 | "isSigner": true
22 | },
23 | {
24 | "name": "systemProgram",
25 | "isMut": false,
26 | "isSigner": false
27 | }
28 | ],
29 | "args": []
30 | },
31 | {
32 | "name": "setParams",
33 | "docs": [
34 | "Sets the global state parameters."
35 | ],
36 | "accounts": [
37 | {
38 | "name": "global",
39 | "isMut": true,
40 | "isSigner": false
41 | },
42 | {
43 | "name": "user",
44 | "isMut": true,
45 | "isSigner": true
46 | },
47 | {
48 | "name": "systemProgram",
49 | "isMut": false,
50 | "isSigner": false
51 | },
52 | {
53 | "name": "eventAuthority",
54 | "isMut": false,
55 | "isSigner": false
56 | },
57 | {
58 | "name": "program",
59 | "isMut": false,
60 | "isSigner": false
61 | }
62 | ],
63 | "args": [
64 | {
65 | "name": "feeRecipient",
66 | "type": "publicKey"
67 | },
68 | {
69 | "name": "initialVirtualTokenReserves",
70 | "type": "u64"
71 | },
72 | {
73 | "name": "initialVirtualSolReserves",
74 | "type": "u64"
75 | },
76 | {
77 | "name": "initialRealTokenReserves",
78 | "type": "u64"
79 | },
80 | {
81 | "name": "tokenTotalSupply",
82 | "type": "u64"
83 | },
84 | {
85 | "name": "feeBasisPoints",
86 | "type": "u64"
87 | }
88 | ]
89 | },
90 | {
91 | "name": "create",
92 | "docs": [
93 | "Creates a new coin and bonding curve."
94 | ],
95 | "accounts": [
96 | {
97 | "name": "mint",
98 | "isMut": true,
99 | "isSigner": true
100 | },
101 | {
102 | "name": "mintAuthority",
103 | "isMut": false,
104 | "isSigner": false
105 | },
106 | {
107 | "name": "bondingCurve",
108 | "isMut": true,
109 | "isSigner": false
110 | },
111 | {
112 | "name": "associatedBondingCurve",
113 | "isMut": true,
114 | "isSigner": false
115 | },
116 | {
117 | "name": "global",
118 | "isMut": false,
119 | "isSigner": false
120 | },
121 | {
122 | "name": "mplTokenMetadata",
123 | "isMut": false,
124 | "isSigner": false
125 | },
126 | {
127 | "name": "metadata",
128 | "isMut": true,
129 | "isSigner": false
130 | },
131 | {
132 | "name": "user",
133 | "isMut": true,
134 | "isSigner": true
135 | },
136 | {
137 | "name": "systemProgram",
138 | "isMut": false,
139 | "isSigner": false
140 | },
141 | {
142 | "name": "tokenProgram",
143 | "isMut": false,
144 | "isSigner": false
145 | },
146 | {
147 | "name": "associatedTokenProgram",
148 | "isMut": false,
149 | "isSigner": false
150 | },
151 | {
152 | "name": "rent",
153 | "isMut": false,
154 | "isSigner": false
155 | },
156 | {
157 | "name": "eventAuthority",
158 | "isMut": false,
159 | "isSigner": false
160 | },
161 | {
162 | "name": "program",
163 | "isMut": false,
164 | "isSigner": false
165 | }
166 | ],
167 | "args": [
168 | {
169 | "name": "name",
170 | "type": "string"
171 | },
172 | {
173 | "name": "symbol",
174 | "type": "string"
175 | },
176 | {
177 | "name": "uri",
178 | "type": "string"
179 | }
180 | ]
181 | },
182 | {
183 | "name": "buy",
184 | "docs": [
185 | "Buys tokens from a bonding curve."
186 | ],
187 | "accounts": [
188 | {
189 | "name": "global",
190 | "isMut": false,
191 | "isSigner": false
192 | },
193 | {
194 | "name": "feeRecipient",
195 | "isMut": true,
196 | "isSigner": false
197 | },
198 | {
199 | "name": "mint",
200 | "isMut": false,
201 | "isSigner": false
202 | },
203 | {
204 | "name": "bondingCurve",
205 | "isMut": true,
206 | "isSigner": false
207 | },
208 | {
209 | "name": "associatedBondingCurve",
210 | "isMut": true,
211 | "isSigner": false
212 | },
213 | {
214 | "name": "associatedUser",
215 | "isMut": true,
216 | "isSigner": false
217 | },
218 | {
219 | "name": "user",
220 | "isMut": true,
221 | "isSigner": true
222 | },
223 | {
224 | "name": "systemProgram",
225 | "isMut": false,
226 | "isSigner": false
227 | },
228 | {
229 | "name": "tokenProgram",
230 | "isMut": false,
231 | "isSigner": false
232 | },
233 | {
234 | "name": "rent",
235 | "isMut": false,
236 | "isSigner": false
237 | },
238 | {
239 | "name": "eventAuthority",
240 | "isMut": false,
241 | "isSigner": false
242 | },
243 | {
244 | "name": "program",
245 | "isMut": false,
246 | "isSigner": false
247 | }
248 | ],
249 | "args": [
250 | {
251 | "name": "amount",
252 | "type": "u64"
253 | },
254 | {
255 | "name": "maxSolCost",
256 | "type": "u64"
257 | }
258 | ]
259 | },
260 | {
261 | "name": "sell",
262 | "docs": [
263 | "Sells tokens into a bonding curve."
264 | ],
265 | "accounts": [
266 | {
267 | "name": "global",
268 | "isMut": false,
269 | "isSigner": false
270 | },
271 | {
272 | "name": "feeRecipient",
273 | "isMut": true,
274 | "isSigner": false
275 | },
276 | {
277 | "name": "mint",
278 | "isMut": false,
279 | "isSigner": false
280 | },
281 | {
282 | "name": "bondingCurve",
283 | "isMut": true,
284 | "isSigner": false
285 | },
286 | {
287 | "name": "associatedBondingCurve",
288 | "isMut": true,
289 | "isSigner": false
290 | },
291 | {
292 | "name": "associatedUser",
293 | "isMut": true,
294 | "isSigner": false
295 | },
296 | {
297 | "name": "user",
298 | "isMut": true,
299 | "isSigner": true
300 | },
301 | {
302 | "name": "systemProgram",
303 | "isMut": false,
304 | "isSigner": false
305 | },
306 | {
307 | "name": "associatedTokenProgram",
308 | "isMut": false,
309 | "isSigner": false
310 | },
311 | {
312 | "name": "tokenProgram",
313 | "isMut": false,
314 | "isSigner": false
315 | },
316 | {
317 | "name": "eventAuthority",
318 | "isMut": false,
319 | "isSigner": false
320 | },
321 | {
322 | "name": "program",
323 | "isMut": false,
324 | "isSigner": false
325 | }
326 | ],
327 | "args": [
328 | {
329 | "name": "amount",
330 | "type": "u64"
331 | },
332 | {
333 | "name": "minSolOutput",
334 | "type": "u64"
335 | }
336 | ]
337 | },
338 | {
339 | "name": "withdraw",
340 | "docs": [
341 | "Allows the admin to withdraw liquidity for a migration once the bonding curve completes"
342 | ],
343 | "accounts": [
344 | {
345 | "name": "global",
346 | "isMut": false,
347 | "isSigner": false
348 | },
349 | {
350 | "name": "mint",
351 | "isMut": false,
352 | "isSigner": false
353 | },
354 | {
355 | "name": "bondingCurve",
356 | "isMut": true,
357 | "isSigner": false
358 | },
359 | {
360 | "name": "associatedBondingCurve",
361 | "isMut": true,
362 | "isSigner": false
363 | },
364 | {
365 | "name": "associatedUser",
366 | "isMut": true,
367 | "isSigner": false
368 | },
369 | {
370 | "name": "user",
371 | "isMut": true,
372 | "isSigner": true
373 | },
374 | {
375 | "name": "systemProgram",
376 | "isMut": false,
377 | "isSigner": false
378 | },
379 | {
380 | "name": "tokenProgram",
381 | "isMut": false,
382 | "isSigner": false
383 | },
384 | {
385 | "name": "rent",
386 | "isMut": false,
387 | "isSigner": false
388 | },
389 | {
390 | "name": "eventAuthority",
391 | "isMut": false,
392 | "isSigner": false
393 | },
394 | {
395 | "name": "program",
396 | "isMut": false,
397 | "isSigner": false
398 | }
399 | ],
400 | "args": []
401 | }
402 | ],
403 | "accounts": [
404 | {
405 | "name": "Global",
406 | "type": {
407 | "kind": "struct",
408 | "fields": [
409 | {
410 | "name": "initialized",
411 | "type": "bool"
412 | },
413 | {
414 | "name": "authority",
415 | "type": "publicKey"
416 | },
417 | {
418 | "name": "feeRecipient",
419 | "type": "publicKey"
420 | },
421 | {
422 | "name": "initialVirtualTokenReserves",
423 | "type": "u64"
424 | },
425 | {
426 | "name": "initialVirtualSolReserves",
427 | "type": "u64"
428 | },
429 | {
430 | "name": "initialRealTokenReserves",
431 | "type": "u64"
432 | },
433 | {
434 | "name": "tokenTotalSupply",
435 | "type": "u64"
436 | },
437 | {
438 | "name": "feeBasisPoints",
439 | "type": "u64"
440 | }
441 | ]
442 | }
443 | },
444 | {
445 | "name": "BondingCurve",
446 | "type": {
447 | "kind": "struct",
448 | "fields": [
449 | {
450 | "name": "virtualTokenReserves",
451 | "type": "u64"
452 | },
453 | {
454 | "name": "virtualSolReserves",
455 | "type": "u64"
456 | },
457 | {
458 | "name": "realTokenReserves",
459 | "type": "u64"
460 | },
461 | {
462 | "name": "realSolReserves",
463 | "type": "u64"
464 | },
465 | {
466 | "name": "tokenTotalSupply",
467 | "type": "u64"
468 | },
469 | {
470 | "name": "complete",
471 | "type": "bool"
472 | }
473 | ]
474 | }
475 | }
476 | ],
477 | "events": [
478 | {
479 | "name": "CreateEvent",
480 | "fields": [
481 | {
482 | "name": "name",
483 | "type": "string",
484 | "index": false
485 | },
486 | {
487 | "name": "symbol",
488 | "type": "string",
489 | "index": false
490 | },
491 | {
492 | "name": "uri",
493 | "type": "string",
494 | "index": false
495 | },
496 | {
497 | "name": "mint",
498 | "type": "publicKey",
499 | "index": false
500 | },
501 | {
502 | "name": "bondingCurve",
503 | "type": "publicKey",
504 | "index": false
505 | },
506 | {
507 | "name": "user",
508 | "type": "publicKey",
509 | "index": false
510 | }
511 | ]
512 | },
513 | {
514 | "name": "TradeEvent",
515 | "fields": [
516 | {
517 | "name": "mint",
518 | "type": "publicKey",
519 | "index": false
520 | },
521 | {
522 | "name": "solAmount",
523 | "type": "u64",
524 | "index": false
525 | },
526 | {
527 | "name": "tokenAmount",
528 | "type": "u64",
529 | "index": false
530 | },
531 | {
532 | "name": "isBuy",
533 | "type": "bool",
534 | "index": false
535 | },
536 | {
537 | "name": "user",
538 | "type": "publicKey",
539 | "index": false
540 | },
541 | {
542 | "name": "timestamp",
543 | "type": "i64",
544 | "index": false
545 | },
546 | {
547 | "name": "virtualSolReserves",
548 | "type": "u64",
549 | "index": false
550 | },
551 | {
552 | "name": "virtualTokenReserves",
553 | "type": "u64",
554 | "index": false
555 | }
556 | ]
557 | },
558 | {
559 | "name": "CompleteEvent",
560 | "fields": [
561 | {
562 | "name": "user",
563 | "type": "publicKey",
564 | "index": false
565 | },
566 | {
567 | "name": "mint",
568 | "type": "publicKey",
569 | "index": false
570 | },
571 | {
572 | "name": "bondingCurve",
573 | "type": "publicKey",
574 | "index": false
575 | },
576 | {
577 | "name": "timestamp",
578 | "type": "i64",
579 | "index": false
580 | }
581 | ]
582 | },
583 | {
584 | "name": "SetParamsEvent",
585 | "fields": [
586 | {
587 | "name": "feeRecipient",
588 | "type": "publicKey",
589 | "index": false
590 | },
591 | {
592 | "name": "initialVirtualTokenReserves",
593 | "type": "u64",
594 | "index": false
595 | },
596 | {
597 | "name": "initialVirtualSolReserves",
598 | "type": "u64",
599 | "index": false
600 | },
601 | {
602 | "name": "initialRealTokenReserves",
603 | "type": "u64",
604 | "index": false
605 | },
606 | {
607 | "name": "tokenTotalSupply",
608 | "type": "u64",
609 | "index": false
610 | },
611 | {
612 | "name": "feeBasisPoints",
613 | "type": "u64",
614 | "index": false
615 | }
616 | ]
617 | }
618 | ],
619 | "errors": [
620 | {
621 | "code": 6000,
622 | "name": "NotAuthorized",
623 | "msg": "The given account is not authorized to execute this instruction."
624 | },
625 | {
626 | "code": 6001,
627 | "name": "AlreadyInitialized",
628 | "msg": "The program is already initialized."
629 | },
630 | {
631 | "code": 6002,
632 | "name": "TooMuchSolRequired",
633 | "msg": "slippage: Too much SOL required to buy the given amount of tokens."
634 | },
635 | {
636 | "code": 6003,
637 | "name": "TooLittleSolReceived",
638 | "msg": "slippage: Too little SOL received to sell the given amount of tokens."
639 | },
640 | {
641 | "code": 6004,
642 | "name": "MintDoesNotMatchBondingCurve",
643 | "msg": "The mint does not match the bonding curve."
644 | },
645 | {
646 | "code": 6005,
647 | "name": "BondingCurveComplete",
648 | "msg": "The bonding curve has completed and liquidity migrated to raydium."
649 | },
650 | {
651 | "code": 6006,
652 | "name": "BondingCurveNotComplete",
653 | "msg": "The bonding curve has not completed."
654 | },
655 | {
656 | "code": 6007,
657 | "name": "NotInitialized",
658 | "msg": "The program is not initialized."
659 | }
660 | ],
661 | "metadata": {
662 | "address": "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"
663 | }
664 | };
665 |
666 | export default idl;
--------------------------------------------------------------------------------