@biconomy/abstractjs
Version:
SDK for Biconomy integration with support for account abstraction, smart accounts, ERC-4337.
132 lines (103 loc) • 5.5 kB
Markdown
[](https://biconomy.io)
[](https://github.com/bcnmy/abstractjs/actions)
[](./LICENSE)
[](https://codecov.io/github/bcnmy/abstractjs)
[](https://packagephobia.com/result?p=@biconomy/abstractjs)
# abstractjs 🚀
[](https://codespaces.new/bcnmy/abstractjs)
The Biconomy SDK is your all-in-one toolkit for building decentralized applications (dApps) with **ERC4337 Account Abstraction** and **Smart Accounts**. It is designed for seamless user experiences and offers non-custodial solutions for user onboarding, sending transactions (userOps), gas sponsorship and much more.
## 📚 Table of Contents
- [SDK 🚀](#sdk-)
- [📚 Table of Contents](#-table-of-contents)
- [🛠️ Quickstart](#-quickstart)
- [Installation](#installation)
- [Testing](#testing)
- [📄 Documentation and Resources](#-documentation-and-resources)
- [💼 Examples](#-examples)
- [License](#license)
- [Connect with Biconomy 🍊](#connect-with-biconomy-)
## 🛠️ Quickstart
### Installation
1. **Add the package:**
```bash
bun add @biconomy/abstractjs viem @rhinestone/module-sdk
```
2. **Basic Usage:**
```typescript
import {
toMultichainNexusAccount,
mcUSDC,
createMeeClient,
getMEEVersion,
MEEVersion
} from "@biconomy/abstractjs";
import { base, optimism } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";
import { http } from "viem";
const eoaAccount = privateKeyToAccount(`0x${process.env.PRIVATE_KEY}`)
const mcNexus = await toMultichainNexusAccount({
signer: eoaAccount,
chainConfigurations: [
{
chain: base,
transport: http(),
version: getMEEVersion(MEEVersion.V2_1_0)
},
{
chain: optimism,
transport: http(),
version: getMEEVersion(MEEVersion.V2_1_0)
}
]
})
const meeClient = await createMeeClient({ account: mcNexus })
const quote = await meeClient.getQuote({
instructions: [{
calls: [{ to: "0x...", value: 1n, gasLimit: 100000n }],
chainId: base.id
}],
feeToken: {
address: mcUSDC.addressOn(base.id),
chainId: base.id
}
})
// Execute the quote and get back a transaction hash
// This sends the transaction to the network
const { hash } = await meeClient.executeQuote({ quote })
```
### Testing
**Prerequisites:**
- [Node.js](https://nodejs.org/en/download/package-manager) *(v22 or higher)*
- [Bun](https://bun.sh/) package manager
- [Foundry](https://book.getfoundry.sh/getting-started/installation)
- [Yarn](https://www.npmjs.com/package/yarn) *(must be 1.1.x, not 3.x)*. This is necessary because the nexus contracts repo relies on yarn.
**Setup:**
```bash
bun install --frozen-lockfile
```
**Funding test accounts:**
```bash
# Fund test nexus accounts with native tokens and USDC, using a funded PRIVATE_KEY master account
bun run fund:nexus
```
**Running Tests:**
```bash
# Run all tests
bun run test
# Run tests in watch mode for a specific subset of tests (by test description)
bun run test:watch -t=mee
```
For detailed information about the testing framework, network configurations, and debugging guidelines, please refer to our [Testing Documentation](./src/test/README.md).
## 📄 Documentation and Resources
For a comprehensive understanding of our project and to contribute effectively, please refer to the following resources:
- [**Biconomy Documentation**](https://docs.biconomy.io)
- [**Biconomy Dashboard**](https://dashboard.biconomy.io)
- [**API Documentation**](https://bcnmy.github.io/abstractjs)
- [**Contributing Guidelines**](./CONTRIBUTING.md): Learn how to contribute to our project, from code contributions to documentation improvements.
- [**Code of Conduct**](./CODE_OF_CONDUCT.md): Our commitment to fostering an open and welcoming environment.
- [**Security Policy**](./SECURITY.md): Guidelines for reporting security vulnerabilities.
- [**Changelog**](./CHANGELOG.md): Stay updated with the changes and versions
## License
This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details
## Connect with Biconomy 🍊
[](https://biconomy.io) [](https://t.me/biconomy) [](https://twitter.com/biconomy) [](https://www.linkedin.com/company/biconomy) [](https://discord.gg/biconomy) [](https://www.youtube.com/channel/UC0CtA-Dw9yg-ENgav_VYjRw) [](https://github.com/bcnmy/)