Catalog npm
Back to packageRELEASE DETAILS

0.0.7

npm

@0xgasless/0xgasless-aa-sdk

Account abstraction (ERC-4337) SDK layer

Published11 Dec 2023
Direct dependencies8
Transitive dependenciesNot calculated

README

Current package documentation

0xgasless Account Abstraction SDK

Account abstraction (ERC-4337) SDK layer

Overview

This documentation provides an explanation of the AA0xGasless SDK functionalities used for interacting with smart contracts, focusing on account abstraction in accordance with the ERC-4337 standard. The SDK is designed to simplify the process of executing transactions in a gasless manner and interacting with EVM contracts.

Prerequisites

Before implementing the SDK, ensure the following requirements are met:

  • Node.js installed.
  • AA0xGasless SDK installed.

Environment Variables

Set up the following environment variable:

  • API_KEY: Your unique API key for the AA0xGasless SDK. Get the API key from 0xGasless dashboard.

SDK Initialization

  1. Initializing the SDK:
    const apiKey = process.env.API_KEY;
    const sdk = new AA0xGasless(apiKey);
    const smartAccountAddress = await sdk.init(provider, options);
    
    Initialize the AA0xGasless SDK with your API key. Replace provider and options with your specific configurations to set up the SDK properly.

options

The ClientOptions interface for the SDK configuration includes:

  • chainId (number): The chain ID of the Ethereum network.
  • privateKey (string, optional): The private key for signing transactions.
  • rpcUrl (string, optional): The URL of the Ethereum RPC endpoint.
  • isSponsoredTrx (boolean, optional): Indicates if the transaction is sponsored.
  • paymasterEndpoint (string, optional): The endpoint URL for the paymaster.
  • paymaster (string, optional): Type of paymaster, options are "PIMLICO" or "STACKUP".
  • bundlerEndpoint (string, optional): The endpoint URL for the bundler.

Configure these options as per your application's requirements.

Example: Simple Counter Contract Transaction

  1. Setting up Smart Contract Interaction:

    const apiKey = process.env.API_KEY;
    const sdk = new AA0xGasless(apiKey);
    const smartAccountAddress = await sdk.init(provider, options);
    const contractAddress = "<contract_address>";
    const abi = COUNTER_CONTRACT_ABI;
    const counterContract = new ethers.Contract(contractAddress, abi);
    

    Define the contract address and ABI of the ERC-721 contract for interaction using the SDK.

  2. Creating a Transaction:

    const trx = {
        target: contractAddress,
        data: counterContract.interface.encodeFunctionData("increment") `
    };
    

    Formulate a transaction object for invoking the increment function on the Counter contract through the SDK.

  3. Executing the Transaction:

    const userOpHash = await sdk.sendUserOp(trx);
    console.log("userOpHash", userOpHash);
    

    Send the transaction using the AA0xGasless SDK and get the operation hash and transaction hash.

Conclusion

This guide covers the basic setup and interaction with an simple Counter smart contract for incremeting using the AA0xGasless SDK. The SDK facilitates gasless transactions and simplifies the implementation of account abstraction as per ERC-4337.

Refer to the AA0xGasless SDK and ERC-4337 documentation for more detailed information.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 8

Native requirements
8 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
@ethersproject/providers
Environment
{
  "local_name": "@ethersproject/providers",
  "alias": false,
  "peer_metadata": null
}
^5.7.2runtime
@account-abstraction/contracts
Environment
{
  "local_name": "@account-abstraction/contracts",
  "alias": false,
  "peer_metadata": null
}
^0.6.0development
@types/jest
Environment
{
  "local_name": "@types/jest",
  "alias": false,
  "peer_metadata": null
}
^29.5.5development
dotenv
Environment
{
  "local_name": "dotenv",
  "alias": false,
  "peer_metadata": null
}
^16.3.1development
jest
Environment
{
  "local_name": "jest",
  "alias": false,
  "peer_metadata": null
}
^29.7.0development
microbundle
Environment
{
  "local_name": "microbundle",
  "alias": false,
  "peer_metadata": null
}
^0.15.1development
ts-jest
Environment
{
  "local_name": "ts-jest",
  "alias": false,
  "peer_metadata": null
}
^29.1.1development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^5.2.2development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-eZ2c13QdaWogai1z9zQl96iXIEVLbgvzAKfxmWcTcbXJa7fAPcQdeEguMhahrYLepqP3Ygh0xRaUPQYYmjUo5g==",
  "shasum": "84f4132e2a5a9ebebd25debd4b96c27bd4588ade",
  "tarball": "https://registry.npmjs.org/@0xgasless/0xgasless-aa-sdk/-/0xgasless-aa-sdk-0.0.7.tgz",
  "fileCount": 49,
  "unpackedSize": 9993980,
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEQCIGNtjHu0oPZ3rxI3o+6jqeGheRb5a6SZoG+lI570Im7HAiAGSmqq27bgDsiEyj05t/sO1S/WEBTGMk3keflOYHQR6Q=="
    }
  ]
}

Repository

PENDING
buildorz/0xgas_aa_sdk

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 08:55 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:dbaf19cd26755451ed704b3359bb64b94af7a238e767cb7fac43b6344199e8d1

Other collected versions

0.0.2626 Apr0.0.2525 Apr0.0.249 Apr0.0.2311 Mar0.0.229 Mar0.0.2127 FebView all collected versions →