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

soul-wallet-lib

v0.1.1

Published

The EIP-4337 library for Soul-Wallet

Downloads

73

Readme

Table of Contents

Features

  • All-In-One

  • UserOperation can be built with a single function

  • Built-in Bundler module

  • Built-in CallData parsing module

  • Built-in common operations, such as ERC20 ERC721 ERC1155 (e.g. you can create a transfer UserOperation with one function)

  • Auto update preVerificationGas (lower deposit requirements for user)

  • ⚠️ Note: current version will refactor the code in the future and cannot guarantee compatibility

Installing

Using npm:

$ npm install git+https://github.com/proofofsoulprotocol/soulwalletlib.git#v0.1.0-alpha.13

Using yarn:

$ yarn add git+https://github.com/proofofsoulprotocol/soulwalletlib.git#v0.1.0-alpha.13

Using pnpm:

$ pnpm add git+https://github.com/proofofsoulprotocol/soulwalletlib.git#v0.1.0-alpha.13

Once the package is installed, you can import the library using import approach:

import { IApproveToken, ITransaction, SoulWalletLib, UserOperation } from 'soul-wallet-lib';

Example

import { ethers } from "ethers";
import { IUserOpReceipt, SoulWalletLib, UserOperation } from 'soul-wallet-lib';

async function main() {
    const soulWalletLib = new SoulWalletLib();

    const walletAddress = await soulWalletLib.calculateWalletAddress(
        '0x0',  // <address> SoulWalletLogic Contract Address
        '0x0',  // <address> EntryPoint Contract Address
        '0x0',  // <address> Wallet Owner Address
        86400,  // <uint32> upgradeDelay (seconds)
        86400,  // <uint32> guardianDelay (seconds)
        '0x0'  // <address> guardianAddress
    );

    const activateOp = soulWalletLib.activateWalletOp(
        '0x0',  // <address> SoulWalletLogic Contract Address
        '0x0',  // <address> EntryPoint Contract Address
        '0x0',  // <address> Wallet Owner Address
        86400,  // <uint32> upgradeDelay (seconds)
        86400,  // <uint32> guardianDelay (seconds)
        '0x0',  // <address> guardianAddress
        '0x',   // <bytes> paymasterAndData
        10000000000,// 100Gwei
        1000000000,// 10Gwei 
    );

    const userOpHash = activateOp.getUserOpHash(
        '0x0',  // <address> EntryPoint Contract Address
        1,      // <uint32> chainId
    );

    activateOp.signWithSignature(
        '0x0',  // <address> Wallet Owner Address
        '0x'    // <bytes> signature of userOpHash
    );


    const bundler = new soulWalletLib.Bundler(
        '0x0',  // <address> EntryPoint Contract Address
        new ethers.providers.JsonRpcProvider('<RPC Provider>'),
    );

    const validation = await bundler.simulateValidation(activateOp);
    if (validation.status !== 0) {
        throw new Error(`error code:${validation.status}`);
    }

    const bundlerEvent = bundler.sendUserOperation(activateOp);
    bundlerEvent.on('error', (err: any) => {
        console.log(err);
    });
    bundlerEvent.on('send', (userOpHash: string) => {
        console.log('send: ' + userOpHash);
    });
    bundlerEvent.on('receipt', (receipt: IUserOpReceipt) => {
        console.log('receipt: ' + JSON.stringify(receipt));
    });
    bundlerEvent.on('timeout', () => {
        console.log('timeout');
    });
}

main();
  • More Example: https://github.com/proofofsoulprotocol/soul-wallet-contract/blob/main/test/test.ts

License

MPL-2.0