Commit e9c1d27e authored by therealwolf's avatar therealwolf 💯
Browse files

initial

parents
{
"presets": [
["env", {
"targets": { "node": 6 },
"useBuiltIns": true
}],
"stage-0",
"react"
],
"plugins": ["add-module-exports", "dynamic-import-webpack"],
"env": {
"production": {
"presets": ["react-optimize"],
"plugins": ["babel-plugin-dev-expression"]
},
"development": {
"plugins": [
"transform-class-properties",
"transform-es2015-classes",
"react-hot-loader/babel",
["flow-runtime", {
"assert": true,
"annotate": true
}]
]
}
}
}
root = true
[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.{json,js,jsx,html,css}]
indent_style = space
indent_size = 2
[.eslintrc]
indent_style = space
indent_size = 2
[*.md]
trim_trailing_whitespace = false
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
.eslintcache
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
app/node_modules
# OSX
.DS_Store
# flow-typed
flow-typed/npm/*
!flow-typed/npm/module_vx.x.x.js
# App packaged
release
app/main.prod.js
app/main.prod.js.map
app/bundle.js
app/bundle.js.map
app/style.css
app/style.css.map
dist
dll
main.js
main.js.map
.idea
npm-debug.log.*
__snapshots__
{
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module",
"allowImportExportEverywhere": true
},
"extends": "airbnb",
"env": {
"browser": true,
"node": true
},
"rules": {
"arrow-parens": ["off"],
"compat/compat": "error",
"consistent-return": "off",
"comma-dangle": "off",
"flowtype-errors/show-errors": "error",
"generator-star-spacing": "off",
"import/no-unresolved": "error",
"import/no-extraneous-dependencies": "off",
"no-console": "off",
"no-use-before-define": "off",
"no-multi-assign": "off",
"promise/param-names": "error",
"promise/always-return": "error",
"promise/catch-or-return": "error",
"promise/no-native": "off",
"react/sort-comp": ["error", {
"order": ["type-annotations", "static-methods", "lifecycle", "everything-else", "render"]
}],
"react/jsx-no-bind": "off",
"react/jsx-filename-extension": ["error", { "extensions": [".js", ".jsx"] }],
"react/prefer-stateless-function": "off"
},
"plugins": [
"flowtype",
"flowtype-errors",
"import",
"promise",
"compat",
"react"
],
"settings": {
"import/resolver": {
"webpack": {
"config": "webpack.config.eslint.js"
}
}
}
}
[ignore]
<PROJECT_ROOT>/node_modules/*
<PROJECT_ROOT>/app/main.prod.js
<PROJECT_ROOT>/app/main.prod.js.map
<PROJECT_ROOT>/app/dist/.*
<PROJECT_ROOT>/resources/.*
<PROJECT_ROOT>/release/.*
<PROJECT_ROOT>/dll/.*
<PROJECT_ROOT>/release/.*
<PROJECT_ROOT>/git/.*
[include]
[libs]
[options]
esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable
esproposal.export_star_as=enable
module.name_mapper.extension='css' -> '<PROJECT_ROOT>/internals/flow/CSSModule.js.flow'
module.name_mapper.extension='styl' -> '<PROJECT_ROOT>/internals/flow/CSSModule.js.flow'
module.name_mapper.extension='scss' -> '<PROJECT_ROOT>/internals/flow/CSSModule.js.flow'
module.name_mapper.extension='png' -> '<PROJECT_ROOT>/internals/flow/WebpackAsset.js.flow'
module.name_mapper.extension='jpg' -> '<PROJECT_ROOT>/internals/flow/WebpackAsset.js.flow'
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue
* text eol=lf
*.png binary
*.ico binary
*.icns binary
.git/**
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
.eslintcache
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
app/node_modules
# OSX
.DS_Store
# flow-typed
flow-typed/npm/*
!flow-typed/npm/module_vx.x.x.js
# App packaged
release
app/main.prod.js
app/main.prod.js.map
app/bundle.js
app/bundle.js.map
app/style.css
app/style.css.map
dist
dll
main.js
main.js.map
.idea
npm-debug.log.*
# Temporary Disable until Implemented
appveyor.yml
.travis
/test
v6.9.5
{
"extends": "stylelint-config-standard"
}
{
"ecmaVersion": 7,
"libs": [
"browser"
],
"dontLoad": [
"node_modules/**"
],
"plugins": {
"doc_comment": {
"fullDocs": true,
"strong": true
}
}
}
sudo: false
language: node_js
node_js:
- 7
- 6
cache:
directories:
- node_modules
# Enable when https://github.com/yarnpkg/yarn/issues/1233 and
# https://github.com/yarnpkg/yarn/issues/1059 are resolved and disable npm cache
#
# cache:
# directories:
# - $HOME/.yarn-cache
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
- icnsutils
- graphicsmagick
- xz-utils
- xorriso
install:
- export CXX="g++-4.8"
- npm install -g npm@latest
- npm install
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16"
# Enable when https://github.com/yarnpkg/yarn/issues/1233 and
# https://github.com/yarnpkg/yarn/issues/1059 are resolved and disable npm cache
#
# install:
# - export CXX="g++-4.8"
# - npm install -g yarnpkg
# - yarn
# - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16"
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start &
- sleep 3
script:
- npm run lint
- npm run test
- npm run build
- npm run test-e2e
- npm run package
{
"javascript.validate.enable": false,
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"flow.useNPMPackagedFlow": true,
"search.exclude": {
".git": true,
"node_modules": true,
"flow-typed": true,
"__snapshots__": true,
"bower_components": true
}
}
The MIT License (MIT)
Copyright (c) 2017-present Aaron Cox
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.
# Vessel - Hive Desktop Wallet
Vessel is a lite wallet for the Hive blockchain that you can run on your desktop computer without needing to run the blockchain itself.
**This is experimental and messy software at the moment, please use with caution.**
## No Support & No Warranty
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.
## Initial Updates
- [2017/12/09 - 0.2.0 Release Notes](https://hive.blog/vessel/@jesta/vessel-0-2-0-interact-with-steem-securely-from-any-website)
- [2017/11/29 - 0.0.9 Release Notes](https://hive.blog/vessel/@jesta/vessel-009-witness-voting-improved-delegation-controls-auths-and-customjson-ops)
- [2017/10/19 - 0.0.8 Release Notes](https://hive.blog/steem-project/@jesta/vessel-008-configurable-steem-node-new-default-node)
- [2017/09/19 - 0.0.7 Release Notes](https://hive.blog/steem-project/@jesta/vessel-007-account-creation-encrypted-memos-bittrex)
- [2017/05/24 - 0.0.6 Release Notes](https://hive.blog/steem-project/@jesta/vessel-006-steem-power-delegation)
- [2017/05/20 - This app was announced on hive.blog](https://hive.blog/steem-project/@jesta/vessel-pre-release-looking-for-feedback)
\ No newline at end of file
{
"rules": {
"flowtype/boolean-style": [2, "boolean"],
"flowtype/define-flow-type": 1,
"flowtype/delimiter-dangle": [2, "never"],
"flowtype/generic-spacing": [2, "never"],
"flowtype/no-primitive-constructor-types": 2,
"flowtype/no-weak-types": 1,
"flowtype/object-type-delimiter": [2, "comma"],
"flowtype/require-parameter-type": 0,
"flowtype/require-return-type": 0,
"flowtype/require-valid-file-annotation": 0,
"flowtype/semi": [2, "always"],
"flowtype/space-after-type-colon": [2, "always"],
"flowtype/space-before-generic-bracket": [2, "never"],
"flowtype/space-before-type-colon": [2, "never"],
"flowtype/union-intersection-spacing": [2, "always"],
"flowtype/use-flow-type": 2,
"flowtype/valid-syntax": 2,
"flowtype-errors/show-errors": 2
}
}
This diff is collapsed.
// @flow
import hive from '@hiveio/hive-js';
import * as ProcessingActions from './processing';
export const HIVE_GLOBALPROPS_UPDATE = 'HIVE_GLOBALPROPS_UPDATE';
export const HIVE_GLOBALPROPS_UPDATE_RESOLVED = 'HIVE_GLOBALPROPS_UPDATE_RESOLVED';
export function refreshGlobalProps() {
return (dispatch: () => void) => {
hive.api.getDynamicGlobalProperties((err, results) => {
if (err) {
// dispatch({
// type: ACCOUNT_DATA_UPDATE_FAILED,
// payload: err
// });
} else {
if(results.virtual_supply.search('HIVE') >= 0){
results.network = "Hive";
// } else if(results.virtual_supply.search('STEEM') >= 0){
// results.network = "Steem";
} else {
results.network = "Hive";
}
dispatch({
type: HIVE_GLOBALPROPS_UPDATE_RESOLVED,
payload: results
});
}
});
};
}
// @flow
import hive from '@hiveio/hive-js';
import type { keysStateType } from '../reducers/keys';
import * as AccountActions from './account';
import {
PROCESSING_ACCOUNT_LOADING,
PROCESSING_ACCOUNT_LOADING_COMPLETE,
PROCESSING_ACCOUNT_LOADING_FAILED
} from './processing';
var CryptoJS = require("crypto-js");
export const KEY_REMOVE_CANCEL = 'KEY_REMOVE_CANCEL';
export const KEY_REMOVE_CONFIRM = 'KEY_REMOVE_CONFIRM';
export const KEY_REMOVE_CONFIRMED = 'KEY_REMOVE_CONFIRMED';
export const KEY_USE = 'KEY_USE';
export const KEY_USE_DECRYPT_PROMPT = 'KEY_USE_DECRYPT_PROMPT';
export const KEY_USE_DECRYPT_PROMPT_CLOSE = 'KEY_USE_DECRYPT_PROMPT_CLOSE';
export const KEY_ADD_CANCEL = 'KEY_ADD_CANCEL';
export const KEY_ADD_CONFIRM = 'KEY_ADD_CONFIRM';
export const KEY_ADD_CONFIRMED = 'KEY_ADD_CONFIRMED';
export const KEY_ADD_FAILED = 'KEY_ADD_FAILED';
export const KEY_ADD_FAILED_ACCOUNT_404 = 'KEY_ADD_FAILED_ACCOUNT_404';
export const KEY_ADD_FAILED_WIF_INCORRECT = 'KEY_ADD_FAILED_WIF_INCORRECT';
export const KEY_ADD_FAILED_WIF_INVALID = 'KEY_ADD_FAILED_WIF_INVALID';
export const KEY_ADD_MEMO_CANCEL = 'KEY_ADD_MEMO_CANCEL';
export const KEY_ADD_MEMO_CONFIRM = 'KEY_ADD_MEMO_CONFIRM';
export const KEY_ADD_MEMO_CONFIRMED = 'KEY_ADD_MEMO_CONFIRMED';
export const KEY_ADD_MEMO_PROMPT = 'KEY_ADD_MEMO_PROMPT';
export const KEY_ADD_AUTH_CANCEL = 'KEY_ADD_AUTH_CANCEL';
export const KEY_ADD_AUTH_CONFIRM = 'KEY_ADD_AUTH_CONFIRM';
export const KEY_ADD_AUTH_CONFIRMED = 'KEY_ADD_AUTH_CONFIRMED';
export const KEY_ADD_AUTH_PROMPT = 'KEY_ADD_AUTH_PROMPT';
export const KEY_ADD_PROMPT = 'KEY_ADD_PROMPT';
export const KEY_CREATE_CANCEL = 'KEY_CREATE_CANCEL';
export const KEY_CREATE_PROMPT = 'KEY_CREATE_PROMPT';
export function addKey(account: string, wif: string) {
const isValidKey = hive.auth.isWif(wif);
if (isValidKey) {
return (dispatch: () => void) => {
dispatch({
type: PROCESSING_ACCOUNT_LOADING
});
hive.api.getAccounts([account], (err, result) => {
// Account not found
if (err || !result.length) {
dispatch({
type: KEY_ADD_FAILED_ACCOUNT_404
});
dispatch({
type: PROCESSING_ACCOUNT_LOADING_COMPLETE
});
}
if (result && result.length) {
const derivedKey = hive.auth.wifToPublic(wif);
const keyTypes = getKeyType(derivedKey, result[0]);
if (keyTypes.length > 0) {
// Correct key + weight, save keyAuths
const payload = {
account,
wif,
active: (keyTypes.indexOf('active') !== -1),
posting: (keyTypes.indexOf('posting') !== -1),
owner: (keyTypes.indexOf('owner') !== -1)
};
dispatch({
type: PROCESSING_ACCOUNT_LOADING_COMPLETE
});
dispatch({
type: KEY_ADD_CONFIRM,
payload
});
} else {
// Incorrect key for account
dispatch({
type: PROCESSING_ACCOUNT_LOADING_COMPLETE
});
dispatch({
type: KEY_ADD_FAILED_WIF_INCORRECT
});
}
}
});
};
}
return {
type: KEY_ADD_FAILED_WIF_INVALID
};
}
export function addKeyConfirmed(
account: string,
wif: string,
type: string,
encrypted: boolean,
password: string
) {
return (dispatch: () => void) => {
let key = wif;
const payload = {};
if (encrypted) {
key = CryptoJS.AES.encrypt(wif, password).toString();
}
payload[account] = {
account,
key,
encrypted,
type
};
dispatch({
type: KEY_ADD_CONFIRMED,
payload
});
};
}
export function addKeyCancel() {
return {
type: KEY_ADD_CANCEL
};
}
export function addKeyPrompt() {
return {
type: KEY_ADD_PROMPT
};
}
export function createKeyPrompt() {
return {
type: KEY_CREATE_PROMPT
}
}
export function createKeyCancel() {
return {
type: KEY_CREATE_CANCEL
}
}
// Given an account and a keys
// Check if key is encrypted
export function useKeyRequestDecrypt(operation, params, auth) {
return {
type: KEY_USE_DECRYPT_PROMPT,
payload: { operation, params, auth }
};
}
export function useKeyRequestDecryptClose() {
return {
type: KEY_USE_DECRYPT_PROMPT_CLOSE
};
}
export function useKey(operation, params, auth) {
return (dispatch: () => void) => {
if (auth.encrypted) {
const authEncrypted = Object.assign({}, auth);
dispatch(useKeyRequestDecrypt(operation, params, authEncrypted));
} else {
const callback = AccountActions[operation];
dispatch(callback(auth.key, params));
dispatch(useKeyRequestDecryptClose());
}
};
}
export function getKeyType(wif: string, account: object) {
const validFor = [];
['owner', 'active', 'posting'].forEach((keyType) => {
const keyAuths = account[keyType].key_auths;
const weightThreshold = account[keyType].weight_threshold;
const matchingWeight = keyAuths
.filter((set) => set[0] === wif)
.map((set) => set[1])
.reduce((a, b) => a + b, 0);
if (matchingWeight >= weightThreshold) {
validFor.push(keyType);
}
});
return validFor;
}
export function removeKey(account: string) {
return {
type: KEY_REMOVE_CONFIRM,