Skip to content

Latest commit

 

History

History
35 lines (29 loc) · 1.53 KB

SEND_SOME_ETH_WITH_SPONSORSHIP.md

File metadata and controls

35 lines (29 loc) · 1.53 KB
Key Description
oneOrManyTx Submit multiple or one transactions
userOpReceipt Returned information about your tx, receipts, userOpHashes etc
import { createSmartAccountClient } from "@biconomy/account";
import { createWalletClient, http, createPublicClient } from "viem";
import { privateKeyToAccount, generatePrivateKey } from "viem/accounts";
import { mainnet as chain } from "viem/chains";

const account = privateKeyToAccount(generatePrivateKey());
const signer = createWalletClient({ account, chain, transport: http() });
const smartAccount = await createSmartAccountClient({
  signer,
  bundlerUrl,
  paymasterUrl,
}); // Retrieve bundler and paymaster urls from dashboard

const oneOrManyTx = { to: "0x...", value: 1 };

const { wait } = await smartAccount.sendTransaction(oneOrManyTx, {
  paymasterServiceData: {
    mode: PaymasterMode.SPONSORED,
  },
});

const {
  receipt: { transactionHash },
  userOpHash,
  success,
} = await wait();