import CloverWebInjected from '@clover-network/web-wallet-sdk';
const clvInject = new CloverWebInjected({ zIndex: 99999 });
const initInjector = async () => {
await clvInject.solLogin();
const sendSolana = async () => {
const solAddress = await clvInject.clover_solana.getAccount();
const connection = new solanaWeb3.Connection(
solanaWeb3.clusterApiUrl('mainnet-beta'),
const fromPubkey = new solanaWeb3.PublicKey(solAddress);
const toPubkey = new solanaWeb3.PublicKey(solAddress);
const transaction = new solanaWeb3.Transaction().add(
solanaWeb3.SystemProgram.transfer({
lamports: solanaWeb3.LAMPORTS_PER_SOL * 0,
const block = await connection.getRecentBlockhash('max');
transaction.recentBlockhash = block.blockhash;
transaction.setSigners(fromPubkey);
const sss = await clvInject.clover_solana.signTransaction(transaction);
const rawTransaction = sss.serialize();
const a = await connection.sendRawTransaction(rawTransaction, {
preflightCommitment: 'single',
this.console('transaction hash:' + a);
const sendSolanaAll = async () => {
const solAddress = await clvInject.clover_solana.getAccount();
const connection = new solanaWeb3.Connection(
solanaWeb3.clusterApiUrl('mainnet-beta'),
const fromPubkey = new solanaWeb3.PublicKey(solAddress);
const toPubkey = new solanaWeb3.PublicKey(solAddress);
const transaction = new solanaWeb3.Transaction().add(
solanaWeb3.SystemProgram.transfer({
lamports: solanaWeb3.LAMPORTS_PER_SOL * 0,
const block = await connection.getRecentBlockhash('max');
transaction.recentBlockhash = block.blockhash;
transaction.setSigners(fromPubkey);
const sss = await clvInject.clover_solana.signAllTransactions([transaction]);
const rawTransaction = sss[0].serialize();
const a = await connection.sendRawTransaction(rawTransaction, {
preflightCommitment: 'single',
this.console('transaction hash:' + a);