flipmeme-sdk 1.3.7 → 1.3.9

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
@@ -2896,29 +2896,31 @@ var SolanaConnector = class {
2896
2896
  }).compileToV0Message(
2897
2897
  lookupTableAccounts == null ? [] : [lookupTableAccounts]
2898
2898
  );
2899
- console.log("transaction size ", messageV0.serialize().length);
2900
2899
  let versionedTx = new import_web34.VersionedTransaction(messageV0);
2901
2900
  if (sdkTx.additionalSigher) versionedTx.sign(sdkTx.additionalSigher);
2902
2901
  return versionedTx;
2903
2902
  });
2904
2903
  const signedTxs = yield this.config.signAllTransactions(txs);
2905
- let signatures = yield Promise.all(
2906
- signedTxs.map((signedTx, index) => __async(this, null, function* () {
2907
- if (signedTx instanceof import_web34.VersionedTransaction) {
2908
- try {
2909
- let signature = yield this.config.provider.connection.sendTransaction(signedTx, {
2904
+ let signatures = [];
2905
+ for (let i = 0; i < signedTxs.length; i++) {
2906
+ let signedTx = signedTxs[i];
2907
+ if (signedTx instanceof import_web34.VersionedTransaction) {
2908
+ try {
2909
+ let signature = yield this.config.provider.connection.sendTransaction(
2910
+ signedTx,
2911
+ {
2910
2912
  skipPreflight: true,
2911
2913
  preflightCommitment: "confirmed"
2912
- });
2913
- return { signature, index };
2914
- } catch (e) {
2915
- console.log("Transaction submit error:", e);
2916
- return { signature: null, index };
2917
- }
2914
+ }
2915
+ );
2916
+ signatures.push({ signature, i });
2917
+ } catch (e) {
2918
+ console.log("Transaction submit error:", e);
2919
+ signatures.push({ signature: null, i });
2918
2920
  }
2919
- }))
2920
- );
2921
- console.log("signatures from Promisze all ===============", signatures);
2921
+ }
2922
+ }
2923
+ console.log("signatures", signatures);
2922
2924
  return {
2923
2925
  signatures,
2924
2926
  latestBlockhash
@@ -2972,11 +2974,12 @@ var SolanaConnector = class {
2972
2974
  try {
2973
2975
  for (const chunk of tokenChunks) {
2974
2976
  let transaction = yield this.setUpInstructions(14e5);
2975
- index += chunk.length - 1;
2977
+ index += chunk.length;
2976
2978
  let slippagePrice = this.getPriceOfIndex(
2977
2979
  "buy" /* BUY */,
2978
2980
  collectionInfo,
2979
- index
2981
+ index - 1
2982
+ //when buy it calculates price first and control index
2980
2983
  ).mul(slippage + 0.01).div(100).toFixed(0);
2981
2984
  for (const nft of chunk) {
2982
2985
  const nftPda2 = nftPda(
@@ -3040,6 +3043,7 @@ var SolanaConnector = class {
3040
3043
  "sell" /* SELL */,
3041
3044
  collectionInfo,
3042
3045
  index
3046
+ //when sell it control index and calculate the price
3043
3047
  ).mul(slippage - 0.01).div(100).toFixed(0);
3044
3048
  console.log("slippage price", slippagePrice);
3045
3049
  for (const nft of chunk) {
@@ -3107,8 +3111,10 @@ var SolanaConnector = class {
3107
3111
  let slippagePrice = this.getPriceOfIndex(
3108
3112
  "buy" /* BUY */,
3109
3113
  collectionInfo,
3110
- index
3114
+ index - 1
3115
+ // when mint calculate price and control index
3111
3116
  ).mul(slippage + 0.01).div(100).toFixed(0);
3117
+ console.log(index - 1, "'s slippage price", slippagePrice);
3112
3118
  for (const nftName of chunks) {
3113
3119
  const nftSeedKeypair = import_web34.Keypair.generate();
3114
3120
  const nftPda2 = nftPda(
@@ -3117,7 +3123,6 @@ var SolanaConnector = class {
3117
3123
  nftSeedKeypair.publicKey,
3118
3124
  this.program.programId
3119
3125
  );
3120
- console.log("=======nft seed==========", nftSeedKeypair.publicKey);
3121
3126
  const instruction = yield this.program.methods.mintAndBuy(
3122
3127
  nftSeedKeypair.publicKey,
3123
3128
  nftName,