Ui 2 shared package (redux, mobx, utils) (#5579)

* Create @parity/shared

* Move ~/util to shared/util

* Move ~/contracts to shared/contracts

* Move ~/config to shared/config

* Move ~/environment to shared/environment

* Updated paths

* Move ~/mobx to shared/mobx

* Move ~/redux to shared/redux

* Add shared to test babel compile
This commit is contained in:
Jaco Greeff 2017-05-09 12:01:44 +02:00 committed by GitHub
parent 073564b508
commit 4c28ef40b7
291 changed files with 396 additions and 310 deletions

View File

@ -162,6 +162,7 @@
"@parity/abi": "file:src/abi",
"@parity/api": "file:src/api",
"@parity/jsonrpc": "file:src/jsonrpc",
"@parity/shared": "file:src/shared",
"@parity/ui": "file:src/ui",
"@parity/wordlist": "1.0.1",
"base32.js": "0.1.0",

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import builtinsJson from '~/config/dappsBuiltin.json';
import builtinsJson from '@parity/shared/config/dappsBuiltin.json';
const REGISTER_URLS = {
console: 'https://raw.githubusercontent.com/paritytech/console/3ea0dbfefded359ccdbea37bc4cf350c0aa16948/console.jpeg',

View File

@ -14,7 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import abi from '~/contracts/abi/badgereg';
import abi from '@parity/shared/contracts/abi/badgereg';
import { compiler, source as sourceUrl, output as byteCode } from './code/badgereg';
const id = 'badgereg';

View File

@ -14,7 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import abi from '~/contracts/abi/dappreg';
import abi from '@parity/shared/contracts/abi/dappreg';
import { compiler, source as sourceUrl, output as byteCode } from './code/dappreg';
const id = 'dappreg'; // 7bbc4f1a27628781b96213e781a1b8eec6982c1db8fac739af6e4c5a55862c03

View File

@ -14,7 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import abi from '~/contracts/abi/gavcoin';
import abi from '@parity/shared/contracts/abi/gavcoin';
import { compiler, source as sourceUrl, output as byteCode } from './code/gavcoin';
const isExternal = true;

View File

@ -14,7 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import abi from '~/contracts/abi/githubhint';
import abi from '@parity/shared/contracts/abi/githubhint';
import { compiler, source as sourceUrl, output as byteCode } from './code/githubhint';
const id = 'githubhint';

View File

@ -14,7 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import abi from '~/contracts/abi/registry2';
import abi from '@parity/shared/contracts/abi/registry2';
import { compiler, source as sourceUrl, output as byteCode } from './code/registry';
const id = 'registry';

View File

@ -14,7 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import abi from '~/contracts/abi/signaturereg';
import abi from '@parity/shared/contracts/abi/signaturereg';
import { compiler, source as sourceUrl, output as byteCode } from './code/signaturereg';
const id = 'signaturereg';

View File

@ -14,7 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import abi from '~/contracts/abi/basiccoinmanager';
import abi from '@parity/shared/contracts/abi/basiccoinmanager';
import { compiler, source as sourceUrl, output as byteCode } from './code/tokendeploy';
const id = 'basiccoinmgr';

View File

@ -14,7 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import abi from '~/contracts/abi/tokenreg';
import abi from '@parity/shared/contracts/abi/tokenreg';
import { compiler, source as sourceUrl, output as byteCode } from './code/tokenreg';
const id = 'tokenreg';

View File

@ -14,7 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import abi from '~/contracts/abi/email-verification';
import abi from '@parity/shared/contracts/abi/email-verification';
import { compiler, source as sourceUrl, output as byteCode } from './code/verifyEmail';
const isBadge = true;

View File

@ -14,7 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import abi from '~/contracts/abi/sms-verification';
import abi from '@parity/shared/contracts/abi/sms-verification';
import { compiler, source as sourceUrl, output as byteCode } from './code/verifySms';
const isBadge = true;

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import { walletCompiler as compiler, walletLibrary as byteCode, walletLibraryABI as abiJson, walletLibraryRegKey as id, walletSource as sourceUrl } from '~/contracts/code/wallet';
import { walletCompiler as compiler, walletLibrary as byteCode, walletLibraryABI as abiJson, walletLibraryRegKey as id, walletSource as sourceUrl } from '@parity/shared/contracts/code/wallet';
const abi = JSON.parse(abiJson);
const deployParams = [];

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import builtins from '~/config/dappsBuiltin.json';
import builtins from '@parity/shared/config/dappsBuiltin.json';
const id = 'console';
const app = builtins.find((app) => app.url === id);

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import builtins from '~/config/dappsBuiltin.json';
import builtins from '@parity/shared/config/dappsBuiltin.json';
const id = 'dappreg';
const app = builtins.find((app) => app.url === id);

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import builtins from '~/config/dappsBuiltin.json';
import builtins from '@parity/shared/config/dappsBuiltin.json';
const id = 'githubhint';
const app = builtins.find((app) => app.url === id);

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import builtins from '~/config/dappsBuiltin.json';
import builtins from '@parity/shared/config/dappsBuiltin.json';
const id = 'localtx';
const app = builtins.find((app) => app.url === id);

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import builtins from '~/config/dappsBuiltin.json';
import builtins from '@parity/shared/config/dappsBuiltin.json';
const id = 'registry';
const app = builtins.find((app) => app.url === id);

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import builtins from '~/config/dappsBuiltin.json';
import builtins from '@parity/shared/config/dappsBuiltin.json';
const id = 'signaturereg';
const app = builtins.find((app) => app.url === id);

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import builtins from '~/config/dappsBuiltin.json';
import builtins from '@parity/shared/config/dappsBuiltin.json';
const id = 'tokendeploy';
const app = builtins.find((app) => app.url === id);

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import builtins from '~/config/dappsBuiltin.json';
import builtins from '@parity/shared/config/dappsBuiltin.json';
const id = 'tokenreg';
const app = builtins.find((app) => app.url === id);

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import builtins from '~/config/dappsBuiltin.json';
import builtins from '@parity/shared/config/dappsBuiltin.json';
const id = 'web';
const app = builtins.find((app) => app.url === id);

View File

@ -18,9 +18,9 @@ import BigNumber from 'bignumber.js';
import { action, computed, observable, transaction } from 'mobx';
import { flatten } from 'lodash';
import * as abis from '~/contracts/abi';
import Contracts from '~/contracts';
import builtinJson from '~/config/dappsBuiltin.json';
import * as abis from '@parity/shared/contracts/abi';
import Contracts from '@parity/shared/contracts';
import builtinJson from '@parity/shared/config/dappsBuiltin.json';
import Dapp from './dappStore.js';
import { deleteDapp, registerDapp, updateDapp } from './utils';

View File

@ -14,7 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import * as abis from '~/contracts/abi';
import * as abis from '@parity/shared/contracts/abi';
import { api } from './parity';
let defaultSubscriptionId;

View File

@ -17,7 +17,7 @@
import React from 'react';
import { shallow } from 'enzyme';
import '../../../environment/tests';
import '@parity/shared/environment/tests';
import Application from './application';

View File

@ -17,8 +17,8 @@
import React from 'react';
import { shallow } from 'enzyme';
import '../../../environment/tests';
import EthApi from '../../../api';
import EthApi from '@parity/api';
import '@parity/shared/environment/tests';
// Mock API for tests
import * as Api from '../parity';

View File

@ -22,7 +22,8 @@ const muiTheme = getMuiTheme(lightBaseTheme);
import CircularProgress from 'material-ui/CircularProgress';
import { Card, CardText } from 'material-ui/Card';
import { nullableProptype } from '~/util/proptypes';
import { nullableProptype } from '@parity/shared/util/proptypes';
import { api } from '../parity';
import styles from './application.css';

View File

@ -18,7 +18,7 @@ import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { nullableProptype } from '~/util/proptypes';
import { nullableProptype } from '@parity/shared/util/proptypes';
import Application from './Application';
import * as actions from './actions';

View File

@ -25,7 +25,7 @@ import DropDownMenu from 'material-ui/DropDownMenu';
import MenuItem from 'material-ui/MenuItem';
import keycode from 'keycode';
import { nullableProptype } from '~/util/proptypes';
import { nullableProptype } from '@parity/shared/util/proptypes';
import Address from '../ui/address.js';
import renderImage from '../ui/image.js';

View File

@ -24,7 +24,8 @@ import MenuItem from 'material-ui/MenuItem';
import RaisedButton from 'material-ui/RaisedButton';
import CheckIcon from 'material-ui/svg-icons/navigation/check';
import { nullableProptype } from '~/util/proptypes';
import { nullableProptype } from '@parity/shared/util/proptypes';
import { fromWei } from '../parity.js';
import { clearError, reserve, drop } from './actions';

View File

@ -24,7 +24,8 @@ import MenuItem from 'material-ui/MenuItem';
import RaisedButton from 'material-ui/RaisedButton';
import SaveIcon from 'material-ui/svg-icons/content/save';
import { nullableProptype } from '~/util/proptypes';
import { nullableProptype } from '@parity/shared/util/proptypes';
import { clearError, update } from './actions';
import styles from './records.css';

View File

@ -21,7 +21,8 @@ import {
Card, CardHeader, CardText, TextField, DropDownMenu, MenuItem, RaisedButton
} from 'material-ui';
import { nullableProptype } from '~/util/proptypes';
import { nullableProptype } from '@parity/shared/util/proptypes';
import { AddIcon, CheckIcon } from '~/ui/Icons';
import { clearError, confirm, propose } from './actions';
import styles from './reverse.css';

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import Contracts from '~/contracts';
import Contracts from '@parity/shared/contracts';
import { api } from './parity.js';
import * as addresses from './addresses/actions.js';

View File

@ -17,10 +17,11 @@
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { nullableProptype } from '@parity/shared/util/proptypes';
import Hash from './hash';
import etherscanUrl from '../util/etherscan-url';
import IdentityIcon from '../IdentityIcon';
import { nullableProptype } from '~/util/proptypes';
import styles from './address.css';

View File

@ -16,7 +16,7 @@
import React from 'react';
import { parityNode } from '../../../environment';
import { parityNode } from '@parity/shared/environment';
const styles = {
padding: '.5em',

View File

@ -14,7 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import * as abis from '~/contracts/abi';
import * as abis from '@parity/shared/contracts/abi';
import { api } from './parity';
const sortEvents = (a, b) => b.blockNumber.cmp(a.blockNumber) || b.logIndex.cmp(a.logIndex);

View File

@ -17,7 +17,7 @@
import BigNumber from 'bignumber.js';
import React, { Component, PropTypes } from 'react';
import { eip20 } from '~/contracts/abi';
import { eip20 } from '@parity/shared/contracts/abi';
import { api } from '../../parity';
import { loadBalances } from '../../services';

View File

@ -17,7 +17,8 @@
import BigNumber from 'bignumber.js';
import { url as etherscanUrl } from '~/3rdparty/etherscan/links';
import * as abis from '~/contracts/abi';
import * as abis from '@parity/shared/contracts/abi';
import { api } from './parity';
let managerInstance;

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import Contracts from '~/contracts';
import Contracts from '@parity/shared/contracts';
import { loadToken, setTokenPending, deleteToken, setTokenData } from '../Tokens/actions';
import { api } from '../parity';

View File

@ -30,7 +30,7 @@ import styles from './token.css';
import { metaDataKeys } from '../../constants';
import { api } from '../../parity';
import { parityNode } from '../../../../environment';
import { parityNode } from '@parity/shared/environment';
export default class Token extends Component {
static propTypes = {

View File

@ -16,7 +16,7 @@
import { api } from './parity';
import { eip20 as eip20Abi } from '~/contracts/abi';
import { eip20 as eip20Abi } from '@parity/shared/contracts/abi';
export const INVALID_URL_HASH = '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470';
export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';

View File

@ -18,7 +18,7 @@ import { uniq } from 'lodash';
import store from 'store';
import Api from '@parity/api';
import { LOG_KEYS, getLogger } from '~/config';
import { LOG_KEYS, getLogger } from '@parity/shared/config';
const log = getLogger(LOG_KEYS.Signer);

View File

@ -0,0 +1,19 @@
{
"name": "@parity/shared",
"description": "Shared states and non-ui components for the Parity wallet",
"version": "0.0.0",
"main": "index.js",
"author": "Parity Team <admin@parity.io>",
"maintainers": [],
"contributors": [],
"license": "GPL-3.0",
"repository": {
"type": "git",
"url": "git+https://github.com/paritytech/parity.git"
},
"keywords": [],
"scripts": {},
"devDependencies": {},
"dependencies": {},
"peerDependencies": {}
}

View File

@ -17,12 +17,11 @@
import { throttle } from 'lodash';
import { padRight } from '@parity/api/util/format';
import Contracts from '@parity/shared/contracts';
import { fetchBalances, fetchTokensBalances, queryTokensFilter } from './balancesActions';
import { loadTokens, fetchTokens } from './tokensActions';
import Contracts from '~/contracts';
let instance = null;
export default class Balances {

Some files were not shown because too many files have changed in this diff Show More