0.1.23 • Published 3 months ago

@actalink/snap v0.1.23

Weekly downloads
-
License
(MIT-0 OR Apache-...
Repository
github
Last release
3 months ago

Acta Snap

Welcome to the MetaMask Snap integration for Acta SDK. This Snap empowers users to harness the full potential of their smart wallet payments by seamlessly integrating the Acta SDK into the MetaMask extension.

  • Create Smart Wallet from your EOA and load it to Metamask using Acta SDK
  • Send ERC20 tokens from your EOA via your Smart Wallet
  • Scheduled payments using Smart Wallet

⚡️ Features

🚀 Smart Wallet Creation

Utilize Acta Snap to effortlessly create and load smart wallets into MetaMask Keyring API, seamlessly integrating them as regular MetaMask accounts labeled with Snaps Beta. These off-chain smart wallets incur no gas fees during creation, transitioning to on-chain upon the completion of the first transaction. Enjoy a streamlined and cost-effective onboarding experience with Acta Snap.

App Screenshot

🤑 Send Payments via Smart Wallet

Send ERC20 tokens using your smart wallet. Steps to achieve this :-

  • Give allowance to the smart wallet address generated
  • Connect your wallet
  • Sign the message

App Screenshot

⏰ Send Scheduled Payments via Smart Wallet

Send ERC20 tokens using your smart wallet at requested intervals. Steps to achieve this :-

  • Give allowance to the smart wallet address generated
  • Connect your wallet
  • Give the interval and the numbe of scheduled transactions
  • Sign the tx only once and forget

📕 Documentation - @actalink/snap

⬇️ Installing the snap

To install the snap, you need to attach the follwing code to the button

    await window.ethereum.request({
            method: 'wallet_requestSnaps',
            params: {
                [npm:@actalink/snap]: <version number>,
            },
  });

🌎 Create Smart Wallet

    await window.ethereum.request({
        method: 'wallet_invokeSnap',
        params: {
            snapId: "npm:@actalink/snap",
            request: { method: 'snap.createAccount' },
        },
  }))

💸 Send Erc20 Token

Here, the tokenAddress is the address of the ERC20 toke smart contract, data is the transaction data generated using contract.interface.encodeFunctionData from ethersjs.

await window.ethereum.request({
  method: 'wallet_invokeSnap',
  params: {
    snapId: 'npm:@actalink/snap',
    request: {
      method: 'snap.transaction',
      params: {
        tokenAddress,
        data,
      },
    },
  },
});

🕰️ Scheduled Transaction

Here, the tokenAddress is the address of the ERC20 toke smart contract, scheduledData is the transaction data generated using contract.interface.encodeFunctionData from ethersjs. The minutes filed here is a comma-seperated uints for specific intervals, eg. - [3,2,1] will execute the first tx after 3 mins from now, and then 2 minutes from then after 1 minute.

await window.ethereum.request({
  method: 'wallet_invokeSnap',
  params: {
    snapId: defaultSnapOrigin,
    request: {
      method: 'snap.scheduledOp',
      params: {
        scheduledTo: tokenAddress,
        scheduledData: data,
        minutes: intervalMinutes,
      },
    },
  },
});

Authors