Fix Sending SPL token issue (#1924)

* Fix creating ATA

* give more buffer for the transaction to be broadcast [skip ci]
This commit is contained in:
Omar Hatem 2025-01-03 08:55:01 +02:00 committed by GitHub
parent 5ea443235d
commit 52e20e1a44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -515,7 +515,7 @@ class SolanaWalletClient {
final instruction = AssociatedTokenAccountInstruction.createAccount( final instruction = AssociatedTokenAccountInstruction.createAccount(
mint: mint, mint: mint,
address: derivedAddress, address: derivedAddress,
owner: ownerKeypair.publicKey, owner: destinationOwner,
funder: ownerKeypair.publicKey, funder: ownerKeypair.publicKey,
); );
@ -541,6 +541,8 @@ class SolanaWalletClient {
data: null, data: null,
), ),
); );
await Future.delayed(Duration(seconds: 5));
} }
} catch (e) { } catch (e) {
throw SolanaCreateAssociatedTokenAccountException(e.toString()); throw SolanaCreateAssociatedTokenAccountException(e.toString());
@ -583,10 +585,14 @@ class SolanaWalletClient {
latestBlockhash: latestBlockhash, latestBlockhash: latestBlockhash,
); );
sendTx() async => await sendTransaction( sendTx() async {
await Future.delayed(Duration(seconds: 3));
return await sendTransaction(
signedTransaction: signedTx, signedTransaction: signedTx,
commitment: commitment, commitment: commitment,
); );
}
final pendingTransaction = PendingSolanaTransaction( final pendingTransaction = PendingSolanaTransaction(
amount: inputAmount, amount: inputAmount,