Skip to content

Commit

Permalink
Release 0.6.1 (#584)
Browse files Browse the repository at this point in the history
- Login presentation
- New profile sidebar
- Vote limit slider for Voting
- Fee slider in confirm tx dialog
- Internal IPFS node
  • Loading branch information
ipavlenko committed Feb 25, 2018
1 parent 186553e commit cae48c0
Show file tree
Hide file tree
Showing 109 changed files with 3,139 additions and 1,078 deletions.
4 changes: 4 additions & 0 deletions config/webpack.config.base.js
Expand Up @@ -16,8 +16,10 @@ if (isInDebugMode) {
}

let srcPath = path.resolve(__dirname, relativePath, 'src')
let modulesPath = path.resolve(__dirname, relativePath, 'node_modules')
let packagesPath = path.resolve(__dirname, relativePath, 'packages')
let indexHtmlPath = path.resolve(__dirname, relativePath, 'index.html')
let indexPresentationHtmlPath = path.resolve(__dirname, relativePath, 'index-presentation.html')
let faviconPath = path.resolve(__dirname, relativePath, 'favicon.ico')
let buildPath = path.join(__dirname, isInNodeModules ? '../../..' : '..', 'build')

Expand All @@ -31,7 +33,9 @@ const buildConfig = (factory) => {
devtool,
} = factory({
srcPath,
modulesPath,
indexHtmlPath,
indexPresentationHtmlPath,
faviconPath,
buildPath,
})
Expand Down
41 changes: 32 additions & 9 deletions config/webpack.config.prod.js
@@ -1,13 +1,16 @@
let path = require('path')
let webpack = require('webpack')
const path = require('path')
const webpack = require('webpack')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin')

let config = require('./webpack.config.base.js')
const config = require('./webpack.config.base.js')

let HtmlWebpackPlugin = require('html-webpack-plugin')
let ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const HtmlWebpackIncludeAssetsPlugin = require('html-webpack-include-assets-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')

module.exports = config.buildConfig(
({ srcPath, buildPath, indexHtmlPath, faviconPath }) => ({
({ srcPath, modulesPath, buildPath, indexPresentationHtmlPath, faviconPath }) => ({
entry: path.join(srcPath, 'index'),
output: {
path: buildPath,
Expand All @@ -17,13 +20,13 @@ module.exports = config.buildConfig(
babel: require('./babel.prod'),
plugins: [
new HtmlWebpackPlugin({
inject: true,
template: indexHtmlPath,
inject: 'head',
template: indexPresentationHtmlPath,
favicon: faviconPath,
hash: true,
minify: {
removeComments: true,
collapseWhitespace: true,
collapseWhitespace: false,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
Expand All @@ -34,6 +37,10 @@ module.exports = config.buildConfig(
minifyURLs: true,
},
}),
new ScriptExtHtmlWebpackPlugin({
defaultAttribute: 'async',
sync: ['chronomint-presentation/js/vendor.js', 'chronomint-presentation/js/index.js'],
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': `"${process.env.NODE_ENV}"`,
WEB3_RPC_LOCATION: '"' + process.env.WEB3_RPC_LOCATION + '"',
Expand All @@ -54,6 +61,22 @@ module.exports = config.buildConfig(
},
}),
new ExtractTextPlugin('[name].[contenthash].css'),
new CopyWebpackPlugin([
{
context: path.join(modulesPath, '@chronobank/chronomint-presentation/dist/chronomint-presentation'),
from: '**',
to: path.join(buildPath, 'chronomint-presentation'),
},
]),
new HtmlWebpackIncludeAssetsPlugin({
assets: [
'chronomint-presentation/css/index.css',
'chronomint-presentation/js/vendor.js',
'chronomint-presentation/js/index.js',
],
hash: true,
append: false,
}),
],
})
)
35 changes: 35 additions & 0 deletions index-presentation.html
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<title>ChronoMint</title>
<link rel="shortcut icon" href="favicon.ico">
<style>
html {
background-image: linear-gradient(224deg, #644ebf, #262448);
}
</style>
</head>
<body>
<div id="presentation-root"></div>
<div id="react-root"></div>
<script>
ReactDOM.render(React.createElement(Components.PresentationApp, {
applicationContainer: document.getElementById("react-root")
}), document.getElementById("presentation-root"));
</script>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add web fonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` in this folder.
To create a production bundle, use `npm run build`.
-->
</body>
</html>
10 changes: 5 additions & 5 deletions index.html
@@ -1,11 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<title>ChronoMint</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<title>ChronoMint</title>
</head>
<body>
<div id="react-root"></div>
Expand Down
10 changes: 7 additions & 3 deletions package.json
@@ -1,9 +1,10 @@
{
"name": "@chronobank/mint",
"version": "0.5.2",
"version": "0.6.1",
"description": "Control panel for ChronoBank",
"private": true,
"devDependencies": {
"@chronobank/chronomint-presentation": "github:chronobank/ChronoMintPresentation",
"@chronobank/login": "*",
"@chronobank/login-ui": "*",
"archiver": "^2.0.0",
Expand All @@ -26,6 +27,7 @@
"babel-preset-react-hmre": "^1.1.1",
"babel-preset-stage-0": "^6.24.1",
"chalk": "1.1.3",
"copy-webpack-plugin": "^4.0.0",
"coveralls": "^2.13.1",
"cross-env": "^5.0.0",
"css-loader": "0.28.1",
Expand All @@ -44,6 +46,7 @@
"extract-text-webpack-plugin": "2.1.0",
"file-loader": "0.11.1",
"flexboxgrid": "^6.3.1",
"html-webpack-include-assets-plugin": "^1.0.2",
"html-webpack-plugin": "2.28.0",
"http-server": "^0.10.0",
"import-sort": "^3.3.0",
Expand All @@ -64,7 +67,9 @@
"redux-devtools": "^3.4.0",
"redux-mock-store": "^1.2.3",
"sass-loader": "^6.0.5",
"script-ext-html-webpack-plugin": "^1.8.8",
"socket.io-mock": "^1.2.3",
"style-ext-html-webpack-plugin": "^3.4.7",
"style-loader": "^0.17.0",
"uglify-js": "github:mishoo/UglifyJS2#harmony",
"url-loader": "0.5.8",
Expand All @@ -78,7 +83,7 @@
"bip39": "^2.3.0",
"bitcoinjs-lib": "github:chronobank/bitcoinjs-lib#opt-in-bitcoincash-sighash",
"bs58": "latest",
"chronobank-smart-contracts": "1.1.45",
"chronobank-smart-contracts": "github:chronobank/SmartContracts#release/release-1.1.46",
"classnames": "^2.2.5",
"coinselect": "^3.1.11",
"d3": "^4.10.0",
Expand All @@ -90,7 +95,6 @@
"ipfs-api": "^16.0.0",
"js-file-download": "^0.4.1",
"keythereum": "^0.5.2",
"ledger-wallet-provider": "github:dkchv/ledger-wallet-provider",
"lodash": "^4.17.4",
"material-colors-scss": "^1.0.0",
"material-ui": "^0.19.4",
Expand Down
Expand Up @@ -182,7 +182,6 @@ class LoginWithOptions extends PureComponent {
this.props.clearErrors()
try {
ledgerProvider.setupAndStart(networkService.getProviderURL())
web3Provider.reinit(ledgerProvider.getWeb3(), ledgerProvider.getProvider())
const provider = ledgerProvider.getNetworkProvider(networkService.getProviderSettings())
this.setupAndLogin(provider)
} catch (e) {
Expand All @@ -195,7 +194,6 @@ class LoginWithOptions extends PureComponent {
this.props.clearErrors()
try {
trezorProvider.setupAndStart(networkService.getProviderURL())
web3Provider.reinit(trezorProvider.getWeb3(), trezorProvider.getProvider())
const provider = trezorProvider.getNetworkProvider(networkService.getProviderSettings())
this.setupAndLogin(provider)
} catch (e) {
Expand Down
4 changes: 2 additions & 2 deletions packages/login-ui/package.json
@@ -1,7 +1,7 @@
{
"name": "@chronobank/login-ui",
"version": "0.3.2",
"version": "0.6.0",
"dependencies": {
"@chronobank/login": "0.3.2"
"@chronobank/login": "0.6.0"
}
}
4 changes: 4 additions & 0 deletions packages/login/network/BitcoinEngine.js
Expand Up @@ -18,6 +18,10 @@ export class BitcoinEngine {
return this._wallet.getAddress()
}

getPrivateKey () {
return this._wallet.keyPair.d.toBuffer().toString('hex')
}

isAddressValid (address) {
try {
bitcoin.address.toOutputScript(address, this._network)
Expand Down
4 changes: 4 additions & 0 deletions packages/login/network/BitcoinProvider.js
Expand Up @@ -71,6 +71,10 @@ export class BitcoinProvider extends AbstractProvider {
balance,
})
}

getPrivateKey () {
return this._engine ? this._engine.getPrivateKey() : null
}
}

export const btcProvider = new BitcoinProvider(selectBTCNode, BLOCKCHAIN_BITCOIN)
Expand Down
4 changes: 4 additions & 0 deletions packages/login/network/EthereumEngine.js
Expand Up @@ -18,4 +18,8 @@ export default class EthereumEngine {
getProvider () {
return this._engine
}

getPrivateKey () {
return this._wallet && this._wallet.getPrivateKey && Buffer.from(this._wallet.getPrivateKey()).toString('hex')
}
}
4 changes: 4 additions & 0 deletions packages/login/network/EthereumProvider.js
Expand Up @@ -37,6 +37,10 @@ export class EthereumProvider extends AbstractProvider {
})
return node
}

getPrivateKey () {
return this._engine ? this._engine.getPrivateKey() : null
}
}

export const ethereumProvider = new EthereumProvider(selectEthereumNode)
4 changes: 2 additions & 2 deletions packages/login/network/LedgerProvider.js
Expand Up @@ -48,8 +48,8 @@ class LedgerProvider extends EventEmitter {
}

setupAndStart (providerURL) {
this._engine.addProvider(this._ledgerSubprovider)
this._engine.addProvider(new FilterSubprovider())
this._engine.addProvider(this._ledgerSubprovider)
this._engine.addProvider(new Web3Subprovider(new Web3.providers.HttpProvider(providerURL)))
this._engine.start()
}
Expand Down Expand Up @@ -113,7 +113,7 @@ class LedgerProvider extends EventEmitter {
if (error) {
resolve(null)
}
this._wallet = new HardwareWallet(accounts[0])
this._wallet = new HardwareWallet(accounts[ 0 ])
resolve(accounts)
})
}, 200)
Expand Down
10 changes: 7 additions & 3 deletions packages/login/network/NemEngine.js
Expand Up @@ -17,6 +17,10 @@ export class NemEngine {
return this._wallet.getAddress()
}

getPrivateKey () {
return this._wallet.getPrivateKey()
}

createTransaction (to, amount: BigNumber, mosaicDefinition = null, feeMultiplier) {
return mosaicDefinition
? this._createMosaicTransaction(to, amount, mosaicDefinition, feeMultiplier)
Expand All @@ -30,7 +34,7 @@ export class NemEngine {
const transferTransaction = nem.model.objects.create("transferTransaction")(
to,
value,
'Tx from ChronoMint'
'Tx from ChronoMint',
)

const transactionEntity = nem.model.transactions.prepare("transferTransaction")(common, transferTransaction, this._network.id)
Expand All @@ -56,14 +60,14 @@ export class NemEngine {
const transferTransaction = nem.model.objects.create("transferTransaction")(
to,
1, // works as a multiplier
'Tx from ChronoMint'
'Tx from ChronoMint',
)

const mosaicAttachment = nem.model.objects.create("mosaicAttachment")(mosaicDefinition.id.namespaceId, mosaicDefinition.id.name, value)
transferTransaction.mosaics.push(mosaicAttachment)

const transactionEntity = nem.model.transactions.prepare("mosaicTransferTransaction")(common, transferTransaction, {
[`${mosaicDefinition.id.namespaceId}:${mosaicDefinition.id.name}`]: {
[ `${mosaicDefinition.id.namespaceId}:${mosaicDefinition.id.name}` ]: {
mosaicDefinition,
},
}, this._network.id)
Expand Down
4 changes: 4 additions & 0 deletions packages/login/network/NemProvider.js
Expand Up @@ -38,6 +38,10 @@ export class NemProvider extends AbstractProvider {
return node.getMosaics() || []
}

getPrivateKey () {
return this._engine ? this._engine.getPrivateKey() : null
}

async getAccountBalances (mosaic = null) {
const node = this._selectNode(this._engine)
const { balance, mosaics } = await node.getAddressInfo(this._engine.getAddress())
Expand Down
7 changes: 7 additions & 0 deletions packages/login/network/NetworkService.js
Expand Up @@ -218,6 +218,13 @@ class NetworkService extends EventEmitter {
return protocol ? `${protocol}://${host}` : `//${host}`
}

getName = () => {
const state = this._store.getState()
const { selectedNetworkId, selectedProviderId, isLocal } = state.get(DUCK_NETWORK)
const { name } = getNetworkById(selectedNetworkId, selectedProviderId, isLocal)
return name
}

checkMetaMask = () => {
metaMaskResolver
.on('resolve', (isMetaMask) => {
Expand Down
7 changes: 5 additions & 2 deletions packages/login/package.json
@@ -1,4 +1,7 @@
{
"name": "@chronobank/login",
"version": "0.3.2"
}
"version": "0.6.0",
"dependencies": {
"ledger-wallet-provider": "github:dkchv/ledger-wallet-provider"
}
}
21 changes: 21 additions & 0 deletions packages/login/redux/network/actions.js
@@ -1,3 +1,7 @@
import { ethereumProvider } from '../../network/EthereumProvider'
import { btcProvider, ltcProvider, btgProvider } from '../../network/BitcoinProvider'
import { nemProvider } from '../../network/NemProvider'

export const DUCK_NETWORK = 'network'

export const NETWORK_LOADING = 'network/LOADING'
Expand All @@ -21,3 +25,20 @@ export const addError = (error) => (dispatch) => {
export const clearErrors = () => (dispatch) => {
dispatch({ type: NETWORK_CLEAR_ERRORS })
}

export const getPrivateKeyFromBlockchain = (blockchain: string) => {
switch (blockchain) {
case 'Ethereum':
return ethereumProvider.getPrivateKey()
case 'Bitcoin':
return btcProvider.getPrivateKey()
case 'Bitcoin Gold':
return btgProvider.getPrivateKey()
case 'Litecoin':
return ltcProvider.getPrivateKey()
case 'NEM':
return nemProvider.getPrivateKey()
default:
return null
}
}

0 comments on commit cae48c0

Please sign in to comment.