@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.
@@ -1 +1 @@
1
- {"version":3,"file":"bonkfun.d.ts","sourceRoot":"","sources":["../src/bonkfun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAuC,MAAM,iBAAiB,CAAC;AA0B9H,eAAO,MAAM,gBAAgB,WAAgE,CAAC;AAE9F,eAAO,MAAM,SAAS,GAAU,YAAY,UAAU,EAAE,IAAI,OAAO,EAAE,WAAW,MAAM,EAAE,SAAS,SAAS,EAAE,aAAa,SAAS,sCAkFjI,CAAA;AAED,eAAO,MAAM,UAAU,GAAU,YAAY,UAAU,EAAE,IAAI,OAAO,EAAE,MAAM,SAAS,EAAE,SAAS,SAAS,EAAE,UAAS,OAAc,EAAE,aAAY,MAAU,yDA0EzJ,CAAA"}
1
+ {"version":3,"file":"bonkfun.d.ts","sourceRoot":"","sources":["../src/bonkfun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAuC,MAAM,iBAAiB,CAAC;AA2B9H,eAAO,MAAM,gBAAgB,WAAgE,CAAC;AAE9F,eAAO,MAAM,SAAS,GAAU,YAAY,UAAU,EAAE,IAAI,OAAO,EAAE,WAAW,MAAM,EAAE,SAAS,SAAS,EAAE,aAAa,SAAS,sCAkFjI,CAAA;AAED,eAAO,MAAM,UAAU,GAAU,YAAY,UAAU,EAAE,IAAI,OAAO,EAAE,MAAM,SAAS,EAAE,SAAS,SAAS,EAAE,UAAS,OAAc,EAAE,aAAY,MAAU,yDA0EzJ,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { logger } from './logger';
1
2
  export { PumpFunSDK, DEFAULT_DECIMALS, GLOBAL_ACCOUNT_SEED, MINT_AUTHORITY_SEED, BONDING_CURVE_SEED, METADATA_SEED } from './pumpfun';
2
3
  export type { CreateTokenMetadata, TokenMetadata, CreateEvent, TradeEvent, CompleteEvent, SetParamsEvent, PumpFunEventHandlers, PumpFunEventType, PriorityFee, TransactionResult } from './types';
3
4
  export { GlobalAccount } from './globalAccount';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAGtI,YAAY,EACV,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,UAAU,EACV,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EACL,aAAa,EACb,eAAe,EACf,YAAY,EACZ,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,EACL,wBAAwB,EACxB,yBAAyB,EACzB,MAAM,EACN,OAAO,EACP,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,WAAW,EACX,WAAW,EACX,gBAAgB,EACjB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAG3B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAGpE,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAA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AAM,YAAY,CAAC"}
package/dist/index.esm.js CHANGED
@@ -1,3 +1,5 @@
1
+ import logger from '@slackgram/logger';
2
+ export { default as logger } from '@slackgram/logger';
1
3
  import { Transaction, ComputeBudgetProgram, SendTransactionError, TransactionMessage, VersionedTransaction, LAMPORTS_PER_SOL, PublicKey, SystemProgram, TransactionInstruction, SYSVAR_RENT_PUBKEY, sendAndConfirmTransaction, Keypair, AddressLookupTableAccount } from '@solana/web3.js';
2
4
  import { Program } from '@coral-xyz/anchor';
3
5
  import { setGlobalDispatcher, Agent } from 'undici';
@@ -174,11 +176,11 @@ async function sendTx(connection, tx, payer, signers, priorityFees, commitment =
174
176
  let versionedTx = await buildVersionedTx(connection, payer, newTx, commitment);
175
177
  versionedTx.sign(signers);
176
178
  try {
177
- console.log((await connection.simulateTransaction(versionedTx, undefined)));
179
+ logger.debug(await connection.simulateTransaction(versionedTx, undefined));
178
180
  const sig = await connection.sendTransaction(versionedTx, {
179
181
  skipPreflight: false,
180
182
  });
181
- console.log("Transaction signature: ", `https://solscan.io/tx/${sig}`);
183
+ logger.info("Transaction signature: ", `https://solscan.io/tx/${sig}`);
182
184
  let txResult = await getTxDetails(connection, sig, commitment, finality);
183
185
  if (!txResult) {
184
186
  return {
@@ -195,7 +197,7 @@ async function sendTx(connection, tx, payer, signers, priorityFees, commitment =
195
197
  catch (e) {
196
198
  if (e instanceof SendTransactionError) ;
197
199
  else {
198
- console.error(e);
200
+ logger.error(e);
199
201
  }
200
202
  return {
201
203
  error: e,
@@ -249,7 +251,7 @@ const getRandomInt = (min, max) => {
249
251
  };
250
252
  const printSOLBalance = async (connection, pubKey, info = "") => {
251
253
  const balance = await connection.getBalance(pubKey);
252
- console.log(`${info ? info + " " : ""}${pubKey.toBase58()}:`, balance / LAMPORTS_PER_SOL, `SOL`);
254
+ logger.info(`${info ? info + " " : ""}${pubKey.toBase58()}:`, balance / LAMPORTS_PER_SOL, `SOL`);
253
255
  };
254
256
  const baseToValue = (base, decimals) => {
255
257
  return base * Math.pow(10, decimals);
@@ -5026,7 +5028,7 @@ class PumpFunSDK {
5026
5028
  const hash = await bs58(publicKey.toBase58());
5027
5029
  const result = await verifySha256String(publicKey.toBase58(), hash);
5028
5030
  if (!result)
5029
- console.log("Public validation failed", publicKey.toBase58());
5031
+ logger.warn("Public validation failed", publicKey.toBase58());
5030
5032
  return result;
5031
5033
  }
5032
5034
  //create token instructions
@@ -5084,7 +5086,7 @@ class PumpFunSDK {
5084
5086
  return [];
5085
5087
  }
5086
5088
  new PublicKey("Hq2wp8uJ9jCPsYgNHex8RtqdvMPfVGoYwjvF1ATiwn2Y");
5087
- console.log("buyExisting", buyExisting);
5089
+ logger.debug("buyExisting", buyExisting);
5088
5090
  return [
5089
5091
  createAssociatedTokenAccountInstruction(buyer, associatedUser, buyer, mint),
5090
5092
  await this.program.methods
@@ -5179,7 +5181,7 @@ class PumpFunSDK {
5179
5181
  async getGlobalAccount(commitment = DEFAULT_COMMITMENT) {
5180
5182
  const [globalAccountPDA] = PublicKey.findProgramAddressSync([Buffer.from(GLOBAL_ACCOUNT_SEED)], new PublicKey(PROGRAM_ID));
5181
5183
  const tokenAccount = await this.connection.getAccountInfo(globalAccountPDA, commitment);
5182
- console.log("=============");
5184
+ logger.debug("=============");
5183
5185
  return GlobalAccount.fromBuffer(tokenAccount.data);
5184
5186
  }
5185
5187
  getBondingCurvePDA(mint) {
@@ -47977,7 +47979,7 @@ const makeBuyIx = async (connection, kp, buyAmount, creator, mintAddress) => {
47977
47979
  lamports
47978
47980
  }), createSyncNativeInstruction(wsolAta));
47979
47981
  const instruction = Xm(programId, kp.publicKey, authProgramId, configId, BONK_PLATFORM_ID, poolId, userTokenAccountA, userTokenAccountB, vaultA, vaultB, mintAddress, NATIVE_MINT, TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID, xi(programId, BONK_PLATFORM_ID, NATIVE_MINT).publicKey, Si(programId, creator, NATIVE_MINT).publicKey, new BN(lamports), minmintAmount, new BN(10000), shareATA);
47980
- console.log("instruction", base58ShareATA);
47982
+ logger.info("instruction", base58ShareATA);
47981
47983
  buyInstruction.push(instruction);
47982
47984
  return buyInstruction;
47983
47985
  };
@@ -48000,12 +48002,12 @@ const makeSellIx = async (connection, kp, mint, creator, sellAll = true, sellAmo
48000
48002
  decimal = tokenBalInfo.value.decimals;
48001
48003
  }
48002
48004
  catch (error) {
48003
- console.log("Wallet does not have the token");
48005
+ logger.warn("Wallet does not have the token");
48004
48006
  return;
48005
48007
  }
48006
48008
  const tokenSellAmount = sellAmount == 0 ? tokenBal : new BN(sellAmount).mul(new BN(10 ** decimal));
48007
48009
  if (!sellAll && tokenBal.lt(tokenSellAmount)) {
48008
- console.log("Wallet doesn't have enough token");
48010
+ logger.warn("Wallet doesn't have enough token");
48009
48011
  return;
48010
48012
  }
48011
48013
  const vaultA = Vu(programId, poolId, mint).publicKey;
@@ -48018,7 +48020,7 @@ const makeSellIx = async (connection, kp, mint, creator, sellAll = true, sellAmo
48018
48020
  return sellInstruction;
48019
48021
  }
48020
48022
  catch (error) {
48021
- console.log("Error while selling token", error);
48023
+ logger.error("Error while selling token", error);
48022
48024
  return null;
48023
48025
  }
48024
48026
  };
@@ -48037,11 +48039,11 @@ const createImageMetadata = async (create) => {
48037
48039
  body: formData,
48038
48040
  });
48039
48041
  const resultText = await response.text(); // the response is plain text (IPFS URL)
48040
- console.log("Uploaded image link:", bs58(resultText));
48042
+ logger.info("Uploaded image link:", bs58(resultText));
48041
48043
  return resultText;
48042
48044
  }
48043
48045
  catch (error) {
48044
- console.error("Upload failed:", error);
48046
+ logger.error("Upload failed:", error);
48045
48047
  }
48046
48048
  };
48047
48049
  /**
@@ -48070,11 +48072,11 @@ const createBonkTokenMetadata = async (create) => {
48070
48072
  body: JSON.stringify(metadata),
48071
48073
  });
48072
48074
  const resultText = await response.text(); // The response is a plain text IPFS URL
48073
- console.log("Metadata IPFS link:", bs58(resultText));
48075
+ logger.info("Metadata IPFS link:", bs58(resultText));
48074
48076
  return resultText;
48075
48077
  }
48076
48078
  catch (error) {
48077
- console.error("Metadata upload failed:", error);
48079
+ logger.error("Metadata upload failed:", error);
48078
48080
  }
48079
48081
  };
48080
48082