diff --git a/dl/src/actions/AccountActions.js b/dl/src/actions/AccountActions.js index 0e16277703..2856264970 100644 --- a/dl/src/actions/AccountActions.js +++ b/dl/src/actions/AccountActions.js @@ -113,4 +113,4 @@ class AccountActions { } } -module.exports = alt.createActions(AccountActions); +export default alt.createActions(AccountActions); diff --git a/dl/src/actions/AssetActions.js b/dl/src/actions/AssetActions.js index 263c94e24e..ce470da550 100644 --- a/dl/src/actions/AssetActions.js +++ b/dl/src/actions/AssetActions.js @@ -340,4 +340,4 @@ class AssetActions { } } -module.exports = alt.createActions(AssetActions); +export default alt.createActions(AssetActions); diff --git a/dl/src/actions/BlockchainActions.js b/dl/src/actions/BlockchainActions.js index 25b5da84d3..cecfe1f8ac 100644 --- a/dl/src/actions/BlockchainActions.js +++ b/dl/src/actions/BlockchainActions.js @@ -52,4 +52,4 @@ class BlockchainActions { const BlockchainActionsInstance = alt.createActions(BlockchainActions); Apis.setRpcConnectionStatusCallback(BlockchainActionsInstance.updateRpcConnectionStatus); -module.exports = BlockchainActionsInstance; +export default BlockchainActionsInstance; diff --git a/dl/src/actions/MarketsActions.js b/dl/src/actions/MarketsActions.js index ecc1cfcc01..cd1fb5ac03 100644 --- a/dl/src/actions/MarketsActions.js +++ b/dl/src/actions/MarketsActions.js @@ -276,4 +276,4 @@ class MarketsActions { } -module.exports = alt.createActions(MarketsActions); +export default alt.createActions(MarketsActions); diff --git a/dl/src/actions/SettingsActions.js b/dl/src/actions/SettingsActions.js index 62261e691d..cd1d41f5bd 100644 --- a/dl/src/actions/SettingsActions.js +++ b/dl/src/actions/SettingsActions.js @@ -18,6 +18,14 @@ class SettingsActions { this.dispatch({quote, base}); } + addStarAccount(account) { + this.dispatch(account); + } + + removeStarAccount(account) { + this.dispatch(account); + } + addWS(ws) { this.dispatch(ws); } diff --git a/dl/src/actions/WalletActions.js b/dl/src/actions/WalletActions.js index 02407c54c1..deed4c6fbc 100644 --- a/dl/src/actions/WalletActions.js +++ b/dl/src/actions/WalletActions.js @@ -186,7 +186,7 @@ class WalletActions { } // With a lot of balance claims the signing can take so Long // the transaction will expire. This will increase the timeout... - tr.set_expire_seconds(config.expire_in_secs + balance_claims.length) + tr.set_expire_seconds( (15 * 60) + balance_claims.length) return WalletDb.process_transaction( tr, Object.keys(signer_pubkeys), broadcast ).then( @@ -197,4 +197,4 @@ class WalletActions { } } -module.exports = alt.createActions(WalletActions) +export default alt.createActions(WalletActions) diff --git a/dl/src/api/ChainStore.js b/dl/src/api/ChainStore.js index eb9a41e7c4..057816ff9e 100644 --- a/dl/src/api/ChainStore.js +++ b/dl/src/api/ChainStore.js @@ -145,7 +145,6 @@ class ChainStore let obj = updated_objects[a][i] if( utils.is_object_id( obj ) ) { /// the object was removed - // Cancelled limit order, emit event for MarketStore to update it's state if( obj.search( order_prefix ) == 0 ) { let old_obj = this.objects_by_id.get(obj); @@ -153,6 +152,14 @@ class ChainStore return; } emitter.emit('cancel-order', old_obj.get("id")); + let account = this.objects_by_id.get(old_obj.get("seller")); + if (account && account.has("orders")) { + let limit_orders = account.get("orders"); + if (account.get("orders").has(obj)) { + account = account.set("orders", limit_orders.delete(obj)); + this.objects_by_id = this.objects_by_id.set( account.get("id"), account ); + } + } } // Update nested call_order inside account object @@ -695,7 +702,7 @@ class ChainStore account.lifetime_referrer_name = lifetime_referrer_name account.registrar_name = registrar_name account.balances = {} - account.orders = new Immutable.Set(limit_orders) + account.orders = new Immutable.Set() account.vesting_balances = new Immutable.Set() account.balances = new Immutable.Map() account.call_orders = new Immutable.Set() @@ -716,6 +723,13 @@ class ChainStore }); }); + account.orders = account.orders.withMutations(set => { + limit_orders.forEach(order => { + this._updateObject( order, false ) + set.add( order.id ) + }); + }); + account.call_orders = account.call_orders.withMutations(set => { call_orders.forEach(co => { this._updateObject( co, false ) @@ -869,50 +883,50 @@ class ChainStore * then updates the account object with relevant meta-info depending * upon the type of account */ - _updateAccount( account_id, payload ) - { - let updates = payload[0] - - for( let i = 0; i < updates.length; ++i ) - { - let update = updates[i] - if( typeof update == 'string' ) - { - let old_obj = this._removeObject( update ) - - if( update.search( order_prefix ) == 0 ) - { - acnt = acnt.setIn( ['orders'], set => set.delete(update) ) - } - else if( update.search( vesting_balance_prefix ) == 0 ) - { - acnt = acnt.setIn( ['vesting_balances'], set => set.delete(update) ) - } - } - else - { - let updated_obj = this._updateObject( update ) - if( update.id.search( balance_prefix ) == 0 ) - { - if( update.owner == account_id ) - acnt = acnt.setIn( ['balances'], map => map.set(update.asset_type,update.id) ) - } - else if( update.id.search( order_prefix ) == 0 ) - { - if( update.owner == account_id ) - acnt = acnt.setIn( ['orders'], set => set.add(update.id) ) - } - else if( update.id.search( vesting_balance_prefix ) == 0 ) - { - if( update.owner == account_id ) - acnt = acnt.setIn( ['vesting_balances'], set => set.add(update.id) ) - } - - this.objects_by_id = this.objects_by_id.set( acnt.id, acnt ) - } - } - this.fetchRecentHistory( acnt ) - } + // _updateAccount( account_id, payload ) + // { + // let updates = payload[0] + + // for( let i = 0; i < updates.length; ++i ) + // { + // let update = updates[i] + // if( typeof update == 'string' ) + // { + // let old_obj = this._removeObject( update ) + + // if( update.search( order_prefix ) == 0 ) + // { + // acnt = acnt.setIn( ['orders'], set => set.delete(update) ) + // } + // else if( update.search( vesting_balance_prefix ) == 0 ) + // { + // acnt = acnt.setIn( ['vesting_balances'], set => set.delete(update) ) + // } + // } + // else + // { + // let updated_obj = this._updateObject( update ) + // if( update.id.search( balance_prefix ) == 0 ) + // { + // if( update.owner == account_id ) + // acnt = acnt.setIn( ['balances'], map => map.set(update.asset_type,update.id) ) + // } + // else if( update.id.search( order_prefix ) == 0 ) + // { + // if( update.owner == account_id ) + // acnt = acnt.setIn( ['orders'], set => set.add(update.id) ) + // } + // else if( update.id.search( vesting_balance_prefix ) == 0 ) + // { + // if( update.owner == account_id ) + // acnt = acnt.setIn( ['vesting_balances'], set => set.add(update.id) ) + // } + + // this.objects_by_id = this.objects_by_id.set( acnt.id, acnt ) + // } + // } + // this.fetchRecentHistory( acnt ) + // } /** @@ -933,6 +947,8 @@ class ChainStore // if (!(object.id.split(".")[0] == 2) && !(object.id.split(".")[1] == 6)) { // console.log( "update: ", object ) // } + + // DYNAMIC GLOBAL OBJECT if( object.id == "2.1.0" ) { object.participation = 100*(BigInteger(object.recent_slots_filled).bitCount() / 128.0) this.head_block_time_string = object.time @@ -952,6 +968,7 @@ class ChainStore } + // BALANCE OBJECT if( object.id.substring(0,balance_prefix.length) == balance_prefix ) { let owner = this.objects_by_id.get( object.owner ) @@ -973,6 +990,7 @@ class ChainStore } this.objects_by_id = this.objects_by_id.set( object.owner, owner ) } + // ACCOUNT STATS OBJECT else if( object.id.substring(0,account_stats_prefix.length) == account_stats_prefix ) { // console.log( "HISTORY CHANGED" ) @@ -982,16 +1000,19 @@ class ChainStore this.fetchRecentHistory( object.owner ); } } + // WITNESS OBJECT else if( object.id.substring(0,witness_prefix.length) == witness_prefix ) { this.witness_by_account_id.set( object.witness_account, object.id ) this.objects_by_vote_id.set( object.vote_id, object.id ) } + // COMMITTEE MEMBER OBJECT else if( object.id.substring(0,committee_prefix.length) == committee_prefix ) { this.committee_by_account_id.set( object.committee_member_account, object.id ) this.objects_by_vote_id.set( object.vote_id, object.id ) } + // ACCOUNT OBJECT else if( object.id.substring(0,account_prefix.length) == account_prefix ) { current = current.set( 'active', Immutable.fromJS( object.active ) ); @@ -1004,6 +1025,7 @@ class ChainStore this.objects_by_id = this.objects_by_id.set( object.id, current ); this.accounts_by_name = this.accounts_by_name.set( object.name, object.id ) } + // ASSET OBJECT else if( object.id.substring(0,asset_prefix.length) == asset_prefix ) { this.assets_by_symbol = this.assets_by_symbol.set( object.symbol, object.id ) @@ -1036,6 +1058,7 @@ class ChainStore this.objects_by_id = this.objects_by_id.set( object.id, current ); } } + // ASSET DYNAMIC DATA OBJECT else if( object.id.substring(0,asset_dynamic_data_prefix.length) == asset_dynamic_data_prefix ) { // let asset_id = asset_prefix + object.id.substring( asset_dynamic_data_prefix.length ) @@ -1049,11 +1072,13 @@ class ChainStore } } + // WORKER OBJECT else if( object.id.substring(0,worker_prefix.length ) == worker_prefix ) { this.objects_by_vote_id.set( object.vote_for, object.id ); this.objects_by_vote_id.set( object.vote_against, object.id ); } + // BITASSET DATA OBJECT else if( object.id.substring(0,bitasset_data_prefix.length) == bitasset_data_prefix ) { let asset_id = current.get( "asset_id" ); @@ -1065,21 +1090,36 @@ class ChainStore } } } + // CALL ORDER OBJECT else if( object.id.substring(0,call_order_prefix.length ) == call_order_prefix ) { // Update nested call_orders inside account object if (emit) { emitter.emit("call-order-update", object); } + let account = this.objects_by_id.get(object.borrower); if (account && account.has("call_orders")) { let call_orders = account.get("call_orders"); - if (!account.get("call_orders").has(object.id)) { + if (!call_orders.has(object.id)) { account = account.set("call_orders", call_orders.add(object.id)); this.objects_by_id = this.objects_by_id.set( account.get("id"), account ); } } } + // LIMIT ORDER OBJECT + else if( object.id.substring(0,order_prefix.length ) == order_prefix ) { + let account = this.objects_by_id.get(object.seller); + if (account && account.has("orders")) { + let limit_orders = account.get("orders"); + if (!limit_orders.has(object.id)) { + account = account.set("orders", limit_orders.add(object.id)); + this.objects_by_id = this.objects_by_id.set( account.get("id"), account ); + } + } + } + + if( notify_subscribers ) this.notifySubscribers() diff --git a/dl/src/common/market_utils.js b/dl/src/common/market_utils.js index b107c651d2..60a17fbb06 100644 --- a/dl/src/common/market_utils.js +++ b/dl/src/common/market_utils.js @@ -147,6 +147,7 @@ class MarketUtils { let price_full = utils.get_asset_price(order.receives.amount, receivesAsset, order.pays.amount, paysAsset, isAsk); // price_full = !flipped ? (1 / price_full) : price_full; // let {int, dec} = this.split_price(price_full, isAsk ? receivesAsset.get("precision") : paysAsset.get("precision")); + let {int, dec, trailing} = utils.price_to_text(price_full, isAsk ? receivesAsset : paysAsset, isAsk ? paysAsset : receivesAsset); let className = isCall ? "orderHistoryCall" : isAsk ? "orderHistoryBid" : "orderHistoryAsk"; @@ -155,17 +156,20 @@ class MarketUtils { time = order.time.split("T")[1]; let now = new Date(); let offset = now.getTimezoneOffset() / 60; + let date = utils.format_date(order.time + "Z").split("/"); let hour = time.substr(0, 2); let hourNumber = parseInt(hour, 10); - let localHour = hourNumber - offset + let localHour = hourNumber - offset; if (localHour >= 24) { localHour -= 24; + } else if (localHour < 0) { + localHour += 24; } let hourString = localHour.toString(); if (parseInt(hourString, 10) < 10) { hourString = "0" + hourString; } - time = time.replace(hour, hourString); + time = date[0] + "/" + date[1] + " " + time.replace(hour, hourString); } return { receives: isAsk ? receives : pays, diff --git a/dl/src/common/utils.js b/dl/src/common/utils.js index 449bf3ebe7..1a0294b1d1 100644 --- a/dl/src/common/utils.js +++ b/dl/src/common/utils.js @@ -22,6 +22,28 @@ var Utils = { return obj_id.substring(0, prefix.length) === prefix; }, + get_satoshi_amount(amount, asset) { + let precision = asset.toJS ? asset.get("precision") : asset.precision; + let assetPrecision = this.get_asset_precision(precision); + amount = typeof amount === "string" ? amount : amount.toString(); + + let decimalPosition = amount.indexOf("."); + if (decimalPosition === -1) { + return parseInt(amount, 10) * assetPrecision; + } else { + let amountLength = amount.length; + amount = amount.replace(".", ""); + for (let i = 0; i < precision; i++) { + decimalPosition += 1; + if (decimalPosition > amount.length) { + amount += "0"; + } + }; + + return parseInt(amount, 10); + } + }, + get_asset_precision: (precision) => { precision = precision.toJS ? precision.get("precision") : precision; return Math.pow(10, precision); @@ -46,9 +68,9 @@ var Utils = { format_volume(amount) { if (amount < 10) { - return this.format_number(amount, 2); + return this.format_number(amount, 2); } else if (amount < 10000) { - return this.format_number(amount, 0); + return this.format_number(amount, 0); } else { return Math.round(amount / 1000) + "k"; } @@ -58,7 +80,7 @@ var Utils = { if(isNaN(number) || !isFinite(number) || number === undefined || number === null) return ""; let zeros = "."; for (var i = 0; i < decimals; i++) { - zeros += "0"; + zeros += "0"; } let num = numeral(number).format("0,0" + zeros); if( num.indexOf('.') > 0 && !trailing_zeros) @@ -71,13 +93,13 @@ var Utils = { let digits = 0 if( asset === undefined ) return undefined - if( 'symbol' in asset ) + if( 'symbol' in asset ) { // console.log( "asset: ", asset ) symbol = asset.symbol digits = asset.precision } - else + else { // console.log( "asset: ", asset.toJS() ) symbol = asset.get('symbol') @@ -111,28 +133,34 @@ var Utils = { } }, + price_text: function(price, base, quote) { + let maxDecimals = 9; + let priceText; + let quoteID = quote.toJS ? quote.get("id") : quote.id; + let quotePrecision = quote.toJS ? quote.get("precision") : quote.precision; + let baseID = base.toJS ? base.get("id") : base.id; + let basePrecision = base.toJS ? base.get("precision") : base.precision; + if (quoteID === "1.3.0") { + priceText = this.format_number(price, quotePrecision - 1); + } else if (baseID === "1.3.0") { + priceText = this.format_number(price, Math.min(maxDecimals, quotePrecision + 1)); + } else { + priceText = this.format_number(price, Math.min(maxDecimals, quotePrecision + basePrecision)); + } + return priceText; + }, + price_to_text: function(price, base, quote, forcePrecision = null) { if (typeof price !== "number" || !base || !quote) { return; } let precision; let priceText; - let satoshi = 8; if (forcePrecision) { priceText = this.format_number(price, forcePrecision); } else { - let quoteID = quote.toJS ? quote.get("id") : quote.id; - let quotePrecision = quote.toJS ? quote.get("precision") : quote.precision; - let baseID = base.toJS ? base.get("id") : base.id; - let basePrecision = base.toJS ? base.get("precision") : base.precision; - if (quoteID === "1.3.0") { - priceText = this.format_number(price, quotePrecision - 1); - } else if (baseID === "1.3.0") { - priceText = this.format_number(price, Math.min(satoshi, quotePrecision + 1)); - } else { - priceText = this.format_number(price, Math.min(satoshi, quotePrecision + basePrecision)); - } + priceText = this.price_text(price, base, quote); } let price_split = priceText.split("."); let int = price_split[0]; @@ -371,8 +399,26 @@ var Utils = { } else { return false; } + }, + + sortText(a, b, inverse = false) { + if (a > b) { + return inverse ? 1 : -1; + } else if (a < b) { + return inverse ? -1 : 1; + } else { + return 0; + } + }, + + sortID(a, b, inverse = false) { + // inverse = false => low to high + let intA = parseInt(a.split(".")[2], 10); + let intB = parseInt(b.split(".")[2], 10); + + return inverse ? (intB - intA) : (intA -intB); } }; -module.exports = Utils; +export default Utils; diff --git a/dl/src/idb-instance.js b/dl/src/idb-instance.js index 266411674e..3d745ce0b3 100644 --- a/dl/src/idb-instance.js +++ b/dl/src/idb-instance.js @@ -63,9 +63,7 @@ var openDatabase = function(database_name = this.getDatabaseName()) { }) } -var iDB - -module.exports = iDB = (function () { +var iDB = (function () { var _instance; var idb; @@ -256,3 +254,4 @@ module.exports = iDB = (function () { })(); +export default iDB; diff --git a/dl/src/rpc_api/ApiInstances.js b/dl/src/rpc_api/ApiInstances.js index 5611d9f6f6..2c1d897b5a 100644 --- a/dl/src/rpc_api/ApiInstances.js +++ b/dl/src/rpc_api/ApiInstances.js @@ -82,7 +82,7 @@ class Apis { var apis_instance; -module.exports = { +export default { setRpcConnectionStatusCallback: function(callback) { this.update_rpc_connection_status_callback = callback; if(apis_instance) apis_instance.setRpcConnectionStatusCallback(callback); diff --git a/dl/src/rpc_api/ApplicationApi.js b/dl/src/rpc_api/ApplicationApi.js index a0a7927047..8f8f1335d0 100644 --- a/dl/src/rpc_api/ApplicationApi.js +++ b/dl/src/rpc_api/ApplicationApi.js @@ -163,4 +163,4 @@ class ApplicationApi { } } -module.exports = ApplicationApi; +export default ApplicationApi; diff --git a/dl/src/rpc_api/WalletApi.js b/dl/src/rpc_api/WalletApi.js index a6721bd2b8..9aa73500bb 100644 --- a/dl/src/rpc_api/WalletApi.js +++ b/dl/src/rpc_api/WalletApi.js @@ -75,4 +75,4 @@ class WalletApi { } } -module.exports = WalletApi +export default WalletApi diff --git a/dl/src/stores/AccountRefsStore.js b/dl/src/stores/AccountRefsStore.js index 94b9a77a7d..e2ce5cd632 100644 --- a/dl/src/stores/AccountRefsStore.js +++ b/dl/src/stores/AccountRefsStore.js @@ -80,8 +80,8 @@ class AccountRefsStore extends BaseStore { } } - -module.exports = alt.createStore(AccountRefsStore, "AccountRefsStore") + +export default alt.createStore(AccountRefsStore, "AccountRefsStore") // Performance optimization for large wallets function loadNoAccountRefs() { diff --git a/dl/src/stores/AccountStore.js b/dl/src/stores/AccountStore.js index fbea22a4ad..c96067504b 100644 --- a/dl/src/stores/AccountStore.js +++ b/dl/src/stores/AccountStore.js @@ -8,6 +8,7 @@ import validation from "common/validation" import ChainStore from "api/ChainStore" import AccountRefsStore from "stores/AccountRefsStore" import AddressIndex from "stores/AddressIndex" +import SettingsStore from "stores/SettingsStore" /** * This Store holds information about accounts in this wallet @@ -174,7 +175,12 @@ class AccountStore extends BaseStore { if (localStorage.currentAccount) { return this.setCurrentAccount(localStorage.currentAccount); } - if (this.state.linkedAccounts.size > 0) { + + let {starredAccounts} = SettingsStore.getState(); + if (starredAccounts.size) { + return this.setCurrentAccount(starredAccounts.first().name); + } + if (this.state.linkedAccounts.size) { return this.setCurrentAccount(this.state.linkedAccounts.first()); } } @@ -245,7 +251,7 @@ class AccountStore extends BaseStore { } -module.exports = alt.createStore(AccountStore, "AccountStore"); +export default alt.createStore(AccountStore, "AccountStore"); // @return 3 full, 2 partial, 0 none function pubkeyThreshold(authority) { diff --git a/dl/src/stores/AddressIndex.js b/dl/src/stores/AddressIndex.js index 3d116abc14..ab22b51034 100644 --- a/dl/src/stores/AddressIndex.js +++ b/dl/src/stores/AddressIndex.js @@ -107,4 +107,4 @@ class AddressIndex extends BaseStore { } // console.log("post msg a"); // worker.postMessage("a") -module.exports = alt.createStore(AddressIndex, "AddressIndex"); +export default alt.createStore(AddressIndex, "AddressIndex"); diff --git a/dl/src/stores/AssetStore.js b/dl/src/stores/AssetStore.js index e4337c13e1..97c44e15e6 100644 --- a/dl/src/stores/AssetStore.js +++ b/dl/src/stores/AssetStore.js @@ -101,4 +101,4 @@ class AssetStore extends BaseStore { } } -module.exports = alt.createStore(AssetStore, "AssetStore"); +export default alt.createStore(AssetStore, "AssetStore"); diff --git a/dl/src/stores/BalanceClaimActiveStore.js b/dl/src/stores/BalanceClaimActiveStore.js index dbbc4814c5..46d181c5fc 100644 --- a/dl/src/stores/BalanceClaimActiveStore.js +++ b/dl/src/stores/BalanceClaimActiveStore.js @@ -46,7 +46,7 @@ class BalanceClaimActiveStore extends BaseStore { checked: Immutable.Map(), selected_balances: Immutable.Seq(), claim_account_name: undefined, - loading: false + loading: true } } @@ -77,19 +77,24 @@ class BalanceClaimActiveStore extends BaseStore { // param: Immutable Seq or array onSetPubkeys(pubkeys) { + if( Array.isArray( pubkeys )) pubkeys = Immutable.Seq( pubkeys ) if(this.pubkeys && this.pubkeys.equals( pubkeys )) return this.reset() this.pubkeys = pubkeys if( pubkeys.size === 0) { this.setState({ loading: false }) - return + return true; } this.setState({ loading: true }) this.loadNoBalanceAddresses().then( () => { - for(let pubkey of pubkeys) this.indexPubkey(pubkey) - return this.refreshBalances() - }).catch( error => console.error( error )) + // for(let pubkey of pubkeys) { + this.indexPubkeys(pubkeys) + // } + + this.refreshBalances(); + return false; + }).catch( error => console.error( error )); } onSetSelectedBalanceClaims(checked) { @@ -109,10 +114,26 @@ class BalanceClaimActiveStore extends BaseStore { this.no_balance_address = new Set(array) }) } + + indexPubkeys(pubkeys) { + let {address_to_pubkey} = this.state; + + for(let pubkey of pubkeys) { + for(let address_string of key.addresses(pubkey)) { + if( !this.no_balance_address.has(address_string)) { + // AddressIndex indexes all addresses .. Here only 1 address is involved + address_to_pubkey.set(address_string, pubkey) + this.addresses.add(address_string) + } + } + } + this.setState({address_to_pubkey: address_to_pubkey}) + } indexPubkey(pubkey) { + for(let address_string of key.addresses(pubkey)) { - if( ! this.no_balance_address.has(address_string)) { + if( !this.no_balance_address.has(address_string)) { // AddressIndex indexes all addresses .. Here only 1 address is involved this.state.address_to_pubkey.set(address_string, pubkey) this.addresses.add(address_string) @@ -122,17 +143,17 @@ class BalanceClaimActiveStore extends BaseStore { } refreshBalances() { - return this.lookupBalanceObjects().then( balances => { + this.lookupBalanceObjects().then( balances => { var state = this.getInitialViewState() state.balances = balances state.loading = false - this.setState(state) + this.setState(state); }) } /** @return Promise.resolve(balances) */ lookupBalanceObjects() { - // console.log("BalanceClaimActiveStore.lookupBalanceObjects") + console.log("BalanceClaimActiveStore.lookupBalanceObjects") var db = Apis.instance().db_api() var no_balance_address = new Set(this.no_balance_address) var no_bal_size = no_balance_address.size diff --git a/dl/src/stores/BlockchainStore.js b/dl/src/stores/BlockchainStore.js index 354cf0f710..dca885fcfd 100644 --- a/dl/src/stores/BlockchainStore.js +++ b/dl/src/stores/BlockchainStore.js @@ -77,4 +77,4 @@ class BlockchainStore extends BaseStore{ } -module.exports = alt.createStore(BlockchainStore, "BlockchainStore"); +export default alt.createStore(BlockchainStore, "BlockchainStore"); diff --git a/dl/src/stores/IntlStore.js b/dl/src/stores/IntlStore.js index aef39d097d..9ab78dfdd1 100644 --- a/dl/src/stores/IntlStore.js +++ b/dl/src/stores/IntlStore.js @@ -3,12 +3,13 @@ var IntlActions = require("../actions/IntlActions"); var BaseStore = require("./BaseStore"); var counterpart = require("counterpart-instance"); var locale_en = require("assets/locales/locale-en"); +var cookies = require("cookies-js"); counterpart.registerTranslations("en", locale_en); class IntlStore extends BaseStore { constructor() { super(); - this.currentLocale = "en"; + this.currentLocale = cookies.locale || "en"; this.locales = ["en"]; this.localesObject = {en: locale_en}; diff --git a/dl/src/stores/MarketsStore.js b/dl/src/stores/MarketsStore.js index f762a62b32..caa284740f 100644 --- a/dl/src/stores/MarketsStore.js +++ b/dl/src/stores/MarketsStore.js @@ -85,7 +85,7 @@ class MarketsStore { _getBucketSize() { let bs = ls ? ls.getItem("__graphene___bucketSize") : null; - return bs ? parseInt(bs) : 3600; + return bs ? parseInt(bs) : 24 * 3600; } _setBucketSize(size) { @@ -767,4 +767,4 @@ class MarketsStore { } } -module.exports = alt.createStore(MarketsStore, "MarketsStore"); +export default alt.createStore(MarketsStore, "MarketsStore"); diff --git a/dl/src/stores/PrivateKeyStore.js b/dl/src/stores/PrivateKeyStore.js index f3e811c9bd..ffcdca0f78 100644 --- a/dl/src/stores/PrivateKeyStore.js +++ b/dl/src/stores/PrivateKeyStore.js @@ -204,4 +204,4 @@ class PrivateKeyStore extends BaseStore { } -module.exports = alt.createStore(PrivateKeyStore, "PrivateKeyStore"); +export default alt.createStore(PrivateKeyStore, "PrivateKeyStore"); diff --git a/dl/src/stores/SettingsStore.js b/dl/src/stores/SettingsStore.js index 093c3df766..a4b2d63b6a 100644 --- a/dl/src/stores/SettingsStore.js +++ b/dl/src/stores/SettingsStore.js @@ -45,6 +45,8 @@ class SettingsStore { [CORE_ASSET + "_METAEX.BTC", {"quote": CORE_ASSET,"base": "METAEX.BTC" } ] ]); + this.starredAccounts = Immutable.Map(); + // If you want a default value to be translated, add the translation to settings in locale-xx.js // and use an object {translate: key} in the defaults array this.defaults = { @@ -82,6 +84,8 @@ class SettingsStore { onChangeViewSetting: SettingsActions.changeViewSetting, onAddStarMarket: SettingsActions.addStarMarket, onRemoveStarMarket: SettingsActions.removeStarMarket, + onAddStarAccount: SettingsActions.addStarAccount, + onRemoveStarAccount: SettingsActions.removeStarAccount, onAddWS: SettingsActions.addWS, onRemoveWS: SettingsActions.removeWS }); @@ -94,6 +98,10 @@ class SettingsStore { this.starredMarkets = Immutable.Map(JSON.parse(this._lsGet("starredMarkets"))); } + if (this._lsGet("starredAccounts")) { + this.starredAccounts = Immutable.Map(JSON.parse(this._lsGet("starredAccounts"))); + } + if (this._lsGet("defaults_v1")) { this.defaults = _.merge(this.defaults, JSON.parse(this._lsGet("defaults_v1"))); } @@ -157,6 +165,23 @@ class SettingsStore { this._lsSet("starredMarkets", this.starredMarkets.toJS()); } + onAddStarAccount(account) { + if (!this.starredAccounts.has(account)) { + this.starredAccounts = this.starredAccounts.set(account, {name: account}); + + this._lsSet("starredAccounts", this.starredAccounts.toJS()); + } else { + return false; + } + } + + onRemoveStarAccount(account) { + + this.starredAccounts = this.starredAccounts.delete(account); + + this._lsSet("starredAccounts", this.starredAccounts.toJS()); + } + onAddWS(ws) { this.defaults.connection.push(ws); this._lsSet("defaults_v1", this.defaults); diff --git a/dl/src/stores/WalletDb.js b/dl/src/stores/WalletDb.js index 04c9c61ba8..388eded4e0 100644 --- a/dl/src/stores/WalletDb.js +++ b/dl/src/stores/WalletDb.js @@ -509,7 +509,7 @@ class WalletDb extends BaseStore { } export var WalletDbWrapped = alt.createStore(WalletDb, "WalletDb"); -module.exports = WalletDbWrapped +export default WalletDbWrapped function reject(error) { console.error( "----- WalletDb reject error -----", error) diff --git a/electron/build/electron.js b/electron/build/electron.js index 2eb1d0f970..e43d84f5db 100644 --- a/electron/build/electron.js +++ b/electron/build/electron.js @@ -43,6 +43,11 @@ mainWindowState.saveState(mainWindow); }); + mainWindow.webContents.on('new-window', function(e, url) { + e.preventDefault(); + require('shell').openExternal(url); + }); + // Create the Application's main menu var app_menu = process.platform === 'darwin' ? diff --git a/help/cn/components/AccountPermActive.md b/help/cn/components/AccountPermActive.md new file mode 100644 index 0000000000..e6825fc32e --- /dev/null +++ b/help/cn/components/AccountPermActive.md @@ -0,0 +1,3 @@ +活跃权限用来设定拥有花费本账户资金权限的账户名或公钥。 + +可方便的架设多重签名机制,参见 [权限](accounts/permissions) 了解更新信息。 \ No newline at end of file diff --git a/help/cn/components/AccountPermMemo.md b/help/cn/components/AccountPermMemo.md new file mode 100644 index 0000000000..380abce696 --- /dev/null +++ b/help/cn/components/AccountPermMemo.md @@ -0,0 +1,3 @@ +交易附带的备注信息是使用备注公钥加密后传输的。为了解密备注信息,需要拥有备注公钥对应的私钥。 + +备注信息由单独公/私钥对进行管理,而非兼用活跃权限职权实体可让你安全的将备注信息的只读权限交由第三方,而无需暴露在资金控制权外泄的风险下。 \ No newline at end of file diff --git a/help/cn/components/AccountPermOwner.md b/help/cn/components/AccountPermOwner.md new file mode 100644 index 0000000000..46c00ccf01 --- /dev/null +++ b/help/cn/components/AccountPermOwner.md @@ -0,0 +1,3 @@ +账户权限设定谁可以控制本账户。控制人(账户名或公钥)可修改账户相关的各种设置,包括权限设置。 + +参见 [权限](accounts/permissions) 了解更多信息。 \ No newline at end of file diff --git a/help/cn/components/Fees.md b/help/cn/components/Fees.md index 7600b98eb9..4fdd2b4833 100644 --- a/help/cn/components/Fees.md +++ b/help/cn/components/Fees.md @@ -1,3 +1,3 @@ # 手续费率 -在BitShares系统中,每一种操作都将花费*相应*手续费。手续费率可能发生变化。然而,手续费的变化需要获得股东的授权。所以每一位持有BitShares核心资产(BTS)的股东对费率的构成都有话语权。如果股东确信某种手续费的降低将带来好处,并且达成共识,那么该中手续费则有区块链自动进行调低。区块链参数的改变有理事会成员提出动议。这些成员有全体股东投票选举产生,已提高系统灵活性和响应率。 \ No newline at end of file +在BitShares系统中,每一种操作都将花费*相应*手续费。手续费率可能发生变化。然而,手续费的调整需要获得股东的授权。所以每一位持有BitShares核心资产(BTS)的股东对费率的构成都有话语权。如果股东确信某种手续费的降低将带来好处,并且达成共识,那么该种手续费则由区块链自动进行调低。区块链参数的改变由理事会成员提出动议。这些成员由全体股东投票选举产生,以提高系统灵活性和响应率。 \ No newline at end of file diff --git a/help/en/accounts/permissions.md b/help/en/accounts/permissions.md index 7585aa75eb..84bc868103 100644 --- a/help/en/accounts/permissions.md +++ b/help/en/accounts/permissions.md @@ -106,7 +106,7 @@ This scheme allows: * the CEO to spend funds * the Chief of Finance Officer to spend funds * Treasurer together with Controller to spend funds -* Controller or Treasurer together with wither the Tax Manager or Accounting to +* Controller or Treasurer together with the Tax Manager and Accounting to spend funds. Hence, a try of arbitrary depth can be spanned in order to construct a flexible diff --git a/help/tr/accounts/membership.md b/help/tr/accounts/membership.md index 567d602694..4f264e9ead 100644 --- a/help/tr/accounts/membership.md +++ b/help/tr/accounts/membership.md @@ -10,21 +10,21 @@ faydalanmalarına imkan tanıdık. ## Ömür-boyu Üyeler -Ömür-boyu üyelerin ödediği her işlem ücretinin belirli bir yüzdesi kendilerine iade +Ömür-boyu-üyelerinin ödediği her işlem ücretinin belirli bir yüzdesi kendilerine iade edilir ve kaydını yaptıkları ya da getirdikleri üyelerden komisyon geliri kazanmaya -hak kazanırlar. Ömür-boyu üyelikle alakalı kurul tarafından belirlenmiş belli miktarda +hak kazanırlar. Ömür-boyu-üyelikle alakalı kurul tarafından belirlenmiş belli miktarda tek-seferlik bir ücret vardır. ## Yıllık Üyeler -Ömür-boyu üyelik eğer çok fazla gelirse , bir yıl süreli tek-seferlik düşük bir bedel +Ömür-boyu-üyelik eğer çok fazla gelirse , bir yıl süreli tek-seferlik düşük bir bedel karşılığında yıllık abone olarak bir sonraki seneye de aynı iadeyi alabilirsiniz. ### Ücret Paylaşımı Getirdiğiniz hesap her işlem ücreti ödediğinde o ücret birçok farklı hesap arasında -pay edilir. Ağımız bir kısmını alır , hesabı getiren ömür-boyu üye de diğer kısmını alır. +pay edilir. Ağımız bir kısmını alır , hesabı getiren ömür-boyu-üye de diğer kısmını alır. Hesabı getiren üye bir kısım pay alır. Kayıtçı , hesabın ağımıza kaydı yapılırken işlem ücretini ödeyen hesaptır. Kayıtçı @@ -36,7 +36,7 @@ verir. Ödenen ücretler sadece ağımız, getirenler, ve kayıtçılar arasında her bakım aralığında bir kez pay edilir. -### Hak Ücretler +### Hak Edilen Ücretler Çoğu ücretler anında ödenmesine rağmen , bir limitin üzerindeki ücretler (mesela üyeliğinizi yükseltmek için ödediğiniz ya da paralı hesap kaydetmek için ödediğiniz diff --git a/help/tr/assets/EUR.md b/help/tr/assets/EUR.md index 9447991ef2..a5082444a9 100644 --- a/help/tr/assets/EUR.md +++ b/help/tr/assets/EUR.md @@ -4,4 +4,4 @@ {description} Piyasaya süren {issuer} -Euro (işaret: €; sembol: EUR) Avrupa bölgesindeki katılımcı ülkelerin resmi para birimidir. \ No newline at end of file +Euro (işaret: €; sembol: EUR) Avrupa bölgesindeki katılımcı ülkelerin resmi para birimidir. diff --git a/help/tr/components/AccountMembership.md b/help/tr/components/AccountMembership.md index d814704faf..63cb98c968 100644 --- a/help/tr/components/AccountMembership.md +++ b/help/tr/components/AccountMembership.md @@ -1,5 +1,5 @@ [# lifetime] -###Ücretlerde {feesCashback}% iade alın. +### Ücretlerde {feesCashback}% iade alın. Ömür-boyu Üyeler ödedikleri her ücretten {feesCashback}% iade alırlar ve kaydını yaptıkları ya da ağa yönlendirdikleri kullanıcılardan gelir elde ederler. Ömür-boyu ücret @@ -28,4 +28,4 @@ Bir sonraki bakım vakti {nextMaintenanceTime}dır. #### Hacizdeki Ücretler Çoğu ücretler anında ödendiği halde {vestingThreshold} miktarını aşan bazı ücretler -(üyeliğinizi yükseltmek için yada paralı hesap adı kaydı yaptırmak için ödenen) toplam {vestingPeriod} gün hacizde tutulmak zorundadır. \ No newline at end of file +(üyeliğinizi yükseltmek için yada paralı hesap adı kaydı yaptırmak için ödenen) toplam {vestingPeriod} gün hacizde tutulmak zorundadır. diff --git a/help/tr/components/InitError.md b/help/tr/components/InitError.md index 1b39d675f9..afbe477451 100644 --- a/help/tr/components/InitError.md +++ b/help/tr/components/InitError.md @@ -3,4 +3,4 @@ Ful noda websocket bağlantısı kuramadık. Olası sebepler: TODO - sebep #1 -- sebep #2 \ No newline at end of file +- sebep #2 diff --git a/help/tr/dex/shorting.md b/help/tr/dex/shorting.md index 240ded826f..e66ebaabcf 100644 --- a/help/tr/dex/shorting.md +++ b/help/tr/dex/shorting.md @@ -1,7 +1,7 @@ -# BitVarlık Kısa Satışı +# BitAktif Kısa Satışı -BTS'le temasınızı arttırmak ve USD,EUR,GOLD gibi BitVarlıklara likidite sağlamak için -bu BitVarlıkları ağdan *ödünç* alabilir ve *kısa satabilirsiniz*. Prosedürü burada kısaca +BTS'le temasınızı arttırmak ve USD,EUR,GOLD gibi BitAktiflere likidite sağlamak için +bu BitAktifleri ağdan *ödünç* alabilir ve *kısa satabilirsiniz*. Prosedürü burada kısaca anlatacağız. ## Ödünç Alma @@ -27,20 +27,20 @@ fiyatından(x/BTS) daha düşük olduğu anda teminatı zorla sattırılır. SQP = uzlaşma fiyatı / MSQR çağrı fiyatı = BORÇ / TEMİNAT * MCR -Marjin çağrısı teminatı alır , ödünç alınmış bitVarlık hisselerinin SQP ya kadarki kısmını +Marjin çağrısı teminatı alır , ödünç alınmış bitaktif hisselerinin SQP ya kadarki kısmını piyasa fiyatından satın alır ve pozisyonu kapar. Teminattan geri kalan BTS müşteriye iade edilir. ### Hesap görme -Her bitVarlık sahibi istediği zaman *adil bir fiyattan* hesap görmeyi talep edebilir. +Her bitaktif sahibi istediği zaman *adil bir fiyattan* hesap görmeyi talep edebilir. Hesap görme işlemi, ödünç/kısa pozisyonlarını en düşük teminat oranıyla kapar ve hesap görmek üzere teminatı satar. ## Satış -BitVarlık ödünç alındıktan sonra, ilgili herhangi bir piyasada alıcının ödemek istediği -bir fiyattan satılabilir . Bu aşamayla , kısa-satış tamamlanmış olur ve o bitVarlık da kısa +BitAktif ödünç alındıktan sonra alakalı piyasalardan herhangi birinde herhangi +bir fiyattan satılabilir . Bu aşamayla , kısa-satış tamamlanmış olur ve o bitaktif da kısa olursunuz. ## Teminat Oranını Güncellemek @@ -54,6 +54,6 @@ gerektirir. ## Kapamak Ödünç/kısa pozisyonunu kapamak için , ilk önce kişinin , BitShares ağına teslim -etmek üzere o Bitvarlığın ödünç alınan miktarının elinde bulunması gerekir. Ondan -sonra , BitVarlıklar ilgili arz stoğundan düşer ve teminat serbest bırakılıp sahibine geri +etmek üzere o Bitvarlığın ödünç alınan miktarda elinde bulunması gerekir. Ondan +sonra , BitAktifler arz stoğundan düşer ve teminat serbest bırakılıp sahibine geri verilir. \ No newline at end of file diff --git a/help/tr/introduction/workers.md b/help/tr/introduction/workers.md index 3bcaf4acd5..d81822c554 100644 --- a/help/tr/introduction/workers.md +++ b/help/tr/introduction/workers.md @@ -1,4 +1,4 @@ -# İşçiler +# Emekçiler İşçiler maaş karşılığında bir hizmet veren tekliflerdir, maaşlarını blok zincirinden alırlar. Bir işçi teklifi en azından aşağıdaki bilgileri kapsamalıdır : diff --git a/release-notes.txt b/release-notes.txt index 5c957ff29e..9ed6e6403d 100644 --- a/release-notes.txt +++ b/release-notes.txt @@ -1,3 +1,24 @@ +--------------------------------------------------------------------- +Release 2.0.151216 +--------------------------------------------------------------------- + +NEW FEATURES: +- Dashboard makeover #590 +- Total Value in header #584 +- Show Date in All History #580 +- Switch the default chart interval to 1 day #601 +- Show one more decimal for prices in Exchange +- Show popup with additional info when user clicks on currency symbol + + +BUG FIXES: +- Failed to broadcast the transaction (now <= trx.expiration) #583 +- Consolidated Open Orders screen bug #585 +- Get rid of the horizontal scroll-bar in Recent Activity #470 +- Unnecessary scroll-bars on the Create Asset confirmation screen #547 +- Decimal Bug in Matching in 8-digit Assets #586 +- In Lite wallet all website links result in broken pages #581 + --------------------------------------------------------------------- Release 2.0.151202 --------------------------------------------------------------------- diff --git a/web/app/App.jsx b/web/app/App.jsx index 1c11b5a1b3..b17c616338 100644 --- a/web/app/App.jsx +++ b/web/app/App.jsx @@ -1,5 +1,6 @@ import React from "react"; -import Router from "react-router"; +import ReactDOM from "react-dom"; +import {Router, Route, IndexRoute, Redirect} from "react-router"; import IntlStore from "stores/IntlStore"; // This needs to be initalized here even though IntlStore is never used import Apis from "rpc_api/ApiInstances"; import DashboardContainer from "./components/Dashboard/DashboardContainer"; @@ -18,7 +19,6 @@ import AccountAssetCreate from "./components/Account/AccountAssetCreate"; import AccountAssetUpdate from "./components/Account/AccountAssetUpdate"; import AccountMembership from "./components/Account/AccountMembership"; import AccountDepositWithdraw from "./components/Account/AccountDepositWithdraw"; -import AccountPayees from "./components/Account/AccountPayees"; import AccountPermissions from "./components/Account/AccountPermissions"; import AccountVoting from "./components/Account/AccountVoting"; import AccountOrders from "./components/Account/AccountOrders"; @@ -39,7 +39,6 @@ import TransactionConfirm from "./components/Blockchain/TransactionConfirm"; import WalletUnlockModal from "./components/Wallet/WalletUnlockModal" import NotificationSystem from "react-notification-system"; import NotificationStore from "stores/NotificationStore"; -import cookies from "cookies-js"; import iDB from "idb-instance"; import ExistingAccount, {ExistingAccountOptions} from "./components/Wallet/ExistingAccount"; import WalletCreate from "./components/Wallet/WalletCreate"; @@ -50,7 +49,7 @@ import Console from "./components/Console/Console"; import ReactTooltip from "react-tooltip"; import Invoice from "./components/Transfer/Invoice"; import ChainStore from "api/ChainStore"; -import Backup, {BackupCreate, BackupVerify, BackupRestore} from "./components/Wallet/Backup"; +import {BackupCreate, BackupVerify, BackupRestore} from "./components/Wallet/Backup"; import WalletChangePassword from "./components/Wallet/WalletChangePassword" import WalletManagerStore from "stores/WalletManagerStore"; import WalletManager, {WalletOptions, ChangeActiveWallet, WalletDelete} from "./components/Wallet/WalletManager"; @@ -61,17 +60,19 @@ import AccountRefsStore from "stores/AccountRefsStore"; import Help from "./components/Help"; import InitError from "./components/InitError"; import BrowserSupportModal from "./components/Modal/BrowserSupportModal"; +import createBrowserHistory from 'history/lib/createHashHistory'; +import {IntlProvider} from "react-intl"; +import intlData from "./components/Utility/intlData"; +import connectToStores from "alt/utils/connectToStores"; require("./components/Utility/Prototypes"); // Adds a .equals method to Array for use in shouldComponentUpdate require("./assets/stylesheets/app.scss"); require("dl_cli_index").init(window) // Adds some object refs to the global window object -const { Route, RouteHandler, DefaultRoute, Redirect} = Router; +let history = createBrowserHistory({queryKey: false}) class App extends React.Component { - static contextTypes = { router: React.PropTypes.func.isRequired } - constructor() { super(); this.state = {loading: true, synced: false}; @@ -85,15 +86,7 @@ class App extends React.Component { try { NotificationStore.listen(this._onNotificationChange.bind(this)); - // Try to retrieve locale from cookies - let locale; - if (cookies) { - locale = cookies.get("graphene_locale"); - } - // Switch locale if the user has already set a different locale than en - let localePromise = (locale) ? IntlActions.switchLocale(locale) : null; Promise.all([ - localePromise, // Non API AccountStore.loadDbData() ]).then(() => { AccountStore.tryToSetCurrentAccount(); @@ -112,7 +105,8 @@ class App extends React.Component { } catch(e) { console.error(e); } - if (!window.chrome) { + 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(); } } @@ -133,8 +127,7 @@ class App extends React.Component { // } render() { - - if (this.context.router.getCurrentPath() === "/init-error") { // temporary, until we implement right offline mode + if (this.props.location.pathname === "/init-error") { // temporary, until we implement right offline mode return (