Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add account abstraction example #70

Closed
wants to merge 13 commits into from
Closed
2 changes: 2 additions & 0 deletions examples/account-abstraction/eth-finitism/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VITE_WALLET_CONNECT_PROJECT_ID=
VITE_PIMLICO_API_KEY=
18 changes: 18 additions & 0 deletions examples/account-abstraction/eth-finitism/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
26 changes: 26 additions & 0 deletions examples/account-abstraction/eth-finitism/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

.env
5 changes: 5 additions & 0 deletions examples/account-abstraction/eth-finitism/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dist
node_modules
coverage
build
pnpm-lock.yaml
8 changes: 8 additions & 0 deletions examples/account-abstraction/eth-finitism/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 120,
"tabWidth": 2,
"singleQuote": true,
"jsxSingleQuote": true,
"trailingComma": "none",
"bracketSpacing": true
}
45 changes: 45 additions & 0 deletions examples/account-abstraction/eth-finitism/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## Local development

### Installing the project

1. Install [pnpm](https://pnpm.io/installation)
2. Run `pnpm install`

### Connecting Metamask

1. Go to [Conduit](https://app.conduit.xyz/published/view/fluffy-bob-7mjgi9pmtg)
2. Click the 'Add to wallet button.'

### Funding your account

#### Native token

1. Create a new account in your wallet
2. From the L2 Faucet section in [Conduit](https://app.conduit.xyz/published/view/fluffy-bob-7mjgi9pmtg), enter your address and click the 'Claim' button.

Note: we have seen instances of this failing. If this happens, the api can be called from a terminal:
`curl -XPOST -i https://faucetl2-fluffy-bob-7mjgi9pmtg.t.conduit.xyz/drip/0x4062e44077b1e58C3D630a0e4e632fF81868e448`

#### Other supported tokens

1. This can be done either by using the faucet button in the UI or by interacting with the smart contract in [Conduit](https://explorerl2-fluffy-bob-7mjgi9pmtg.t.conduit.xyz/address/[address])

### Starting the project

1. Run `pnpm dev`

### Browser support

This application is tested using:

- Chrome
- Brave
- Firefox

In the following environments:

- Linux
- MacOS
- Windows

It does not currently support any mobile wallets.
22 changes: 22 additions & 0 deletions examples/account-abstraction/eth-finitism/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<!-- TODO: Use local image rather than pulling in from website -->
<link
href="https://uploads-ssl.webflow.com/64e85c2f3609488b3ed725f4/64ecae53ef4b561482f1c49f_bob1.jpg"
rel="shortcut icon"
type="image/x-icon"
/>
<link
href="https://uploads-ssl.webflow.com/64e85c2f3609488b3ed725f4/64ecae715f5d3632aa4b6905_bob256.jpg"
rel="apple-touch-icon"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>BOB: Peer to Peer Swap</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
61 changes: 61 additions & 0 deletions examples/account-abstraction/eth-finitism/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"name": "bob-ui-poc",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"format:check": "prettier --check src/** --cache",
"format:write": "prettier --write src/** --cache"
},
"dependencies": {
"@account-abstraction/contracts": "^0.6.0",
"@account-abstraction/sdk": "^0.6.0",
"@ethersproject/abi": "^5.7.0",
"@ethersproject/abstract-provider": "^5.7.0",
"@ethersproject/abstract-signer": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"@gobob/bob-sdk": "^1.0.3",
"@interlay/hooks": "^0.0.7",
"@interlay/system": "^0.0.1",
"@interlay/theme": "^0.0.6",
"@interlay/ui": "0.0.6",
"@metamask/providers": "^12.0.0",
"@react-aria/utils": "^3.21.0",
"@tanstack/react-query": "^4.36.1",
"@wagmi/core": "^1.4.5",
"@web3auth/base": "^7.0.4",
"@web3auth/ethereum-provider": "^7.0.4",
"@web3auth/modal": "^7.0.5",
"@web3auth/openlogin-adapter": "^7.0.4",
"@web3modal/wagmi": "^3.1.0",
"big.js": "^6.2.1",
"ethers": "^5.7.2",
"permissionless": "^0.0.9",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-jazzicon": "^1.0.4",
"styled-components": "^6.0.8",
"truncate-eth-address": "^1.0.2",
"viem": "^1.10.9",
"vite-plugin-node-polyfills": "^0.15.0",
"wagmi": "^1.4.5"
},
"devDependencies": {
"@typechain/ethers-v6": "^0.5.0",
"@types/big.js": "^6.2.0",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vitejs/plugin-react": "^4.0.3",
"eslint": "^8.45.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"typescript": "^5.2.2",
"vite": "^4.4.5"
}
}
Loading