pump-trader 1.0.2 → 1.0.4
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.d.ts +2 -2
- package/dist/index.js +15 -11
- package/index.js +18 -13
- package/index.ts +19 -13
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -158,8 +158,8 @@ export declare class PumpTrader {
|
|
|
158
158
|
protocolFeeRecipients: PublicKey[];
|
|
159
159
|
};
|
|
160
160
|
getAmmPoolReserves(poolKeys: any): Promise<PoolReserves>;
|
|
161
|
-
createAmmBuyInstruction(poolInfo: PoolInfo, userBaseAta: PublicKey, userQuoteAta: PublicKey, baseAmountOut: bigint, maxQuoteAmountIn: bigint): TransactionInstruction;
|
|
162
|
-
createAmmSellInstruction(poolInfo: PoolInfo, userBaseAta: PublicKey, userQuoteAta: PublicKey, baseAmountIn: bigint, minQuoteAmountOut: bigint): TransactionInstruction;
|
|
161
|
+
createAmmBuyInstruction(poolInfo: PoolInfo, userBaseAta: PublicKey, userQuoteAta: PublicKey, baseAmountOut: bigint, maxQuoteAmountIn: bigint, tokenProgramId: PublicKey): TransactionInstruction;
|
|
162
|
+
createAmmSellInstruction(poolInfo: PoolInfo, userBaseAta: PublicKey, userQuoteAta: PublicKey, baseAmountIn: bigint, minQuoteAmountOut: bigint, tokenProgramId: PublicKey): TransactionInstruction;
|
|
163
163
|
confirmTransactionWithPolling(signature: string, lastValidBlockHeight: number, maxAttempts?: number, delayMs?: number): Promise<string>;
|
|
164
164
|
listenTrades(callback: (event: TradeEvent) => void, mintFilter?: PublicKey | null): number;
|
|
165
165
|
fetchMeta(tokenAddr: string): Promise<MetadataInfo | null>;
|
package/dist/index.js
CHANGED
|
@@ -605,25 +605,28 @@ class PumpTrader {
|
|
|
605
605
|
async ammBuy(tokenAddr, totalSolIn, tradeOpt) {
|
|
606
606
|
const mint = new web3_js_1.PublicKey(tokenAddr);
|
|
607
607
|
const poolInfo = await this.getAmmPoolInfo(mint);
|
|
608
|
-
const reserves = await this.getAmmPoolReserves(poolInfo.poolKeys);
|
|
609
608
|
const solChunks = this.splitByMax(totalSolIn, tradeOpt.maxSolPerTx);
|
|
609
|
+
const tokenProgram = await this.detectTokenProgram(tokenAddr);
|
|
610
610
|
const pendingTransactions = [];
|
|
611
611
|
const failedTransactions = [];
|
|
612
612
|
for (let i = 0; i < solChunks.length; i++) {
|
|
613
613
|
try {
|
|
614
614
|
const solIn = solChunks[i];
|
|
615
|
-
const
|
|
616
|
-
const
|
|
615
|
+
const reserves = await this.getAmmPoolReserves(poolInfo.poolKeys);
|
|
616
|
+
const rawSlippageBps = this.calcSlippage({
|
|
617
617
|
tradeSize: solIn,
|
|
618
618
|
reserve: reserves.quoteAmount,
|
|
619
619
|
slippageOpt: tradeOpt.slippage
|
|
620
620
|
});
|
|
621
|
+
const slippageBps = Math.max(0, Math.min(rawSlippageBps, 9000));
|
|
621
622
|
const maxQuoteIn = (solIn * BigInt(10_000 + slippageBps)) / 10000n;
|
|
623
|
+
const estimatedBaseOut = this.calculateAmmBuyOutput(solIn, reserves);
|
|
624
|
+
const baseAmountOut = ((estimatedBaseOut * BigInt(10_000 - slippageBps)) / 10000n) || 1n;
|
|
622
625
|
const priority = this.genPriority(tradeOpt.priority);
|
|
623
626
|
const tx = new web3_js_1.Transaction().add(web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 300_000 }), web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: priority }));
|
|
624
|
-
const userBaseAta = await this.ensureAta(tx, poolInfo.poolKeys.baseMint);
|
|
627
|
+
const userBaseAta = await this.ensureAta(tx, poolInfo.poolKeys.baseMint, tokenProgram.programId);
|
|
625
628
|
const userQuoteAta = await this.ensureWSOLAta(tx, this.wallet.publicKey, "buy", maxQuoteIn);
|
|
626
|
-
const buyIx = this.createAmmBuyInstruction(poolInfo, userBaseAta, userQuoteAta, baseAmountOut, maxQuoteIn);
|
|
629
|
+
const buyIx = this.createAmmBuyInstruction(poolInfo, userBaseAta, userQuoteAta, baseAmountOut, maxQuoteIn, tokenProgram.programId);
|
|
627
630
|
tx.add(buyIx);
|
|
628
631
|
tx.add((0, spl_token_1.createCloseAccountInstruction)(userQuoteAta, this.wallet.publicKey, this.wallet.publicKey));
|
|
629
632
|
const { blockhash, lastValidBlockHeight } = await this.connection.getLatestBlockhash('finalized');
|
|
@@ -654,6 +657,7 @@ class PumpTrader {
|
|
|
654
657
|
const poolInfo = await this.getAmmPoolInfo(mint);
|
|
655
658
|
const reserves = await this.getAmmPoolReserves(poolInfo.poolKeys);
|
|
656
659
|
const totalSolOut = this.calculateAmmSellOutput(totalTokenIn, reserves);
|
|
660
|
+
const tokenProgram = await this.detectTokenProgram(tokenAddr);
|
|
657
661
|
const tokenChunks = totalSolOut <= tradeOpt.maxSolPerTx
|
|
658
662
|
? [totalTokenIn]
|
|
659
663
|
: this.splitIntoN(totalTokenIn, Number((totalSolOut + tradeOpt.maxSolPerTx - 1n) / tradeOpt.maxSolPerTx));
|
|
@@ -671,9 +675,9 @@ class PumpTrader {
|
|
|
671
675
|
const minQuoteOut = (solOut * BigInt(10_000 - slippageBps)) / 10000n;
|
|
672
676
|
const priority = this.genPriority(tradeOpt.priority);
|
|
673
677
|
const tx = new web3_js_1.Transaction().add(web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({ units: 300_000 }), web3_js_1.ComputeBudgetProgram.setComputeUnitPrice({ microLamports: priority }));
|
|
674
|
-
const userBaseAta = await this.ensureAta(tx, poolInfo.poolKeys.baseMint);
|
|
678
|
+
const userBaseAta = await this.ensureAta(tx, poolInfo.poolKeys.baseMint, tokenProgram.programId);
|
|
675
679
|
const userQuoteAta = await this.ensureWSOLAta(tx, this.wallet.publicKey, "sell");
|
|
676
|
-
const sellIx = this.createAmmSellInstruction(poolInfo, userBaseAta, userQuoteAta, tokenIn, minQuoteOut);
|
|
680
|
+
const sellIx = this.createAmmSellInstruction(poolInfo, userBaseAta, userQuoteAta, tokenIn, minQuoteOut, tokenProgram.programId);
|
|
677
681
|
tx.add(sellIx);
|
|
678
682
|
tx.add((0, spl_token_1.createCloseAccountInstruction)(userQuoteAta, this.wallet.publicKey, this.wallet.publicKey));
|
|
679
683
|
const { blockhash, lastValidBlockHeight } = await this.connection.getLatestBlockhash('finalized');
|
|
@@ -747,7 +751,7 @@ class PumpTrader {
|
|
|
747
751
|
};
|
|
748
752
|
}
|
|
749
753
|
/* ---------- AMM 指令构建 ---------- */
|
|
750
|
-
createAmmBuyInstruction(poolInfo, userBaseAta, userQuoteAta, baseAmountOut, maxQuoteAmountIn) {
|
|
754
|
+
createAmmBuyInstruction(poolInfo, userBaseAta, userQuoteAta, baseAmountOut, maxQuoteAmountIn, tokenProgramId) {
|
|
751
755
|
const { pool, poolKeys, globalConfig } = poolInfo;
|
|
752
756
|
const [eventAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("__event_authority")], PROGRAM_IDS.PUMP_AMM);
|
|
753
757
|
const [coinCreatorVaultAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("creator_vault"), poolKeys.coinCreator.toBuffer()], PROGRAM_IDS.PUMP_AMM);
|
|
@@ -771,7 +775,7 @@ class PumpTrader {
|
|
|
771
775
|
{ pubkey: poolKeys.poolQuoteTokenAccount, isSigner: false, isWritable: true },
|
|
772
776
|
{ pubkey: protocolFeeRecipient, isSigner: false, isWritable: false },
|
|
773
777
|
{ pubkey: protocolFeeRecipientTokenAccount, isSigner: false, isWritable: true },
|
|
774
|
-
{ pubkey:
|
|
778
|
+
{ pubkey: tokenProgramId, isSigner: false, isWritable: false },
|
|
775
779
|
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
776
780
|
{ pubkey: web3_js_1.SystemProgram.programId, isSigner: false, isWritable: false },
|
|
777
781
|
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
@@ -792,7 +796,7 @@ class PumpTrader {
|
|
|
792
796
|
])
|
|
793
797
|
});
|
|
794
798
|
}
|
|
795
|
-
createAmmSellInstruction(poolInfo, userBaseAta, userQuoteAta, baseAmountIn, minQuoteAmountOut) {
|
|
799
|
+
createAmmSellInstruction(poolInfo, userBaseAta, userQuoteAta, baseAmountIn, minQuoteAmountOut, tokenProgramId) {
|
|
796
800
|
const { pool, poolKeys, globalConfig } = poolInfo;
|
|
797
801
|
const [eventAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("__event_authority")], PROGRAM_IDS.PUMP_AMM);
|
|
798
802
|
const [coinCreatorVaultAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("creator_vault"), poolKeys.coinCreator.toBuffer()], PROGRAM_IDS.PUMP_AMM);
|
|
@@ -814,7 +818,7 @@ class PumpTrader {
|
|
|
814
818
|
{ pubkey: poolKeys.poolQuoteTokenAccount, isSigner: false, isWritable: true },
|
|
815
819
|
{ pubkey: protocolFeeRecipient, isSigner: false, isWritable: false },
|
|
816
820
|
{ pubkey: protocolFeeRecipientTokenAccount, isSigner: false, isWritable: true },
|
|
817
|
-
{ pubkey:
|
|
821
|
+
{ pubkey: tokenProgramId, isSigner: false, isWritable: false },
|
|
818
822
|
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
819
823
|
{ pubkey: web3_js_1.SystemProgram.programId, isSigner: false, isWritable: false },
|
|
820
824
|
{ pubkey: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
package/index.js
CHANGED
|
@@ -836,22 +836,24 @@ export class PumpTrader {
|
|
|
836
836
|
async ammBuy(tokenAddr, totalSolIn, tradeOpt) {
|
|
837
837
|
const mint = new PublicKey(tokenAddr);
|
|
838
838
|
const poolInfo = await this.getAmmPoolInfo(mint);
|
|
839
|
-
const reserves = await this.getAmmPoolReserves(poolInfo.poolKeys);
|
|
840
839
|
const solChunks = this.splitByMax(totalSolIn, tradeOpt.maxSolPerTx);
|
|
841
|
-
|
|
840
|
+
const tokenProgram = await this.detectTokenProgram(tokenAddr);
|
|
842
841
|
const pendingTransactions = [];
|
|
843
842
|
const failedTransactions = [];
|
|
844
843
|
|
|
845
844
|
for (let i = 0; i < solChunks.length; i++) {
|
|
846
845
|
try {
|
|
847
846
|
const solIn = solChunks[i];
|
|
848
|
-
const
|
|
849
|
-
const
|
|
847
|
+
const reserves = await this.getAmmPoolReserves(poolInfo.poolKeys);
|
|
848
|
+
const rawSlippageBps = this.calcSlippage({
|
|
850
849
|
tradeSize: solIn,
|
|
851
850
|
reserve: reserves.quoteAmount,
|
|
852
851
|
slippageOpt: tradeOpt.slippage
|
|
853
852
|
});
|
|
853
|
+
const slippageBps = Math.max(0, Math.min(rawSlippageBps, 9000));
|
|
854
854
|
const maxQuoteIn = (solIn * BigInt(10_000 + slippageBps)) / 10_000n;
|
|
855
|
+
const estimatedBaseOut = this.calculateAmmBuyOutput(solIn, reserves);
|
|
856
|
+
const baseAmountOut = ((estimatedBaseOut * BigInt(10_000 - slippageBps)) / 10_000n) || 1n;
|
|
855
857
|
const priority = this.genPriority(tradeOpt.priority);
|
|
856
858
|
|
|
857
859
|
const tx = new Transaction().add(
|
|
@@ -859,7 +861,7 @@ export class PumpTrader {
|
|
|
859
861
|
ComputeBudgetProgram.setComputeUnitPrice({ microLamports: priority })
|
|
860
862
|
);
|
|
861
863
|
|
|
862
|
-
const userBaseAta = await this.ensureAta(tx, poolInfo.poolKeys.baseMint);
|
|
864
|
+
const userBaseAta = await this.ensureAta(tx, poolInfo.poolKeys.baseMint, tokenProgram.programId);
|
|
863
865
|
const userQuoteAta = await this.ensureWSOLAta(
|
|
864
866
|
tx,
|
|
865
867
|
this.wallet.publicKey,
|
|
@@ -872,7 +874,8 @@ export class PumpTrader {
|
|
|
872
874
|
userBaseAta,
|
|
873
875
|
userQuoteAta,
|
|
874
876
|
baseAmountOut,
|
|
875
|
-
maxQuoteIn
|
|
877
|
+
maxQuoteIn,
|
|
878
|
+
tokenProgram.programId
|
|
876
879
|
);
|
|
877
880
|
|
|
878
881
|
tx.add(buyIx);
|
|
@@ -916,6 +919,7 @@ export class PumpTrader {
|
|
|
916
919
|
const poolInfo = await this.getAmmPoolInfo(mint);
|
|
917
920
|
const reserves = await this.getAmmPoolReserves(poolInfo.poolKeys);
|
|
918
921
|
const totalSolOut = this.calculateAmmSellOutput(totalTokenIn, reserves);
|
|
922
|
+
const tokenProgram = await this.detectTokenProgram(tokenAddr);
|
|
919
923
|
|
|
920
924
|
const tokenChunks = totalSolOut <= tradeOpt.maxSolPerTx
|
|
921
925
|
? [totalTokenIn]
|
|
@@ -944,7 +948,7 @@ export class PumpTrader {
|
|
|
944
948
|
ComputeBudgetProgram.setComputeUnitPrice({ microLamports: priority })
|
|
945
949
|
);
|
|
946
950
|
|
|
947
|
-
const userBaseAta = await this.ensureAta(tx, poolInfo.poolKeys.baseMint);
|
|
951
|
+
const userBaseAta = await this.ensureAta(tx, poolInfo.poolKeys.baseMint, tokenProgram.programId);
|
|
948
952
|
const userQuoteAta = await this.ensureWSOLAta(tx, this.wallet.publicKey, "sell");
|
|
949
953
|
|
|
950
954
|
const sellIx = this.createAmmSellInstruction(
|
|
@@ -952,7 +956,8 @@ export class PumpTrader {
|
|
|
952
956
|
userBaseAta,
|
|
953
957
|
userQuoteAta,
|
|
954
958
|
tokenIn,
|
|
955
|
-
minQuoteOut
|
|
959
|
+
minQuoteOut,
|
|
960
|
+
tokenProgram.programId
|
|
956
961
|
);
|
|
957
962
|
|
|
958
963
|
tx.add(sellIx);
|
|
@@ -1063,7 +1068,7 @@ export class PumpTrader {
|
|
|
1063
1068
|
|
|
1064
1069
|
/* ---------- AMM 指令构建 ---------- */
|
|
1065
1070
|
|
|
1066
|
-
createAmmBuyInstruction(poolInfo, userBaseAta, userQuoteAta, baseAmountOut, maxQuoteAmountIn) {
|
|
1071
|
+
createAmmBuyInstruction(poolInfo, userBaseAta, userQuoteAta, baseAmountOut, maxQuoteAmountIn, tokenProgramId) {
|
|
1067
1072
|
const { pool, poolKeys, globalConfig } = poolInfo;
|
|
1068
1073
|
|
|
1069
1074
|
const [eventAuthority] = PublicKey.findProgramAddressSync(
|
|
@@ -1122,7 +1127,7 @@ export class PumpTrader {
|
|
|
1122
1127
|
{ pubkey: poolKeys.poolQuoteTokenAccount, isSigner: false, isWritable: true },
|
|
1123
1128
|
{ pubkey: protocolFeeRecipient, isSigner: false, isWritable: false },
|
|
1124
1129
|
{ pubkey: protocolFeeRecipientTokenAccount, isSigner: false, isWritable: true },
|
|
1125
|
-
{ pubkey:
|
|
1130
|
+
{ pubkey: tokenProgramId, isSigner: false, isWritable: false },
|
|
1126
1131
|
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
1127
1132
|
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
1128
1133
|
{ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
@@ -1144,7 +1149,7 @@ export class PumpTrader {
|
|
|
1144
1149
|
});
|
|
1145
1150
|
}
|
|
1146
1151
|
|
|
1147
|
-
createAmmSellInstruction(poolInfo, userBaseAta, userQuoteAta, baseAmountIn, minQuoteAmountOut) {
|
|
1152
|
+
createAmmSellInstruction(poolInfo, userBaseAta, userQuoteAta, baseAmountIn, minQuoteAmountOut, tokenProgramId) {
|
|
1148
1153
|
const { pool, poolKeys, globalConfig } = poolInfo;
|
|
1149
1154
|
|
|
1150
1155
|
const [eventAuthority] = PublicKey.findProgramAddressSync(
|
|
@@ -1193,7 +1198,7 @@ export class PumpTrader {
|
|
|
1193
1198
|
{ pubkey: poolKeys.poolQuoteTokenAccount, isSigner: false, isWritable: true },
|
|
1194
1199
|
{ pubkey: protocolFeeRecipient, isSigner: false, isWritable: false },
|
|
1195
1200
|
{ pubkey: protocolFeeRecipientTokenAccount, isSigner: false, isWritable: true },
|
|
1196
|
-
{ pubkey:
|
|
1201
|
+
{ pubkey: tokenProgramId, isSigner: false, isWritable: false },
|
|
1197
1202
|
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
1198
1203
|
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
1199
1204
|
{ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
@@ -1370,4 +1375,4 @@ export class PumpTrader {
|
|
|
1370
1375
|
getCachedTokenProgram(tokenAddr) {
|
|
1371
1376
|
return this.tokenProgramCache.get(tokenAddr);
|
|
1372
1377
|
}
|
|
1373
|
-
}
|
|
1378
|
+
}
|
package/index.ts
CHANGED
|
@@ -943,22 +943,24 @@ export class PumpTrader {
|
|
|
943
943
|
async ammBuy(tokenAddr: string, totalSolIn: bigint, tradeOpt: TradeOptions): Promise<TradeResult> {
|
|
944
944
|
const mint = new PublicKey(tokenAddr);
|
|
945
945
|
const poolInfo = await this.getAmmPoolInfo(mint);
|
|
946
|
-
const reserves = await this.getAmmPoolReserves(poolInfo.poolKeys);
|
|
947
946
|
const solChunks = this.splitByMax(totalSolIn, tradeOpt.maxSolPerTx);
|
|
948
|
-
|
|
947
|
+
const tokenProgram = await this.detectTokenProgram(tokenAddr);
|
|
949
948
|
const pendingTransactions: PendingTransaction[] = [];
|
|
950
949
|
const failedTransactions: FailedTransaction[] = [];
|
|
951
950
|
|
|
952
951
|
for (let i = 0; i < solChunks.length; i++) {
|
|
953
952
|
try {
|
|
954
953
|
const solIn = solChunks[i];
|
|
955
|
-
const
|
|
956
|
-
const
|
|
954
|
+
const reserves = await this.getAmmPoolReserves(poolInfo.poolKeys);
|
|
955
|
+
const rawSlippageBps = this.calcSlippage({
|
|
957
956
|
tradeSize: solIn,
|
|
958
957
|
reserve: reserves.quoteAmount,
|
|
959
958
|
slippageOpt: tradeOpt.slippage
|
|
960
959
|
});
|
|
960
|
+
const slippageBps = Math.max(0, Math.min(rawSlippageBps, 9000));
|
|
961
961
|
const maxQuoteIn = (solIn * BigInt(10_000 + slippageBps)) / 10_000n;
|
|
962
|
+
const estimatedBaseOut = this.calculateAmmBuyOutput(solIn, reserves);
|
|
963
|
+
const baseAmountOut = ((estimatedBaseOut * BigInt(10_000 - slippageBps)) / 10_000n) || 1n;
|
|
962
964
|
const priority = this.genPriority(tradeOpt.priority);
|
|
963
965
|
|
|
964
966
|
const tx = new Transaction().add(
|
|
@@ -966,7 +968,7 @@ export class PumpTrader {
|
|
|
966
968
|
ComputeBudgetProgram.setComputeUnitPrice({ microLamports: priority })
|
|
967
969
|
);
|
|
968
970
|
|
|
969
|
-
const userBaseAta = await this.ensureAta(tx, poolInfo.poolKeys.baseMint);
|
|
971
|
+
const userBaseAta = await this.ensureAta(tx, poolInfo.poolKeys.baseMint, tokenProgram.programId);
|
|
970
972
|
const userQuoteAta = await this.ensureWSOLAta(
|
|
971
973
|
tx,
|
|
972
974
|
this.wallet.publicKey,
|
|
@@ -979,7 +981,8 @@ export class PumpTrader {
|
|
|
979
981
|
userBaseAta,
|
|
980
982
|
userQuoteAta,
|
|
981
983
|
baseAmountOut,
|
|
982
|
-
maxQuoteIn
|
|
984
|
+
maxQuoteIn,
|
|
985
|
+
tokenProgram.programId
|
|
983
986
|
);
|
|
984
987
|
|
|
985
988
|
tx.add(buyIx);
|
|
@@ -1023,7 +1026,7 @@ export class PumpTrader {
|
|
|
1023
1026
|
const poolInfo = await this.getAmmPoolInfo(mint);
|
|
1024
1027
|
const reserves = await this.getAmmPoolReserves(poolInfo.poolKeys);
|
|
1025
1028
|
const totalSolOut = this.calculateAmmSellOutput(totalTokenIn, reserves);
|
|
1026
|
-
|
|
1029
|
+
const tokenProgram = await this.detectTokenProgram(tokenAddr);
|
|
1027
1030
|
const tokenChunks = totalSolOut <= tradeOpt.maxSolPerTx
|
|
1028
1031
|
? [totalTokenIn]
|
|
1029
1032
|
: this.splitIntoN(
|
|
@@ -1051,7 +1054,7 @@ export class PumpTrader {
|
|
|
1051
1054
|
ComputeBudgetProgram.setComputeUnitPrice({ microLamports: priority })
|
|
1052
1055
|
);
|
|
1053
1056
|
|
|
1054
|
-
const userBaseAta = await this.ensureAta(tx, poolInfo.poolKeys.baseMint);
|
|
1057
|
+
const userBaseAta = await this.ensureAta(tx, poolInfo.poolKeys.baseMint, tokenProgram.programId);
|
|
1055
1058
|
const userQuoteAta = await this.ensureWSOLAta(tx, this.wallet.publicKey, "sell");
|
|
1056
1059
|
|
|
1057
1060
|
const sellIx = this.createAmmSellInstruction(
|
|
@@ -1059,7 +1062,8 @@ export class PumpTrader {
|
|
|
1059
1062
|
userBaseAta,
|
|
1060
1063
|
userQuoteAta,
|
|
1061
1064
|
tokenIn,
|
|
1062
|
-
minQuoteOut
|
|
1065
|
+
minQuoteOut,
|
|
1066
|
+
tokenProgram.programId
|
|
1063
1067
|
);
|
|
1064
1068
|
|
|
1065
1069
|
tx.add(sellIx);
|
|
@@ -1175,7 +1179,8 @@ export class PumpTrader {
|
|
|
1175
1179
|
userBaseAta: PublicKey,
|
|
1176
1180
|
userQuoteAta: PublicKey,
|
|
1177
1181
|
baseAmountOut: bigint,
|
|
1178
|
-
maxQuoteAmountIn: bigint
|
|
1182
|
+
maxQuoteAmountIn: bigint,
|
|
1183
|
+
tokenProgramId: PublicKey
|
|
1179
1184
|
): TransactionInstruction {
|
|
1180
1185
|
const { pool, poolKeys, globalConfig } = poolInfo;
|
|
1181
1186
|
|
|
@@ -1235,7 +1240,7 @@ export class PumpTrader {
|
|
|
1235
1240
|
{ pubkey: poolKeys.poolQuoteTokenAccount, isSigner: false, isWritable: true },
|
|
1236
1241
|
{ pubkey: protocolFeeRecipient, isSigner: false, isWritable: false },
|
|
1237
1242
|
{ pubkey: protocolFeeRecipientTokenAccount, isSigner: false, isWritable: true },
|
|
1238
|
-
{ pubkey:
|
|
1243
|
+
{ pubkey: tokenProgramId, isSigner: false, isWritable: false },
|
|
1239
1244
|
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
1240
1245
|
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
1241
1246
|
{ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
@@ -1262,7 +1267,8 @@ export class PumpTrader {
|
|
|
1262
1267
|
userBaseAta: PublicKey,
|
|
1263
1268
|
userQuoteAta: PublicKey,
|
|
1264
1269
|
baseAmountIn: bigint,
|
|
1265
|
-
minQuoteAmountOut: bigint
|
|
1270
|
+
minQuoteAmountOut: bigint,
|
|
1271
|
+
tokenProgramId: PublicKey
|
|
1266
1272
|
): TransactionInstruction {
|
|
1267
1273
|
const { pool, poolKeys, globalConfig } = poolInfo;
|
|
1268
1274
|
|
|
@@ -1312,7 +1318,7 @@ export class PumpTrader {
|
|
|
1312
1318
|
{ pubkey: poolKeys.poolQuoteTokenAccount, isSigner: false, isWritable: true },
|
|
1313
1319
|
{ pubkey: protocolFeeRecipient, isSigner: false, isWritable: false },
|
|
1314
1320
|
{ pubkey: protocolFeeRecipientTokenAccount, isSigner: false, isWritable: true },
|
|
1315
|
-
{ pubkey:
|
|
1321
|
+
{ pubkey: tokenProgramId, isSigner: false, isWritable: false },
|
|
1316
1322
|
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
1317
1323
|
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
1318
1324
|
{ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|