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