@solana-launchpad/sdk 1.0.0

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.
@@ -0,0 +1,4961 @@
1
+ import { Transaction, ComputeBudgetProgram, SendTransactionError, TransactionMessage, VersionedTransaction, LAMPORTS_PER_SOL, PublicKey } from '@solana/web3.js';
2
+ import { Program } from '@coral-xyz/anchor';
3
+ import { setGlobalDispatcher, Agent } from 'undici';
4
+ import { struct, u64, bool, publicKey } from '@coral-xyz/borsh';
5
+ import { getAssociatedTokenAddress, createAssociatedTokenAccountInstruction, getAccount } from '@solana/spl-token';
6
+ import { BN } from 'bn.js';
7
+ import { sha256 } from 'js-sha256';
8
+
9
+ class GlobalAccount {
10
+ constructor(discriminator, initialized, authority, feeRecipient, initialVirtualTokenReserves, initialVirtualSolReserves, initialRealTokenReserves, tokenTotalSupply, feeBasisPoints) {
11
+ this.initialized = false;
12
+ this.discriminator = discriminator;
13
+ this.initialized = initialized;
14
+ this.authority = authority;
15
+ this.feeRecipient = feeRecipient;
16
+ this.initialVirtualTokenReserves = initialVirtualTokenReserves;
17
+ this.initialVirtualSolReserves = initialVirtualSolReserves;
18
+ this.initialRealTokenReserves = initialRealTokenReserves;
19
+ this.tokenTotalSupply = tokenTotalSupply;
20
+ this.feeBasisPoints = feeBasisPoints;
21
+ }
22
+ getInitialBuyPrice(amount) {
23
+ if (amount <= 0n) {
24
+ return 0n;
25
+ }
26
+ let n = this.initialVirtualSolReserves * this.initialVirtualTokenReserves;
27
+ let i = this.initialVirtualSolReserves + amount;
28
+ let r = n / i + 1n;
29
+ let s = this.initialVirtualTokenReserves - r;
30
+ return s < this.initialRealTokenReserves
31
+ ? s
32
+ : this.initialRealTokenReserves;
33
+ }
34
+ static fromBuffer(buffer) {
35
+ const structure = struct([
36
+ u64("discriminator"),
37
+ bool("initialized"),
38
+ publicKey("authority"),
39
+ publicKey("feeRecipient"),
40
+ u64("initialVirtualTokenReserves"),
41
+ u64("initialVirtualSolReserves"),
42
+ u64("initialRealTokenReserves"),
43
+ u64("tokenTotalSupply"),
44
+ u64("feeBasisPoints"),
45
+ ]);
46
+ let value = structure.decode(buffer);
47
+ return new GlobalAccount(BigInt(value.discriminator), value.initialized, value.authority, value.feeRecipient, BigInt(value.initialVirtualTokenReserves), BigInt(value.initialVirtualSolReserves), BigInt(value.initialRealTokenReserves), BigInt(value.tokenTotalSupply), BigInt(value.feeBasisPoints));
48
+ }
49
+ }
50
+
51
+ class BondingCurveAccount {
52
+ constructor(discriminator, virtualTokenReserves, virtualSolReserves, realTokenReserves, realSolReserves, tokenTotalSupply, complete, creator) {
53
+ this.discriminator = discriminator;
54
+ this.virtualTokenReserves = virtualTokenReserves;
55
+ this.virtualSolReserves = virtualSolReserves;
56
+ this.realTokenReserves = realTokenReserves;
57
+ this.realSolReserves = realSolReserves;
58
+ this.tokenTotalSupply = tokenTotalSupply;
59
+ this.complete = complete;
60
+ this.creator = creator;
61
+ }
62
+ getBuyPrice(amount) {
63
+ if (this.complete) {
64
+ throw new Error("Curve is complete");
65
+ }
66
+ if (amount <= 0n) {
67
+ return 0n;
68
+ }
69
+ // Calculate the product of virtual reserves
70
+ let n = this.virtualSolReserves * this.virtualTokenReserves;
71
+ // Calculate the new virtual sol reserves after the purchase
72
+ let i = this.virtualSolReserves + amount;
73
+ // Calculate the new virtual token reserves after the purchase
74
+ let r = n / i + 1n;
75
+ // Calculate the amount of tokens to be purchased
76
+ let s = this.virtualTokenReserves - r;
77
+ // Return the minimum of the calculated tokens and real token reserves
78
+ return s < this.realTokenReserves ? s : this.realTokenReserves;
79
+ }
80
+ getSellPrice(amount, feeBasisPoints) {
81
+ if (this.complete) {
82
+ throw new Error("Curve is complete");
83
+ }
84
+ if (amount <= 0n) {
85
+ return 0n;
86
+ }
87
+ // Calculate the proportional amount of virtual sol reserves to be received
88
+ let n = (amount * this.virtualSolReserves) / (this.virtualTokenReserves + amount);
89
+ // Calculate the fee amount in the same units
90
+ let a = (n * feeBasisPoints) / 10000n;
91
+ // Return the net amount after deducting the fee
92
+ return n - a;
93
+ }
94
+ getMarketCapSOL() {
95
+ if (this.virtualTokenReserves === 0n) {
96
+ return 0n;
97
+ }
98
+ return ((this.tokenTotalSupply * this.virtualSolReserves) /
99
+ this.virtualTokenReserves);
100
+ }
101
+ getFinalMarketCapSOL(feeBasisPoints) {
102
+ let totalSellValue = this.getBuyOutPrice(this.realTokenReserves, feeBasisPoints);
103
+ let totalVirtualValue = this.virtualSolReserves + totalSellValue;
104
+ let totalVirtualTokens = this.virtualTokenReserves - this.realTokenReserves;
105
+ if (totalVirtualTokens === 0n) {
106
+ return 0n;
107
+ }
108
+ return (this.tokenTotalSupply * totalVirtualValue) / totalVirtualTokens;
109
+ }
110
+ getBuyOutPrice(amount, feeBasisPoints) {
111
+ let solTokens = amount < this.realSolReserves ? this.realSolReserves : amount;
112
+ let totalSellValue = (solTokens * this.virtualSolReserves) /
113
+ (this.virtualTokenReserves - solTokens) +
114
+ 1n;
115
+ let fee = (totalSellValue * feeBasisPoints) / 10000n;
116
+ return totalSellValue + fee;
117
+ }
118
+ static fromBuffer(buffer) {
119
+ const structure = struct([
120
+ u64("discriminator"),
121
+ u64("virtualTokenReserves"),
122
+ u64("virtualSolReserves"),
123
+ u64("realTokenReserves"),
124
+ u64("realSolReserves"),
125
+ u64("tokenTotalSupply"),
126
+ bool("complete"),
127
+ publicKey("creator"),
128
+ ]);
129
+ let value = structure.decode(buffer);
130
+ return new BondingCurveAccount(BigInt(value.discriminator), BigInt(value.virtualTokenReserves), BigInt(value.virtualSolReserves), BigInt(value.realTokenReserves), BigInt(value.realSolReserves), BigInt(value.tokenTotalSupply), value.complete, value.creator);
131
+ }
132
+ }
133
+
134
+ const DEFAULT_COMMITMENT = "finalized";
135
+ const DEFAULT_FINALITY = "finalized";
136
+ const sleep = async (ms) => {
137
+ await new Promise((resolve) => setTimeout(resolve, ms));
138
+ };
139
+ const calculateWithSlippageBuy = (amount, basisPoints) => {
140
+ return amount + (amount * basisPoints) / BigInt(1000);
141
+ };
142
+ const calculateWithSlippageSell = (amount, basisPoints) => {
143
+ return amount - (amount * basisPoints) / BigInt(1000);
144
+ };
145
+ async function sendTx(connection, tx, payer, signers, priorityFees, commitment = DEFAULT_COMMITMENT, finality = DEFAULT_FINALITY) {
146
+ let newTx = new Transaction();
147
+ if (priorityFees) {
148
+ const modifyComputeUnits = ComputeBudgetProgram.setComputeUnitLimit({
149
+ units: priorityFees.unitLimit,
150
+ });
151
+ const addPriorityFee = ComputeBudgetProgram.setComputeUnitPrice({
152
+ microLamports: priorityFees.unitPrice,
153
+ });
154
+ newTx.add(modifyComputeUnits);
155
+ newTx.add(addPriorityFee);
156
+ }
157
+ newTx.add(tx);
158
+ let versionedTx = await buildVersionedTx(connection, payer, newTx, commitment);
159
+ versionedTx.sign(signers);
160
+ try {
161
+ console.log((await connection.simulateTransaction(versionedTx, undefined)));
162
+ const sig = await connection.sendTransaction(versionedTx, {
163
+ skipPreflight: false,
164
+ });
165
+ console.log("Transaction signature: ", `https://solscan.io/tx/${sig}`);
166
+ let txResult = await getTxDetails(connection, sig, commitment, finality);
167
+ if (!txResult) {
168
+ return {
169
+ success: false,
170
+ error: "Transaction failed",
171
+ };
172
+ }
173
+ return {
174
+ success: true,
175
+ signature: sig,
176
+ results: txResult,
177
+ };
178
+ }
179
+ catch (e) {
180
+ if (e instanceof SendTransactionError) ;
181
+ else {
182
+ console.error(e);
183
+ }
184
+ return {
185
+ error: e,
186
+ success: false,
187
+ };
188
+ }
189
+ }
190
+ async function buildTx(connection, tx, payer, signers, priorityFees, commitment = DEFAULT_COMMITMENT, finality = DEFAULT_FINALITY) {
191
+ let newTx = new Transaction();
192
+ if (priorityFees) {
193
+ const modifyComputeUnits = ComputeBudgetProgram.setComputeUnitLimit({
194
+ units: priorityFees.unitLimit,
195
+ });
196
+ const addPriorityFee = ComputeBudgetProgram.setComputeUnitPrice({
197
+ microLamports: priorityFees.unitPrice,
198
+ });
199
+ newTx.add(modifyComputeUnits);
200
+ newTx.add(addPriorityFee);
201
+ }
202
+ newTx.add(tx);
203
+ let versionedTx = await buildVersionedTx(connection, payer, newTx, commitment);
204
+ versionedTx.sign(signers);
205
+ return versionedTx;
206
+ }
207
+ const buildVersionedTx = async (connection, payer, tx, commitment = DEFAULT_COMMITMENT) => {
208
+ const blockHash = (await connection.getLatestBlockhash(commitment))
209
+ .blockhash;
210
+ let messageV0 = new TransactionMessage({
211
+ payerKey: payer,
212
+ recentBlockhash: blockHash,
213
+ instructions: tx.instructions,
214
+ }).compileToV0Message();
215
+ return new VersionedTransaction(messageV0);
216
+ };
217
+ const getTxDetails = async (connection, sig, commitment = DEFAULT_COMMITMENT, finality = DEFAULT_FINALITY) => {
218
+ const latestBlockHash = await connection.getLatestBlockhash();
219
+ await connection.confirmTransaction({
220
+ blockhash: latestBlockHash.blockhash,
221
+ lastValidBlockHeight: latestBlockHash.lastValidBlockHeight,
222
+ signature: sig,
223
+ }, commitment);
224
+ return connection.getTransaction(sig, {
225
+ maxSupportedTransactionVersion: 0,
226
+ commitment: finality,
227
+ });
228
+ };
229
+ const getRandomInt = (min, max) => {
230
+ min = Math.ceil(min);
231
+ max = Math.floor(max);
232
+ return Math.floor(Math.random() * (max - min + 1)) + min; // The maximum is inclusive, the minimum is inclusive
233
+ };
234
+ const printSOLBalance = async (connection, pubKey, info = "") => {
235
+ const balance = await connection.getBalance(pubKey);
236
+ console.log(`${info ? info + " " : ""}${pubKey.toBase58()}:`, balance / LAMPORTS_PER_SOL, `SOL`);
237
+ };
238
+ const baseToValue = (base, decimals) => {
239
+ return base * Math.pow(10, decimals);
240
+ };
241
+ const valueToBase = (value, decimals) => {
242
+ return value / Math.pow(10, decimals);
243
+ };
244
+ //i.e. account:BondingCurve
245
+ function getDiscriminator(name) {
246
+ return sha256.digest(name).slice(0, 8);
247
+ }
248
+
249
+ var address = "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P";
250
+ var metadata = {
251
+ name: "pump",
252
+ version: "0.1.0",
253
+ spec: "0.1.0",
254
+ description: "Created with Anchor"
255
+ };
256
+ var instructions = [
257
+ {
258
+ name: "admin_set_creator",
259
+ docs: [
260
+ "Allows Global::admin_set_creator_authority to override the bonding curve creator"
261
+ ],
262
+ discriminator: [
263
+ 69,
264
+ 25,
265
+ 171,
266
+ 142,
267
+ 57,
268
+ 239,
269
+ 13,
270
+ 4
271
+ ],
272
+ accounts: [
273
+ {
274
+ name: "admin_set_creator_authority",
275
+ signer: true,
276
+ relations: [
277
+ "global"
278
+ ]
279
+ },
280
+ {
281
+ name: "global",
282
+ pda: {
283
+ seeds: [
284
+ {
285
+ kind: "const",
286
+ value: [
287
+ 103,
288
+ 108,
289
+ 111,
290
+ 98,
291
+ 97,
292
+ 108
293
+ ]
294
+ }
295
+ ]
296
+ }
297
+ },
298
+ {
299
+ name: "mint"
300
+ },
301
+ {
302
+ name: "bonding_curve",
303
+ writable: true,
304
+ pda: {
305
+ seeds: [
306
+ {
307
+ kind: "const",
308
+ value: [
309
+ 98,
310
+ 111,
311
+ 110,
312
+ 100,
313
+ 105,
314
+ 110,
315
+ 103,
316
+ 45,
317
+ 99,
318
+ 117,
319
+ 114,
320
+ 118,
321
+ 101
322
+ ]
323
+ },
324
+ {
325
+ kind: "account",
326
+ path: "mint"
327
+ }
328
+ ]
329
+ }
330
+ },
331
+ {
332
+ name: "event_authority",
333
+ pda: {
334
+ seeds: [
335
+ {
336
+ kind: "const",
337
+ value: [
338
+ 95,
339
+ 95,
340
+ 101,
341
+ 118,
342
+ 101,
343
+ 110,
344
+ 116,
345
+ 95,
346
+ 97,
347
+ 117,
348
+ 116,
349
+ 104,
350
+ 111,
351
+ 114,
352
+ 105,
353
+ 116,
354
+ 121
355
+ ]
356
+ }
357
+ ]
358
+ }
359
+ },
360
+ {
361
+ name: "program"
362
+ }
363
+ ],
364
+ args: [
365
+ {
366
+ name: "creator",
367
+ type: "pubkey"
368
+ }
369
+ ]
370
+ },
371
+ {
372
+ name: "admin_set_idl_authority",
373
+ discriminator: [
374
+ 8,
375
+ 217,
376
+ 96,
377
+ 231,
378
+ 144,
379
+ 104,
380
+ 192,
381
+ 5
382
+ ],
383
+ accounts: [
384
+ {
385
+ name: "authority",
386
+ signer: true,
387
+ relations: [
388
+ "global"
389
+ ]
390
+ },
391
+ {
392
+ name: "global",
393
+ pda: {
394
+ seeds: [
395
+ {
396
+ kind: "const",
397
+ value: [
398
+ 103,
399
+ 108,
400
+ 111,
401
+ 98,
402
+ 97,
403
+ 108
404
+ ]
405
+ }
406
+ ]
407
+ }
408
+ },
409
+ {
410
+ name: "idl_account",
411
+ writable: true
412
+ },
413
+ {
414
+ name: "system_program",
415
+ address: "11111111111111111111111111111111"
416
+ },
417
+ {
418
+ name: "program_signer",
419
+ pda: {
420
+ seeds: [
421
+ ]
422
+ }
423
+ },
424
+ {
425
+ name: "event_authority",
426
+ pda: {
427
+ seeds: [
428
+ {
429
+ kind: "const",
430
+ value: [
431
+ 95,
432
+ 95,
433
+ 101,
434
+ 118,
435
+ 101,
436
+ 110,
437
+ 116,
438
+ 95,
439
+ 97,
440
+ 117,
441
+ 116,
442
+ 104,
443
+ 111,
444
+ 114,
445
+ 105,
446
+ 116,
447
+ 121
448
+ ]
449
+ }
450
+ ]
451
+ }
452
+ },
453
+ {
454
+ name: "program"
455
+ }
456
+ ],
457
+ args: [
458
+ {
459
+ name: "idl_authority",
460
+ type: "pubkey"
461
+ }
462
+ ]
463
+ },
464
+ {
465
+ name: "admin_update_token_incentives",
466
+ discriminator: [
467
+ 209,
468
+ 11,
469
+ 115,
470
+ 87,
471
+ 213,
472
+ 23,
473
+ 124,
474
+ 204
475
+ ],
476
+ accounts: [
477
+ {
478
+ name: "authority",
479
+ writable: true,
480
+ signer: true,
481
+ relations: [
482
+ "global"
483
+ ]
484
+ },
485
+ {
486
+ name: "global",
487
+ pda: {
488
+ seeds: [
489
+ {
490
+ kind: "const",
491
+ value: [
492
+ 103,
493
+ 108,
494
+ 111,
495
+ 98,
496
+ 97,
497
+ 108
498
+ ]
499
+ }
500
+ ]
501
+ }
502
+ },
503
+ {
504
+ name: "global_volume_accumulator",
505
+ writable: true,
506
+ pda: {
507
+ seeds: [
508
+ {
509
+ kind: "const",
510
+ value: [
511
+ 103,
512
+ 108,
513
+ 111,
514
+ 98,
515
+ 97,
516
+ 108,
517
+ 95,
518
+ 118,
519
+ 111,
520
+ 108,
521
+ 117,
522
+ 109,
523
+ 101,
524
+ 95,
525
+ 97,
526
+ 99,
527
+ 99,
528
+ 117,
529
+ 109,
530
+ 117,
531
+ 108,
532
+ 97,
533
+ 116,
534
+ 111,
535
+ 114
536
+ ]
537
+ }
538
+ ]
539
+ }
540
+ },
541
+ {
542
+ name: "mint"
543
+ },
544
+ {
545
+ name: "global_incentive_token_account",
546
+ writable: true,
547
+ pda: {
548
+ seeds: [
549
+ {
550
+ kind: "account",
551
+ path: "global_volume_accumulator"
552
+ },
553
+ {
554
+ kind: "account",
555
+ path: "token_program"
556
+ },
557
+ {
558
+ kind: "account",
559
+ path: "mint"
560
+ }
561
+ ],
562
+ program: {
563
+ kind: "const",
564
+ value: [
565
+ 140,
566
+ 151,
567
+ 37,
568
+ 143,
569
+ 78,
570
+ 36,
571
+ 137,
572
+ 241,
573
+ 187,
574
+ 61,
575
+ 16,
576
+ 41,
577
+ 20,
578
+ 142,
579
+ 13,
580
+ 131,
581
+ 11,
582
+ 90,
583
+ 19,
584
+ 153,
585
+ 218,
586
+ 255,
587
+ 16,
588
+ 132,
589
+ 4,
590
+ 142,
591
+ 123,
592
+ 216,
593
+ 219,
594
+ 233,
595
+ 248,
596
+ 89
597
+ ]
598
+ }
599
+ }
600
+ },
601
+ {
602
+ name: "associated_token_program",
603
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
604
+ },
605
+ {
606
+ name: "system_program",
607
+ address: "11111111111111111111111111111111"
608
+ },
609
+ {
610
+ name: "token_program"
611
+ },
612
+ {
613
+ name: "event_authority",
614
+ pda: {
615
+ seeds: [
616
+ {
617
+ kind: "const",
618
+ value: [
619
+ 95,
620
+ 95,
621
+ 101,
622
+ 118,
623
+ 101,
624
+ 110,
625
+ 116,
626
+ 95,
627
+ 97,
628
+ 117,
629
+ 116,
630
+ 104,
631
+ 111,
632
+ 114,
633
+ 105,
634
+ 116,
635
+ 121
636
+ ]
637
+ }
638
+ ]
639
+ }
640
+ },
641
+ {
642
+ name: "program"
643
+ }
644
+ ],
645
+ args: [
646
+ {
647
+ name: "start_time",
648
+ type: "i64"
649
+ },
650
+ {
651
+ name: "end_time",
652
+ type: "i64"
653
+ },
654
+ {
655
+ name: "seconds_in_a_day",
656
+ type: "i64"
657
+ },
658
+ {
659
+ name: "day_number",
660
+ type: "u64"
661
+ },
662
+ {
663
+ name: "pump_token_supply_per_day",
664
+ type: "u64"
665
+ }
666
+ ]
667
+ },
668
+ {
669
+ name: "buy",
670
+ docs: [
671
+ "Buys tokens from a bonding curve."
672
+ ],
673
+ discriminator: [
674
+ 102,
675
+ 6,
676
+ 61,
677
+ 18,
678
+ 1,
679
+ 218,
680
+ 235,
681
+ 234
682
+ ],
683
+ accounts: [
684
+ {
685
+ name: "global",
686
+ pda: {
687
+ seeds: [
688
+ {
689
+ kind: "const",
690
+ value: [
691
+ 103,
692
+ 108,
693
+ 111,
694
+ 98,
695
+ 97,
696
+ 108
697
+ ]
698
+ }
699
+ ]
700
+ }
701
+ },
702
+ {
703
+ name: "fee_recipient",
704
+ writable: true
705
+ },
706
+ {
707
+ name: "mint"
708
+ },
709
+ {
710
+ name: "bonding_curve",
711
+ writable: true,
712
+ pda: {
713
+ seeds: [
714
+ {
715
+ kind: "const",
716
+ value: [
717
+ 98,
718
+ 111,
719
+ 110,
720
+ 100,
721
+ 105,
722
+ 110,
723
+ 103,
724
+ 45,
725
+ 99,
726
+ 117,
727
+ 114,
728
+ 118,
729
+ 101
730
+ ]
731
+ },
732
+ {
733
+ kind: "account",
734
+ path: "mint"
735
+ }
736
+ ]
737
+ }
738
+ },
739
+ {
740
+ name: "associated_bonding_curve",
741
+ writable: true,
742
+ pda: {
743
+ seeds: [
744
+ {
745
+ kind: "account",
746
+ path: "bonding_curve"
747
+ },
748
+ {
749
+ kind: "const",
750
+ value: [
751
+ 6,
752
+ 221,
753
+ 246,
754
+ 225,
755
+ 215,
756
+ 101,
757
+ 161,
758
+ 147,
759
+ 217,
760
+ 203,
761
+ 225,
762
+ 70,
763
+ 206,
764
+ 235,
765
+ 121,
766
+ 172,
767
+ 28,
768
+ 180,
769
+ 133,
770
+ 237,
771
+ 95,
772
+ 91,
773
+ 55,
774
+ 145,
775
+ 58,
776
+ 140,
777
+ 245,
778
+ 133,
779
+ 126,
780
+ 255,
781
+ 0,
782
+ 169
783
+ ]
784
+ },
785
+ {
786
+ kind: "account",
787
+ path: "mint"
788
+ }
789
+ ],
790
+ program: {
791
+ kind: "const",
792
+ value: [
793
+ 140,
794
+ 151,
795
+ 37,
796
+ 143,
797
+ 78,
798
+ 36,
799
+ 137,
800
+ 241,
801
+ 187,
802
+ 61,
803
+ 16,
804
+ 41,
805
+ 20,
806
+ 142,
807
+ 13,
808
+ 131,
809
+ 11,
810
+ 90,
811
+ 19,
812
+ 153,
813
+ 218,
814
+ 255,
815
+ 16,
816
+ 132,
817
+ 4,
818
+ 142,
819
+ 123,
820
+ 216,
821
+ 219,
822
+ 233,
823
+ 248,
824
+ 89
825
+ ]
826
+ }
827
+ }
828
+ },
829
+ {
830
+ name: "associated_user",
831
+ writable: true
832
+ },
833
+ {
834
+ name: "user",
835
+ writable: true,
836
+ signer: true
837
+ },
838
+ {
839
+ name: "system_program",
840
+ address: "11111111111111111111111111111111"
841
+ },
842
+ {
843
+ name: "token_program",
844
+ address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
845
+ },
846
+ {
847
+ name: "creator_vault",
848
+ writable: true,
849
+ pda: {
850
+ seeds: [
851
+ {
852
+ kind: "const",
853
+ value: [
854
+ 99,
855
+ 114,
856
+ 101,
857
+ 97,
858
+ 116,
859
+ 111,
860
+ 114,
861
+ 45,
862
+ 118,
863
+ 97,
864
+ 117,
865
+ 108,
866
+ 116
867
+ ]
868
+ },
869
+ {
870
+ kind: "account",
871
+ path: "bonding_curve.creator",
872
+ account: "BondingCurve"
873
+ }
874
+ ]
875
+ }
876
+ },
877
+ {
878
+ name: "event_authority",
879
+ pda: {
880
+ seeds: [
881
+ {
882
+ kind: "const",
883
+ value: [
884
+ 95,
885
+ 95,
886
+ 101,
887
+ 118,
888
+ 101,
889
+ 110,
890
+ 116,
891
+ 95,
892
+ 97,
893
+ 117,
894
+ 116,
895
+ 104,
896
+ 111,
897
+ 114,
898
+ 105,
899
+ 116,
900
+ 121
901
+ ]
902
+ }
903
+ ]
904
+ }
905
+ },
906
+ {
907
+ name: "program"
908
+ },
909
+ {
910
+ name: "global_volume_accumulator",
911
+ writable: true,
912
+ pda: {
913
+ seeds: [
914
+ {
915
+ kind: "const",
916
+ value: [
917
+ 103,
918
+ 108,
919
+ 111,
920
+ 98,
921
+ 97,
922
+ 108,
923
+ 95,
924
+ 118,
925
+ 111,
926
+ 108,
927
+ 117,
928
+ 109,
929
+ 101,
930
+ 95,
931
+ 97,
932
+ 99,
933
+ 99,
934
+ 117,
935
+ 109,
936
+ 117,
937
+ 108,
938
+ 97,
939
+ 116,
940
+ 111,
941
+ 114
942
+ ]
943
+ }
944
+ ]
945
+ }
946
+ },
947
+ {
948
+ name: "user_volume_accumulator",
949
+ writable: true,
950
+ pda: {
951
+ seeds: [
952
+ {
953
+ kind: "const",
954
+ value: [
955
+ 117,
956
+ 115,
957
+ 101,
958
+ 114,
959
+ 95,
960
+ 118,
961
+ 111,
962
+ 108,
963
+ 117,
964
+ 109,
965
+ 101,
966
+ 95,
967
+ 97,
968
+ 99,
969
+ 99,
970
+ 117,
971
+ 109,
972
+ 117,
973
+ 108,
974
+ 97,
975
+ 116,
976
+ 111,
977
+ 114
978
+ ]
979
+ },
980
+ {
981
+ kind: "account",
982
+ path: "user"
983
+ }
984
+ ]
985
+ }
986
+ }
987
+ ],
988
+ args: [
989
+ {
990
+ name: "amount",
991
+ type: "u64"
992
+ },
993
+ {
994
+ name: "max_sol_cost",
995
+ type: "u64"
996
+ },
997
+ {
998
+ name: "track_volume",
999
+ type: {
1000
+ defined: {
1001
+ name: "OptionBool"
1002
+ }
1003
+ }
1004
+ }
1005
+ ]
1006
+ },
1007
+ {
1008
+ name: "claim_token_incentives",
1009
+ discriminator: [
1010
+ 16,
1011
+ 4,
1012
+ 71,
1013
+ 28,
1014
+ 204,
1015
+ 1,
1016
+ 40,
1017
+ 27
1018
+ ],
1019
+ accounts: [
1020
+ {
1021
+ name: "user"
1022
+ },
1023
+ {
1024
+ name: "user_ata",
1025
+ writable: true,
1026
+ pda: {
1027
+ seeds: [
1028
+ {
1029
+ kind: "account",
1030
+ path: "user"
1031
+ },
1032
+ {
1033
+ kind: "account",
1034
+ path: "token_program"
1035
+ },
1036
+ {
1037
+ kind: "account",
1038
+ path: "mint"
1039
+ }
1040
+ ],
1041
+ program: {
1042
+ kind: "const",
1043
+ value: [
1044
+ 140,
1045
+ 151,
1046
+ 37,
1047
+ 143,
1048
+ 78,
1049
+ 36,
1050
+ 137,
1051
+ 241,
1052
+ 187,
1053
+ 61,
1054
+ 16,
1055
+ 41,
1056
+ 20,
1057
+ 142,
1058
+ 13,
1059
+ 131,
1060
+ 11,
1061
+ 90,
1062
+ 19,
1063
+ 153,
1064
+ 218,
1065
+ 255,
1066
+ 16,
1067
+ 132,
1068
+ 4,
1069
+ 142,
1070
+ 123,
1071
+ 216,
1072
+ 219,
1073
+ 233,
1074
+ 248,
1075
+ 89
1076
+ ]
1077
+ }
1078
+ }
1079
+ },
1080
+ {
1081
+ name: "global_volume_accumulator",
1082
+ pda: {
1083
+ seeds: [
1084
+ {
1085
+ kind: "const",
1086
+ value: [
1087
+ 103,
1088
+ 108,
1089
+ 111,
1090
+ 98,
1091
+ 97,
1092
+ 108,
1093
+ 95,
1094
+ 118,
1095
+ 111,
1096
+ 108,
1097
+ 117,
1098
+ 109,
1099
+ 101,
1100
+ 95,
1101
+ 97,
1102
+ 99,
1103
+ 99,
1104
+ 117,
1105
+ 109,
1106
+ 117,
1107
+ 108,
1108
+ 97,
1109
+ 116,
1110
+ 111,
1111
+ 114
1112
+ ]
1113
+ }
1114
+ ]
1115
+ }
1116
+ },
1117
+ {
1118
+ name: "global_incentive_token_account",
1119
+ writable: true,
1120
+ pda: {
1121
+ seeds: [
1122
+ {
1123
+ kind: "account",
1124
+ path: "global_volume_accumulator"
1125
+ },
1126
+ {
1127
+ kind: "account",
1128
+ path: "token_program"
1129
+ },
1130
+ {
1131
+ kind: "account",
1132
+ path: "mint"
1133
+ }
1134
+ ],
1135
+ program: {
1136
+ kind: "const",
1137
+ value: [
1138
+ 140,
1139
+ 151,
1140
+ 37,
1141
+ 143,
1142
+ 78,
1143
+ 36,
1144
+ 137,
1145
+ 241,
1146
+ 187,
1147
+ 61,
1148
+ 16,
1149
+ 41,
1150
+ 20,
1151
+ 142,
1152
+ 13,
1153
+ 131,
1154
+ 11,
1155
+ 90,
1156
+ 19,
1157
+ 153,
1158
+ 218,
1159
+ 255,
1160
+ 16,
1161
+ 132,
1162
+ 4,
1163
+ 142,
1164
+ 123,
1165
+ 216,
1166
+ 219,
1167
+ 233,
1168
+ 248,
1169
+ 89
1170
+ ]
1171
+ }
1172
+ }
1173
+ },
1174
+ {
1175
+ name: "user_volume_accumulator",
1176
+ writable: true,
1177
+ pda: {
1178
+ seeds: [
1179
+ {
1180
+ kind: "const",
1181
+ value: [
1182
+ 117,
1183
+ 115,
1184
+ 101,
1185
+ 114,
1186
+ 95,
1187
+ 118,
1188
+ 111,
1189
+ 108,
1190
+ 117,
1191
+ 109,
1192
+ 101,
1193
+ 95,
1194
+ 97,
1195
+ 99,
1196
+ 99,
1197
+ 117,
1198
+ 109,
1199
+ 117,
1200
+ 108,
1201
+ 97,
1202
+ 116,
1203
+ 111,
1204
+ 114
1205
+ ]
1206
+ },
1207
+ {
1208
+ kind: "account",
1209
+ path: "user"
1210
+ }
1211
+ ]
1212
+ }
1213
+ },
1214
+ {
1215
+ name: "mint",
1216
+ relations: [
1217
+ "global_volume_accumulator"
1218
+ ]
1219
+ },
1220
+ {
1221
+ name: "token_program"
1222
+ },
1223
+ {
1224
+ name: "system_program",
1225
+ address: "11111111111111111111111111111111"
1226
+ },
1227
+ {
1228
+ name: "associated_token_program",
1229
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
1230
+ },
1231
+ {
1232
+ name: "event_authority",
1233
+ pda: {
1234
+ seeds: [
1235
+ {
1236
+ kind: "const",
1237
+ value: [
1238
+ 95,
1239
+ 95,
1240
+ 101,
1241
+ 118,
1242
+ 101,
1243
+ 110,
1244
+ 116,
1245
+ 95,
1246
+ 97,
1247
+ 117,
1248
+ 116,
1249
+ 104,
1250
+ 111,
1251
+ 114,
1252
+ 105,
1253
+ 116,
1254
+ 121
1255
+ ]
1256
+ }
1257
+ ]
1258
+ }
1259
+ },
1260
+ {
1261
+ name: "program"
1262
+ },
1263
+ {
1264
+ name: "payer",
1265
+ writable: true,
1266
+ signer: true
1267
+ }
1268
+ ],
1269
+ args: [
1270
+ ]
1271
+ },
1272
+ {
1273
+ name: "close_user_volume_accumulator",
1274
+ discriminator: [
1275
+ 249,
1276
+ 69,
1277
+ 164,
1278
+ 218,
1279
+ 150,
1280
+ 103,
1281
+ 84,
1282
+ 138
1283
+ ],
1284
+ accounts: [
1285
+ {
1286
+ name: "user",
1287
+ writable: true,
1288
+ signer: true
1289
+ },
1290
+ {
1291
+ name: "user_volume_accumulator",
1292
+ writable: true,
1293
+ pda: {
1294
+ seeds: [
1295
+ {
1296
+ kind: "const",
1297
+ value: [
1298
+ 117,
1299
+ 115,
1300
+ 101,
1301
+ 114,
1302
+ 95,
1303
+ 118,
1304
+ 111,
1305
+ 108,
1306
+ 117,
1307
+ 109,
1308
+ 101,
1309
+ 95,
1310
+ 97,
1311
+ 99,
1312
+ 99,
1313
+ 117,
1314
+ 109,
1315
+ 117,
1316
+ 108,
1317
+ 97,
1318
+ 116,
1319
+ 111,
1320
+ 114
1321
+ ]
1322
+ },
1323
+ {
1324
+ kind: "account",
1325
+ path: "user"
1326
+ }
1327
+ ]
1328
+ }
1329
+ },
1330
+ {
1331
+ name: "event_authority",
1332
+ pda: {
1333
+ seeds: [
1334
+ {
1335
+ kind: "const",
1336
+ value: [
1337
+ 95,
1338
+ 95,
1339
+ 101,
1340
+ 118,
1341
+ 101,
1342
+ 110,
1343
+ 116,
1344
+ 95,
1345
+ 97,
1346
+ 117,
1347
+ 116,
1348
+ 104,
1349
+ 111,
1350
+ 114,
1351
+ 105,
1352
+ 116,
1353
+ 121
1354
+ ]
1355
+ }
1356
+ ]
1357
+ }
1358
+ },
1359
+ {
1360
+ name: "program"
1361
+ }
1362
+ ],
1363
+ args: [
1364
+ ]
1365
+ },
1366
+ {
1367
+ name: "collect_creator_fee",
1368
+ docs: [
1369
+ "Collects creator_fee from creator_vault to the coin creator account"
1370
+ ],
1371
+ discriminator: [
1372
+ 20,
1373
+ 22,
1374
+ 86,
1375
+ 123,
1376
+ 198,
1377
+ 28,
1378
+ 219,
1379
+ 132
1380
+ ],
1381
+ accounts: [
1382
+ {
1383
+ name: "creator",
1384
+ writable: true
1385
+ },
1386
+ {
1387
+ name: "creator_vault",
1388
+ writable: true,
1389
+ pda: {
1390
+ seeds: [
1391
+ {
1392
+ kind: "const",
1393
+ value: [
1394
+ 99,
1395
+ 114,
1396
+ 101,
1397
+ 97,
1398
+ 116,
1399
+ 111,
1400
+ 114,
1401
+ 45,
1402
+ 118,
1403
+ 97,
1404
+ 117,
1405
+ 108,
1406
+ 116
1407
+ ]
1408
+ },
1409
+ {
1410
+ kind: "account",
1411
+ path: "creator"
1412
+ }
1413
+ ]
1414
+ }
1415
+ },
1416
+ {
1417
+ name: "system_program",
1418
+ address: "11111111111111111111111111111111"
1419
+ },
1420
+ {
1421
+ name: "event_authority",
1422
+ pda: {
1423
+ seeds: [
1424
+ {
1425
+ kind: "const",
1426
+ value: [
1427
+ 95,
1428
+ 95,
1429
+ 101,
1430
+ 118,
1431
+ 101,
1432
+ 110,
1433
+ 116,
1434
+ 95,
1435
+ 97,
1436
+ 117,
1437
+ 116,
1438
+ 104,
1439
+ 111,
1440
+ 114,
1441
+ 105,
1442
+ 116,
1443
+ 121
1444
+ ]
1445
+ }
1446
+ ]
1447
+ }
1448
+ },
1449
+ {
1450
+ name: "program"
1451
+ }
1452
+ ],
1453
+ args: [
1454
+ ]
1455
+ },
1456
+ {
1457
+ name: "create",
1458
+ docs: [
1459
+ "Creates a new coin and bonding curve."
1460
+ ],
1461
+ discriminator: [
1462
+ 24,
1463
+ 30,
1464
+ 200,
1465
+ 40,
1466
+ 5,
1467
+ 28,
1468
+ 7,
1469
+ 119
1470
+ ],
1471
+ accounts: [
1472
+ {
1473
+ name: "mint",
1474
+ writable: true,
1475
+ signer: true
1476
+ },
1477
+ {
1478
+ name: "mint_authority",
1479
+ pda: {
1480
+ seeds: [
1481
+ {
1482
+ kind: "const",
1483
+ value: [
1484
+ 109,
1485
+ 105,
1486
+ 110,
1487
+ 116,
1488
+ 45,
1489
+ 97,
1490
+ 117,
1491
+ 116,
1492
+ 104,
1493
+ 111,
1494
+ 114,
1495
+ 105,
1496
+ 116,
1497
+ 121
1498
+ ]
1499
+ }
1500
+ ]
1501
+ }
1502
+ },
1503
+ {
1504
+ name: "bonding_curve",
1505
+ writable: true,
1506
+ pda: {
1507
+ seeds: [
1508
+ {
1509
+ kind: "const",
1510
+ value: [
1511
+ 98,
1512
+ 111,
1513
+ 110,
1514
+ 100,
1515
+ 105,
1516
+ 110,
1517
+ 103,
1518
+ 45,
1519
+ 99,
1520
+ 117,
1521
+ 114,
1522
+ 118,
1523
+ 101
1524
+ ]
1525
+ },
1526
+ {
1527
+ kind: "account",
1528
+ path: "mint"
1529
+ }
1530
+ ]
1531
+ }
1532
+ },
1533
+ {
1534
+ name: "associated_bonding_curve",
1535
+ writable: true,
1536
+ pda: {
1537
+ seeds: [
1538
+ {
1539
+ kind: "account",
1540
+ path: "bonding_curve"
1541
+ },
1542
+ {
1543
+ kind: "const",
1544
+ value: [
1545
+ 6,
1546
+ 221,
1547
+ 246,
1548
+ 225,
1549
+ 215,
1550
+ 101,
1551
+ 161,
1552
+ 147,
1553
+ 217,
1554
+ 203,
1555
+ 225,
1556
+ 70,
1557
+ 206,
1558
+ 235,
1559
+ 121,
1560
+ 172,
1561
+ 28,
1562
+ 180,
1563
+ 133,
1564
+ 237,
1565
+ 95,
1566
+ 91,
1567
+ 55,
1568
+ 145,
1569
+ 58,
1570
+ 140,
1571
+ 245,
1572
+ 133,
1573
+ 126,
1574
+ 255,
1575
+ 0,
1576
+ 169
1577
+ ]
1578
+ },
1579
+ {
1580
+ kind: "account",
1581
+ path: "mint"
1582
+ }
1583
+ ],
1584
+ program: {
1585
+ kind: "const",
1586
+ value: [
1587
+ 140,
1588
+ 151,
1589
+ 37,
1590
+ 143,
1591
+ 78,
1592
+ 36,
1593
+ 137,
1594
+ 241,
1595
+ 187,
1596
+ 61,
1597
+ 16,
1598
+ 41,
1599
+ 20,
1600
+ 142,
1601
+ 13,
1602
+ 131,
1603
+ 11,
1604
+ 90,
1605
+ 19,
1606
+ 153,
1607
+ 218,
1608
+ 255,
1609
+ 16,
1610
+ 132,
1611
+ 4,
1612
+ 142,
1613
+ 123,
1614
+ 216,
1615
+ 219,
1616
+ 233,
1617
+ 248,
1618
+ 89
1619
+ ]
1620
+ }
1621
+ }
1622
+ },
1623
+ {
1624
+ name: "global",
1625
+ pda: {
1626
+ seeds: [
1627
+ {
1628
+ kind: "const",
1629
+ value: [
1630
+ 103,
1631
+ 108,
1632
+ 111,
1633
+ 98,
1634
+ 97,
1635
+ 108
1636
+ ]
1637
+ }
1638
+ ]
1639
+ }
1640
+ },
1641
+ {
1642
+ name: "mpl_token_metadata",
1643
+ address: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
1644
+ },
1645
+ {
1646
+ name: "metadata",
1647
+ writable: true,
1648
+ pda: {
1649
+ seeds: [
1650
+ {
1651
+ kind: "const",
1652
+ value: [
1653
+ 109,
1654
+ 101,
1655
+ 116,
1656
+ 97,
1657
+ 100,
1658
+ 97,
1659
+ 116,
1660
+ 97
1661
+ ]
1662
+ },
1663
+ {
1664
+ kind: "const",
1665
+ value: [
1666
+ 11,
1667
+ 112,
1668
+ 101,
1669
+ 177,
1670
+ 227,
1671
+ 209,
1672
+ 124,
1673
+ 69,
1674
+ 56,
1675
+ 157,
1676
+ 82,
1677
+ 127,
1678
+ 107,
1679
+ 4,
1680
+ 195,
1681
+ 205,
1682
+ 88,
1683
+ 184,
1684
+ 108,
1685
+ 115,
1686
+ 26,
1687
+ 160,
1688
+ 253,
1689
+ 181,
1690
+ 73,
1691
+ 182,
1692
+ 209,
1693
+ 188,
1694
+ 3,
1695
+ 248,
1696
+ 41,
1697
+ 70
1698
+ ]
1699
+ },
1700
+ {
1701
+ kind: "account",
1702
+ path: "mint"
1703
+ }
1704
+ ],
1705
+ program: {
1706
+ kind: "account",
1707
+ path: "mpl_token_metadata"
1708
+ }
1709
+ }
1710
+ },
1711
+ {
1712
+ name: "user",
1713
+ writable: true,
1714
+ signer: true
1715
+ },
1716
+ {
1717
+ name: "system_program",
1718
+ address: "11111111111111111111111111111111"
1719
+ },
1720
+ {
1721
+ name: "token_program",
1722
+ address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
1723
+ },
1724
+ {
1725
+ name: "associated_token_program",
1726
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
1727
+ },
1728
+ {
1729
+ name: "rent",
1730
+ address: "SysvarRent111111111111111111111111111111111"
1731
+ },
1732
+ {
1733
+ name: "event_authority",
1734
+ pda: {
1735
+ seeds: [
1736
+ {
1737
+ kind: "const",
1738
+ value: [
1739
+ 95,
1740
+ 95,
1741
+ 101,
1742
+ 118,
1743
+ 101,
1744
+ 110,
1745
+ 116,
1746
+ 95,
1747
+ 97,
1748
+ 117,
1749
+ 116,
1750
+ 104,
1751
+ 111,
1752
+ 114,
1753
+ 105,
1754
+ 116,
1755
+ 121
1756
+ ]
1757
+ }
1758
+ ]
1759
+ }
1760
+ },
1761
+ {
1762
+ name: "program"
1763
+ }
1764
+ ],
1765
+ args: [
1766
+ {
1767
+ name: "name",
1768
+ type: "string"
1769
+ },
1770
+ {
1771
+ name: "symbol",
1772
+ type: "string"
1773
+ },
1774
+ {
1775
+ name: "uri",
1776
+ type: "string"
1777
+ },
1778
+ {
1779
+ name: "creator",
1780
+ type: "pubkey"
1781
+ }
1782
+ ]
1783
+ },
1784
+ {
1785
+ name: "extend_account",
1786
+ docs: [
1787
+ "Extends the size of program-owned accounts"
1788
+ ],
1789
+ discriminator: [
1790
+ 234,
1791
+ 102,
1792
+ 194,
1793
+ 203,
1794
+ 150,
1795
+ 72,
1796
+ 62,
1797
+ 229
1798
+ ],
1799
+ accounts: [
1800
+ {
1801
+ name: "account",
1802
+ writable: true
1803
+ },
1804
+ {
1805
+ name: "user",
1806
+ signer: true
1807
+ },
1808
+ {
1809
+ name: "system_program",
1810
+ address: "11111111111111111111111111111111"
1811
+ },
1812
+ {
1813
+ name: "event_authority",
1814
+ pda: {
1815
+ seeds: [
1816
+ {
1817
+ kind: "const",
1818
+ value: [
1819
+ 95,
1820
+ 95,
1821
+ 101,
1822
+ 118,
1823
+ 101,
1824
+ 110,
1825
+ 116,
1826
+ 95,
1827
+ 97,
1828
+ 117,
1829
+ 116,
1830
+ 104,
1831
+ 111,
1832
+ 114,
1833
+ 105,
1834
+ 116,
1835
+ 121
1836
+ ]
1837
+ }
1838
+ ]
1839
+ }
1840
+ },
1841
+ {
1842
+ name: "program"
1843
+ }
1844
+ ],
1845
+ args: [
1846
+ ]
1847
+ },
1848
+ {
1849
+ name: "init_user_volume_accumulator",
1850
+ discriminator: [
1851
+ 94,
1852
+ 6,
1853
+ 202,
1854
+ 115,
1855
+ 255,
1856
+ 96,
1857
+ 232,
1858
+ 183
1859
+ ],
1860
+ accounts: [
1861
+ {
1862
+ name: "payer",
1863
+ writable: true,
1864
+ signer: true
1865
+ },
1866
+ {
1867
+ name: "user"
1868
+ },
1869
+ {
1870
+ name: "user_volume_accumulator",
1871
+ writable: true,
1872
+ pda: {
1873
+ seeds: [
1874
+ {
1875
+ kind: "const",
1876
+ value: [
1877
+ 117,
1878
+ 115,
1879
+ 101,
1880
+ 114,
1881
+ 95,
1882
+ 118,
1883
+ 111,
1884
+ 108,
1885
+ 117,
1886
+ 109,
1887
+ 101,
1888
+ 95,
1889
+ 97,
1890
+ 99,
1891
+ 99,
1892
+ 117,
1893
+ 109,
1894
+ 117,
1895
+ 108,
1896
+ 97,
1897
+ 116,
1898
+ 111,
1899
+ 114
1900
+ ]
1901
+ },
1902
+ {
1903
+ kind: "account",
1904
+ path: "user"
1905
+ }
1906
+ ]
1907
+ }
1908
+ },
1909
+ {
1910
+ name: "system_program",
1911
+ address: "11111111111111111111111111111111"
1912
+ },
1913
+ {
1914
+ name: "event_authority",
1915
+ pda: {
1916
+ seeds: [
1917
+ {
1918
+ kind: "const",
1919
+ value: [
1920
+ 95,
1921
+ 95,
1922
+ 101,
1923
+ 118,
1924
+ 101,
1925
+ 110,
1926
+ 116,
1927
+ 95,
1928
+ 97,
1929
+ 117,
1930
+ 116,
1931
+ 104,
1932
+ 111,
1933
+ 114,
1934
+ 105,
1935
+ 116,
1936
+ 121
1937
+ ]
1938
+ }
1939
+ ]
1940
+ }
1941
+ },
1942
+ {
1943
+ name: "program"
1944
+ }
1945
+ ],
1946
+ args: [
1947
+ ]
1948
+ },
1949
+ {
1950
+ name: "initialize",
1951
+ docs: [
1952
+ "Creates the global state."
1953
+ ],
1954
+ discriminator: [
1955
+ 175,
1956
+ 175,
1957
+ 109,
1958
+ 31,
1959
+ 13,
1960
+ 152,
1961
+ 155,
1962
+ 237
1963
+ ],
1964
+ accounts: [
1965
+ {
1966
+ name: "global",
1967
+ writable: true,
1968
+ pda: {
1969
+ seeds: [
1970
+ {
1971
+ kind: "const",
1972
+ value: [
1973
+ 103,
1974
+ 108,
1975
+ 111,
1976
+ 98,
1977
+ 97,
1978
+ 108
1979
+ ]
1980
+ }
1981
+ ]
1982
+ }
1983
+ },
1984
+ {
1985
+ name: "user",
1986
+ writable: true,
1987
+ signer: true
1988
+ },
1989
+ {
1990
+ name: "system_program",
1991
+ address: "11111111111111111111111111111111"
1992
+ }
1993
+ ],
1994
+ args: [
1995
+ ]
1996
+ },
1997
+ {
1998
+ name: "migrate",
1999
+ docs: [
2000
+ "Migrates liquidity to pump_amm if the bonding curve is complete"
2001
+ ],
2002
+ discriminator: [
2003
+ 155,
2004
+ 234,
2005
+ 231,
2006
+ 146,
2007
+ 236,
2008
+ 158,
2009
+ 162,
2010
+ 30
2011
+ ],
2012
+ accounts: [
2013
+ {
2014
+ name: "global",
2015
+ pda: {
2016
+ seeds: [
2017
+ {
2018
+ kind: "const",
2019
+ value: [
2020
+ 103,
2021
+ 108,
2022
+ 111,
2023
+ 98,
2024
+ 97,
2025
+ 108
2026
+ ]
2027
+ }
2028
+ ]
2029
+ }
2030
+ },
2031
+ {
2032
+ name: "withdraw_authority",
2033
+ writable: true,
2034
+ relations: [
2035
+ "global"
2036
+ ]
2037
+ },
2038
+ {
2039
+ name: "mint"
2040
+ },
2041
+ {
2042
+ name: "bonding_curve",
2043
+ writable: true,
2044
+ pda: {
2045
+ seeds: [
2046
+ {
2047
+ kind: "const",
2048
+ value: [
2049
+ 98,
2050
+ 111,
2051
+ 110,
2052
+ 100,
2053
+ 105,
2054
+ 110,
2055
+ 103,
2056
+ 45,
2057
+ 99,
2058
+ 117,
2059
+ 114,
2060
+ 118,
2061
+ 101
2062
+ ]
2063
+ },
2064
+ {
2065
+ kind: "account",
2066
+ path: "mint"
2067
+ }
2068
+ ]
2069
+ }
2070
+ },
2071
+ {
2072
+ name: "associated_bonding_curve",
2073
+ writable: true,
2074
+ pda: {
2075
+ seeds: [
2076
+ {
2077
+ kind: "account",
2078
+ path: "bonding_curve"
2079
+ },
2080
+ {
2081
+ kind: "const",
2082
+ value: [
2083
+ 6,
2084
+ 221,
2085
+ 246,
2086
+ 225,
2087
+ 215,
2088
+ 101,
2089
+ 161,
2090
+ 147,
2091
+ 217,
2092
+ 203,
2093
+ 225,
2094
+ 70,
2095
+ 206,
2096
+ 235,
2097
+ 121,
2098
+ 172,
2099
+ 28,
2100
+ 180,
2101
+ 133,
2102
+ 237,
2103
+ 95,
2104
+ 91,
2105
+ 55,
2106
+ 145,
2107
+ 58,
2108
+ 140,
2109
+ 245,
2110
+ 133,
2111
+ 126,
2112
+ 255,
2113
+ 0,
2114
+ 169
2115
+ ]
2116
+ },
2117
+ {
2118
+ kind: "account",
2119
+ path: "mint"
2120
+ }
2121
+ ],
2122
+ program: {
2123
+ kind: "const",
2124
+ value: [
2125
+ 140,
2126
+ 151,
2127
+ 37,
2128
+ 143,
2129
+ 78,
2130
+ 36,
2131
+ 137,
2132
+ 241,
2133
+ 187,
2134
+ 61,
2135
+ 16,
2136
+ 41,
2137
+ 20,
2138
+ 142,
2139
+ 13,
2140
+ 131,
2141
+ 11,
2142
+ 90,
2143
+ 19,
2144
+ 153,
2145
+ 218,
2146
+ 255,
2147
+ 16,
2148
+ 132,
2149
+ 4,
2150
+ 142,
2151
+ 123,
2152
+ 216,
2153
+ 219,
2154
+ 233,
2155
+ 248,
2156
+ 89
2157
+ ]
2158
+ }
2159
+ }
2160
+ },
2161
+ {
2162
+ name: "user",
2163
+ signer: true
2164
+ },
2165
+ {
2166
+ name: "system_program",
2167
+ address: "11111111111111111111111111111111"
2168
+ },
2169
+ {
2170
+ name: "token_program",
2171
+ address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
2172
+ },
2173
+ {
2174
+ name: "pump_amm",
2175
+ address: "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA"
2176
+ },
2177
+ {
2178
+ name: "pool",
2179
+ writable: true,
2180
+ pda: {
2181
+ seeds: [
2182
+ {
2183
+ kind: "const",
2184
+ value: [
2185
+ 112,
2186
+ 111,
2187
+ 111,
2188
+ 108
2189
+ ]
2190
+ },
2191
+ {
2192
+ kind: "const",
2193
+ value: [
2194
+ 0,
2195
+ 0
2196
+ ]
2197
+ },
2198
+ {
2199
+ kind: "account",
2200
+ path: "pool_authority"
2201
+ },
2202
+ {
2203
+ kind: "account",
2204
+ path: "mint"
2205
+ },
2206
+ {
2207
+ kind: "account",
2208
+ path: "wsol_mint"
2209
+ }
2210
+ ],
2211
+ program: {
2212
+ kind: "account",
2213
+ path: "pump_amm"
2214
+ }
2215
+ }
2216
+ },
2217
+ {
2218
+ name: "pool_authority",
2219
+ writable: true,
2220
+ pda: {
2221
+ seeds: [
2222
+ {
2223
+ kind: "const",
2224
+ value: [
2225
+ 112,
2226
+ 111,
2227
+ 111,
2228
+ 108,
2229
+ 45,
2230
+ 97,
2231
+ 117,
2232
+ 116,
2233
+ 104,
2234
+ 111,
2235
+ 114,
2236
+ 105,
2237
+ 116,
2238
+ 121
2239
+ ]
2240
+ },
2241
+ {
2242
+ kind: "account",
2243
+ path: "mint"
2244
+ }
2245
+ ]
2246
+ }
2247
+ },
2248
+ {
2249
+ name: "pool_authority_mint_account",
2250
+ writable: true,
2251
+ pda: {
2252
+ seeds: [
2253
+ {
2254
+ kind: "account",
2255
+ path: "pool_authority"
2256
+ },
2257
+ {
2258
+ kind: "account",
2259
+ path: "token_program"
2260
+ },
2261
+ {
2262
+ kind: "account",
2263
+ path: "mint"
2264
+ }
2265
+ ],
2266
+ program: {
2267
+ kind: "account",
2268
+ path: "associated_token_program"
2269
+ }
2270
+ }
2271
+ },
2272
+ {
2273
+ name: "pool_authority_wsol_account",
2274
+ writable: true,
2275
+ pda: {
2276
+ seeds: [
2277
+ {
2278
+ kind: "account",
2279
+ path: "pool_authority"
2280
+ },
2281
+ {
2282
+ kind: "account",
2283
+ path: "token_program"
2284
+ },
2285
+ {
2286
+ kind: "account",
2287
+ path: "wsol_mint"
2288
+ }
2289
+ ],
2290
+ program: {
2291
+ kind: "account",
2292
+ path: "associated_token_program"
2293
+ }
2294
+ }
2295
+ },
2296
+ {
2297
+ name: "amm_global_config",
2298
+ pda: {
2299
+ seeds: [
2300
+ {
2301
+ kind: "const",
2302
+ value: [
2303
+ 103,
2304
+ 108,
2305
+ 111,
2306
+ 98,
2307
+ 97,
2308
+ 108,
2309
+ 95,
2310
+ 99,
2311
+ 111,
2312
+ 110,
2313
+ 102,
2314
+ 105,
2315
+ 103
2316
+ ]
2317
+ }
2318
+ ],
2319
+ program: {
2320
+ kind: "account",
2321
+ path: "pump_amm"
2322
+ }
2323
+ }
2324
+ },
2325
+ {
2326
+ name: "wsol_mint",
2327
+ address: "So11111111111111111111111111111111111111112"
2328
+ },
2329
+ {
2330
+ name: "lp_mint",
2331
+ writable: true,
2332
+ pda: {
2333
+ seeds: [
2334
+ {
2335
+ kind: "const",
2336
+ value: [
2337
+ 112,
2338
+ 111,
2339
+ 111,
2340
+ 108,
2341
+ 95,
2342
+ 108,
2343
+ 112,
2344
+ 95,
2345
+ 109,
2346
+ 105,
2347
+ 110,
2348
+ 116
2349
+ ]
2350
+ },
2351
+ {
2352
+ kind: "account",
2353
+ path: "pool"
2354
+ }
2355
+ ],
2356
+ program: {
2357
+ kind: "account",
2358
+ path: "pump_amm"
2359
+ }
2360
+ }
2361
+ },
2362
+ {
2363
+ name: "user_pool_token_account",
2364
+ writable: true,
2365
+ pda: {
2366
+ seeds: [
2367
+ {
2368
+ kind: "account",
2369
+ path: "pool_authority"
2370
+ },
2371
+ {
2372
+ kind: "account",
2373
+ path: "token_2022_program"
2374
+ },
2375
+ {
2376
+ kind: "account",
2377
+ path: "lp_mint"
2378
+ }
2379
+ ],
2380
+ program: {
2381
+ kind: "account",
2382
+ path: "associated_token_program"
2383
+ }
2384
+ }
2385
+ },
2386
+ {
2387
+ name: "pool_base_token_account",
2388
+ writable: true,
2389
+ pda: {
2390
+ seeds: [
2391
+ {
2392
+ kind: "account",
2393
+ path: "pool"
2394
+ },
2395
+ {
2396
+ kind: "account",
2397
+ path: "token_program"
2398
+ },
2399
+ {
2400
+ kind: "account",
2401
+ path: "mint"
2402
+ }
2403
+ ],
2404
+ program: {
2405
+ kind: "account",
2406
+ path: "associated_token_program"
2407
+ }
2408
+ }
2409
+ },
2410
+ {
2411
+ name: "pool_quote_token_account",
2412
+ writable: true,
2413
+ pda: {
2414
+ seeds: [
2415
+ {
2416
+ kind: "account",
2417
+ path: "pool"
2418
+ },
2419
+ {
2420
+ kind: "account",
2421
+ path: "token_program"
2422
+ },
2423
+ {
2424
+ kind: "account",
2425
+ path: "wsol_mint"
2426
+ }
2427
+ ],
2428
+ program: {
2429
+ kind: "account",
2430
+ path: "associated_token_program"
2431
+ }
2432
+ }
2433
+ },
2434
+ {
2435
+ name: "token_2022_program",
2436
+ address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
2437
+ },
2438
+ {
2439
+ name: "associated_token_program",
2440
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
2441
+ },
2442
+ {
2443
+ name: "pump_amm_event_authority",
2444
+ pda: {
2445
+ seeds: [
2446
+ {
2447
+ kind: "const",
2448
+ value: [
2449
+ 95,
2450
+ 95,
2451
+ 101,
2452
+ 118,
2453
+ 101,
2454
+ 110,
2455
+ 116,
2456
+ 95,
2457
+ 97,
2458
+ 117,
2459
+ 116,
2460
+ 104,
2461
+ 111,
2462
+ 114,
2463
+ 105,
2464
+ 116,
2465
+ 121
2466
+ ]
2467
+ }
2468
+ ],
2469
+ program: {
2470
+ kind: "account",
2471
+ path: "pump_amm"
2472
+ }
2473
+ }
2474
+ },
2475
+ {
2476
+ name: "event_authority",
2477
+ pda: {
2478
+ seeds: [
2479
+ {
2480
+ kind: "const",
2481
+ value: [
2482
+ 95,
2483
+ 95,
2484
+ 101,
2485
+ 118,
2486
+ 101,
2487
+ 110,
2488
+ 116,
2489
+ 95,
2490
+ 97,
2491
+ 117,
2492
+ 116,
2493
+ 104,
2494
+ 111,
2495
+ 114,
2496
+ 105,
2497
+ 116,
2498
+ 121
2499
+ ]
2500
+ }
2501
+ ]
2502
+ }
2503
+ },
2504
+ {
2505
+ name: "program"
2506
+ }
2507
+ ],
2508
+ args: [
2509
+ ]
2510
+ },
2511
+ {
2512
+ name: "sell",
2513
+ docs: [
2514
+ "Sells tokens into a bonding curve."
2515
+ ],
2516
+ discriminator: [
2517
+ 51,
2518
+ 230,
2519
+ 133,
2520
+ 164,
2521
+ 1,
2522
+ 127,
2523
+ 131,
2524
+ 173
2525
+ ],
2526
+ accounts: [
2527
+ {
2528
+ name: "global",
2529
+ pda: {
2530
+ seeds: [
2531
+ {
2532
+ kind: "const",
2533
+ value: [
2534
+ 103,
2535
+ 108,
2536
+ 111,
2537
+ 98,
2538
+ 97,
2539
+ 108
2540
+ ]
2541
+ }
2542
+ ]
2543
+ }
2544
+ },
2545
+ {
2546
+ name: "fee_recipient",
2547
+ writable: true
2548
+ },
2549
+ {
2550
+ name: "mint"
2551
+ },
2552
+ {
2553
+ name: "bonding_curve",
2554
+ writable: true,
2555
+ pda: {
2556
+ seeds: [
2557
+ {
2558
+ kind: "const",
2559
+ value: [
2560
+ 98,
2561
+ 111,
2562
+ 110,
2563
+ 100,
2564
+ 105,
2565
+ 110,
2566
+ 103,
2567
+ 45,
2568
+ 99,
2569
+ 117,
2570
+ 114,
2571
+ 118,
2572
+ 101
2573
+ ]
2574
+ },
2575
+ {
2576
+ kind: "account",
2577
+ path: "mint"
2578
+ }
2579
+ ]
2580
+ }
2581
+ },
2582
+ {
2583
+ name: "associated_bonding_curve",
2584
+ writable: true,
2585
+ pda: {
2586
+ seeds: [
2587
+ {
2588
+ kind: "account",
2589
+ path: "bonding_curve"
2590
+ },
2591
+ {
2592
+ kind: "const",
2593
+ value: [
2594
+ 6,
2595
+ 221,
2596
+ 246,
2597
+ 225,
2598
+ 215,
2599
+ 101,
2600
+ 161,
2601
+ 147,
2602
+ 217,
2603
+ 203,
2604
+ 225,
2605
+ 70,
2606
+ 206,
2607
+ 235,
2608
+ 121,
2609
+ 172,
2610
+ 28,
2611
+ 180,
2612
+ 133,
2613
+ 237,
2614
+ 95,
2615
+ 91,
2616
+ 55,
2617
+ 145,
2618
+ 58,
2619
+ 140,
2620
+ 245,
2621
+ 133,
2622
+ 126,
2623
+ 255,
2624
+ 0,
2625
+ 169
2626
+ ]
2627
+ },
2628
+ {
2629
+ kind: "account",
2630
+ path: "mint"
2631
+ }
2632
+ ],
2633
+ program: {
2634
+ kind: "const",
2635
+ value: [
2636
+ 140,
2637
+ 151,
2638
+ 37,
2639
+ 143,
2640
+ 78,
2641
+ 36,
2642
+ 137,
2643
+ 241,
2644
+ 187,
2645
+ 61,
2646
+ 16,
2647
+ 41,
2648
+ 20,
2649
+ 142,
2650
+ 13,
2651
+ 131,
2652
+ 11,
2653
+ 90,
2654
+ 19,
2655
+ 153,
2656
+ 218,
2657
+ 255,
2658
+ 16,
2659
+ 132,
2660
+ 4,
2661
+ 142,
2662
+ 123,
2663
+ 216,
2664
+ 219,
2665
+ 233,
2666
+ 248,
2667
+ 89
2668
+ ]
2669
+ }
2670
+ }
2671
+ },
2672
+ {
2673
+ name: "associated_user",
2674
+ writable: true
2675
+ },
2676
+ {
2677
+ name: "user",
2678
+ writable: true,
2679
+ signer: true
2680
+ },
2681
+ {
2682
+ name: "system_program",
2683
+ address: "11111111111111111111111111111111"
2684
+ },
2685
+ {
2686
+ name: "creator_vault",
2687
+ writable: true,
2688
+ pda: {
2689
+ seeds: [
2690
+ {
2691
+ kind: "const",
2692
+ value: [
2693
+ 99,
2694
+ 114,
2695
+ 101,
2696
+ 97,
2697
+ 116,
2698
+ 111,
2699
+ 114,
2700
+ 45,
2701
+ 118,
2702
+ 97,
2703
+ 117,
2704
+ 108,
2705
+ 116
2706
+ ]
2707
+ },
2708
+ {
2709
+ kind: "account",
2710
+ path: "bonding_curve.creator",
2711
+ account: "BondingCurve"
2712
+ }
2713
+ ]
2714
+ }
2715
+ },
2716
+ {
2717
+ name: "token_program",
2718
+ address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
2719
+ },
2720
+ {
2721
+ name: "event_authority",
2722
+ pda: {
2723
+ seeds: [
2724
+ {
2725
+ kind: "const",
2726
+ value: [
2727
+ 95,
2728
+ 95,
2729
+ 101,
2730
+ 118,
2731
+ 101,
2732
+ 110,
2733
+ 116,
2734
+ 95,
2735
+ 97,
2736
+ 117,
2737
+ 116,
2738
+ 104,
2739
+ 111,
2740
+ 114,
2741
+ 105,
2742
+ 116,
2743
+ 121
2744
+ ]
2745
+ }
2746
+ ]
2747
+ }
2748
+ },
2749
+ {
2750
+ name: "program"
2751
+ }
2752
+ ],
2753
+ args: [
2754
+ {
2755
+ name: "amount",
2756
+ type: "u64"
2757
+ },
2758
+ {
2759
+ name: "min_sol_output",
2760
+ type: "u64"
2761
+ }
2762
+ ]
2763
+ },
2764
+ {
2765
+ name: "set_creator",
2766
+ docs: [
2767
+ "Allows Global::set_creator_authority to set the bonding curve creator from Metaplex metadata or input argument"
2768
+ ],
2769
+ discriminator: [
2770
+ 254,
2771
+ 148,
2772
+ 255,
2773
+ 112,
2774
+ 207,
2775
+ 142,
2776
+ 170,
2777
+ 165
2778
+ ],
2779
+ accounts: [
2780
+ {
2781
+ name: "set_creator_authority",
2782
+ signer: true,
2783
+ relations: [
2784
+ "global"
2785
+ ]
2786
+ },
2787
+ {
2788
+ name: "global",
2789
+ pda: {
2790
+ seeds: [
2791
+ {
2792
+ kind: "const",
2793
+ value: [
2794
+ 103,
2795
+ 108,
2796
+ 111,
2797
+ 98,
2798
+ 97,
2799
+ 108
2800
+ ]
2801
+ }
2802
+ ]
2803
+ }
2804
+ },
2805
+ {
2806
+ name: "mint"
2807
+ },
2808
+ {
2809
+ name: "metadata",
2810
+ pda: {
2811
+ seeds: [
2812
+ {
2813
+ kind: "const",
2814
+ value: [
2815
+ 109,
2816
+ 101,
2817
+ 116,
2818
+ 97,
2819
+ 100,
2820
+ 97,
2821
+ 116,
2822
+ 97
2823
+ ]
2824
+ },
2825
+ {
2826
+ kind: "const",
2827
+ value: [
2828
+ 11,
2829
+ 112,
2830
+ 101,
2831
+ 177,
2832
+ 227,
2833
+ 209,
2834
+ 124,
2835
+ 69,
2836
+ 56,
2837
+ 157,
2838
+ 82,
2839
+ 127,
2840
+ 107,
2841
+ 4,
2842
+ 195,
2843
+ 205,
2844
+ 88,
2845
+ 184,
2846
+ 108,
2847
+ 115,
2848
+ 26,
2849
+ 160,
2850
+ 253,
2851
+ 181,
2852
+ 73,
2853
+ 182,
2854
+ 209,
2855
+ 188,
2856
+ 3,
2857
+ 248,
2858
+ 41,
2859
+ 70
2860
+ ]
2861
+ },
2862
+ {
2863
+ kind: "account",
2864
+ path: "mint"
2865
+ }
2866
+ ],
2867
+ program: {
2868
+ kind: "const",
2869
+ value: [
2870
+ 11,
2871
+ 112,
2872
+ 101,
2873
+ 177,
2874
+ 227,
2875
+ 209,
2876
+ 124,
2877
+ 69,
2878
+ 56,
2879
+ 157,
2880
+ 82,
2881
+ 127,
2882
+ 107,
2883
+ 4,
2884
+ 195,
2885
+ 205,
2886
+ 88,
2887
+ 184,
2888
+ 108,
2889
+ 115,
2890
+ 26,
2891
+ 160,
2892
+ 253,
2893
+ 181,
2894
+ 73,
2895
+ 182,
2896
+ 209,
2897
+ 188,
2898
+ 3,
2899
+ 248,
2900
+ 41,
2901
+ 70
2902
+ ]
2903
+ }
2904
+ }
2905
+ },
2906
+ {
2907
+ name: "bonding_curve",
2908
+ writable: true,
2909
+ pda: {
2910
+ seeds: [
2911
+ {
2912
+ kind: "const",
2913
+ value: [
2914
+ 98,
2915
+ 111,
2916
+ 110,
2917
+ 100,
2918
+ 105,
2919
+ 110,
2920
+ 103,
2921
+ 45,
2922
+ 99,
2923
+ 117,
2924
+ 114,
2925
+ 118,
2926
+ 101
2927
+ ]
2928
+ },
2929
+ {
2930
+ kind: "account",
2931
+ path: "mint"
2932
+ }
2933
+ ]
2934
+ }
2935
+ },
2936
+ {
2937
+ name: "event_authority",
2938
+ pda: {
2939
+ seeds: [
2940
+ {
2941
+ kind: "const",
2942
+ value: [
2943
+ 95,
2944
+ 95,
2945
+ 101,
2946
+ 118,
2947
+ 101,
2948
+ 110,
2949
+ 116,
2950
+ 95,
2951
+ 97,
2952
+ 117,
2953
+ 116,
2954
+ 104,
2955
+ 111,
2956
+ 114,
2957
+ 105,
2958
+ 116,
2959
+ 121
2960
+ ]
2961
+ }
2962
+ ]
2963
+ }
2964
+ },
2965
+ {
2966
+ name: "program"
2967
+ }
2968
+ ],
2969
+ args: [
2970
+ {
2971
+ name: "creator",
2972
+ type: "pubkey"
2973
+ }
2974
+ ]
2975
+ },
2976
+ {
2977
+ name: "set_metaplex_creator",
2978
+ docs: [
2979
+ "Syncs the bonding curve creator with the Metaplex metadata creator if it exists"
2980
+ ],
2981
+ discriminator: [
2982
+ 138,
2983
+ 96,
2984
+ 174,
2985
+ 217,
2986
+ 48,
2987
+ 85,
2988
+ 197,
2989
+ 246
2990
+ ],
2991
+ accounts: [
2992
+ {
2993
+ name: "mint"
2994
+ },
2995
+ {
2996
+ name: "metadata",
2997
+ pda: {
2998
+ seeds: [
2999
+ {
3000
+ kind: "const",
3001
+ value: [
3002
+ 109,
3003
+ 101,
3004
+ 116,
3005
+ 97,
3006
+ 100,
3007
+ 97,
3008
+ 116,
3009
+ 97
3010
+ ]
3011
+ },
3012
+ {
3013
+ kind: "const",
3014
+ value: [
3015
+ 11,
3016
+ 112,
3017
+ 101,
3018
+ 177,
3019
+ 227,
3020
+ 209,
3021
+ 124,
3022
+ 69,
3023
+ 56,
3024
+ 157,
3025
+ 82,
3026
+ 127,
3027
+ 107,
3028
+ 4,
3029
+ 195,
3030
+ 205,
3031
+ 88,
3032
+ 184,
3033
+ 108,
3034
+ 115,
3035
+ 26,
3036
+ 160,
3037
+ 253,
3038
+ 181,
3039
+ 73,
3040
+ 182,
3041
+ 209,
3042
+ 188,
3043
+ 3,
3044
+ 248,
3045
+ 41,
3046
+ 70
3047
+ ]
3048
+ },
3049
+ {
3050
+ kind: "account",
3051
+ path: "mint"
3052
+ }
3053
+ ],
3054
+ program: {
3055
+ kind: "const",
3056
+ value: [
3057
+ 11,
3058
+ 112,
3059
+ 101,
3060
+ 177,
3061
+ 227,
3062
+ 209,
3063
+ 124,
3064
+ 69,
3065
+ 56,
3066
+ 157,
3067
+ 82,
3068
+ 127,
3069
+ 107,
3070
+ 4,
3071
+ 195,
3072
+ 205,
3073
+ 88,
3074
+ 184,
3075
+ 108,
3076
+ 115,
3077
+ 26,
3078
+ 160,
3079
+ 253,
3080
+ 181,
3081
+ 73,
3082
+ 182,
3083
+ 209,
3084
+ 188,
3085
+ 3,
3086
+ 248,
3087
+ 41,
3088
+ 70
3089
+ ]
3090
+ }
3091
+ }
3092
+ },
3093
+ {
3094
+ name: "bonding_curve",
3095
+ writable: true,
3096
+ pda: {
3097
+ seeds: [
3098
+ {
3099
+ kind: "const",
3100
+ value: [
3101
+ 98,
3102
+ 111,
3103
+ 110,
3104
+ 100,
3105
+ 105,
3106
+ 110,
3107
+ 103,
3108
+ 45,
3109
+ 99,
3110
+ 117,
3111
+ 114,
3112
+ 118,
3113
+ 101
3114
+ ]
3115
+ },
3116
+ {
3117
+ kind: "account",
3118
+ path: "mint"
3119
+ }
3120
+ ]
3121
+ }
3122
+ },
3123
+ {
3124
+ name: "event_authority",
3125
+ pda: {
3126
+ seeds: [
3127
+ {
3128
+ kind: "const",
3129
+ value: [
3130
+ 95,
3131
+ 95,
3132
+ 101,
3133
+ 118,
3134
+ 101,
3135
+ 110,
3136
+ 116,
3137
+ 95,
3138
+ 97,
3139
+ 117,
3140
+ 116,
3141
+ 104,
3142
+ 111,
3143
+ 114,
3144
+ 105,
3145
+ 116,
3146
+ 121
3147
+ ]
3148
+ }
3149
+ ]
3150
+ }
3151
+ },
3152
+ {
3153
+ name: "program"
3154
+ }
3155
+ ],
3156
+ args: [
3157
+ ]
3158
+ },
3159
+ {
3160
+ name: "set_params",
3161
+ docs: [
3162
+ "Sets the global state parameters."
3163
+ ],
3164
+ discriminator: [
3165
+ 27,
3166
+ 234,
3167
+ 178,
3168
+ 52,
3169
+ 147,
3170
+ 2,
3171
+ 187,
3172
+ 141
3173
+ ],
3174
+ accounts: [
3175
+ {
3176
+ name: "global",
3177
+ writable: true,
3178
+ pda: {
3179
+ seeds: [
3180
+ {
3181
+ kind: "const",
3182
+ value: [
3183
+ 103,
3184
+ 108,
3185
+ 111,
3186
+ 98,
3187
+ 97,
3188
+ 108
3189
+ ]
3190
+ }
3191
+ ]
3192
+ }
3193
+ },
3194
+ {
3195
+ name: "authority",
3196
+ writable: true,
3197
+ signer: true,
3198
+ relations: [
3199
+ "global"
3200
+ ]
3201
+ },
3202
+ {
3203
+ name: "event_authority",
3204
+ pda: {
3205
+ seeds: [
3206
+ {
3207
+ kind: "const",
3208
+ value: [
3209
+ 95,
3210
+ 95,
3211
+ 101,
3212
+ 118,
3213
+ 101,
3214
+ 110,
3215
+ 116,
3216
+ 95,
3217
+ 97,
3218
+ 117,
3219
+ 116,
3220
+ 104,
3221
+ 111,
3222
+ 114,
3223
+ 105,
3224
+ 116,
3225
+ 121
3226
+ ]
3227
+ }
3228
+ ]
3229
+ }
3230
+ },
3231
+ {
3232
+ name: "program"
3233
+ }
3234
+ ],
3235
+ args: [
3236
+ {
3237
+ name: "initial_virtual_token_reserves",
3238
+ type: "u64"
3239
+ },
3240
+ {
3241
+ name: "initial_virtual_sol_reserves",
3242
+ type: "u64"
3243
+ },
3244
+ {
3245
+ name: "initial_real_token_reserves",
3246
+ type: "u64"
3247
+ },
3248
+ {
3249
+ name: "token_total_supply",
3250
+ type: "u64"
3251
+ },
3252
+ {
3253
+ name: "fee_basis_points",
3254
+ type: "u64"
3255
+ },
3256
+ {
3257
+ name: "withdraw_authority",
3258
+ type: "pubkey"
3259
+ },
3260
+ {
3261
+ name: "enable_migrate",
3262
+ type: "bool"
3263
+ },
3264
+ {
3265
+ name: "pool_migration_fee",
3266
+ type: "u64"
3267
+ },
3268
+ {
3269
+ name: "creator_fee_basis_points",
3270
+ type: "u64"
3271
+ },
3272
+ {
3273
+ name: "set_creator_authority",
3274
+ type: "pubkey"
3275
+ },
3276
+ {
3277
+ name: "admin_set_creator_authority",
3278
+ type: "pubkey"
3279
+ }
3280
+ ]
3281
+ },
3282
+ {
3283
+ name: "sync_user_volume_accumulator",
3284
+ discriminator: [
3285
+ 86,
3286
+ 31,
3287
+ 192,
3288
+ 87,
3289
+ 163,
3290
+ 87,
3291
+ 79,
3292
+ 238
3293
+ ],
3294
+ accounts: [
3295
+ {
3296
+ name: "user"
3297
+ },
3298
+ {
3299
+ name: "global_volume_accumulator",
3300
+ pda: {
3301
+ seeds: [
3302
+ {
3303
+ kind: "const",
3304
+ value: [
3305
+ 103,
3306
+ 108,
3307
+ 111,
3308
+ 98,
3309
+ 97,
3310
+ 108,
3311
+ 95,
3312
+ 118,
3313
+ 111,
3314
+ 108,
3315
+ 117,
3316
+ 109,
3317
+ 101,
3318
+ 95,
3319
+ 97,
3320
+ 99,
3321
+ 99,
3322
+ 117,
3323
+ 109,
3324
+ 117,
3325
+ 108,
3326
+ 97,
3327
+ 116,
3328
+ 111,
3329
+ 114
3330
+ ]
3331
+ }
3332
+ ]
3333
+ }
3334
+ },
3335
+ {
3336
+ name: "user_volume_accumulator",
3337
+ writable: true,
3338
+ pda: {
3339
+ seeds: [
3340
+ {
3341
+ kind: "const",
3342
+ value: [
3343
+ 117,
3344
+ 115,
3345
+ 101,
3346
+ 114,
3347
+ 95,
3348
+ 118,
3349
+ 111,
3350
+ 108,
3351
+ 117,
3352
+ 109,
3353
+ 101,
3354
+ 95,
3355
+ 97,
3356
+ 99,
3357
+ 99,
3358
+ 117,
3359
+ 109,
3360
+ 117,
3361
+ 108,
3362
+ 97,
3363
+ 116,
3364
+ 111,
3365
+ 114
3366
+ ]
3367
+ },
3368
+ {
3369
+ kind: "account",
3370
+ path: "user"
3371
+ }
3372
+ ]
3373
+ }
3374
+ },
3375
+ {
3376
+ name: "event_authority",
3377
+ pda: {
3378
+ seeds: [
3379
+ {
3380
+ kind: "const",
3381
+ value: [
3382
+ 95,
3383
+ 95,
3384
+ 101,
3385
+ 118,
3386
+ 101,
3387
+ 110,
3388
+ 116,
3389
+ 95,
3390
+ 97,
3391
+ 117,
3392
+ 116,
3393
+ 104,
3394
+ 111,
3395
+ 114,
3396
+ 105,
3397
+ 116,
3398
+ 121
3399
+ ]
3400
+ }
3401
+ ]
3402
+ }
3403
+ },
3404
+ {
3405
+ name: "program"
3406
+ }
3407
+ ],
3408
+ args: [
3409
+ ]
3410
+ },
3411
+ {
3412
+ name: "update_global_authority",
3413
+ discriminator: [
3414
+ 227,
3415
+ 181,
3416
+ 74,
3417
+ 196,
3418
+ 208,
3419
+ 21,
3420
+ 97,
3421
+ 213
3422
+ ],
3423
+ accounts: [
3424
+ {
3425
+ name: "global",
3426
+ writable: true,
3427
+ pda: {
3428
+ seeds: [
3429
+ {
3430
+ kind: "const",
3431
+ value: [
3432
+ 103,
3433
+ 108,
3434
+ 111,
3435
+ 98,
3436
+ 97,
3437
+ 108
3438
+ ]
3439
+ }
3440
+ ]
3441
+ }
3442
+ },
3443
+ {
3444
+ name: "authority",
3445
+ signer: true,
3446
+ relations: [
3447
+ "global"
3448
+ ]
3449
+ },
3450
+ {
3451
+ name: "new_authority"
3452
+ },
3453
+ {
3454
+ name: "event_authority",
3455
+ pda: {
3456
+ seeds: [
3457
+ {
3458
+ kind: "const",
3459
+ value: [
3460
+ 95,
3461
+ 95,
3462
+ 101,
3463
+ 118,
3464
+ 101,
3465
+ 110,
3466
+ 116,
3467
+ 95,
3468
+ 97,
3469
+ 117,
3470
+ 116,
3471
+ 104,
3472
+ 111,
3473
+ 114,
3474
+ 105,
3475
+ 116,
3476
+ 121
3477
+ ]
3478
+ }
3479
+ ]
3480
+ }
3481
+ },
3482
+ {
3483
+ name: "program"
3484
+ }
3485
+ ],
3486
+ args: [
3487
+ ]
3488
+ }
3489
+ ];
3490
+ var accounts = [
3491
+ {
3492
+ name: "BondingCurve",
3493
+ discriminator: [
3494
+ 23,
3495
+ 183,
3496
+ 248,
3497
+ 55,
3498
+ 96,
3499
+ 216,
3500
+ 172,
3501
+ 96
3502
+ ]
3503
+ },
3504
+ {
3505
+ name: "Global",
3506
+ discriminator: [
3507
+ 167,
3508
+ 232,
3509
+ 232,
3510
+ 177,
3511
+ 200,
3512
+ 108,
3513
+ 114,
3514
+ 127
3515
+ ]
3516
+ },
3517
+ {
3518
+ name: "GlobalVolumeAccumulator",
3519
+ discriminator: [
3520
+ 202,
3521
+ 42,
3522
+ 246,
3523
+ 43,
3524
+ 142,
3525
+ 190,
3526
+ 30,
3527
+ 255
3528
+ ]
3529
+ },
3530
+ {
3531
+ name: "UserVolumeAccumulator",
3532
+ discriminator: [
3533
+ 86,
3534
+ 255,
3535
+ 112,
3536
+ 14,
3537
+ 102,
3538
+ 53,
3539
+ 154,
3540
+ 250
3541
+ ]
3542
+ }
3543
+ ];
3544
+ var events = [
3545
+ {
3546
+ name: "AdminSetCreatorEvent",
3547
+ discriminator: [
3548
+ 64,
3549
+ 69,
3550
+ 192,
3551
+ 104,
3552
+ 29,
3553
+ 30,
3554
+ 25,
3555
+ 107
3556
+ ]
3557
+ },
3558
+ {
3559
+ name: "AdminSetIdlAuthorityEvent",
3560
+ discriminator: [
3561
+ 245,
3562
+ 59,
3563
+ 70,
3564
+ 34,
3565
+ 75,
3566
+ 185,
3567
+ 109,
3568
+ 92
3569
+ ]
3570
+ },
3571
+ {
3572
+ name: "AdminUpdateTokenIncentivesEvent",
3573
+ discriminator: [
3574
+ 147,
3575
+ 250,
3576
+ 108,
3577
+ 120,
3578
+ 247,
3579
+ 29,
3580
+ 67,
3581
+ 222
3582
+ ]
3583
+ },
3584
+ {
3585
+ name: "ClaimTokenIncentivesEvent",
3586
+ discriminator: [
3587
+ 79,
3588
+ 172,
3589
+ 246,
3590
+ 49,
3591
+ 205,
3592
+ 91,
3593
+ 206,
3594
+ 232
3595
+ ]
3596
+ },
3597
+ {
3598
+ name: "CloseUserVolumeAccumulatorEvent",
3599
+ discriminator: [
3600
+ 146,
3601
+ 159,
3602
+ 189,
3603
+ 172,
3604
+ 146,
3605
+ 88,
3606
+ 56,
3607
+ 244
3608
+ ]
3609
+ },
3610
+ {
3611
+ name: "CollectCreatorFeeEvent",
3612
+ discriminator: [
3613
+ 122,
3614
+ 2,
3615
+ 127,
3616
+ 1,
3617
+ 14,
3618
+ 191,
3619
+ 12,
3620
+ 175
3621
+ ]
3622
+ },
3623
+ {
3624
+ name: "CompleteEvent",
3625
+ discriminator: [
3626
+ 95,
3627
+ 114,
3628
+ 97,
3629
+ 156,
3630
+ 212,
3631
+ 46,
3632
+ 152,
3633
+ 8
3634
+ ]
3635
+ },
3636
+ {
3637
+ name: "CompletePumpAmmMigrationEvent",
3638
+ discriminator: [
3639
+ 189,
3640
+ 233,
3641
+ 93,
3642
+ 185,
3643
+ 92,
3644
+ 148,
3645
+ 234,
3646
+ 148
3647
+ ]
3648
+ },
3649
+ {
3650
+ name: "CreateEvent",
3651
+ discriminator: [
3652
+ 27,
3653
+ 114,
3654
+ 169,
3655
+ 77,
3656
+ 222,
3657
+ 235,
3658
+ 99,
3659
+ 118
3660
+ ]
3661
+ },
3662
+ {
3663
+ name: "ExtendAccountEvent",
3664
+ discriminator: [
3665
+ 97,
3666
+ 97,
3667
+ 215,
3668
+ 144,
3669
+ 93,
3670
+ 146,
3671
+ 22,
3672
+ 124
3673
+ ]
3674
+ },
3675
+ {
3676
+ name: "InitUserVolumeAccumulatorEvent",
3677
+ discriminator: [
3678
+ 134,
3679
+ 36,
3680
+ 13,
3681
+ 72,
3682
+ 232,
3683
+ 101,
3684
+ 130,
3685
+ 216
3686
+ ]
3687
+ },
3688
+ {
3689
+ name: "SetCreatorEvent",
3690
+ discriminator: [
3691
+ 237,
3692
+ 52,
3693
+ 123,
3694
+ 37,
3695
+ 245,
3696
+ 251,
3697
+ 72,
3698
+ 210
3699
+ ]
3700
+ },
3701
+ {
3702
+ name: "SetMetaplexCreatorEvent",
3703
+ discriminator: [
3704
+ 142,
3705
+ 203,
3706
+ 6,
3707
+ 32,
3708
+ 127,
3709
+ 105,
3710
+ 191,
3711
+ 162
3712
+ ]
3713
+ },
3714
+ {
3715
+ name: "SetParamsEvent",
3716
+ discriminator: [
3717
+ 223,
3718
+ 195,
3719
+ 159,
3720
+ 246,
3721
+ 62,
3722
+ 48,
3723
+ 143,
3724
+ 131
3725
+ ]
3726
+ },
3727
+ {
3728
+ name: "SyncUserVolumeAccumulatorEvent",
3729
+ discriminator: [
3730
+ 197,
3731
+ 122,
3732
+ 167,
3733
+ 124,
3734
+ 116,
3735
+ 81,
3736
+ 91,
3737
+ 255
3738
+ ]
3739
+ },
3740
+ {
3741
+ name: "TradeEvent",
3742
+ discriminator: [
3743
+ 189,
3744
+ 219,
3745
+ 127,
3746
+ 211,
3747
+ 78,
3748
+ 230,
3749
+ 97,
3750
+ 238
3751
+ ]
3752
+ },
3753
+ {
3754
+ name: "UpdateGlobalAuthorityEvent",
3755
+ discriminator: [
3756
+ 182,
3757
+ 195,
3758
+ 137,
3759
+ 42,
3760
+ 35,
3761
+ 206,
3762
+ 207,
3763
+ 247
3764
+ ]
3765
+ }
3766
+ ];
3767
+ var errors = [
3768
+ {
3769
+ code: 6000,
3770
+ name: "NotAuthorized",
3771
+ msg: "The given account is not authorized to execute this instruction."
3772
+ },
3773
+ {
3774
+ code: 6001,
3775
+ name: "AlreadyInitialized",
3776
+ msg: "The program is already initialized."
3777
+ },
3778
+ {
3779
+ code: 6002,
3780
+ name: "TooMuchSolRequired",
3781
+ msg: "slippage: Too much SOL required to buy the given amount of tokens."
3782
+ },
3783
+ {
3784
+ code: 6003,
3785
+ name: "TooLittleSolReceived",
3786
+ msg: "slippage: Too little SOL received to sell the given amount of tokens."
3787
+ },
3788
+ {
3789
+ code: 6004,
3790
+ name: "MintDoesNotMatchBondingCurve",
3791
+ msg: "The mint does not match the bonding curve."
3792
+ },
3793
+ {
3794
+ code: 6005,
3795
+ name: "BondingCurveComplete",
3796
+ msg: "The bonding curve has completed and liquidity migrated to raydium."
3797
+ },
3798
+ {
3799
+ code: 6006,
3800
+ name: "BondingCurveNotComplete",
3801
+ msg: "The bonding curve has not completed."
3802
+ },
3803
+ {
3804
+ code: 6007,
3805
+ name: "NotInitialized",
3806
+ msg: "The program is not initialized."
3807
+ },
3808
+ {
3809
+ code: 6008,
3810
+ name: "WithdrawTooFrequent",
3811
+ msg: "Withdraw too frequent"
3812
+ },
3813
+ {
3814
+ code: 6009,
3815
+ name: "NewSizeShouldBeGreaterThanCurrentSize",
3816
+ msg: "new_size should be > current_size"
3817
+ },
3818
+ {
3819
+ code: 6010,
3820
+ name: "AccountTypeNotSupported",
3821
+ msg: "Account type not supported"
3822
+ },
3823
+ {
3824
+ code: 6011,
3825
+ name: "InitialRealTokenReservesShouldBeLessThanTokenTotalSupply",
3826
+ msg: "initial_real_token_reserves should be less than token_total_supply"
3827
+ },
3828
+ {
3829
+ code: 6012,
3830
+ name: "InitialVirtualTokenReservesShouldBeGreaterThanInitialRealTokenReserves",
3831
+ msg: "initial_virtual_token_reserves should be greater than initial_real_token_reserves"
3832
+ },
3833
+ {
3834
+ code: 6013,
3835
+ name: "FeeBasisPointsGreaterThanMaximum",
3836
+ msg: "fee_basis_points greater than maximum"
3837
+ },
3838
+ {
3839
+ code: 6014,
3840
+ name: "AllZerosWithdrawAuthority",
3841
+ msg: "Withdraw authority cannot be set to System program ID"
3842
+ },
3843
+ {
3844
+ code: 6015,
3845
+ name: "PoolMigrationFeeShouldBeLessThanFinalRealSolReserves",
3846
+ msg: "pool_migration_fee should be less than final_real_sol_reserves"
3847
+ },
3848
+ {
3849
+ code: 6016,
3850
+ name: "PoolMigrationFeeShouldBeGreaterThanCreatorFeePlusMaxMigrateFees",
3851
+ msg: "pool_migration_fee should be greater than creator_fee + MAX_MIGRATE_FEES"
3852
+ },
3853
+ {
3854
+ code: 6017,
3855
+ name: "DisabledWithdraw",
3856
+ msg: "Migrate instruction is disabled"
3857
+ },
3858
+ {
3859
+ code: 6018,
3860
+ name: "DisabledMigrate",
3861
+ msg: "Migrate instruction is disabled"
3862
+ },
3863
+ {
3864
+ code: 6019,
3865
+ name: "InvalidCreator",
3866
+ msg: "Invalid creator pubkey"
3867
+ },
3868
+ {
3869
+ code: 6020,
3870
+ name: "BuyZeroAmount",
3871
+ msg: "Buy zero amount"
3872
+ },
3873
+ {
3874
+ code: 6021,
3875
+ name: "NotEnoughTokensToBuy",
3876
+ msg: "Not enough tokens to buy"
3877
+ },
3878
+ {
3879
+ code: 6022,
3880
+ name: "SellZeroAmount",
3881
+ msg: "Sell zero amount"
3882
+ },
3883
+ {
3884
+ code: 6023,
3885
+ name: "NotEnoughTokensToSell",
3886
+ msg: "Not enough tokens to sell"
3887
+ },
3888
+ {
3889
+ code: 6024,
3890
+ name: "Overflow",
3891
+ msg: "Overflow"
3892
+ },
3893
+ {
3894
+ code: 6025,
3895
+ name: "Truncation",
3896
+ msg: "Truncation"
3897
+ },
3898
+ {
3899
+ code: 6026,
3900
+ name: "DivisionByZero",
3901
+ msg: "Division by zero"
3902
+ },
3903
+ {
3904
+ code: 6027,
3905
+ name: "NotEnoughRemainingAccounts",
3906
+ msg: "Not enough remaining accounts"
3907
+ },
3908
+ {
3909
+ code: 6028,
3910
+ name: "AllFeeRecipientsShouldBeNonZero",
3911
+ msg: "All fee recipients should be non-zero"
3912
+ },
3913
+ {
3914
+ code: 6029,
3915
+ name: "UnsortedNotUniqueFeeRecipients",
3916
+ msg: "Unsorted or not unique fee recipients"
3917
+ },
3918
+ {
3919
+ code: 6030,
3920
+ name: "CreatorShouldNotBeZero",
3921
+ msg: "Creator should not be zero"
3922
+ },
3923
+ {
3924
+ code: 6031,
3925
+ name: "StartTimeInThePast"
3926
+ },
3927
+ {
3928
+ code: 6032,
3929
+ name: "EndTimeInThePast"
3930
+ },
3931
+ {
3932
+ code: 6033,
3933
+ name: "EndTimeBeforeStartTime"
3934
+ },
3935
+ {
3936
+ code: 6034,
3937
+ name: "TimeRangeTooLarge"
3938
+ },
3939
+ {
3940
+ code: 6035,
3941
+ name: "EndTimeBeforeCurrentDay"
3942
+ },
3943
+ {
3944
+ code: 6036,
3945
+ name: "SupplyUpdateForFinishedRange"
3946
+ },
3947
+ {
3948
+ code: 6037,
3949
+ name: "DayIndexAfterEndIndex"
3950
+ },
3951
+ {
3952
+ code: 6038,
3953
+ name: "DayInActiveRange"
3954
+ },
3955
+ {
3956
+ code: 6039,
3957
+ name: "InvalidIncentiveMint"
3958
+ }
3959
+ ];
3960
+ var types = [
3961
+ {
3962
+ name: "AdminSetCreatorEvent",
3963
+ type: {
3964
+ kind: "struct",
3965
+ fields: [
3966
+ {
3967
+ name: "timestamp",
3968
+ type: "i64"
3969
+ },
3970
+ {
3971
+ name: "admin_set_creator_authority",
3972
+ type: "pubkey"
3973
+ },
3974
+ {
3975
+ name: "mint",
3976
+ type: "pubkey"
3977
+ },
3978
+ {
3979
+ name: "bonding_curve",
3980
+ type: "pubkey"
3981
+ },
3982
+ {
3983
+ name: "old_creator",
3984
+ type: "pubkey"
3985
+ },
3986
+ {
3987
+ name: "new_creator",
3988
+ type: "pubkey"
3989
+ }
3990
+ ]
3991
+ }
3992
+ },
3993
+ {
3994
+ name: "AdminSetIdlAuthorityEvent",
3995
+ type: {
3996
+ kind: "struct",
3997
+ fields: [
3998
+ {
3999
+ name: "idl_authority",
4000
+ type: "pubkey"
4001
+ }
4002
+ ]
4003
+ }
4004
+ },
4005
+ {
4006
+ name: "AdminUpdateTokenIncentivesEvent",
4007
+ type: {
4008
+ kind: "struct",
4009
+ fields: [
4010
+ {
4011
+ name: "start_time",
4012
+ type: "i64"
4013
+ },
4014
+ {
4015
+ name: "end_time",
4016
+ type: "i64"
4017
+ },
4018
+ {
4019
+ name: "day_number",
4020
+ type: "u64"
4021
+ },
4022
+ {
4023
+ name: "token_supply_per_day",
4024
+ type: "u64"
4025
+ },
4026
+ {
4027
+ name: "mint",
4028
+ type: "pubkey"
4029
+ },
4030
+ {
4031
+ name: "seconds_in_a_day",
4032
+ type: "i64"
4033
+ },
4034
+ {
4035
+ name: "timestamp",
4036
+ type: "i64"
4037
+ }
4038
+ ]
4039
+ }
4040
+ },
4041
+ {
4042
+ name: "BondingCurve",
4043
+ type: {
4044
+ kind: "struct",
4045
+ fields: [
4046
+ {
4047
+ name: "virtual_token_reserves",
4048
+ type: "u64"
4049
+ },
4050
+ {
4051
+ name: "virtual_sol_reserves",
4052
+ type: "u64"
4053
+ },
4054
+ {
4055
+ name: "real_token_reserves",
4056
+ type: "u64"
4057
+ },
4058
+ {
4059
+ name: "real_sol_reserves",
4060
+ type: "u64"
4061
+ },
4062
+ {
4063
+ name: "token_total_supply",
4064
+ type: "u64"
4065
+ },
4066
+ {
4067
+ name: "complete",
4068
+ type: "bool"
4069
+ },
4070
+ {
4071
+ name: "creator",
4072
+ type: "pubkey"
4073
+ }
4074
+ ]
4075
+ }
4076
+ },
4077
+ {
4078
+ name: "ClaimTokenIncentivesEvent",
4079
+ type: {
4080
+ kind: "struct",
4081
+ fields: [
4082
+ {
4083
+ name: "user",
4084
+ type: "pubkey"
4085
+ },
4086
+ {
4087
+ name: "mint",
4088
+ type: "pubkey"
4089
+ },
4090
+ {
4091
+ name: "amount",
4092
+ type: "u64"
4093
+ },
4094
+ {
4095
+ name: "timestamp",
4096
+ type: "i64"
4097
+ }
4098
+ ]
4099
+ }
4100
+ },
4101
+ {
4102
+ name: "CloseUserVolumeAccumulatorEvent",
4103
+ type: {
4104
+ kind: "struct",
4105
+ fields: [
4106
+ {
4107
+ name: "user",
4108
+ type: "pubkey"
4109
+ },
4110
+ {
4111
+ name: "timestamp",
4112
+ type: "i64"
4113
+ }
4114
+ ]
4115
+ }
4116
+ },
4117
+ {
4118
+ name: "CollectCreatorFeeEvent",
4119
+ type: {
4120
+ kind: "struct",
4121
+ fields: [
4122
+ {
4123
+ name: "timestamp",
4124
+ type: "i64"
4125
+ },
4126
+ {
4127
+ name: "creator",
4128
+ type: "pubkey"
4129
+ },
4130
+ {
4131
+ name: "creator_fee",
4132
+ type: "u64"
4133
+ }
4134
+ ]
4135
+ }
4136
+ },
4137
+ {
4138
+ name: "CompleteEvent",
4139
+ type: {
4140
+ kind: "struct",
4141
+ fields: [
4142
+ {
4143
+ name: "user",
4144
+ type: "pubkey"
4145
+ },
4146
+ {
4147
+ name: "mint",
4148
+ type: "pubkey"
4149
+ },
4150
+ {
4151
+ name: "bonding_curve",
4152
+ type: "pubkey"
4153
+ },
4154
+ {
4155
+ name: "timestamp",
4156
+ type: "i64"
4157
+ }
4158
+ ]
4159
+ }
4160
+ },
4161
+ {
4162
+ name: "CompletePumpAmmMigrationEvent",
4163
+ type: {
4164
+ kind: "struct",
4165
+ fields: [
4166
+ {
4167
+ name: "user",
4168
+ type: "pubkey"
4169
+ },
4170
+ {
4171
+ name: "mint",
4172
+ type: "pubkey"
4173
+ },
4174
+ {
4175
+ name: "mint_amount",
4176
+ type: "u64"
4177
+ },
4178
+ {
4179
+ name: "sol_amount",
4180
+ type: "u64"
4181
+ },
4182
+ {
4183
+ name: "pool_migration_fee",
4184
+ type: "u64"
4185
+ },
4186
+ {
4187
+ name: "bonding_curve",
4188
+ type: "pubkey"
4189
+ },
4190
+ {
4191
+ name: "timestamp",
4192
+ type: "i64"
4193
+ },
4194
+ {
4195
+ name: "pool",
4196
+ type: "pubkey"
4197
+ }
4198
+ ]
4199
+ }
4200
+ },
4201
+ {
4202
+ name: "CreateEvent",
4203
+ type: {
4204
+ kind: "struct",
4205
+ fields: [
4206
+ {
4207
+ name: "name",
4208
+ type: "string"
4209
+ },
4210
+ {
4211
+ name: "symbol",
4212
+ type: "string"
4213
+ },
4214
+ {
4215
+ name: "uri",
4216
+ type: "string"
4217
+ },
4218
+ {
4219
+ name: "mint",
4220
+ type: "pubkey"
4221
+ },
4222
+ {
4223
+ name: "bonding_curve",
4224
+ type: "pubkey"
4225
+ },
4226
+ {
4227
+ name: "user",
4228
+ type: "pubkey"
4229
+ },
4230
+ {
4231
+ name: "creator",
4232
+ type: "pubkey"
4233
+ },
4234
+ {
4235
+ name: "timestamp",
4236
+ type: "i64"
4237
+ },
4238
+ {
4239
+ name: "virtual_token_reserves",
4240
+ type: "u64"
4241
+ },
4242
+ {
4243
+ name: "virtual_sol_reserves",
4244
+ type: "u64"
4245
+ },
4246
+ {
4247
+ name: "real_token_reserves",
4248
+ type: "u64"
4249
+ },
4250
+ {
4251
+ name: "token_total_supply",
4252
+ type: "u64"
4253
+ }
4254
+ ]
4255
+ }
4256
+ },
4257
+ {
4258
+ name: "ExtendAccountEvent",
4259
+ type: {
4260
+ kind: "struct",
4261
+ fields: [
4262
+ {
4263
+ name: "account",
4264
+ type: "pubkey"
4265
+ },
4266
+ {
4267
+ name: "user",
4268
+ type: "pubkey"
4269
+ },
4270
+ {
4271
+ name: "current_size",
4272
+ type: "u64"
4273
+ },
4274
+ {
4275
+ name: "new_size",
4276
+ type: "u64"
4277
+ },
4278
+ {
4279
+ name: "timestamp",
4280
+ type: "i64"
4281
+ }
4282
+ ]
4283
+ }
4284
+ },
4285
+ {
4286
+ name: "Global",
4287
+ type: {
4288
+ kind: "struct",
4289
+ fields: [
4290
+ {
4291
+ name: "initialized",
4292
+ docs: [
4293
+ "Unused"
4294
+ ],
4295
+ type: "bool"
4296
+ },
4297
+ {
4298
+ name: "authority",
4299
+ type: "pubkey"
4300
+ },
4301
+ {
4302
+ name: "fee_recipient",
4303
+ type: "pubkey"
4304
+ },
4305
+ {
4306
+ name: "initial_virtual_token_reserves",
4307
+ type: "u64"
4308
+ },
4309
+ {
4310
+ name: "initial_virtual_sol_reserves",
4311
+ type: "u64"
4312
+ },
4313
+ {
4314
+ name: "initial_real_token_reserves",
4315
+ type: "u64"
4316
+ },
4317
+ {
4318
+ name: "token_total_supply",
4319
+ type: "u64"
4320
+ },
4321
+ {
4322
+ name: "fee_basis_points",
4323
+ type: "u64"
4324
+ },
4325
+ {
4326
+ name: "withdraw_authority",
4327
+ type: "pubkey"
4328
+ },
4329
+ {
4330
+ name: "enable_migrate",
4331
+ docs: [
4332
+ "Unused"
4333
+ ],
4334
+ type: "bool"
4335
+ },
4336
+ {
4337
+ name: "pool_migration_fee",
4338
+ type: "u64"
4339
+ },
4340
+ {
4341
+ name: "creator_fee_basis_points",
4342
+ type: "u64"
4343
+ },
4344
+ {
4345
+ name: "fee_recipients",
4346
+ type: {
4347
+ array: [
4348
+ "pubkey",
4349
+ 7
4350
+ ]
4351
+ }
4352
+ },
4353
+ {
4354
+ name: "set_creator_authority",
4355
+ type: "pubkey"
4356
+ },
4357
+ {
4358
+ name: "admin_set_creator_authority",
4359
+ type: "pubkey"
4360
+ }
4361
+ ]
4362
+ }
4363
+ },
4364
+ {
4365
+ name: "GlobalVolumeAccumulator",
4366
+ type: {
4367
+ kind: "struct",
4368
+ fields: [
4369
+ {
4370
+ name: "start_time",
4371
+ type: "i64"
4372
+ },
4373
+ {
4374
+ name: "end_time",
4375
+ type: "i64"
4376
+ },
4377
+ {
4378
+ name: "seconds_in_a_day",
4379
+ type: "i64"
4380
+ },
4381
+ {
4382
+ name: "mint",
4383
+ type: "pubkey"
4384
+ },
4385
+ {
4386
+ name: "total_token_supply",
4387
+ type: {
4388
+ array: [
4389
+ "u64",
4390
+ 30
4391
+ ]
4392
+ }
4393
+ },
4394
+ {
4395
+ name: "sol_volumes",
4396
+ type: {
4397
+ array: [
4398
+ "u64",
4399
+ 30
4400
+ ]
4401
+ }
4402
+ }
4403
+ ]
4404
+ }
4405
+ },
4406
+ {
4407
+ name: "InitUserVolumeAccumulatorEvent",
4408
+ type: {
4409
+ kind: "struct",
4410
+ fields: [
4411
+ {
4412
+ name: "payer",
4413
+ type: "pubkey"
4414
+ },
4415
+ {
4416
+ name: "user",
4417
+ type: "pubkey"
4418
+ },
4419
+ {
4420
+ name: "timestamp",
4421
+ type: "i64"
4422
+ }
4423
+ ]
4424
+ }
4425
+ },
4426
+ {
4427
+ name: "OptionBool",
4428
+ type: {
4429
+ kind: "struct",
4430
+ fields: [
4431
+ "bool"
4432
+ ]
4433
+ }
4434
+ },
4435
+ {
4436
+ name: "SetCreatorEvent",
4437
+ type: {
4438
+ kind: "struct",
4439
+ fields: [
4440
+ {
4441
+ name: "timestamp",
4442
+ type: "i64"
4443
+ },
4444
+ {
4445
+ name: "mint",
4446
+ type: "pubkey"
4447
+ },
4448
+ {
4449
+ name: "bonding_curve",
4450
+ type: "pubkey"
4451
+ },
4452
+ {
4453
+ name: "creator",
4454
+ type: "pubkey"
4455
+ }
4456
+ ]
4457
+ }
4458
+ },
4459
+ {
4460
+ name: "SetMetaplexCreatorEvent",
4461
+ type: {
4462
+ kind: "struct",
4463
+ fields: [
4464
+ {
4465
+ name: "timestamp",
4466
+ type: "i64"
4467
+ },
4468
+ {
4469
+ name: "mint",
4470
+ type: "pubkey"
4471
+ },
4472
+ {
4473
+ name: "bonding_curve",
4474
+ type: "pubkey"
4475
+ },
4476
+ {
4477
+ name: "metadata",
4478
+ type: "pubkey"
4479
+ },
4480
+ {
4481
+ name: "creator",
4482
+ type: "pubkey"
4483
+ }
4484
+ ]
4485
+ }
4486
+ },
4487
+ {
4488
+ name: "SetParamsEvent",
4489
+ type: {
4490
+ kind: "struct",
4491
+ fields: [
4492
+ {
4493
+ name: "initial_virtual_token_reserves",
4494
+ type: "u64"
4495
+ },
4496
+ {
4497
+ name: "initial_virtual_sol_reserves",
4498
+ type: "u64"
4499
+ },
4500
+ {
4501
+ name: "initial_real_token_reserves",
4502
+ type: "u64"
4503
+ },
4504
+ {
4505
+ name: "final_real_sol_reserves",
4506
+ type: "u64"
4507
+ },
4508
+ {
4509
+ name: "token_total_supply",
4510
+ type: "u64"
4511
+ },
4512
+ {
4513
+ name: "fee_basis_points",
4514
+ type: "u64"
4515
+ },
4516
+ {
4517
+ name: "withdraw_authority",
4518
+ type: "pubkey"
4519
+ },
4520
+ {
4521
+ name: "enable_migrate",
4522
+ type: "bool"
4523
+ },
4524
+ {
4525
+ name: "pool_migration_fee",
4526
+ type: "u64"
4527
+ },
4528
+ {
4529
+ name: "creator_fee_basis_points",
4530
+ type: "u64"
4531
+ },
4532
+ {
4533
+ name: "fee_recipients",
4534
+ type: {
4535
+ array: [
4536
+ "pubkey",
4537
+ 8
4538
+ ]
4539
+ }
4540
+ },
4541
+ {
4542
+ name: "timestamp",
4543
+ type: "i64"
4544
+ },
4545
+ {
4546
+ name: "set_creator_authority",
4547
+ type: "pubkey"
4548
+ },
4549
+ {
4550
+ name: "admin_set_creator_authority",
4551
+ type: "pubkey"
4552
+ }
4553
+ ]
4554
+ }
4555
+ },
4556
+ {
4557
+ name: "SyncUserVolumeAccumulatorEvent",
4558
+ type: {
4559
+ kind: "struct",
4560
+ fields: [
4561
+ {
4562
+ name: "user",
4563
+ type: "pubkey"
4564
+ },
4565
+ {
4566
+ name: "total_claimed_tokens_before",
4567
+ type: "u64"
4568
+ },
4569
+ {
4570
+ name: "total_claimed_tokens_after",
4571
+ type: "u64"
4572
+ },
4573
+ {
4574
+ name: "timestamp",
4575
+ type: "i64"
4576
+ }
4577
+ ]
4578
+ }
4579
+ },
4580
+ {
4581
+ name: "TradeEvent",
4582
+ type: {
4583
+ kind: "struct",
4584
+ fields: [
4585
+ {
4586
+ name: "mint",
4587
+ type: "pubkey"
4588
+ },
4589
+ {
4590
+ name: "sol_amount",
4591
+ type: "u64"
4592
+ },
4593
+ {
4594
+ name: "token_amount",
4595
+ type: "u64"
4596
+ },
4597
+ {
4598
+ name: "is_buy",
4599
+ type: "bool"
4600
+ },
4601
+ {
4602
+ name: "user",
4603
+ type: "pubkey"
4604
+ },
4605
+ {
4606
+ name: "timestamp",
4607
+ type: "i64"
4608
+ },
4609
+ {
4610
+ name: "virtual_sol_reserves",
4611
+ type: "u64"
4612
+ },
4613
+ {
4614
+ name: "virtual_token_reserves",
4615
+ type: "u64"
4616
+ },
4617
+ {
4618
+ name: "real_sol_reserves",
4619
+ type: "u64"
4620
+ },
4621
+ {
4622
+ name: "real_token_reserves",
4623
+ type: "u64"
4624
+ },
4625
+ {
4626
+ name: "fee_recipient",
4627
+ type: "pubkey"
4628
+ },
4629
+ {
4630
+ name: "fee_basis_points",
4631
+ type: "u64"
4632
+ },
4633
+ {
4634
+ name: "fee",
4635
+ type: "u64"
4636
+ },
4637
+ {
4638
+ name: "creator",
4639
+ type: "pubkey"
4640
+ },
4641
+ {
4642
+ name: "creator_fee_basis_points",
4643
+ type: "u64"
4644
+ },
4645
+ {
4646
+ name: "creator_fee",
4647
+ type: "u64"
4648
+ },
4649
+ {
4650
+ name: "track_volume",
4651
+ type: "bool"
4652
+ }
4653
+ ]
4654
+ }
4655
+ },
4656
+ {
4657
+ name: "UpdateGlobalAuthorityEvent",
4658
+ type: {
4659
+ kind: "struct",
4660
+ fields: [
4661
+ {
4662
+ name: "global",
4663
+ type: "pubkey"
4664
+ },
4665
+ {
4666
+ name: "authority",
4667
+ type: "pubkey"
4668
+ },
4669
+ {
4670
+ name: "new_authority",
4671
+ type: "pubkey"
4672
+ },
4673
+ {
4674
+ name: "timestamp",
4675
+ type: "i64"
4676
+ }
4677
+ ]
4678
+ }
4679
+ },
4680
+ {
4681
+ name: "UserVolumeAccumulator",
4682
+ type: {
4683
+ kind: "struct",
4684
+ fields: [
4685
+ {
4686
+ name: "user",
4687
+ type: "pubkey"
4688
+ },
4689
+ {
4690
+ name: "needs_claim",
4691
+ type: "bool"
4692
+ },
4693
+ {
4694
+ name: "total_unclaimed_tokens",
4695
+ type: "u64"
4696
+ },
4697
+ {
4698
+ name: "total_claimed_tokens",
4699
+ type: "u64"
4700
+ },
4701
+ {
4702
+ name: "current_sol_volume",
4703
+ type: "u64"
4704
+ },
4705
+ {
4706
+ name: "last_update_timestamp",
4707
+ type: "i64"
4708
+ },
4709
+ {
4710
+ name: "has_total_claimed_tokens",
4711
+ type: "bool"
4712
+ }
4713
+ ]
4714
+ }
4715
+ }
4716
+ ];
4717
+ var IDL = {
4718
+ address: address,
4719
+ metadata: metadata,
4720
+ instructions: instructions,
4721
+ accounts: accounts,
4722
+ events: events,
4723
+ errors: errors,
4724
+ types: types
4725
+ };
4726
+
4727
+ const PROGRAM_ID = "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P";
4728
+ const MPL_TOKEN_METADATA_PROGRAM_ID = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";
4729
+ const GLOBAL_ACCOUNT_SEED = "global";
4730
+ const MINT_AUTHORITY_SEED = "mint-authority";
4731
+ const BONDING_CURVE_SEED = "bonding-curve";
4732
+ const METADATA_SEED = "metadata";
4733
+ const DEFAULT_DECIMALS = 6;
4734
+ class PumpFunSDK {
4735
+ constructor(provider) {
4736
+ this.program = new Program(IDL, provider);
4737
+ this.connection = this.program.provider.connection;
4738
+ }
4739
+ async sell(seller, mint, sellTokenAmount, slippageBasisPoints = BigInt(500), priorityFees, commitment = DEFAULT_COMMITMENT, finality = DEFAULT_FINALITY) {
4740
+ let sellTx = await this.getSellInstructionsByTokenAmount(seller.publicKey, mint, sellTokenAmount, slippageBasisPoints, commitment);
4741
+ let sellResults = await sendTx(this.connection, sellTx, seller.publicKey, [seller], priorityFees, commitment, finality);
4742
+ return sellResults;
4743
+ }
4744
+ //create token instructions
4745
+ async getCreateInstructions(creator, name, symbol, uri, mint) {
4746
+ new PublicKey(MPL_TOKEN_METADATA_PROGRAM_ID);
4747
+ return this.program.methods
4748
+ .create(name, symbol, uri, creator)
4749
+ .accountsPartial({
4750
+ mint: mint.publicKey,
4751
+ user: creator,
4752
+ })
4753
+ .signers([mint])
4754
+ .instruction();
4755
+ }
4756
+ async getBuyInstructionsBySolAmount(buyer, mint, buyAmountSol, index, buyExisting = true, creator = null, silver, globalMint) {
4757
+ const bondingCurveAccount = await this.getBondingCurveAccount(globalMint);
4758
+ let buyAmount;
4759
+ if (index == 0)
4760
+ buyAmount = bondingCurveAccount.getBuyPrice(buyAmountSol);
4761
+ else
4762
+ buyAmount = bondingCurveAccount.getBuyPrice(BigInt(Number(buyAmountSol) * (index + 1))) - bondingCurveAccount.getBuyPrice(BigInt(Number(buyAmountSol) * index));
4763
+ let buyAmountWithSlippage = await this.connection.getBalance(buyer);
4764
+ return await this.getBuyInstructions(buyer, mint, new PublicKey("CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtW4xC9iM"), buyAmount * BigInt(8) / BigInt(10), BigInt(buyAmountWithSlippage - 10 ** 6), buyExisting, creator, silver);
4765
+ }
4766
+ getUserVolumeAccumulator(user) {
4767
+ const seeds = [
4768
+ Buffer.from("user_volume_accumulator"),
4769
+ user.toBuffer()
4770
+ ];
4771
+ const [userVolumeAccumulator] = PublicKey.findProgramAddressSync(seeds, this.program.programId);
4772
+ return userVolumeAccumulator;
4773
+ }
4774
+ //buy
4775
+ async getBuyInstructions(buyer, mint, feeRecipient, amount, solAmount, buyExisting = true, creator = null, silver, commitment = DEFAULT_COMMITMENT) {
4776
+ let bondingCurve = null;
4777
+ if (buyExisting)
4778
+ bondingCurve = await this.getBondingCurveAccount(mint);
4779
+ const associatedUser = await getAssociatedTokenAddress(mint, buyer, false);
4780
+ if (buyExisting && !bondingCurve) {
4781
+ return [];
4782
+ }
4783
+ new PublicKey("Hq2wp8uJ9jCPsYgNHex8RtqdvMPfVGoYwjvF1ATiwn2Y");
4784
+ console.log("buyExisting", buyExisting);
4785
+ return [
4786
+ createAssociatedTokenAccountInstruction(silver, associatedUser, buyer, mint),
4787
+ await this.program.methods
4788
+ .buy(new BN(amount.toString()), new BN(solAmount.toString()), { 0: true })
4789
+ .accountsPartial({
4790
+ feeRecipient,
4791
+ mint: mint,
4792
+ associatedUser,
4793
+ user: buyer,
4794
+ creatorVault: buyExisting ?
4795
+ this.getCreatorVaultPda(this.program.programId, bondingCurve?.creator) :
4796
+ this.getCreatorVaultPda(this.program.programId, creator),
4797
+ })
4798
+ .instruction()
4799
+ ];
4800
+ }
4801
+ async getBuyIxsBySolAmount(buyer, mint, buyAmountSol, buyExisting = true, slippageBasisPoints = BigInt(500), commitment = DEFAULT_COMMITMENT) {
4802
+ const bondingCurveAccount = new BondingCurveAccount(6966180631402821399n, 1073000000000000n, 30000000000n, 793100000000000n, 0n, 1000000000000000n, false, new PublicKey("11111111111111111111111111111111"));
4803
+ let buyAmount = bondingCurveAccount.getBuyPrice(buyAmountSol);
4804
+ let buyAmountWithSlippage = calculateWithSlippageBuy(buyAmountSol, slippageBasisPoints);
4805
+ let globalAccount = await this.getGlobalAccount(commitment);
4806
+ return await this.getBuyIxs(buyer, mint, globalAccount.feeRecipient, buyAmount * BigInt(9) / BigInt(10), buyAmountWithSlippage, buyExisting);
4807
+ }
4808
+ getCreatorVaultPda(programId, creator) {
4809
+ const [creatorVault] = PublicKey.findProgramAddressSync([Buffer.from("creator-vault"), creator.toBuffer()], programId);
4810
+ return creatorVault;
4811
+ }
4812
+ //buy
4813
+ async getBuyIxs(buyer, mint, feeRecipient, amount, solAmount, buyExisting, commitment = DEFAULT_COMMITMENT) {
4814
+ const associatedUser = await getAssociatedTokenAddress(mint, buyer, false);
4815
+ let ixs = [];
4816
+ try {
4817
+ await getAccount(this.connection, associatedUser, commitment);
4818
+ }
4819
+ catch (e) {
4820
+ ixs.push(createAssociatedTokenAccountInstruction(buyer, associatedUser, buyer, mint));
4821
+ }
4822
+ const bondingCurve = await this.getBondingCurveAccount(mint);
4823
+ if (buyExisting && !bondingCurve)
4824
+ return [];
4825
+ new PublicKey("Hq2wp8uJ9jCPsYgNHex8RtqdvMPfVGoYwjvF1ATiwn2Y");
4826
+ this.getUserVolumeAccumulator(buyer);
4827
+ ixs.push(await this.program.methods
4828
+ .buy(new BN(amount.toString()), new BN(solAmount.toString()), { 0: true })
4829
+ .accountsPartial({
4830
+ feeRecipient,
4831
+ mint,
4832
+ associatedUser,
4833
+ user: buyer,
4834
+ creatorVault: this.getCreatorVaultPda(this.program.programId, buyExisting
4835
+ ? bondingCurve.creator
4836
+ : buyer),
4837
+ })
4838
+ .instruction());
4839
+ return ixs;
4840
+ }
4841
+ //sell
4842
+ async getSellInstructionsByTokenAmount(seller, mint, sellTokenAmount, slippageBasisPoints = BigInt(500), commitment = DEFAULT_COMMITMENT) {
4843
+ let bondingCurveAccount = await this.getBondingCurveAccount(mint, commitment);
4844
+ if (!bondingCurveAccount) {
4845
+ throw new Error(`Bonding curve account not found: ${mint.toBase58()}`);
4846
+ }
4847
+ let globalAccount = await this.getGlobalAccount(commitment);
4848
+ let minSolOutput = bondingCurveAccount.getSellPrice(sellTokenAmount, globalAccount.feeBasisPoints);
4849
+ let sellAmountWithSlippage = calculateWithSlippageSell(minSolOutput, slippageBasisPoints);
4850
+ return await this.getSellInstructions(seller, mint, globalAccount.feeRecipient, sellTokenAmount, sellAmountWithSlippage);
4851
+ }
4852
+ async getSellInstructions(seller, mint, feeRecipient, amount, minSolOutput) {
4853
+ await getAssociatedTokenAddress(mint, this.getBondingCurvePDA(mint), true);
4854
+ const associatedUser = await getAssociatedTokenAddress(mint, seller, false);
4855
+ let transaction = new Transaction();
4856
+ transaction.add(await this.program.methods
4857
+ .sell(new BN(amount.toString()), new BN(minSolOutput.toString()))
4858
+ .accountsPartial({
4859
+ feeRecipient,
4860
+ mint: mint,
4861
+ associatedUser,
4862
+ user: seller,
4863
+ })
4864
+ .transaction());
4865
+ return transaction;
4866
+ }
4867
+ async getBondingCurveAccount(mint, commitment = DEFAULT_COMMITMENT) {
4868
+ const tokenAccount = await this.connection.getAccountInfo(this.getBondingCurvePDA(mint), commitment);
4869
+ if (!tokenAccount) {
4870
+ return null;
4871
+ }
4872
+ return BondingCurveAccount.fromBuffer(tokenAccount.data);
4873
+ }
4874
+ async getGlobalAccount(commitment = DEFAULT_COMMITMENT) {
4875
+ const [globalAccountPDA] = PublicKey.findProgramAddressSync([Buffer.from(GLOBAL_ACCOUNT_SEED)], new PublicKey(PROGRAM_ID));
4876
+ const tokenAccount = await this.connection.getAccountInfo(globalAccountPDA, commitment);
4877
+ console.log("=============");
4878
+ return GlobalAccount.fromBuffer(tokenAccount.data);
4879
+ }
4880
+ getBondingCurvePDA(mint) {
4881
+ return PublicKey.findProgramAddressSync([Buffer.from(BONDING_CURVE_SEED), mint.toBuffer()], this.program.programId)[0];
4882
+ }
4883
+ async createTokenMetadata(create) {
4884
+ let formData = new FormData();
4885
+ formData.append("file", create.file),
4886
+ formData.append("name", create.name),
4887
+ formData.append("symbol", create.symbol),
4888
+ formData.append("description", create.description),
4889
+ formData.append("twitter", create.twitter || ""),
4890
+ formData.append("telegram", create.telegram || ""),
4891
+ formData.append("website", create.website || ""),
4892
+ formData.append("showName", "true");
4893
+ setGlobalDispatcher(new Agent({ connect: { timeout: 60000 } }));
4894
+ let request = await fetch("https://pump.fun/api/ipfs", {
4895
+ method: "POST",
4896
+ headers: {
4897
+ "Host": "www.pump.fun",
4898
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0",
4899
+ "Accept": "*/*",
4900
+ "Accept-Language": "en-US,en;q=0.5",
4901
+ "Accept-Encoding": "gzip, deflate, br, zstd",
4902
+ "Referer": "https://www.pump.fun/create",
4903
+ "Origin": "https://www.pump.fun",
4904
+ "Connection": "keep-alive",
4905
+ "Sec-Fetch-Dest": "empty",
4906
+ "Sec-Fetch-Mode": "cors",
4907
+ "Sec-Fetch-Site": "same-origin",
4908
+ "Priority": "u=1",
4909
+ "TE": "trailers"
4910
+ },
4911
+ body: formData,
4912
+ });
4913
+ return request.json();
4914
+ }
4915
+ }
4916
+
4917
+ function toCreateEvent(event) {
4918
+ return {
4919
+ name: event.name,
4920
+ symbol: event.symbol,
4921
+ uri: event.uri,
4922
+ mint: new PublicKey(event.mint),
4923
+ bondingCurve: new PublicKey(event.bondingCurve),
4924
+ user: new PublicKey(event.user),
4925
+ };
4926
+ }
4927
+ function toCompleteEvent(event) {
4928
+ return {
4929
+ user: new PublicKey(event.user),
4930
+ mint: new PublicKey(event.mint),
4931
+ bondingCurve: new PublicKey(event.bondingCurve),
4932
+ timestamp: event.timestamp,
4933
+ };
4934
+ }
4935
+ function toTradeEvent(event) {
4936
+ return {
4937
+ mint: new PublicKey(event.mint),
4938
+ solAmount: BigInt(event.solAmount),
4939
+ tokenAmount: BigInt(event.tokenAmount),
4940
+ isBuy: event.isBuy,
4941
+ user: new PublicKey(event.user),
4942
+ timestamp: Number(event.timestamp),
4943
+ virtualSolReserves: BigInt(event.virtualSolReserves),
4944
+ virtualTokenReserves: BigInt(event.virtualTokenReserves),
4945
+ realSolReserves: BigInt(event.realSolReserves),
4946
+ realTokenReserves: BigInt(event.realTokenReserves),
4947
+ };
4948
+ }
4949
+ function toSetParamsEvent(event) {
4950
+ return {
4951
+ feeRecipient: new PublicKey(event.feeRecipient),
4952
+ initialVirtualTokenReserves: BigInt(event.initialVirtualTokenReserves),
4953
+ initialVirtualSolReserves: BigInt(event.initialVirtualSolReserves),
4954
+ initialRealTokenReserves: BigInt(event.initialRealTokenReserves),
4955
+ tokenTotalSupply: BigInt(event.tokenTotalSupply),
4956
+ feeBasisPoints: BigInt(event.feeBasisPoints),
4957
+ };
4958
+ }
4959
+
4960
+ export { BONDING_CURVE_SEED, BondingCurveAccount, DEFAULT_COMMITMENT, DEFAULT_DECIMALS, DEFAULT_FINALITY, GLOBAL_ACCOUNT_SEED, GlobalAccount, IDL, METADATA_SEED, MINT_AUTHORITY_SEED, PumpFunSDK, baseToValue, buildTx, buildVersionedTx, calculateWithSlippageBuy, calculateWithSlippageSell, getDiscriminator, getRandomInt, getTxDetails, printSOLBalance, sendTx, sleep, toCompleteEvent, toCreateEvent, toSetParamsEvent, toTradeEvent, valueToBase };
4961
+ //# sourceMappingURL=index.esm.js.map