flipmeme-sdk 1.3.5 → 1.3.7

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 CHANGED
@@ -2381,7 +2381,7 @@ var SolanaConnector = class {
2381
2381
  //useBuy.ts
2382
2382
  buy(params) {
2383
2383
  return __async(this, null, function* () {
2384
- var _a, _b, _c, _d, _e;
2384
+ var _a, _b, _c;
2385
2385
  if (!this.program) {
2386
2386
  throw new Error("Program not initialized");
2387
2387
  }
@@ -2390,7 +2390,7 @@ var SolanaConnector = class {
2390
2390
  throw new Error("No available token to buy");
2391
2391
  }
2392
2392
  let transactions = [];
2393
- if ((_c = reserveToken.buy) == null ? void 0 : _c.length) {
2393
+ if (reserveToken.buy != null && reserveToken.buy.length > 0) {
2394
2394
  try {
2395
2395
  const txs = yield this.getBuyInstructions(
2396
2396
  this.config.wallet,
@@ -2403,7 +2403,7 @@ var SolanaConnector = class {
2403
2403
  console.error("Failed to getBuyInstructions", { error });
2404
2404
  }
2405
2405
  }
2406
- if ((_d = reserveToken.mintAndBuy) == null ? void 0 : _d.length) {
2406
+ if (reserveToken.mintAndBuy != null && reserveToken.mintAndBuy.length > 0) {
2407
2407
  try {
2408
2408
  const txs = yield this.getMintAndBuyInstructions(
2409
2409
  this.config.wallet,
@@ -2411,7 +2411,7 @@ var SolanaConnector = class {
2411
2411
  reserveToken.mintAndBuy,
2412
2412
  baseUri,
2413
2413
  slippage,
2414
- (_e = reserveToken.buy) == null ? void 0 : _e.length
2414
+ (_c = reserveToken.buy) == null ? void 0 : _c.length
2415
2415
  );
2416
2416
  transactions.push(...txs);
2417
2417
  } catch (error) {
@@ -2972,12 +2972,12 @@ var SolanaConnector = class {
2972
2972
  try {
2973
2973
  for (const chunk of tokenChunks) {
2974
2974
  let transaction = yield this.setUpInstructions(14e5);
2975
- index += chunk.length;
2975
+ index += chunk.length - 1;
2976
2976
  let slippagePrice = this.getPriceOfIndex(
2977
2977
  "buy" /* BUY */,
2978
2978
  collectionInfo,
2979
2979
  index
2980
- ).mul(slippage).div(100).toFixed(0);
2980
+ ).mul(slippage + 0.01).div(100).toFixed(0);
2981
2981
  for (const nft of chunk) {
2982
2982
  const nftPda2 = nftPda(
2983
2983
  this.configAddresses,
@@ -3037,10 +3037,11 @@ var SolanaConnector = class {
3037
3037
  let transaction = yield this.setUpInstructions(14e5);
3038
3038
  index += chunk.length;
3039
3039
  let slippagePrice = this.getPriceOfIndex(
3040
- "buy" /* BUY */,
3040
+ "sell" /* SELL */,
3041
3041
  collectionInfo,
3042
3042
  index
3043
- ).mul(slippage).div(100).toFixed(0);
3043
+ ).mul(slippage - 0.01).div(100).toFixed(0);
3044
+ console.log("slippage price", slippagePrice);
3044
3045
  for (const nft of chunk) {
3045
3046
  const nftPda2 = nftPda(
3046
3047
  this.configAddresses,
@@ -3107,7 +3108,7 @@ var SolanaConnector = class {
3107
3108
  "buy" /* BUY */,
3108
3109
  collectionInfo,
3109
3110
  index
3110
- ).mul(slippage).div(100).toFixed(0);
3111
+ ).mul(slippage + 0.01).div(100).toFixed(0);
3111
3112
  for (const nftName of chunks) {
3112
3113
  const nftSeedKeypair = import_web34.Keypair.generate();
3113
3114
  const nftPda2 = nftPda(