Skip to content

Commit 2a8be94

Browse files
committed
Onboard V2 Monorepo
1 parent 3334993 commit 2a8be94

File tree

233 files changed

+12249
-17698
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

233 files changed

+12249
-17698
lines changed

.babelrc

Lines changed: 0 additions & 5 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

.prettierrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ module.exports = {
66
tabWidth: 2,
77
arrowParens: 'avoid',
88
svelteSortOrder: 'options-scripts-styles-markup'
9-
}
9+
}

README.md

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,3 @@
1-
# Onboard
1+
# WIP Branch for Onboard V2
22

3-
JavaScript library to easily onboard users to ethereum apps by enabling wallet selection, connection, wallet checks and real time state updates.
4-
5-
## Install
6-
7-
`npm install bnc-onboard`
8-
9-
## Quick Start
10-
11-
```javascript
12-
import Onboard from 'bnc-onboard'
13-
import Web3 from 'web3'
14-
15-
// set a variable to store instantiated web3
16-
let web3
17-
18-
// head to blocknative.com to create a key
19-
const BLOCKNATIVE_KEY = 'blocknative-api-key'
20-
21-
// the network id that your dapp runs on
22-
const NETWORK_ID = 1
23-
24-
// initialize onboard
25-
const onboard = Onboard({
26-
dappId: BLOCKNATIVE_KEY,
27-
networkId: NETWORK_ID,
28-
subscriptions: {
29-
wallet: wallet => {
30-
// instantiate web3 when the user has selected a wallet
31-
web3 = new Web3(wallet.provider)
32-
console.log(`${wallet.name} connected!`)
33-
}
34-
}
35-
})
36-
37-
// Prompt user to select a wallet
38-
await onboard.walletSelect()
39-
40-
// Run wallet checks to make sure that user is ready to transact
41-
await onboard.walletCheck()
42-
```
43-
44-
## Documentation
45-
46-
For detailed documentation head to [docs.blocknative.com](https://docs.blocknative.com/onboard)
3+
...documentation incoming

ava.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
files: ["tests/**.test.ts"],
3+
ignoredByWatcher: ["dist/**/*"],
4+
cache: true,
5+
concurrency: 2,
6+
typescript: {
7+
rewritePaths: {
8+
"src/": "dist/",
9+
},
10+
compile: false,
11+
},
12+
require: ["ts-node/register/transpile-only"],
13+
};

lerna.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"packages": ["packages/*"],
3+
"npmClient": "yarn",
4+
"useWorkspaces": true,
5+
"version": "independent"
6+
}

package.json

Lines changed: 23 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,32 @@
11
{
2-
"name": "bnc-onboard",
3-
"version": "1.35.4",
4-
"description": "Onboard users to web3 by allowing them to select a wallet, get that wallet ready to transact and have access to synced wallet state.",
5-
"keywords": [
6-
"ethereum",
7-
"web3",
8-
"blocknative",
9-
"wallet"
2+
"name": "core",
3+
"private": true,
4+
"workspaces": [
5+
"packages/*"
106
],
11-
"main": "dist/cjs/onboard.js",
12-
"module": "dist/esm/onboard.js",
13-
"typings": "dist/src/onboard.d.ts",
14-
"files": [
15-
"dist"
16-
],
17-
"author": "Aaron Barnard <[email protected]>",
18-
"repository": {
19-
"type": "git",
20-
"url": "https://github.com/blocknative/onboard"
21-
},
22-
"license": "MIT",
237
"scripts": {
24-
"build": "rimraf dist && rollup -c && babel dist/cjs --out-dir dist/cjs && babel dist/esm --out-dir dist/esm",
25-
"test": "echo \"TBD\" && exit 0",
26-
"prepare": "npm run build",
27-
"lint": "eslint 'src/**/*.ts' && prettier --check {'src/**/*.ts','src/**/*.svelte'}",
28-
"lint:fix": "eslint 'src/**/*.ts' --fix",
29-
"format": "prettier --write {'src/**/*.ts','src/**/*.svelte'}"
8+
"build": "lerna exec yarn build",
9+
"dev": "lerna exec --parallel -- yarn dev",
10+
"test": "lerna exec yarn test",
11+
"format": "prettier --write 'packages/**/*.ts'"
3012
},
3113
"devDependencies": {
32-
"@babel/cli": "^7.7.0",
33-
"@babel/core": "^7.5.5",
34-
"@babel/preset-env": "^7.5.5",
35-
"@pyoner/svelte-ts-preprocess": "^1.2.1",
36-
"@rollup/plugin-image": "^2.0.4",
37-
"@rollup/plugin-json": "^4.0.0",
38-
"@rollup/plugin-node-resolve": "^7.1.1",
39-
"@types/node": "^13.5.1",
40-
"@typescript-eslint/eslint-plugin": "^2.30.0",
41-
"@typescript-eslint/parser": "^2.30.0",
42-
"babel-plugin-external-helpers": "^6.18.0",
43-
"eslint": "^6.8.0",
44-
"eslint-config-prettier": "^8.3.0",
45-
"prettier": "^2.0.5",
46-
"prettier-plugin-svelte": "^2.2.0",
47-
"rimraf": "^3.0.0",
48-
"rollup": "^1.27.5",
49-
"rollup-plugin-svelte": "^6.1.1",
50-
"rollup-plugin-typescript2": "0.21.0",
51-
"svelte": "^3.12.1",
52-
"svelte-i18n": "^1.1.2-beta",
53-
"typescript": "^3.6.4"
14+
"@ava/typescript": "^2.0.0",
15+
"@swc/cli": "^0.1.51",
16+
"@swc/core": "^1.2.92",
17+
"@types/lodash.uniqby": "^4.7.6",
18+
"@types/node": "^16.10.3",
19+
"ava": "^3.15.0",
20+
"browser-env": "^3.3.0",
21+
"lerna": "^4.0.0",
22+
"prettier": "^2.4.1",
23+
"prettier-plugin-svelte": "^2.4.0",
24+
"ts-node": "^10.2.1",
25+
"typescript": "^4.4.3",
26+
"window": "^4.2.7"
5427
},
5528
"dependencies": {
56-
"@cvbb/eth-keyring": "^1.1.0",
57-
"@ensdomains/ensjs": "^2.0.1",
58-
"@ethereumjs/common": "^2.0.0",
59-
"@ethereumjs/tx": "^3.0.0",
60-
"@gnosis.pm/safe-apps-provider": "^0.5.0",
61-
"@gnosis.pm/safe-apps-sdk": "^3.0.0",
62-
"@keystonehq/eth-keyring": "0.9.0",
63-
"@ledgerhq/hw-app-eth": "6.8.1",
64-
"@ledgerhq/hw-transport-u2f": "^5.21.0",
65-
"@ledgerhq/hw-transport-webusb": "6.7.0",
66-
"@portis/web3": "^4.0.0",
67-
"@shapeshiftoss/hdwallet-core": "^1.15.2",
68-
"@shapeshiftoss/hdwallet-keepkey": "^1.15.2",
69-
"@shapeshiftoss/hdwallet-keepkey-webusb": "^1.15.2",
70-
"@toruslabs/torus-embed": "^1.10.11",
71-
"@walletconnect/web3-provider": "^1.6.2",
72-
"authereum": "^0.1.12",
73-
"bignumber.js": "^9.0.0",
74-
"bnc-sdk": "^3.4.1",
75-
"bowser": "^2.10.0",
76-
"eth-lattice-keyring": "^0.2.7",
77-
"eth-provider": "^0.6.1",
78-
"eth-sig-util": "^3.0.1",
79-
"ethereumjs-tx": "^2.1.2",
80-
"ethereumjs-util": "^7.0.3",
81-
"fortmatic": "^2.2.1",
82-
"hdkey": "^2.0.1",
83-
"regenerator-runtime": "^0.13.7",
84-
"trezor-connect": "^8.1.9",
85-
"walletlink": "^2.2.6",
86-
"web3-provider-engine": "^15.0.4"
87-
},
88-
"resolutions": {
89-
"authereum/web3-utils/underscore": "^1.12.1",
90-
"authereum/ethereum-private-key-to-address/meow/trim-newlines": "^3.0.1",
91-
"authereum/ethers/elliptic": "^6.5.3",
92-
"@portis/web3/pocket-js-core/axios": "^0.21.1",
93-
"@shapeshiftoss/hdwallet-keepkey/bnb-javascript-sdk-nobroadcast/axios": "^0.21.1"
29+
"ethers": "^5.4.7",
30+
"joi": "^17.4.2"
9431
}
9532
}

packages/@types/index.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
declare module '*.png'
2+
declare module 'window'
3+
declare const global: typeof globalThis & { window: CustomWindow }

packages/common/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# @onboard/common
2+
3+
Utilities and helper method common to all wallets.
4+
5+
### Usage
6+
7+
createEIP1193Provider
8+
9+
Basic:
10+
11+
```typescript
12+
13+
```

packages/common/package.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "@onboard/common",
3+
"version": "0.0.1",
4+
"description": "Resources common to all wallets",
5+
"module": "dist/index.js",
6+
"typings": "dist/index.d.ts",
7+
"files": [
8+
"dist",
9+
"yarn.lock"
10+
],
11+
"scripts": {
12+
"build": "tsc",
13+
"dev": "tsc -w",
14+
"test": "ava",
15+
"prepare": "yarn build"
16+
},
17+
"license": "MIT",
18+
"devDependencies": {
19+
"typescript": "^4.4.4"
20+
},
21+
"dependencies": {
22+
"@onboard/types": "^0.0.1"
23+
}
24+
}

0 commit comments

Comments
 (0)