From 52e20e1a44c0728ebf1b7814863fea7b16b75b98 Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Fri, 3 Jan 2025 08:55:01 +0200 Subject: [PATCH] Fix Sending SPL token issue (#1924) * Fix creating ATA * give more buffer for the transaction to be broadcast [skip ci] --- cw_solana/lib/solana_client.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cw_solana/lib/solana_client.dart b/cw_solana/lib/solana_client.dart index 16f8988b1..431f5f7fb 100644 --- a/cw_solana/lib/solana_client.dart +++ b/cw_solana/lib/solana_client.dart @@ -515,7 +515,7 @@ class SolanaWalletClient { final instruction = AssociatedTokenAccountInstruction.createAccount( mint: mint, address: derivedAddress, - owner: ownerKeypair.publicKey, + owner: destinationOwner, funder: ownerKeypair.publicKey, ); @@ -541,6 +541,8 @@ class SolanaWalletClient { data: null, ), ); + + await Future.delayed(Duration(seconds: 5)); } } catch (e) { throw SolanaCreateAssociatedTokenAccountException(e.toString()); @@ -583,10 +585,14 @@ class SolanaWalletClient { latestBlockhash: latestBlockhash, ); - sendTx() async => await sendTransaction( + sendTx() async { + await Future.delayed(Duration(seconds: 3)); + + return await sendTransaction( signedTransaction: signedTx, commitment: commitment, ); + } final pendingTransaction = PendingSolanaTransaction( amount: inputAmount,