Fix Sending SPL token issue (#1924)

* Fix creating ATA * give more buffer for the transaction to be broadcast [skip ci]

Omar Hatem committed Jan 3, 2025 at 08:55 UTC 52e20e1a44c0728ebf1b7814863fea7b16b75b98
1 file changed +8 -2
cw_solana/lib/solana_client.dart
+8 -2
@@ -515,7 +515,7 @@ class SolanaWalletClient {
515 final instruction = AssociatedTokenAccountInstruction.createAccount(
516 mint: mint,
517 address: derivedAddress,
518 - owner: ownerKeypair.publicKey,
518 + owner: destinationOwner,
519 funder: ownerKeypair.publicKey,
520 );
521
@@ -541,6 +541,8 @@ class SolanaWalletClient {
541 data: null,
542 ),
543 );
544 +
545 + await Future.delayed(Duration(seconds: 5));
546 }
547 } catch (e) {
548 throw SolanaCreateAssociatedTokenAccountException(e.toString());
@@ -583,10 +585,14 @@ class SolanaWalletClient {
585 latestBlockhash: latestBlockhash,
586 );
587
586 - sendTx() async => await sendTransaction(
588 + sendTx() async {
589 + await Future.delayed(Duration(seconds: 3));
590 +
591 + return await sendTransaction(
592 signedTransaction: signedTx,
593 commitment: commitment,
594 );
595 + }
596
597 final pendingTransaction = PendingSolanaTransaction(
598 amount: inputAmount,