Open kevin-nemo74 opened 11 months ago
I'll look at this tomorrow.
Thank you i actually fixed the function as fellows :
void onSubmit(String amount, recipientAddress) async { try { final connectedAccount = adapter.connectedAccount?.address; if (connectedAccount == null) throw Exception('Connect wallet before sending tx.'); // Mobile wallet displays the address as base-58. final rcv = web3.Pubkey.fromBase58(recipientAddress); // Mobile wallet adapter specification returns address as base-64 final snd = web3.Pubkey.fromBase64(connectedAccount); // final snd = web3.PublicKey.fromBase58("DuR26WphWX3o3S3kVBhNsv7gYpGXBfRwS5CXfFuZGAb1"); print('creating transaction'); // Get latest blockhash info. final blockhash = await connection.getLatestBlockhash(); // Get latest blockhash. // Create transfer tx. final transaction = web3.Transaction.v0( payer: snd, // The account that will sign the tx (and pay any fees). recentBlockhash: blockhash.blockhash, instructions: [ SystemProgram.transfer( fromPubkey: snd, toPubkey: rcv, lamports: web3.solToLamports(double.parse(amount)), ), ], ); // Serialize tx. const config = web3.TransactionSerializableConfig(requireAllSignatures: false); final tt = transaction.serialize(config).getString(BufferEncoding.base64); print('creating transaction string $tt'); // Sign and send tx. final result = await adapter.signAndSendTransactions([tt]); setState(() => out = result.toJson()); // Wait for confirmation. // await connection.confirmTransaction(base64ToBase58(result.signatures.first!)); await connection .confirmTransaction(base64ToBase58(result.signatures.first!)); print('transaction success ${result.signatures.first}'); } catch (error) { print('error sending tx $error'); } }
just the connection issue to the solflare wallet remains Thank you
Are you connecting a Flutter web app to a browser wallet or a mobile app to a mobile wallet?
Am connection a flutter mobile app to mobile wallet
is there still a function to convert base64ToBase58 ? as i had to create my own in this new version and somtimes its throwing an error.
You can use base58To64.decode().
hello
in the older versions of the package and using the provided code i was able to make transations through my dart app but now in the new version its not recognising half the methods if its not too much to ask and see the code below and what would you suggest to fix specially in the 'serialize" transactions area