Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@latch-wallet/account

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@latch-wallet/account

This package provides apis for ERC-4337 based smart account implementations

  • 0.0.7
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

installation

Using npm package manager

npm i @latch-wallet/account

OR

Using yarn package manager

yarn add @latch-wallet/account

Account

Integrating and deploying Smart Accounts, building and sending user operations is a key offering of any toolkit designed for ERC4337. This package seamlessly integrates the essential features associated with ERC-4337 and simplifies the development of your Dapp's account and transaction rails with added usability features.

The account package achieves this by providing a comprehensive set of methods that enable developers to effortlessly create UserOperations. Combined with the sophisticated, developer friendly and scalable infrastructure of Biconomy, it ensures efficient and reliable transmission of these operations across multiple EVM chains.

Smart Account instance configuration

BiconomySmartAccount (V1 Smart Account)
KeyDescription
signerThis signer will be used for signing userOps for any transactions you build. You can supply your your EOA wallet signer
chainIdThis represents the network your smart wallet transactions will be conducted on. Take a look following Link for supported chain id's
rpcUrlThis represents the EVM node RPC URL you'll interact with, adjustable according to your needs. We recommend to use some private node url for efficient userOp building
paymasteryou can pass same paymaster instance that you have build in previous step. Alternatively, you can skip this if you are not interested in sponsoring transaction using paymaster
Note: if you don't pass the paymaster instance, your smart account will need funds to pay for transaction fees.
bundlerYou can pass same bundler instance that you have build in previous step. Alternatively, you can skip this if you are only interested in building userOP

Example Usage

// This is how you create BiconomySmartAccount instance in your dapp's

import { BiconomySmartAccount, BiconomySmartAccountConfig } from "@latch-wallet/account";

// Note that paymaster and bundler are optional. You can choose to create new instances of this later and make account API use
const biconomySmartAccountConfig: BiconomySmartAccountConfig = {
  signer: wallet.getSigner(),
  chainId: ChainId.POLYGON_MAINNET,
  rpcUrl: "",
  // paymaster: paymaster, // check the README.md section of Paymaster package
  // bundler: bundler, // check the README.md section of Bundler package
};

const biconomyAccount = new BiconomySmartAccount(biconomySmartAccountConfig);
const biconomySmartAccount = await biconomyAccount.init();

// native token transfer
// you can create any sort of transaction following same structure
const transaction = {
  to: "0x85B51B068bF0fefFEFD817882a14f6F5BDF7fF2E",
  data: "0x",
  value: ethers.utils.parseEther("0.1"),
};

// building partialUserOp
const partialUserOp = await biconomySmartAccount.buildUserOp([transaction]);

// using the paymaster package one can populate paymasterAndData to partial userOp. by default it is '0x'
const userOpResponse = await smartAccount.sendUserOp(partialUserOp);
const transactionDetails = await userOpResponse.wait();
console.log("transaction details below");
console.log(transactionDetails);

Finally we send the userOp and save the value to a variable named userOpResponse and get the transactionDetails after calling typescript userOpResponse.wait()

const transactionDetails = await userOpResponse.wait();
console.log("transaction details below");
console.log(transactionDetails);
BiconomySmartAccount (V2 Smart Account aka Modular Smart Account)

Keywords

FAQs

Package last updated on 12 Jan 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc