From cb0619eaee3662ff2aeb13dd84350b5f5175d211 Mon Sep 17 00:00:00 2001 From: Joe Pegler Date: Fri, 12 Apr 2024 12:26:41 +0100 Subject: [PATCH] chore: update readme --- README.md | 67 +++++++---------------- config.json | 14 ----- src/modules/BatchedSessionRouterModule.ts | 1 - tests/account/read.test.ts | 4 +- tests/account/write.test.ts | 4 +- tests/modules/read.test.ts | 2 +- tests/modules/write.test.ts | 10 ++-- tests/utils.ts | 12 ++-- 8 files changed, 35 insertions(+), 79 deletions(-) delete mode 100644 config.json diff --git a/README.md b/README.md index 7079ed04e..1629a6e93 100644 --- a/README.md +++ b/README.md @@ -4,40 +4,32 @@ [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/bcnmy/biconomy-client-sdk) -This repository serves as a comprehensive foundation for typescript account abstraction projects, streamlining the development process with a focus on best practices, security, and efficiency. +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) - - [Getting Started](#getting-started) + - [๐Ÿ› ๏ธ Quickstart](#-quickstart) - [Prerequisites](#prerequisites) - [Installation](#installation) - [๐Ÿ› ๏ธ Essential Scripts](#๏ธ-essential-scripts) - [๐Ÿงช Run Tests](#-run-tests) - [๐Ÿ“Š Coverage Report](#-coverage-report) - [๐ŸŽจ Lint Code](#-lint-code) - - [๐Ÿ–Œ๏ธ Auto-fix Linting Issues](#๏ธ-auto-fix-linting-issues) + - [๐Ÿ–Œ๏ธ Format Issues](#๏ธ-auto-fix-linting-issues) - [๐Ÿ“„ Documentation and Resources](#-documentation-and-resources) - [License](#license) - [Connect with Biconomy ๐ŸŠ](#connect-with-biconomy-๐ŸŠ) -## Getting Started - -To kickstart, follow these steps: - -### Prerequisites - -- Node.js (v18.x or later) -- Bun (or npm) +## ๐Ÿ› ๏ธ Quickstart ### Installation -1. **Clone the repository:** +1. **Add the package and install dependencies:** ```bash -git clone https://github.com/bcnmy/biconomy-client-sdk.git -cd sdk +bun add @biconomy/account viem ``` 2. **Install dependencies:** @@ -46,51 +38,30 @@ cd sdk bun i ``` -3. **Setup environment variables:** +```typescript +import { createSmartAccountClient } from "@biconomy/account"; -Copy `.env.example` to `.env` and fill in your details. +const smartAccount = await createSmartAccountClient({ + signer: viemWalletOrEthersSigner, + bundlerUrl: "", // From dashboard.biconomy.io + paymasterUrl: "", // From dashboard.biconomy.io +}); -## ๐Ÿ› ๏ธ Essential Scripts +const { wait } = await smartAccount.sendTransaction({ to: "0x...", value: 1 }); -### ๐Ÿงช Run Tests - -```bash -bun run test --watch +const { + receipt: { transactionHash }, + success, +} = await wait(); ``` -Carries out tests. - -### ๐Ÿ“Š Coverage Report - -```bash -bun run test --coverage -``` - -Creates detailed reports for test coverage. - -### ๐ŸŽจ Lint Code - -```bash -bun run lint:fix -``` - -Checks code for style and potential errors. - -### ๐Ÿ–Œ๏ธ Auto-fix Linting Issues - -```bash -bun run lint:fix -``` - -Automatically fixes linting problems found. - ## 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) -- [**TSDoc**](https://bcnmy.github.io/biconomy-client-sdk) +- [**API Documentation**](https://bcnmy.github.io/biconomy-client-sdk) - [**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. diff --git a/config.json b/config.json deleted file mode 100644 index 765c9d223..000000000 --- a/config.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json", - "changelog": "@changesets/cli/changelog", - "commit": false, - "fixed": [], - "linked": [], - "access": "public", - "baseBranch": "main", - "updateInternalDependencies": "patch", - "___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": { - "onlyUpdatePeerDependentsWhenOutOfRange": true - }, - "ignore": [] -} diff --git a/src/modules/BatchedSessionRouterModule.ts b/src/modules/BatchedSessionRouterModule.ts index 92d223114..42f607d80 100644 --- a/src/modules/BatchedSessionRouterModule.ts +++ b/src/modules/BatchedSessionRouterModule.ts @@ -12,7 +12,6 @@ import { type SmartAccountSigner, convertSigner } from "../account" import { BaseValidationModule } from "./BaseValidationModule.js" import { SessionKeyManagerModule } from "./SessionKeyManagerModule.js" import type { - SessionLeafNode, SessionSearchParam, SessionStatus } from "./interfaces/ISessionStorage.js" diff --git a/tests/account/read.test.ts b/tests/account/read.test.ts index b25152ad1..a7afbd659 100644 --- a/tests/account/read.test.ts +++ b/tests/account/read.test.ts @@ -20,9 +20,9 @@ import { type BiconomySmartAccountV2Config, DEFAULT_ENTRYPOINT_ADDRESS, ERROR_MESSAGES, + NATIVE_TOKEN_ALIAS, compareChainIds, - createSmartAccountClient, - NATIVE_TOKEN_ALIAS + createSmartAccountClient } from "../../src/account" import { type UserOperationStruct, getChain } from "../../src/account" import { BiconomyAccountAbi } from "../../src/account/abi/SmartAccount" diff --git a/tests/account/write.test.ts b/tests/account/write.test.ts index 3935a94d9..fe1aa5bb7 100644 --- a/tests/account/write.test.ts +++ b/tests/account/write.test.ts @@ -9,8 +9,8 @@ import { generatePrivateKey, privateKeyToAccount } from "viem/accounts" import { beforeAll, describe, expect, test } from "vitest" import { type BiconomySmartAccountV2, - createSmartAccountClient, - NATIVE_TOKEN_ALIAS + NATIVE_TOKEN_ALIAS, + createSmartAccountClient } from "../../src/account" import { PaymasterMode } from "../../src/paymaster" import { testOnlyOnOptimism } from "../setupFiles" diff --git a/tests/modules/read.test.ts b/tests/modules/read.test.ts index 32262fc7d..429ca4acc 100644 --- a/tests/modules/read.test.ts +++ b/tests/modules/read.test.ts @@ -1,3 +1,4 @@ +import { defaultAbiCoder } from "@ethersproject/abi" import { JsonRpcProvider } from "@ethersproject/providers" import { Wallet } from "@ethersproject/wallet" import { @@ -17,7 +18,6 @@ import { createMultiChainValidationModule } from "../../src/modules" import { getConfig } from "../utils" -import { defaultAbiCoder } from "@ethersproject/abi" describe("Modules: Read", () => { const { diff --git a/tests/modules/write.test.ts b/tests/modules/write.test.ts index 8dec1345e..c3fd7f622 100644 --- a/tests/modules/write.test.ts +++ b/tests/modules/write.test.ts @@ -1,19 +1,19 @@ import { http, type Hex, + createPublicClient, createWalletClient, + encodeAbiParameters, encodeFunctionData, parseAbi, - encodeAbiParameters, - parseUnits, - createPublicClient + parseUnits } from "viem" import { privateKeyToAccount } from "viem/accounts" import { beforeAll, describe, expect, test } from "vitest" import { type BiconomySmartAccountV2, - createSmartAccountClient, - type WalletClientSigner + type WalletClientSigner, + createSmartAccountClient } from "../../src/account" import { Logger, getChain } from "../../src/account" import { diff --git a/tests/utils.ts b/tests/utils.ts index 2f5b5b669..34eb8fb20 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -1,11 +1,14 @@ +import fs from "node:fs" import { + http, type Chain, type Hex, type PublicClient, - parseAbi, createWalletClient, - http + parseAbi } from "viem" +import { generatePrivateKey, privateKeyToAccount } from "viem/accounts" +import { polygonMumbai } from "viem/chains" import { Logger, type SmartAccountSigner, @@ -16,16 +19,13 @@ import { extractChainIdFromBundlerUrl, extractChainIdFromPaymasterUrl } from "../src/bundler" +import type { SignerData } from "../src/modules" import type { ISessionStorage, SessionLeafNode, SessionSearchParam, SessionStatus } from "../src/modules/interfaces/ISessionStorage" -import fs from "node:fs" -import type { SignerData } from "../src/modules" -import { generatePrivateKey, privateKeyToAccount } from "viem/accounts" -import { polygonMumbai } from "viem/chains" export const getEnvVars = () => { const fields = [