0.0.14 • Published 7 months ago

jaskaran--account v0.0.14

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

installation

Using npm package manager

npm i jaskaran-account 

OR

Using yarn package manager

yarn add jaskaran-account

Account

Building and sending UserOperations is a key offering of any toolkit designed for ERC4337. The Antier account package stands as an exemplary toolkit in this regard. Meticulously crafted with developers' needs in mind, this package seamlessly integrates the essential features associated with ERC-4337. It simplifies the process of creating and sending UserOperations, thus optimizing the development and management of decentralized applications (dApps).

The Antier account package achieves this by providing a comprehensive set of methods that enable developers to effortlessly create UserOperations. Combined with the sophisticated backend infrastructure of the Antier platform, it ensures efficient and reliable transmission of these operations across EVM networks.

Smart Account instance configuration

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 AntierSmartAccount instance in your dapp's

import { AntierSmartAccount, AntierSmartAccountConfig } from "jaskaran--account"

// Note that paymaster and bundler are optional. You can choose to create new instances of this later and make account API use 
const AntierSmartAccountConfig: AntierSmartAccountConfig = {
    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 antierAccount = new AntierSmartAccount(AntierSmartAccountConfig)
const antierSmartAccount =  await antierAccount.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
// In Progress
const partialUserOp = await antierSmartAccount.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)

Authors

@Jaskaran

0.0.12

7 months ago

0.0.13

7 months ago

0.0.14

7 months ago

0.0.11

9 months ago

0.0.10

9 months ago

0.0.9

9 months ago

0.0.8

9 months ago

0.0.7

9 months ago

0.0.6

9 months ago

0.0.5

9 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago