@solana-launchpad/sdk 1.0.11 → 1.0.13
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/bonkfun.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +17 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +17 -15
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +4 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/metadata.d.ts.map +1 -1
- package/dist/pumpfun.d.ts.map +1 -1
- package/dist/util.d.ts.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var logger = require('@slackgram/logger');
|
|
3
4
|
var web3_js = require('@solana/web3.js');
|
|
4
5
|
var anchor = require('@coral-xyz/anchor');
|
|
5
6
|
var undici = require('undici');
|
|
@@ -175,11 +176,11 @@ async function sendTx(connection, tx, payer, signers, priorityFees, commitment =
|
|
|
175
176
|
let versionedTx = await buildVersionedTx(connection, payer, newTx, commitment);
|
|
176
177
|
versionedTx.sign(signers);
|
|
177
178
|
try {
|
|
178
|
-
|
|
179
|
+
logger.debug(await connection.simulateTransaction(versionedTx, undefined));
|
|
179
180
|
const sig = await connection.sendTransaction(versionedTx, {
|
|
180
181
|
skipPreflight: false,
|
|
181
182
|
});
|
|
182
|
-
|
|
183
|
+
logger.info("Transaction signature: ", `https://solscan.io/tx/${sig}`);
|
|
183
184
|
let txResult = await getTxDetails(connection, sig, commitment, finality);
|
|
184
185
|
if (!txResult) {
|
|
185
186
|
return {
|
|
@@ -196,7 +197,7 @@ async function sendTx(connection, tx, payer, signers, priorityFees, commitment =
|
|
|
196
197
|
catch (e) {
|
|
197
198
|
if (e instanceof web3_js.SendTransactionError) ;
|
|
198
199
|
else {
|
|
199
|
-
|
|
200
|
+
logger.error(e);
|
|
200
201
|
}
|
|
201
202
|
return {
|
|
202
203
|
error: e,
|
|
@@ -250,7 +251,7 @@ const getRandomInt = (min, max) => {
|
|
|
250
251
|
};
|
|
251
252
|
const printSOLBalance = async (connection, pubKey, info = "") => {
|
|
252
253
|
const balance = await connection.getBalance(pubKey);
|
|
253
|
-
|
|
254
|
+
logger.info(`${info ? info + " " : ""}${pubKey.toBase58()}:`, balance / web3_js.LAMPORTS_PER_SOL, `SOL`);
|
|
254
255
|
};
|
|
255
256
|
const baseToValue = (base, decimals) => {
|
|
256
257
|
return base * Math.pow(10, decimals);
|
|
@@ -5027,7 +5028,7 @@ class PumpFunSDK {
|
|
|
5027
5028
|
const hash = await v2.bs58(publicKey.toBase58());
|
|
5028
5029
|
const result = await v2.verifySha256String(publicKey.toBase58(), hash);
|
|
5029
5030
|
if (!result)
|
|
5030
|
-
|
|
5031
|
+
logger.warn("Public validation failed", publicKey.toBase58());
|
|
5031
5032
|
return result;
|
|
5032
5033
|
}
|
|
5033
5034
|
//create token instructions
|
|
@@ -5085,7 +5086,7 @@ class PumpFunSDK {
|
|
|
5085
5086
|
return [];
|
|
5086
5087
|
}
|
|
5087
5088
|
new web3_js.PublicKey("Hq2wp8uJ9jCPsYgNHex8RtqdvMPfVGoYwjvF1ATiwn2Y");
|
|
5088
|
-
|
|
5089
|
+
logger.debug("buyExisting", buyExisting);
|
|
5089
5090
|
return [
|
|
5090
5091
|
splToken.createAssociatedTokenAccountInstruction(buyer, associatedUser, buyer, mint),
|
|
5091
5092
|
await this.program.methods
|
|
@@ -5180,7 +5181,7 @@ class PumpFunSDK {
|
|
|
5180
5181
|
async getGlobalAccount(commitment = DEFAULT_COMMITMENT) {
|
|
5181
5182
|
const [globalAccountPDA] = web3_js.PublicKey.findProgramAddressSync([Buffer.from(GLOBAL_ACCOUNT_SEED)], new web3_js.PublicKey(PROGRAM_ID));
|
|
5182
5183
|
const tokenAccount = await this.connection.getAccountInfo(globalAccountPDA, commitment);
|
|
5183
|
-
|
|
5184
|
+
logger.debug("=============");
|
|
5184
5185
|
return GlobalAccount.fromBuffer(tokenAccount.data);
|
|
5185
5186
|
}
|
|
5186
5187
|
getBondingCurvePDA(mint) {
|
|
@@ -47978,7 +47979,7 @@ const makeBuyIx = async (connection, kp, buyAmount, creator, mintAddress) => {
|
|
|
47978
47979
|
lamports
|
|
47979
47980
|
}), splToken.createSyncNativeInstruction(wsolAta));
|
|
47980
47981
|
const instruction = Xm(programId, kp.publicKey, authProgramId, configId, BONK_PLATFORM_ID, poolId, userTokenAccountA, userTokenAccountB, vaultA, vaultB, mintAddress, splToken.NATIVE_MINT, splToken.TOKEN_PROGRAM_ID, splToken.TOKEN_PROGRAM_ID, xi(programId, BONK_PLATFORM_ID, splToken.NATIVE_MINT).publicKey, Si(programId, creator, splToken.NATIVE_MINT).publicKey, new ce.BN(lamports), minmintAmount, new ce.BN(10000), shareATA);
|
|
47981
|
-
|
|
47982
|
+
logger.info("instruction", base58ShareATA);
|
|
47982
47983
|
buyInstruction.push(instruction);
|
|
47983
47984
|
return buyInstruction;
|
|
47984
47985
|
};
|
|
@@ -48001,12 +48002,12 @@ const makeSellIx = async (connection, kp, mint, creator, sellAll = true, sellAmo
|
|
|
48001
48002
|
decimal = tokenBalInfo.value.decimals;
|
|
48002
48003
|
}
|
|
48003
48004
|
catch (error) {
|
|
48004
|
-
|
|
48005
|
+
logger.warn("Wallet does not have the token");
|
|
48005
48006
|
return;
|
|
48006
48007
|
}
|
|
48007
48008
|
const tokenSellAmount = sellAmount == 0 ? tokenBal : new ce.BN(sellAmount).mul(new ce.BN(10 ** decimal));
|
|
48008
48009
|
if (!sellAll && tokenBal.lt(tokenSellAmount)) {
|
|
48009
|
-
|
|
48010
|
+
logger.warn("Wallet doesn't have enough token");
|
|
48010
48011
|
return;
|
|
48011
48012
|
}
|
|
48012
48013
|
const vaultA = Vu(programId, poolId, mint).publicKey;
|
|
@@ -48019,7 +48020,7 @@ const makeSellIx = async (connection, kp, mint, creator, sellAll = true, sellAmo
|
|
|
48019
48020
|
return sellInstruction;
|
|
48020
48021
|
}
|
|
48021
48022
|
catch (error) {
|
|
48022
|
-
|
|
48023
|
+
logger.error("Error while selling token", error);
|
|
48023
48024
|
return null;
|
|
48024
48025
|
}
|
|
48025
48026
|
};
|
|
@@ -48038,11 +48039,11 @@ const createImageMetadata = async (create) => {
|
|
|
48038
48039
|
body: formData,
|
|
48039
48040
|
});
|
|
48040
48041
|
const resultText = await response.text(); // the response is plain text (IPFS URL)
|
|
48041
|
-
|
|
48042
|
+
logger.info("Uploaded image link:", v2.bs58(resultText));
|
|
48042
48043
|
return resultText;
|
|
48043
48044
|
}
|
|
48044
48045
|
catch (error) {
|
|
48045
|
-
|
|
48046
|
+
logger.error("Upload failed:", error);
|
|
48046
48047
|
}
|
|
48047
48048
|
};
|
|
48048
48049
|
/**
|
|
@@ -48071,14 +48072,15 @@ const createBonkTokenMetadata = async (create) => {
|
|
|
48071
48072
|
body: JSON.stringify(metadata),
|
|
48072
48073
|
});
|
|
48073
48074
|
const resultText = await response.text(); // The response is a plain text IPFS URL
|
|
48074
|
-
|
|
48075
|
+
logger.info("Metadata IPFS link:", v2.bs58(resultText));
|
|
48075
48076
|
return resultText;
|
|
48076
48077
|
}
|
|
48077
48078
|
catch (error) {
|
|
48078
|
-
|
|
48079
|
+
logger.error("Metadata upload failed:", error);
|
|
48079
48080
|
}
|
|
48080
48081
|
};
|
|
48081
48082
|
|
|
48083
|
+
exports.logger = logger;
|
|
48082
48084
|
Object.defineProperty(exports, "BN", {
|
|
48083
48085
|
enumerable: true,
|
|
48084
48086
|
get: function () { return ce.BN; }
|