coinley-checkout 1.2.6 → 1.2.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.
@@ -18791,6 +18791,25 @@ const sendSolanaTokenTransaction = async (walletConnection, tokenConfig, toAddre
18791
18791
  fromTokenAccount: fromTokenAccount.toString(),
18792
18792
  toTokenAccount: toTokenAccount.toString()
18793
18793
  });
18794
+ const toAccountInfo = await connection.getAccountInfo(toTokenAccount);
18795
+ console.log("Recipient token account exists:", !!toAccountInfo);
18796
+ const transaction = new Transaction();
18797
+ if (!toAccountInfo) {
18798
+ console.log("Creating associated token account for recipient...");
18799
+ const createAccountInstruction = createAssociatedTokenAccountInstruction(
18800
+ fromPubkey,
18801
+ // payer
18802
+ toTokenAccount,
18803
+ // associated token account
18804
+ toPubkey,
18805
+ // owner
18806
+ mintPubkey,
18807
+ // mint
18808
+ TOKEN_PROGRAM_ID,
18809
+ ASSOCIATED_TOKEN_PROGRAM_ID
18810
+ );
18811
+ transaction.add(createAccountInstruction);
18812
+ }
18794
18813
  console.log("Creating transfer instruction with amount:", amountInSmallestUnit);
18795
18814
  const transferInstruction = createTransferInstruction(
18796
18815
  fromTokenAccount,
@@ -18800,11 +18819,12 @@ const sendSolanaTokenTransaction = async (walletConnection, tokenConfig, toAddre
18800
18819
  [],
18801
18820
  TOKEN_PROGRAM_ID
18802
18821
  );
18803
- const transaction = new Transaction().add(transferInstruction);
18822
+ transaction.add(transferInstruction);
18804
18823
  const { blockhash } = await connection.getLatestBlockhash();
18805
18824
  transaction.recentBlockhash = blockhash;
18806
18825
  transaction.feePayer = fromPubkey;
18807
- console.log("Transaction created, sending to Phantom...");
18826
+ console.log("Transaction created with instructions:", transaction.instructions.length);
18827
+ console.log("Transaction sending to Phantom...");
18808
18828
  const signedTransaction = await phantomProvider.signAndSendTransaction(transaction);
18809
18829
  console.log("✅ Solana token transaction sent successfully:", signedTransaction);
18810
18830
  console.log("=== END SOLANA TOKEN TRANSACTION DEBUG ===");