-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from DcentWallet/dev
master merge for first release
- Loading branch information
Showing
43 changed files
with
24,997 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"presets": [ | ||
"@babel/preset-react", | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"targets": { | ||
"node": "current" | ||
} | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
browser: true, | ||
node: true | ||
}, | ||
parserOptions: { | ||
parser: 'babel-eslint' | ||
}, | ||
extends: [ | ||
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention | ||
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules. | ||
//'plugin:vue/recommended', | ||
'eslint:recommended' | ||
], | ||
// required to lint *.vue files | ||
plugins: [ | ||
//'vue' | ||
], | ||
// add your custom rules here | ||
rules: { | ||
// allow paren-less arrow functions | ||
'arrow-parens': 0, | ||
// allow debugger during development | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, | ||
'indent': 0, | ||
'semi': 0, | ||
'quotes': ["warn", "single", { "avoidEscape": true }], | ||
'spaced-comment': 0, | ||
'no-trailing-spaces': 0, | ||
'comma-dangle': 0, | ||
'operator-linebreak': 0, | ||
'keyword-spacing': 0, | ||
'padded-blocks': 0, | ||
'space-before-blocks': 0, | ||
'yoda': 0, | ||
'no-multi-spaces': 0, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: Node.js CI | ||
|
||
on: | ||
push: | ||
branches: [ master, dev ] | ||
pull_request: | ||
branches: [ master, dev ] | ||
|
||
jobs: | ||
lint-build-unit: | ||
|
||
runs-on: windows-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [10.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm ci | ||
- run: npm run build | ||
- run: npm run build-dev | ||
- run: npm run test | ||
env: | ||
CI: true | ||
NODE_OPTIONS: --max-old-space-size=8192 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dist | ||
node_modules | ||
tests/coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
dist | ||
example | ||
node_modules | ||
tests/coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 D'CENT Wallet | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,86 @@ | ||
# dcent-provider | ||
ethereum web3 provider of D'CENT Biometric Wallet communicating with dcent-web-connector | ||
|
||
This package is ethereum web3 provider of D'CENT Biometric Wallet. | ||
It is the wrapping package communicating with [`dcent-web-connector`](https://github.com/DcentWallet/dcent-web-connector). Since `dcent-web-connector` can be used only on desktop environment via USB interface, this package only for desktop environment. | ||
|
||
## Prerequisite | ||
|
||
* [D'CENT Biometric Wallet](https://dcentwallet.com/products/BiometricWallet) device | ||
|
||
## Installation | ||
|
||
```sh | ||
npm i dcent-provider | ||
``` | ||
|
||
## Usage | ||
|
||
### Create provider and use directly | ||
|
||
```js | ||
import DcentProvider from 'dcent-provider' | ||
|
||
const provider = new DcentProvider({ | ||
rpcUrl: "YOUR_RPC_URL", // required | ||
chainId: 1, // (optional) default = 1 | ||
}) | ||
|
||
const account = await provider.enable() | ||
const tx = { | ||
from: account[0], | ||
gasPrice: "2000000000", | ||
gas: "21000", | ||
to: account[0], | ||
value: "0", | ||
data: "" | ||
} | ||
const receipt = await provider.send('eth_sendTransaction', tx) | ||
``` | ||
|
||
### Set provider on web3js | ||
|
||
```js | ||
import Web3 from 'web3' | ||
import DcentProvider from 'dcent-provider' | ||
|
||
const provider = new DcentProvider({ | ||
rpcUrl: "YOUR_RPC_URL", // required | ||
chainId: 1, // (optional) default = 1 | ||
}) | ||
|
||
const web3 = new Web3(provider) | ||
const accounts = await web3.eth.getAccounts() | ||
const tx = { | ||
from: accounts[0], | ||
gasPrice: "2000000000", | ||
gas: "21000", | ||
to: account[0], | ||
value: "0", | ||
data: "" | ||
} | ||
const receipt = await web3.eth.sendTransaction(tx) | ||
``` | ||
|
||
## Demo | ||
|
||
Check [example](example/README.md) package | ||
|
||
## Build & Test | ||
|
||
### build for production | ||
|
||
```sh | ||
npm run build | ||
``` | ||
|
||
### build for development | ||
|
||
```sh | ||
npm run build-dev | ||
``` | ||
|
||
### test | ||
|
||
```sh | ||
npm run test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.DS_Store | ||
node_modules | ||
/dist | ||
|
||
# local env files | ||
.env.local | ||
.env.*.local | ||
|
||
# Log files | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Editor directories and files | ||
.idea | ||
.vscode | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# example | ||
|
||
## Project setup | ||
|
||
```sh | ||
npm install | ||
``` | ||
|
||
### Compiles and hot-reloads for development | ||
|
||
```sh | ||
npm run serve | ||
``` | ||
|
||
### Compiles and minifies for production | ||
|
||
```sh | ||
npm run build | ||
``` | ||
|
||
### Lints and fixes files | ||
|
||
```sh | ||
npm run lint | ||
``` | ||
|
||
### Customize configuration | ||
|
||
See [Configuration Reference](https://cli.vuejs.org/config/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
presets: [ | ||
'@vue/cli-plugin-babel/preset' | ||
] | ||
} |
Oops, something went wrong.