Skip to content

Commit

Permalink
Merge branch 'staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
svk31 committed Oct 15, 2017
2 parents 8270a1f + fcd7d7a commit d2c1cfc
Show file tree
Hide file tree
Showing 131 changed files with 2,862 additions and 1,374 deletions.
50 changes: 50 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,53 @@
---------------------------------------------------------------------
Release 2.0.171015
---------------------------------------------------------------------
New features
--------
- Tables Rewrite - Account Dashboard #378
- Add an optional encrypted qr code for the private key (#542)
- #545: Show gateway status as down for unavailable coins
- #471: Add label to Find Markets add header
- #560 Show unavailable messages for openledger and rudex if they time out
- Add whitelisting to asset update page fix #70 and fix #462
- Clear transfer form once completed (#564)
- Use new tables styling in dashboard, add accounts/recent switching
- #500: Set testnet/mainnet faucets depending on current API node
- #488: Hover state + click toggle for account name QR code
- Filter out insecure websocket urls when using https
- #572: Make sure exchange input only allows numbers, no negative input
- #543: Add sync status check interval, 'Synced/Out of sync/Disconnnected' warning

Bug fixes
--------
- #496: Ensure tables retain correct height
- Remove forced create account step position #576
- Fix #578: Open orders not displaying all orders
- Fix ChainStore failing to notify after reset and latency check counter
- Fix #563: Settlement box width
- Fix App.jsx synced state to mean blockchain sync status #543
- Fix #571
- Fix #479: Max supply bug in asset creation and update
- #574: Remove nodes that are no longer available
- Fix issue #294 (#575)
- Reset backup store when wallet is changed (#570)
- Fix Backup dashboard link
- Set cloud wallet login to default, improve settings switching logic
- #Fix 501: Asset explorer table alignment
- Fix #567: Explorer My Markets page does not load
- Round up `for_sale` and down `to_receive`, #562 (#565)
- Simplify and improve app init chain #531
- Fix #529: Withrawal modal inputs
- Fix #483: Remove TRADE.X from dropdown and remove blocktrades gateway
- #531: Catch some app init errors and redirect, update indexeddbshim
- Add an image for QR code, fix some styling and translations #444
- Harmonize login forms between modes
- Use account.assets from new API to display list of issued assets
- Set password and username type/name/ids for password managers #527
- Fix #535: remove ellipsis and cap password length at 45 chars
- Fix typo (oherwise -> otherwise) (#534)
- fix: parseInt for minimum_feeds when create asset (#539)
- #532 change noone to no one

---------------------------------------------------------------------
Release 2.0.170914
---------------------------------------------------------------------
Expand Down
93 changes: 56 additions & 37 deletions app/App.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {ChainStore} from "bitsharesjs/es";
import {Apis} from "bitsharesjs-ws";
import React from "react";
import IntlStore from "stores/IntlStore";
import AccountStore from "stores/AccountStore";
Expand All @@ -21,8 +20,8 @@ import TransactionConfirm from "./components/Blockchain/TransactionConfirm";
import WalletUnlockModal from "./components/Wallet/WalletUnlockModal";
import BrowserSupportModal from "./components/Modal/BrowserSupportModal";
import Footer from "./components/Layout/Footer";
import Incognito from "./components/Layout/Incognito";
import { isIncognito } from "feature_detect";
// import Incognito from "./components/Layout/Incognito";
// import { isIncognito } from "feature_detect";

class App extends React.Component {

Expand All @@ -35,8 +34,8 @@ class App extends React.Component {

let syncFail = ChainStore.subError && (ChainStore.subError.message === "ChainStore sync error, please check your system clock") ? true : false;
this.state = {
loading: true,
synced: ChainStore.subscribed,
loading: false,
synced: this._syncStatus(),
syncFail,
theme: SettingsStore.getState().settings.get("themes"),
disableChat: SettingsStore.getState().settings.get("disableChat", true),
Expand All @@ -48,42 +47,47 @@ class App extends React.Component {
};

this._rebuildTooltips = this._rebuildTooltips.bind(this);
this._onSettingsChange = this._onSettingsChange.bind(this);
this._chainStoreSub = this._chainStoreSub.bind(this);
this._syncStatus = this._syncStatus.bind(this);
}

componentWillUnmount() {
NotificationStore.unlisten(this._onNotificationChange);
SettingsStore.unlisten(this._onSettingsChange);
ChainStore.unsubscribe(this._chainStoreSub);
clearInterval(this.syncCheckInterval);
}

componentDidMount() {
try {
isIncognito(function(incognito){
this.setState({incognito});
}.bind(this));
_syncStatus(setState = false) {
let synced = true;
let dynGlobalObject = ChainStore.getObject("2.1.0");
if (dynGlobalObject) {
let block_time = dynGlobalObject.get("time") + "+00:00";
let bt = (new Date(block_time).getTime() + ChainStore.getEstimatedChainTimeOffset()) / 1000;
let now = new Date().getTime() / 1000;
synced = Math.abs(now - bt) < 5;
}
if (setState && synced !== this.state.synced) {
this.setState({synced});
}
return synced;
}

_setListeners() {
try {
NotificationStore.listen(this._onNotificationChange.bind(this));
SettingsStore.listen(this._onSettingsChange.bind(this));

ChainStore.init().then(() => {
this.setState({synced: true});
Promise.all([
AccountStore.loadDbData(Apis.instance().chainId)
]).then(() => {
AccountStore.tryToSetCurrentAccount();
this.setState({loading: false});
}).catch(error => {
console.log("[App.jsx] ----- ERROR ----->", error);
this.setState({loading: false});
});
}).catch(error => {
console.log("[App.jsx] ----- ChainStore.init error ----->", error);
let syncFail = ChainStore.subError && (ChainStore.subError.message === "ChainStore sync error, please check your system clock") ? true : false;

this.setState({loading: false, synced: false, syncFail});
});
SettingsStore.listen(this._onSettingsChange);
ChainStore.subscribe(this._chainStoreSub);
AccountStore.tryToSetCurrentAccount();
} catch(e) {
console.error("e:", e);
}
}

componentDidMount() {
this._setListeners();
this.syncCheckInterval = setInterval(this._syncStatus, 5000);
const user_agent = navigator.userAgent.toLowerCase();
if (!(window.electron || user_agent.indexOf("firefox") > -1 || user_agent.indexOf("chrome") > -1 || user_agent.indexOf("edge") > -1)) {
this.refs.browser_modal.show();
Expand All @@ -108,6 +112,19 @@ class App extends React.Component {
}, 1500);
}

_chainStoreSub() {
let synced = this._syncStatus();
if (synced !== this.state.synced) {
this.setState({synced});
}
if (ChainStore.subscribed !== this.state.synced || ChainStore.subError) {
let syncFail = ChainStore.subError && (ChainStore.subError.message === "ChainStore sync error, please check your system clock") ? true : false;
this.setState({
syncFail
});
}
}

/** Usage: NotificationActions.[success,error,warning,info] */
_onNotificationChange() {
let notification = NotificationStore.getState().notification;
Expand Down Expand Up @@ -151,21 +168,23 @@ class App extends React.Component {
// }

render() {
let {isMobile, showChat, dockedChat, theme, incognito, incognitoWarningDismissed } = this.state;
let {isMobile, showChat, dockedChat, theme } = this.state;
let content = null;

let showFooter = this.props.location.pathname.indexOf("market") === -1;

if(incognito && !incognitoWarningDismissed){
content = (
<Incognito onClickIgnore={this._onIgnoreIncognitoWarning.bind(this)}/>
);
} else if (this.state.syncFail) {
// if(incognito && !incognitoWarningDismissed){
// content = (
// <Incognito onClickIgnore={this._onIgnoreIncognitoWarning.bind(this)}/>
// );
// } else
if (this.state.syncFail) {
content = (
<SyncError />
);
} else if (this.state.loading) {
content = <div className="grid-frame vertical"><LoadingIndicator /></div>;
content = <div className="grid-frame vertical">
<LoadingIndicator loadingText={"Connecting to APIS and tarting app"}/>
</div>;
} else if (this.props.location.pathname === "/init-error") {
content = <div className="grid-frame vertical">{this.props.children}</div>;
} else {
Expand Down
5 changes: 3 additions & 2 deletions app/Routes-dev.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";

import { Router, Route, IndexRoute, browserHistory, hashHistory } from "react-router/es";
import { Router, Route, IndexRoute, browserHistory, hashHistory, Redirect } from "react-router/es";
import willTransitionTo from "./routerTransition";
import App from "./App";

Expand Down Expand Up @@ -108,7 +108,7 @@ const routes = (

<Route path="/account/:account_name" component={AccountPage} >
<IndexRoute component={AccountOverview} />
<Route path="overview" component={AccountOverview} />
<Route path="dashboard" component={AccountOverview} />
<Route path="assets" component={AccountAssets} />
<Route path="create-asset" component={AccountAssetCreate} />
<Route path="update-asset/:asset" component={AccountAssetUpdate} />
Expand All @@ -119,6 +119,7 @@ const routes = (
<Route path="deposit-withdraw" component={AccountDepositWithdraw} />
<Route path="orders" component={AccountOrders} />
<Route path="whitelist" component={AccountWhitelist} />
<Redirect from="overview" to="dashboard" />
</Route>

<Route path="deposit-withdraw" component={AccountDepositWithdraw} />
Expand Down
5 changes: 3 additions & 2 deletions app/Routes.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";

import { Route, IndexRoute } from "react-router/es";
import { Route, IndexRoute, Redirect } from "react-router/es";
import willTransitionTo from "./routerTransition";
import App from "./App";

Expand Down Expand Up @@ -161,7 +161,7 @@ const routes = (
<IndexRoute getComponent={(location, cb) => {
System.import("components/Account/AccountOverview").then(loadRoute(cb)).catch(errorLoading);
}}/>
<Route path="overview" getComponent={(location, cb) => {
<Route path="dashboard" getComponent={(location, cb) => {
System.import("components/Account/AccountOverview").then(loadRoute(cb)).catch(errorLoading);
}}/>
<Route path="assets" getComponent={(location, cb) => {
Expand Down Expand Up @@ -194,6 +194,7 @@ const routes = (
<Route path="whitelist" getComponent={(location, cb) => {
System.import("components/Account/AccountWhitelist").then(loadRoute(cb)).catch(errorLoading);
}}/>
<Redirect from="overview" to="dashboard" />
</Route>
<Route path="deposit-withdraw" getComponent={(location, cb) => {
System.import("components/Account/AccountDepositWithdraw").then(loadRoute(cb)).catch(errorLoading);
Expand Down
16 changes: 8 additions & 8 deletions app/actions/AssetActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class AssetActions {
}

updateAsset(issuer, new_issuer, update, core_exchange_rate, asset, flags, permissions,
isBitAsset, bitasset_opts, original_bitasset_opts, description) {
isBitAsset, bitasset_opts, original_bitasset_opts, description, auths) {

// Create asset action here...
let tr = wallet_api.new_transaction();
Expand All @@ -155,7 +155,7 @@ class AssetActions {

let cr_quote_amount = (new big(core_exchange_rate.quote.amount)).times(cr_quote_precision).toString();
let cr_base_amount = (new big(core_exchange_rate.base.amount)).times(cr_base_precision).toString();

console.log("auths:", auths);
let updateObject = {
fee: {
amount: 0,
Expand All @@ -172,10 +172,10 @@ class AssetActions {
description: description,
issuer_permissions: permissions,
flags: flags,
whitelist_authorities: asset.getIn(["options", "whitelist_authorities"]),
blacklist_authorities: asset.getIn(["options", "blacklist_authorities"]),
whitelist_markets: asset.getIn(["options", "whitelist_markets"]),
blacklist_markets: asset.getIn(["options", "blacklist_markets"]),
whitelist_authorities: auths.whitelist_authorities.toJS(),
blacklist_authorities: auths.blacklist_authorities.toJS(),
whitelist_markets: auths.whitelist_markets.toJS(),
blacklist_markets: auths.blacklist_markets.toJS(),
extensions: asset.getIn(["options", "extensions"]),
core_exchange_rate: {
quote: {
Expand Down Expand Up @@ -301,7 +301,7 @@ class AssetActions {
delete inProgress[id];
dispatch({
assets: assets,
dynamic_data: results[0],
dynamic: results[0],
bitasset_data: results[1],
loading: false
});
Expand Down Expand Up @@ -356,7 +356,7 @@ class AssetActions {
delete inProgress[id];
dispatch({
asset: asset[0],
dynamic_data: results[0][0],
dynamic: results[0][0],
bitasset_data: results[1] ? results[1][0] : null
});
});
Expand Down
27 changes: 22 additions & 5 deletions app/actions/GatewayActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,35 @@ import {blockTradesAPIs} from "api/apiConfig";

let inProgress = {};

const GATEWAY_TIMEOUT = 10000;

const onGatewayTimeout = (dispatch, gateway)=>{
dispatch({down: gateway});
};

class GatewayActions {
fetchCoins({backer = "OPEN", url = undefined} = {}) {
if (!inProgress["fetchCoins_" + backer]) {
inProgress["fetchCoins_" + backer] = true;
return (dispatch) => {
Promise.all([fetchCoins(url),
let fetchCoinsTimeout = setTimeout(onGatewayTimeout.bind(null, dispatch, backer), GATEWAY_TIMEOUT);

Promise.all([
fetchCoins(url),
fetchBridgeCoins(blockTradesAPIs.BASE_OL),
getActiveWallets(url)
]).then(result => {
clearTimeout(fetchCoinsTimeout);

delete inProgress["fetchCoins_" + backer];
let [coins, tradingPairs, wallets] = result;
let backedCoins = getBackedCoins({allCoins: coins, tradingPairs: tradingPairs, backer: backer}).filter(a => !!a.walletType);
backedCoins.forEach(a => {
a.isAvailable = wallets.indexOf(a.walletType) !== -1;
});
dispatch({
coins: coins,
backedCoins: getBackedCoins({allCoins: coins, tradingPairs: tradingPairs, backer: backer}).filter(a => {
return wallets.indexOf(a.walletType) !== -1;
}),
coins,
backedCoins,
backer
});
});
Expand All @@ -34,8 +47,10 @@ class GatewayActions {
if (!inProgress["fetchCoinsSimple_" + backer]) {
inProgress["fetchCoinsSimple_" + backer] = true;
return (dispatch) => {
let fetchCoinsTimeout = setTimeout(onGatewayTimeout.bind(null, dispatch, backer), GATEWAY_TIMEOUT);
fetchCoinsSimple(url)
.then(coins => {
clearTimeout(fetchCoinsTimeout);
delete inProgress["fetchCoinsSimple_" + backer];

dispatch({
Expand All @@ -53,11 +68,13 @@ class GatewayActions {
if (!inProgress["fetchBridgeCoins"]) {
inProgress["fetchBridgeCoins"] = true;
return (dispatch) => {
let fetchCoinsTimeout = setTimeout(onGatewayTimeout.bind(null, dispatch, "TRADE"), GATEWAY_TIMEOUT);
Promise.all([
fetchCoins(url),
fetchBridgeCoins(blockTradesAPIs.BASE),
getActiveWallets(url)
]).then(result => {
clearTimeout(fetchCoinsTimeout);
delete inProgress["fetchBridgeCoins"];
let [coins, bridgeCoins, wallets] = result;
dispatch({
Expand Down
3 changes: 0 additions & 3 deletions app/api/apiConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,10 @@ export const settingsAPIs = {
{url: "wss://eu.openledger.info/ws", location: "Berlin, Germany"},
{url: "wss://bit.btsabc.org/ws", location: "Hong Kong"},
{url: "wss://bts.ai.la/ws", location: "Hong Kong"},
{url: "wss://bts.transwiser.com/ws", location: "Hangzhou, China"},
{url: "wss://bitshares.dacplay.org/ws", location: "Hangzhou, China"},
{url: "wss://bitshares-api.wancloud.io/ws", location: "China"},
{url: "wss://openledger.hk/ws", location: "Hong Kong"},
{url: "wss://secure.freedomledger.com/ws", location: "Toronto, Canada"},
{url: "wss://dexnode.net/ws", location: "Dallas, USA"},
{url: "wss://altcap.io/ws", location: "Paris, France"},
{url: "wss://bitshares.crypto.fans/ws", location: "Munich, Germany"},
{url: "wss://node.testnet.bitshares.eu", location: "Public Testnet Server (Frankfurt, Germany)"}
],
Expand Down
Loading

0 comments on commit d2c1cfc

Please sign in to comment.