This repo houses the Tokenbound SDK, a front-end library for interacting with ERC-6551 accounts.
- @tokenbound/sdk - SDK client for all projects, signing enabled via either Ethers Signer or viem WalletClient.
- @tokenbound/react - Low-level react hooks for interacting with token bound accounts
- examples/vite-wagmi-viem - An example app using the tokenbound SDK in a vite project with wagmi
- examples/vite-wagmi-ethers - An example app using the tokenbound SDK in a vite project with ethers v5
- examples/vite-wagmi-ethers6 - An example app using the tokenbound SDK in a vite project with ethers v6
- examples/vite-wagmi-ethers-rainbowkit - An example app using the tokenbound SDK in a vite project with ethers v5
- Clone repository and install dependencies:
# clone the repo
$ git clone <repo>
# install dependencies
$ pnpm install
# build packages
$ pnpm --filter "@tokenbound/*" build
NOTE: Any local SDK changes require a rebuild to be useable in the example apps in /example
- Install Anvil to run a local Ethereum node.
- Configure environment variables. See
.env.example
for instructions - Run dev server:
pnpm dev
Unit and integration tests are run by Vitest and rendered with a custom render
function from React Testing Library. See usage of renderWithWagmiConfig
in packages/sdk/src/tests
.
This configuration allows us to use a single wagmi configuration to test the viem walletClient, Ethers 5, and Ethers 6 implementations with wagmi's Ethers adaptors
These tests require a local Anvil node so test transactions can be run against a mainnet fork.
- Start Anvil in a terminal session
pnpm anvil
- Start Vitest in a different terminal session from the SDK root
pnpm test
Husky has been configured to run a pre-commit hook to ensure tests pass
Props to @tmm for sharing testing-wagmi for reference.