New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

vice-aa

Package Overview
Dependencies
Maintainers
0
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vice-aa

Made account abstraction easy to understand and implement.

latest
Source
npmnpm
Version
1.0.23
Version published
Maintainers
0
Created
Source

Installation

npm install vice-aa

Supported Networks

  • AMOY NETWORK
  • MUMBAI NETWORK (Depreciated.)
  • POLYGON NETWORK (Comming Soon...)

Paymaster URL's

Simple Paymaster -> https://vice-aa-api.vercel.app/paymaster

ERC20 Token Paymaster -> https://vice-aa-api.vercel.app/tokenpaymaster

ERC20 Token For TokenPaymaster

You can get this token from Uniswap

⚠️ WARNING: MAKE SURE TO APPROVE THE ERC20PAYMASTER CONTRACT FOR HYPER TOKEN TO USE ERC20PAYMASTER URL.

Usage

This package provides four main functions:

  • getUserOperation
  • getSignedUserOp
  • CustomJsonRpcProvider
  • waitForReceipt

Follow the steps below to use these functions in your project.

Step 1: Create a Provider and Contract Instance

First, set up your provider and create an instance of the contract with which you wish to interact.

import { ethers } from "ethers";
import { YourContractAddress, YourContractABI } from "<your-contract-data-location>";

const provider = new ethers.providers.Web3Provider(window.ethereum);
const contract = new ethers.Contract(YourContractAddress, YourContractABI, provider);

Step 2: Populate Your Transaction

Next, populate the transaction you intend to execute.

const populatedTx = await contract.populateTransaction.<YourContractMethod>(
  // Method parameters go here
);

Step 3: Get User Operation

Use getUserOperation with your contract wallet address, contract address, populated transaction, paymaster URL, and your chosen RPC URL.

import { getUserOperation } from "vice-aa";

const userOperation = await getUserOperation(
  yourContractWalletAddress,
  YourContractAddress,
  populatedTx,
  "https://<your-paymaster-url>",
  "<your-rpc-url>"
);

Step 4: Get Signed User Operation

Then, call getSignedUserOp with the userOperation , paymaster URL, and a boolean to indicate the type of paymaster.

import { getSignedUserOp } from "vice-aa";

const signedUserOp = await getSignedUserOp(
  userOperation,
  "https://<your-paymaster-url>",
  true // Set to false for ERC20 paymaster
);

Step 5: Send User Operation

Create a custom provider and send the user operation.

import { CustomJsonRpcProvider } from "vice-aa";

const customProvider = new CustomJsonRpcProvider("<your-rpc-url>");
const userOpHash = await customProvider.sendUserOperation(signedUserOp);

Step 6: Wait for Transaction Receipt

Finally, wait for the transaction hash using waitForReceipt.

import { waitForReceipt } from "vice-aa";
const txHash = await waitForReceipt(customProvider, userOpHash);

Example

Support

For additional support or queries, feel free to reach out or open an issue on the vice-aa repository.

Keywords

account abstraction

FAQs

Package last updated on 23 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts