Epoch Protocol Docs
  • Epoch Protocol - Overview
  • What is Epoch Protocol - An Introduction
  • 📄Litepaper
  • Blog
  • Links
  • Account Abstraction
    • ERC 4337
      • Operations
    • Benefits
    • Use-cases
      • Examples
    • More Readings
  • Use Epoch Protocol Automation dApp
    • How to use Epoch Protocol for Intent Automation
    • Onboarding
    • Connect to Dapp
    • Record a transaction
    • Bonus Add NFT Action
    • Execute Transaction right now
    • Time-Based triggers
    • Token Received Trigger
    • Reporting a bug and common fixes
  • Use Epoch SDK
    • Getting Started
    • Intent Automation Module
      • Epoch Bundler
      • Epoch SDK
      • Triggers
      • Examples
        • How to Initialise the Epoch SDK
        • How to Get User's SC Wallet Address
        • Check If User's SC Wallet is Deployed or Not
        • Deploy User's SC Wallet if not Deployed
        • Schedule Token Payment
        • Schedule ETH Transfer on Event Trigger
    • Contracts
Powered by GitBook
On this page

Was this helpful?

  1. Use Epoch SDK
  2. Intent Automation Module
  3. Examples

Deploy User's SC Wallet if not Deployed

Note - You need to send some Native Token for Gas to the SC Wallet Address before you can deploy it.

const { walletAPI, bundler } = useBundler();
const isUserWalletNotDeployed = useIsWalletDeployed();
const account = useAccount();

if(isUserWalletNotDeployed && userSCWalletBalance > 0) {
  const op = await walletAPI.createSignedUserOp({
    target: account.address,
    data: "0x",
    value: 0n,
  });
  
  const deployWalletUserOp = await bundler.sendUserOpToBundler(op);
}
PreviousCheck If User's SC Wallet is Deployed or NotNextSchedule Token Payment

Last updated 1 year ago

Was this helpful?