Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 33 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ env:
FOUNDRY_PROFILE: ci

jobs:
lint:
contracts-fmt-check:
name: Lint contracts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand All @@ -25,18 +25,13 @@ jobs:
- name: Run Forge format
run: |
cd contracts
forge --version
forge fmt
id: fmt

test:
strategy:
fail-fast: true
forge fmt --check

contracts-test:
name: Test contracts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand All @@ -48,12 +43,37 @@ jobs:
- name: Run Forge build
run: |
cd contracts
forge --version
forge build --sizes
id: build

- name: Run Forge tests
run: |
cd contracts
forge test -vvv
id: test

build-frontend:
name: Build Next.js frontend
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./front
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run ESLint
run: pnpm run lint

- name: Build application
run: pnpm run build
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Live demo app: <a href="https://passkeys-4337.vercel.app" target="_blank">passke
<div align="center">

[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-red.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![CI](https://github.com/eugenPtr/smart-wallet/actions/workflows/ci.yml/badge.svg)](https://github.com/eugenPtr/smart-wallet/actions/workflows/ci.yml)
[![Sepolia Testnet](https://img.shields.io/badge/Sepolia%20testnet-blue?&label=deployed%20on)](https://passkeys-4337.vercel.app/)
[![ERC-4337](https://img.shields.io/badge/4337-teal?&label=ERC)](https://passkeys-4337.vercel.app/)
[![Passkeys](https://img.shields.io/badge/Passkeys-teal?&label=Auth)](https://w3c.github.io/webauthn/)</br>
Expand Down Expand Up @@ -46,7 +47,7 @@ This project was meant possible thanks to the building blocks previously made by

- [Daimo](https://github.com/daimo-eth) and their [p256-verifier](https://github.com/daimo-eth/p256-verifier) for the onchain signature verification
- [Infinitism](https://github.com/eth-infinitism/) and their work around [ERC-4337](https://eips.ethereum.org/EIPS/eip-4337)
- [StackUp](https://www.stackup.sh/) and their work for the [Bundler node implementation](https://docs.stackup.sh/)
- [Pimlico](https://www.pimlico.io/) and their work for the [Bundler and Paymaster infrastructure](https://docs.pimlico.io/)
- [Matthew Miller](https://twitter.com/iamkale) and his work around [WebAuthn](https://github.com/MasterKale/SimpleWebAuthn)
- [Webauthn.io](https://webauthn.guide/) for their great documentation around WebAuthn and their [demo](https://webauthn.io/)

Expand Down Expand Up @@ -85,7 +86,7 @@ The Smart Account is the contract implementing the ERC-4337 standard. Its addres

## Onchain interactions via UserOperations

The ERC-4337 standard revolves around UserOperations, which are basically objects replacing transactions and that are sent on behalf of the user by nodes known as [`Bundlers`](https://docs.stackup.sh/docs/erc-4337-bundler#:~:text=In%20ERC%2D4337%2C%20a%20Bundler,work%20on%20any%20EVM%20network.). UserOperations are signed by the user with their passkey and the bundler's job is to include them in a block while taking a little fee for the work. In our case, we use the [StackUp Bundler node implementation](https://docs.stackup.sh/). We strongly advise you to look at Stackup documentation and the ERC-4337 EIP to understand how Bundlers work.
The ERC-4337 standard revolves around UserOperations, which are basically objects replacing transactions and that are sent on behalf of the user by nodes known as [`Bundlers`](https://docs.pimlico.io/permissionless/bundler). UserOperations are signed by the user with their passkey and the bundler's job is to include them in a block while taking a little fee for the work. In our case, we use the [Pimlico Bundler implementation](https://docs.pimlico.io/). We strongly advise you to look at Pimlico documentation and the ERC-4337 EIP to understand how Bundlers work.

## Retrieving an account

Expand All @@ -103,7 +104,7 @@ On your first visit, create an account by entering a username. You will be asked
## Requirements

- [pnpm](https://pnpm.io/installation)
- [StackUp API KEY](https://app.stackup.sh/sign-in): to be able to include UserOperations in blocks, see [.env.local.example](./front/.env.local.example)
- [Pimlico API KEY](https://dashboard.pimlico.io/): to be able to include UserOperations in blocks, see [.env.local.example](./front/.env.local.example)
- a **TESTING** account with some Sepolia funds, to be able to sponsor user creation (see [.env.local.example](./front/.env.local.example)). Be careful to not use any private key tied to some real funds. **DO NOT LEAK YOUR PRIVATE KEYS**.
- [Foundry](https://book.getfoundry.sh/getting-started/installation): if you want to deploy your own contracts.

Expand All @@ -120,7 +121,7 @@ Before running the front, you need to update the `.env.local` file with your own

```bash
cp .env.local.example .env.local
# Then update the values of the StackUp API KEY and the TESTING private key
# Then update the values of the Pimlico API KEY and the TESTING private key
```

## Run
Expand Down
6 changes: 4 additions & 2 deletions front/.env.local.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
NEXT_PUBLIC_STACKUP_BUNDLER_API_KEY=""
NEXT_PUBLIC_RPC_ENDPOINT=""
NEXT_PUBLIC_PIMLICO_API_KEY=""
NEXT_PUBLIC_ALCHEMY_RPC_ENDPOINT=""
ETHERSCAN_API_KEY=""
NEXT_PUBLIC_FACTORY_CONTRACT_ADDRESS="0xDD0f9cB4Cf53d28b976C13e7ee4a169F841924c0"
# Private key of the relayer EOA used to register new users in the factory contract
# This account pays for gas fees when creating new smart wallet accounts
RELAYER_PRIVATE_KEY=""
Loading