npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@latch-wallet/account

v0.0.7

Published

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

Downloads

1

Readme

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)

| Key | Description | | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | signer | This signer will be used for signing userOps for any transactions you build. You can supply your your EOA wallet signer | | chainId | This represents the network your smart wallet transactions will be conducted on. Take a look following Link for supported chain id's | | rpcUrl | This 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 | | paymaster | you 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. | | bundler | You 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)