Send Transaction
Sign and send transaction through Blocto.
Sign and Send Transaction
Blocto provides a freemium experience so that they don't have to buy crypto to pay for fees before they try out your dApp (See how meta-transaction works). Hence, your dApps have to sign and send transaction in one-line code so that Blocto is able to pay transaction fee for users.
import { SystemProgram, Account, Transaction } from '@solana/web3.js'
const walletPublicKey = window.solana.publicKey
const transaction = new Transaction()
const instruction = SystemProgram.createAccount({
fromPubkey: walletPublicKey,
...
})
transaction.add(instruction)
const txHash = await window.solana.signAndSendTransaction(transaction)
console.log(txHash) // tx hashConvert to Program Wallet Transaction
Sometimes, you probably need to call web3.partialSign to authenticate System Program. Meta-Transaction is going to wrap your instructions into invoke instruction so that it can be sent to program wallet properly. Therefore, your dApps have to call convertToProgramWalletTransaction to the correct message before calling signAndSendTransaction.
Last updated
Was this helpful?