Skip to content

Commit e324bf2

Browse files
committed
Create basic wallet
0 parents  commit e324bf2

File tree

10 files changed

+13674
-0
lines changed

10 files changed

+13674
-0
lines changed

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env
17+
.env.local
18+
.env.development.local
19+
.env.test.local
20+
.env.production.local
21+
22+
npm-debug.log*
23+
yarn-debug.log*
24+
yarn-error.log*

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Sample Burner Wallet 2
2+
3+
This repo provides a boilerplate for creating a customized wallet using the Burner Wallet 2 libraries.
4+
5+
## Setup
6+
7+
1. Clone the repo
8+
2. Run `yarn install`
9+
3. To connect to mainnet & most testnets, you'll need to provide an Infura key. Create a file
10+
named `.env` in the `basic-wallet` folder and set the contents to `REACT_APP_INFURA_KEY=<your key from infura.com>`
11+
4. Run `yarn start` to start the wallet on `http://localhost:3000`, or run `yarn build` to compile a production wallet into the build directory.
12+
13+
**Note:** If you would like to extend Burner Wallet functionality by building your own plugin, check out the [`burner-wallet/sample-plugin`](https://github.com/burner-wallet/sample-plugin) repo.

package.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "sample-burner-wallet",
3+
"description": "Sample repo for building a wallet using Burner Wallet 2",
4+
"version": "1.0.0",
5+
"private": true,
6+
"dependencies": {
7+
"@burner-wallet/assets": "^1.0.0",
8+
"@burner-wallet/core": "^1.0.0",
9+
"@burner-wallet/exchange": "^1.0.0",
10+
"@burner-wallet/modern-ui": "^1.0.0",
11+
"@types/node": "12.0.4",
12+
"@types/react": "*",
13+
"@types/react-dom": "16.8.4",
14+
"@types/react-router-dom": "^4.3.3",
15+
"react": "^16.8.6",
16+
"react-dom": "^16.8.6",
17+
"react-scripts": "^3.2.0",
18+
"typescript": "3.5.1"
19+
},
20+
"scripts": {
21+
"start": "react-scripts start",
22+
"build": "react-scripts build",
23+
"test": "react-scripts test",
24+
"eject": "react-scripts eject"
25+
},
26+
"browserslist": {
27+
"production": [
28+
">0.2%",
29+
"not dead",
30+
"not op_mini all"
31+
],
32+
"development": [
33+
"last 1 chrome version",
34+
"last 1 firefox version",
35+
"last 1 safari version"
36+
]
37+
},
38+
"devDependencies": {}
39+
}

public/favicon.ico

3.78 KB
Binary file not shown.

public/index.html

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<!--
9+
manifest.json provides metadata used when your web app is installed on a
10+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
11+
-->
12+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
13+
<!--
14+
Notice the use of %PUBLIC_URL% in the tags above.
15+
It will be replaced with the URL of the `public` folder during the build.
16+
Only files inside the `public` folder can be referenced from the HTML.
17+
18+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
19+
work correctly both with client-side routing and a non-root public URL.
20+
Learn how to configure a non-root public URL by running `npm run build`.
21+
-->
22+
<title>Burner Wallet</title>
23+
</head>
24+
<body>
25+
<noscript>You need to enable JavaScript to run this app.</noscript>
26+
<div id="root"></div>
27+
<!--
28+
This HTML file is a template.
29+
If you open it directly in the browser, you will see an empty page.
30+
31+
You can add webfonts, meta tags, or analytics to this file.
32+
The build step will place the bundled scripts into the <body> tag.
33+
34+
To begin the development, run `npm start` or `yarn start`.
35+
To create a production bundle, use `npm run build` or `yarn build`.
36+
-->
37+
</body>
38+
</html>

public/manifest.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"short_name": "React App",
3+
"name": "Create React App Sample",
4+
"icons": [
5+
{
6+
"src": "favicon.ico",
7+
"sizes": "64x64 32x32 24x24 16x16",
8+
"type": "image/x-icon"
9+
}
10+
],
11+
"start_url": ".",
12+
"display": "standalone",
13+
"theme_color": "#000000",
14+
"background_color": "#ffffff"
15+
}

src/index.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import { xdai, dai, eth } from '@burner-wallet/assets';
4+
import BurnerCore from '@burner-wallet/core';
5+
import { InjectedSigner, LocalSigner } from '@burner-wallet/core/signers';
6+
import { InfuraGateway, InjectedGateway, XDaiGateway, } from '@burner-wallet/core/gateways';
7+
import Exchange, { Uniswap, XDaiBridge } from '@burner-wallet/exchange';
8+
import ModernUI from '@burner-wallet/modern-ui';
9+
10+
const core = new BurnerCore({
11+
signers: [new InjectedSigner(), new LocalSigner()],
12+
gateways: [
13+
new InjectedGateway(),
14+
new InfuraGateway(process.env.REACT_APP_INFURA_KEY),
15+
new XDaiGateway(),
16+
],
17+
// TODO use Sai
18+
assets: [xdai, dai, eth],
19+
});
20+
21+
const exchange = new Exchange({
22+
pairs: [new XDaiBridge(), new Uniswap('dai')],
23+
});
24+
25+
const BurnerWallet = () =>
26+
<ModernUI
27+
title="Basic Wallet"
28+
core={core}
29+
plugins={[exchange]}
30+
/>
31+
32+
33+
ReactDOM.render(<BurnerWallet />, document.getElementById('root'));

src/react-app-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="react-scripts" />

tsconfig.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"lib": [
5+
"dom",
6+
"dom.iterable",
7+
"esnext"
8+
],
9+
"allowJs": true,
10+
"skipLibCheck": true,
11+
"esModuleInterop": true,
12+
"allowSyntheticDefaultImports": true,
13+
"strict": true,
14+
"forceConsistentCasingInFileNames": true,
15+
"module": "esnext",
16+
"moduleResolution": "node",
17+
"resolveJsonModule": true,
18+
"isolatedModules": true,
19+
"noEmit": true,
20+
"jsx": "preserve"
21+
},
22+
"include": [
23+
"src"
24+
]
25+
}

0 commit comments

Comments
 (0)