pump-trader 1.0.4 → 1.0.6
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 +6 -2
- package/index.js +8 -2
- package/index.ts +9 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -753,6 +753,8 @@ class PumpTrader {
|
|
|
753
753
|
/* ---------- AMM 指令构建 ---------- */
|
|
754
754
|
createAmmBuyInstruction(poolInfo, userBaseAta, userQuoteAta, baseAmountOut, maxQuoteAmountIn, tokenProgramId) {
|
|
755
755
|
const { pool, poolKeys, globalConfig } = poolInfo;
|
|
756
|
+
const bondingCurveV2Mint = poolKeys.baseMint.equals(SOL_MINT) ? poolKeys.quoteMint : poolKeys.baseMint;
|
|
757
|
+
const [bondingCurveV2] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("bonding-curve-v2"), bondingCurveV2Mint.toBuffer()], PROGRAM_IDS.PUMP);
|
|
756
758
|
const [eventAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("__event_authority")], PROGRAM_IDS.PUMP_AMM);
|
|
757
759
|
const [coinCreatorVaultAuthority] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("creator_vault"), poolKeys.coinCreator.toBuffer()], PROGRAM_IDS.PUMP_AMM);
|
|
758
760
|
const coinCreatorVaultAta = (0, spl_token_1.getAssociatedTokenAddressSync)(SOL_MINT, coinCreatorVaultAuthority, true, spl_token_1.TOKEN_PROGRAM_ID, spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID);
|
|
@@ -786,13 +788,15 @@ class PumpTrader {
|
|
|
786
788
|
{ pubkey: globalVolumeAccumulator, isSigner: false, isWritable: false },
|
|
787
789
|
{ pubkey: userVolumeAccumulator, isSigner: false, isWritable: true },
|
|
788
790
|
{ pubkey: feeConfig, isSigner: false, isWritable: false },
|
|
789
|
-
{ pubkey: PROGRAM_IDS.FEE, isSigner: false, isWritable: false }
|
|
791
|
+
{ pubkey: PROGRAM_IDS.FEE, isSigner: false, isWritable: false },
|
|
792
|
+
{ pubkey: bondingCurveV2, isSigner: false, isWritable: false }
|
|
790
793
|
],
|
|
791
794
|
data: Buffer.concat([
|
|
792
795
|
DISCRIMINATORS.BUY,
|
|
793
796
|
u64(baseAmountOut),
|
|
794
797
|
u64(maxQuoteAmountIn),
|
|
795
|
-
|
|
798
|
+
// trackVolume = Some(false) to avoid recent overflow path in pump-amm buy accounting
|
|
799
|
+
Buffer.from([1, 0])
|
|
796
800
|
])
|
|
797
801
|
});
|
|
798
802
|
}
|
package/index.js
CHANGED
|
@@ -1070,6 +1070,11 @@ export class PumpTrader {
|
|
|
1070
1070
|
|
|
1071
1071
|
createAmmBuyInstruction(poolInfo, userBaseAta, userQuoteAta, baseAmountOut, maxQuoteAmountIn, tokenProgramId) {
|
|
1072
1072
|
const { pool, poolKeys, globalConfig } = poolInfo;
|
|
1073
|
+
const bondingCurveV2Mint = poolKeys.baseMint.equals(SOL_MINT) ? poolKeys.quoteMint : poolKeys.baseMint;
|
|
1074
|
+
const [bondingCurveV2] = PublicKey.findProgramAddressSync(
|
|
1075
|
+
[Buffer.from("bonding-curve-v2"), bondingCurveV2Mint.toBuffer()],
|
|
1076
|
+
PROGRAM_IDS.PUMP
|
|
1077
|
+
);
|
|
1073
1078
|
|
|
1074
1079
|
const [eventAuthority] = PublicKey.findProgramAddressSync(
|
|
1075
1080
|
[Buffer.from("__event_authority")],
|
|
@@ -1138,13 +1143,14 @@ export class PumpTrader {
|
|
|
1138
1143
|
{ pubkey: globalVolumeAccumulator, isSigner: false, isWritable: false },
|
|
1139
1144
|
{ pubkey: userVolumeAccumulator, isSigner: false, isWritable: true },
|
|
1140
1145
|
{ pubkey: feeConfig, isSigner: false, isWritable: false },
|
|
1141
|
-
{ pubkey: PROGRAM_IDS.FEE, isSigner: false, isWritable: false }
|
|
1146
|
+
{ pubkey: PROGRAM_IDS.FEE, isSigner: false, isWritable: false },
|
|
1147
|
+
{ pubkey: bondingCurveV2, isSigner: false, isWritable: false }
|
|
1142
1148
|
],
|
|
1143
1149
|
data: Buffer.concat([
|
|
1144
1150
|
DISCRIMINATORS.BUY,
|
|
1145
1151
|
u64(baseAmountOut),
|
|
1146
1152
|
u64(maxQuoteAmountIn),
|
|
1147
|
-
Buffer.from([1,
|
|
1153
|
+
Buffer.from([1, 0]) // trackVolume = Some(false)
|
|
1148
1154
|
])
|
|
1149
1155
|
});
|
|
1150
1156
|
}
|
package/index.ts
CHANGED
|
@@ -1183,6 +1183,11 @@ export class PumpTrader {
|
|
|
1183
1183
|
tokenProgramId: PublicKey
|
|
1184
1184
|
): TransactionInstruction {
|
|
1185
1185
|
const { pool, poolKeys, globalConfig } = poolInfo;
|
|
1186
|
+
const bondingCurveV2Mint = poolKeys.baseMint.equals(SOL_MINT) ? poolKeys.quoteMint : poolKeys.baseMint;
|
|
1187
|
+
const [bondingCurveV2] = PublicKey.findProgramAddressSync(
|
|
1188
|
+
[Buffer.from("bonding-curve-v2"), bondingCurveV2Mint.toBuffer()],
|
|
1189
|
+
PROGRAM_IDS.PUMP
|
|
1190
|
+
);
|
|
1186
1191
|
|
|
1187
1192
|
const [eventAuthority] = PublicKey.findProgramAddressSync(
|
|
1188
1193
|
[Buffer.from("__event_authority")],
|
|
@@ -1251,13 +1256,15 @@ export class PumpTrader {
|
|
|
1251
1256
|
{ pubkey: globalVolumeAccumulator, isSigner: false, isWritable: false },
|
|
1252
1257
|
{ pubkey: userVolumeAccumulator, isSigner: false, isWritable: true },
|
|
1253
1258
|
{ pubkey: feeConfig, isSigner: false, isWritable: false },
|
|
1254
|
-
{ pubkey: PROGRAM_IDS.FEE, isSigner: false, isWritable: false }
|
|
1259
|
+
{ pubkey: PROGRAM_IDS.FEE, isSigner: false, isWritable: false },
|
|
1260
|
+
{ pubkey: bondingCurveV2, isSigner: false, isWritable: false }
|
|
1255
1261
|
],
|
|
1256
1262
|
data: Buffer.concat([
|
|
1257
1263
|
DISCRIMINATORS.BUY,
|
|
1258
1264
|
u64(baseAmountOut),
|
|
1259
1265
|
u64(maxQuoteAmountIn),
|
|
1260
|
-
|
|
1266
|
+
// trackVolume = Some(false) to avoid recent overflow path in pump-amm buy accounting
|
|
1267
|
+
Buffer.from([1, 0])
|
|
1261
1268
|
])
|
|
1262
1269
|
});
|
|
1263
1270
|
}
|