diff --git a/app/api/ApplicationApi.js b/app/api/ApplicationApi.js index ab8af4bc8c..570670a325 100644 --- a/app/api/ApplicationApi.js +++ b/app/api/ApplicationApi.js @@ -169,8 +169,8 @@ const ApplicationApi = { memo ) : Buffer.isBuffer(memo) - ? memo.toString("utf-8") - : memo + ? memo.toString("utf-8") + : memo }; } } @@ -391,8 +391,8 @@ const ApplicationApi = { memo ) : Buffer.isBuffer(memo) - ? memo.toString("utf-8") - : memo + ? memo.toString("utf-8") + : memo }; } @@ -688,8 +688,8 @@ const ApplicationApi = { memo ) : Buffer.isBuffer(memo) - ? memo.toString("utf-8") - : memo + ? memo.toString("utf-8") + : memo }; } } diff --git a/app/assets/locales/locale-en.json b/app/assets/locales/locale-en.json index 70204ed660..ec50c8011d 100644 --- a/app/assets/locales/locale-en.json +++ b/app/assets/locales/locale-en.json @@ -1516,7 +1516,7 @@ "transfer": "{from} sent {amount} to {to}", "transfer_account": "{account} ownership transferred to {to}", "unlisted_by": "{lister} unlisted the account {listee}", - "update_account": "{account} updated their account data", + "update_account": "{account} updated their account data {change}", "vesting_balance_withdraw": "{account} withdrew vesting balance of {amount}", "whitelisted_by": "{lister} whitelisted the account {listee}", "witness_create": "{account} was upgraded to become a witness", @@ -1551,14 +1551,24 @@ "asset_settle": "Request a settlement of {amount} for {account}", "asset_update": "Update the asset {asset} using the account {account}", "call_order_update": "Change {account} {debtSymbol} debt by {debt} and collateral by {collateral}", + "changes_to_active": "Changes to active", + "changes_to_owner": "Changes to owner", + "changes_to_memo": "Changes to memo", "committee_member_update_global_parameters": "Update committee global parameters by {account}", "delete": "Permanently reject", + "danger_operation": "Dangerous operation", + "set_threshold": "Set threshold to %(threshold)s", + "add": "Add", + "remove": "Remove", + "add_vote": "Add vote for", + "remove_vote": "Remove vote for", "expires": "Expires", "feed_producer": "Update the feed producers for the asset {asset} using the account {account}", "limit_order_buy": "Place an order to buy {amount} at {price} for {account}", "limit_order_create": "Place an order to buy %(buy_amount)s for %(sell_amount)s for %(account)s", "limit_order_sell": "Place an order to sell {amount} at {price} for {account}", "override_transfer": "Transfer {amount} from {from} to {to} by authority of {issuer}", + "permission_changes": "Permission changes", "proposals": "Proposals", "reject": "Reject", "status": "Status", @@ -1571,7 +1581,7 @@ "owner_approvals_to_add": "Owner approvals to add", "owner_approvals_to_remove": "Owner approvals to remove" }, - "update_account": "Update account data for {account}", + "update_account": "Update account data for {account} {change}", "updated": { "active_approvals_to_add": "Active approval(s) added", "active_approvals_to_remove": "Active approval(s) removed", @@ -1580,7 +1590,8 @@ "owner_approvals_to_add": "Owner approval(s) added", "owner_approvals_to_remove": "Owner approval(s) removed" }, - "vesting_balance_withdraw": "Withdraw {amount} from vesting balance of {account}" + "vesting_balance_withdraw": "Withdraw {amount} from vesting balance of {account}", + "votes": "Votes" }, "proposal_create": { "expiration_time": "Expiration time", diff --git a/app/components/Account/AccountPortfolioList.jsx b/app/components/Account/AccountPortfolioList.jsx index 53401c350f..cf39177458 100644 --- a/app/components/Account/AccountPortfolioList.jsx +++ b/app/components/Account/AccountPortfolioList.jsx @@ -334,8 +334,8 @@ class AccountPortfolioList extends React.Component { [action === "bridge_modal" ? "bridgeAsset" : action === "deposit_modal" - ? "depositAsset" - : "withdrawAsset"]: asset, + ? "depositAsset" + : "withdrawAsset"]: asset, fiatModal }, () => { diff --git a/app/components/Account/Proposals.jsx b/app/components/Account/Proposals.jsx index 531d743420..92ad853556 100644 --- a/app/components/Account/Proposals.jsx +++ b/app/components/Account/Proposals.jsx @@ -153,14 +153,14 @@ class Proposals extends Component { touchedAccounts.push(proposer); - if (__DEV__) { + /* if (__DEV__) { console.log( "Proposed transactions: ", proposal, " touching accounts ", touchedAccounts ); - } + } */ touchedAccounts.forEach(_account => { if (accountUtils.isKnownScammer(_account)) { @@ -272,6 +272,7 @@ class Proposals extends Component { proposal={true} id={id} proposer={proposer} + collapsed={false} /> ); }) diff --git a/app/components/Account/RecentTransactions.jsx b/app/components/Account/RecentTransactions.jsx index cf544ea18a..7f0b0a1979 100644 --- a/app/components/Account/RecentTransactions.jsx +++ b/app/components/Account/RecentTransactions.jsx @@ -86,7 +86,6 @@ class RecentTransactions extends React.Component { this.useCustom = counterpart.translate( "account.export_modal.use_custom" ); - // https://eswrapper.bitshares.eu/ is not alive // https://wrapper.elasticsearch.bitshares.ws/ is not alive // http://bts-es.clockwork.gr:5000/ is alive diff --git a/app/components/Blockchain/Asset.jsx b/app/components/Blockchain/Asset.jsx index dbb23ed403..7d368c3ad6 100644 --- a/app/components/Blockchain/Asset.jsx +++ b/app/components/Blockchain/Asset.jsx @@ -356,8 +356,8 @@ class Asset extends React.Component { let preferredMarket = description.market ? description.market : core_asset - ? core_asset.get("symbol") - : "BTS"; + ? core_asset.get("symbol") + : "BTS"; if ("bitasset" in asset && asset.bitasset.is_prediction_market) { preferredMarket = ChainStore.getAsset( asset.bitasset.options.short_backing_asset diff --git a/app/components/Blockchain/Operation.jsx b/app/components/Blockchain/Operation.jsx index a61844c80e..5ae8d05202 100644 --- a/app/components/Blockchain/Operation.jsx +++ b/app/components/Blockchain/Operation.jsx @@ -10,32 +10,18 @@ import LinkToAccountById from "../Utility/LinkToAccountById"; import LinkToAssetById from "../Utility/LinkToAssetById"; import BindToChainState from "../Utility/BindToChainState"; import ChainTypes from "../Utility/ChainTypes"; -import TranslateWithLinks from "../Utility/TranslateWithLinks"; import {ChainStore, ChainTypes as grapheneChainTypes} from "bitsharesjs"; -import account_constants from "chain/account_constants"; -import MemoText from "./MemoText"; -import ProposedOperation from "./ProposedOperation"; -import marketUtils from "common/market_utils"; import {connect} from "alt-react"; import SettingsStore from "stores/SettingsStore"; import PropTypes from "prop-types"; import {Tooltip} from "bitshares-ui-style-guide"; -import asset_utils from "../../lib/common/asset_utils"; const {operations} = grapheneChainTypes; +import opComponents from "./operations"; require("./operations.scss"); let ops = Object.keys(operations); -let listings = account_constants.account_listing; - -const ShortObjectId = ({objectId}) => { - if (typeof objectId === "string") { - const parts = objectId.split("."); - const {length} = parts; - if (length > 0) return "#" + parts[length - 1]; - } - return objectId; -}; +// let listings = account_constants.account_listing; class TransactionLabel extends React.Component { shouldComponentUpdate(nextProps) { @@ -72,10 +58,12 @@ class Row extends React.Component { let last_irreversible_block_num = dynGlobalObject.get( "last_irreversible_block_num" ); - if (nextProps.dynGlobalObject === this.props.dynGlobalObject) { - return false; - } - return block > last_irreversible_block_num; + + return ( + nextProps.dynGlobalObject !== this.props.dynGlobalObject || + block > last_irreversible_block_num || + this.props.color !== nextProps.color + ); } render() { @@ -170,9 +158,14 @@ class Row extends React.Component { ); } } + Row = BindToChainState(Row); class Operation extends React.Component { + state = { + labelColor: "info" + }; + static defaultProps = { op: [], current: "", @@ -194,6 +187,17 @@ class Operation extends React.Component { } } + shouldComponentUpdate(nextProps, nextState) { + if (!this.props.op || !nextProps.op) { + return false; + } + return ( + !utils.are_equal_shallow(nextProps.op[1], this.props.op[1]) || + nextProps.marketDirections !== this.props.marketDirections || + this.state.labelColor !== nextState.labelColor + ); + } + linkToAccount(name_or_id) { if (!name_or_id) return -; return utils.is_object_id(name_or_id) ? ( @@ -212,1536 +216,24 @@ class Operation extends React.Component { ); } - shouldComponentUpdate(nextProps) { - if (!this.props.op || !nextProps.op) { - return false; + changeColor = newColor => { + const {labelColor} = this.state; + if (labelColor !== newColor) { + this.setState({labelColor: newColor}); } - return ( - !utils.are_equal_shallow(nextProps.op[1], this.props.op[1]) || - nextProps.marketDirections !== this.props.marketDirections - ); - } + }; render() { - let {op, current, block} = this.props; + let {op, block} = this.props; let line = null, - column = null, - color = "info"; - let memoComponent = null; - - switch ( - ops[op[0]] // For a list of trx types, see chain_types.coffee - ) { - case "transfer": - if (op[1].memo) { - memoComponent = ; - } - - color = "success"; - op[1].amount.amount = parseFloat(op[1].amount.amount); - - column = ( - - - {memoComponent} - - ); - - break; - - case "limit_order_create": - color = "warning"; - let o = op[1]; - /* - marketName = OPEN.ETH_USD - if (!inverted) (default) - price = USD / OPEN.ETH - buy / sell OPEN.ETH - isBid = amount_to_sell.asset_symbol = USD - amount = to_receive - if (inverted) - price = OPEN.ETH / USD - buy / sell USD - isBid = amount_to_sell.asset_symbol = OPEN.ETH - amount = - */ - column = ( - - - {({base, quote}) => { - const { - marketName, - first, - second - } = marketUtils.getMarketName(base, quote); - const inverted = this.props.marketDirections.get( - marketName - ); - // const paySymbol = base.get("symbol"); - // const receiveSymbol = quote.get("symbol"); - - const isBid = - o.amount_to_sell.asset_id === - (inverted - ? first.get("id") - : second.get("id")); - - let priceBase = isBid - ? o.amount_to_sell - : o.min_to_receive; - let priceQuote = isBid - ? o.min_to_receive - : o.amount_to_sell; - const amount = isBid - ? op[1].min_to_receive - : op[1].amount_to_sell; - let orderId = this.props.result - ? typeof this.props.result[1] == "string" - ? "#" + - this.props.result[1].substring(4) - : "" - : ""; - - return ( - - ); - }} - - - ); - break; - - case "limit_order_cancel": - color = "cancel"; - column = ( - - - - ); - break; - - case "call_order_update": - color = "warning"; - - column = ( - - - - ); - break; - - case "key_create": - column = ( - - - - ); - break; - - case "account_create": - column = ( - - ); - break; - - case "account_update": - column = ( - - - - ); - - break; - - case "account_whitelist": - let label = - op[1].new_listing === listings.no_listing - ? "unlisted_by" - : op[1].new_listing === listings.white_listed - ? "whitelisted_by" - : "blacklisted_by"; - column = ( - - - - ); - break; - - case "account_upgrade": - column = ( - - - - ); - break; - - case "account_transfer": - column = ( - - - - ); - break; - - case "asset_create": - color = "warning"; - column = ( - - - - ); - break; - - case "asset_update": - case "asset_update_bitasset": - color = "warning"; - column = ( - - - - ); - break; - - case "asset_update_feed_producers": - color = "warning"; - - column = ( - - - - ); - break; - - case "asset_issue": - color = "warning"; - - if (op[1].memo) { - memoComponent = ; - } - - op[1].asset_to_issue.amount = parseInt( - op[1].asset_to_issue.amount, - 10 - ); - column = ( - - - {memoComponent} - - ); - break; - - case "asset_fund_fee_pool": - color = "warning"; - - column = ( - - - - ); - break; - - case "asset_settle": - color = "warning"; - const baseAmount = op[1].amount; - const instantSettleCode = 2; - if ( - this.props.result && - this.props.result[0] == instantSettleCode - ) { - const quoteAmount = this.props.result[1]; - column = ( - - - - ); - } else { - column = ( - - - - ); - } - - break; - - case "asset_global_settle": - color = "warning"; - column = ( - - - - ); - break; - - case "asset_publish_feed": - color = "warning"; - column = ( - - - - ); - break; - - case "witness_create": - column = ( - - - - ); - - break; - - case "witness_update": - column = ( - - - - ); - - break; + column = null; - case "witness_withdraw_pay": - console.log("witness_withdraw_pay:", op[1].witness_account); - if (current === op[1].witness_account) { - column = ( - - -   - - -   - {this.linkToAccount(op[1].witness_account)} - - ); - } else { - column = ( - - -   - - -   - {this.linkToAccount(op[1].witness_account)} - - ); - } - break; - - case "proposal_create": - column = ( -
- - - ) : ( - "" - ), - arg: "proposal" - } - ]} - /> - : - -
- {op[1].proposed_ops.map((o, index) => { - return ( - - ); - })} -
-
- ); - break; - - case "proposal_update": - const fields = [ - "active_approvals_to_add", - "active_approvals_to_remove", - "owner_approvals_to_add", - "owner_approvals_to_remove", - "key_approvals_to_add", - "key_approvals_to_remove" - ]; - column = ( -
- - - ), - arg: "proposal" - } - ]} - /> - -
- {fields.map(field => { - if (op[1][field].length) { - return ( -
- -
    - {op[1][field].map(value => { - return ( -
  • - {field.startsWith( - "key" - ) - ? value - : this.linkToAccount( - value - )} -
  • - ); - })} -
-
- ); - } else return null; - })} -
-
- ); - break; - - case "proposal_delete": - column = ( - - - ), - arg: "proposal" - } - ]} - /> - - ); - break; - - case "withdraw_permission_create": - column = ( - - -   - {this.linkToAccount(op[1].withdraw_from_account)} - -   - {this.linkToAccount(op[1].authorized_account)} - - ); - break; - - case "withdraw_permission_update": - column = ( - - -   - {this.linkToAccount(op[1].withdraw_from_account)} - -   - {this.linkToAccount(op[1].authorized_account)} - - ); - break; - - case "withdraw_permission_claim": - column = ( - - -   - {this.linkToAccount(op[1].withdraw_from_account)} - -   - {this.linkToAccount(op[1].withdraw_to_account)} - - ); - break; - - case "withdraw_permission_delete": - column = ( - - -   - {this.linkToAccount(op[1].withdraw_from_account)} - -   - {this.linkToAccount(op[1].authorized_account)} - - ); - break; - - case "fill_order": - color = "success"; - o = op[1]; - - /* - marketName = OPEN.ETH_USD - if (!inverted) (default) - price = USD / OPEN.ETH - buy / sell OPEN.ETH - isBid = amount_to_sell.asset_symbol = USD - amount = to_receive - if (inverted) - price = OPEN.ETH / USD - buy / sell USD - isBid = amount_to_sell.asset_symbol = OPEN.ETH - amount = - - const {marketName, first, second} = marketUtils.getMarketName(base, quote); - const inverted = this.props.marketDirections.get(marketName); - // const paySymbol = base.get("symbol"); - // const receiveSymbol = quote.get("symbol"); - - const isBid = o.amount_to_sell.asset_id === (inverted ? first.get("id") : second.get("id")); - - let priceBase = (isBid) ? o.amount_to_sell : o.min_to_receive; - let priceQuote = (isBid) ? o.min_to_receive : o.amount_to_sell; - const amount = isBid ? op[1].min_to_receive : op[1].amount_to_sell; - */ - - column = ( - - - {({base, quote}) => { - const { - marketName, - first, - second - } = marketUtils.getMarketName(base, quote); - const inverted = this.props.marketDirections.get( - marketName - ); - const isBid = - o.pays.asset_id === - (inverted - ? first.get("id") - : second.get("id")); - - // const paySymbol = base.get("symbol"); - // const receiveSymbol = quote.get("symbol"); - let priceBase = isBid ? o.receives : o.pays; - let priceQuote = isBid ? o.pays : o.receives; - let amount = isBid ? o.receives : o.pays; - let receivedAmount = - o.fee.asset_id === amount.asset_id - ? amount.amount - o.fee.amount - : amount.amount; - - return ( - - ); - }} - - - ); - break; - - case "global_parameters_update": - column = ( - - - - ); - break; - - case "vesting_balance_create": - column = ( - -   - {this.linkToAccount(op[1].creator)} - -   - -   - {this.linkToAccount(op[1].owner)} - - ); - break; - - case "vesting_balance_withdraw": - column = ( - - - - ); - break; - - case "worker_create": - column = ( - - - - ); - break; - - case "balance_claim": - color = "success"; - op[1].total_claimed.amount = parseInt( - op[1].total_claimed.amount, - 10 - ); - column = ( - - - - ); - break; - - case "committee_member_create": - column = ( - - -   - {this.linkToAccount(op[1].committee_member_account)} - - ); - break; - - case "transfer_to_blind": - column = ( - - {this.linkToAccount(op[1].from)} -   - -   - - - ); - break; - - case "transfer_from_blind": - column = ( - - {this.linkToAccount(op[1].to)} -   - -   - - - ); - break; - - case "asset_claim_fees": - color = "success"; - op[1].amount_to_claim.amount = parseInt( - op[1].amount_to_claim.amount, - 10 - ); - column = ( - - {this.linkToAccount(op[1].issuer)} -   - - {({asset}) => ( - - )} - - - ); - break; - - case "custom": - column = ( - - - - ); - break; - - case "asset_reserve": - column = ( - - - - ); - break; - - case "committee_member_update_global_parameters": - console.log( - "committee_member_update_global_parameters op:", - op - ); - column = ( - - - - ); - break; - - case "override_transfer": - column = ( - - ); - break; - - case "asset_settle_cancel": - column = ( - - ); - break; - - case "asset_claim_pool": - column = ( - - ); - break; - - case "asset_update_issuer": - column = ( - - ); - break; - - case "bid_collateral": - column = ( - - ); - break; - // - case "htlc_create": - const globalObject = ChainStore.getObject("2.0.0"); - const dynGlobalObject = ChainStore.getObject("2.1.0"); - let block_time = utils.calc_block_time( - block, - globalObject, - dynGlobalObject - ); - let estimated = false; - if (!block_time) { - block_time = utils.calc_block_time( - block, - globalObject, - dynGlobalObject, - true - ); - estimated = true; - } - - op[1].amount.amount = parseFloat(op[1].amount.amount); - - let expiryTime = new Date(); - - expiryTime.setTime( - block_time.getTime() + op[1].claim_period_seconds * 1000 - ); - - column = ( - - - - - {estimated ? "*" : ""} - - -
- - - {counterpart.translate( - "htlc.preimage_hash" - ) + - " (" + - op[1].preimage_size + - ", " + - op[1].preimage_hash[0] + - "): " + - op[1].preimage_hash[1]} - - -
-
- ); - break; - case "htlc_redeem": - color = "success"; - column = ( - - - - -
- - - {counterpart.translate("htlc.preimage") + - ": " + - op[1].preimage} - - -
-
- ); - break; - case "htlc_extend": - column = ( - - - - ); - break; - case "htlc_redeemed": - column = ( - - - - ); - break; - case "htlc_refund": - color = "warning"; - column = ( - - - - ); - - break; - default: - console.log("unimplemented op '" + ops[op[0]] + "':", op); - column = ( - - #{block} - - ); - } + column = opComponents(ops[op[0]], this.props, { + fromComponent: "operation", + linkToAccount: this.linkToAccount, + linkToAsset: this.linkToAsset, + changeColor: this.changeColor + }); if (this.props.csvExportMode) { const globalObject = ChainStore.getObject("2.0.0"); @@ -1773,7 +265,7 @@ class Operation extends React.Component { includeOperationId={this.props.includeOperationId} block={block} type={op[0]} - color={color} + color={this.state.labelColor} fee={op[1].fee} hideOpLabel={this.props.hideOpLabel} hideDate={this.props.hideDate} diff --git a/app/components/Blockchain/OperationAnt.js b/app/components/Blockchain/OperationAnt.js index b4b5d2ee6c..3e1e24a1eb 100644 --- a/app/components/Blockchain/OperationAnt.js +++ b/app/components/Blockchain/OperationAnt.js @@ -290,8 +290,8 @@ class Operation { op[1].new_listing === listings.no_listing ? "unlisted_by" : op[1].new_listing === listings.white_listed - ? "whitelisted_by" - : "blacklisted_by"; + ? "whitelisted_by" + : "blacklisted_by"; column = ( { const endDate = counterpart.localize(new Date(expiration), { @@ -88,6 +84,10 @@ class Row extends React.Component { } class ProposedOperation extends React.Component { + state = { + label_color: "info" + }; + static defaultProps = { op: [], current: "", @@ -95,7 +95,8 @@ class ProposedOperation extends React.Component { hideDate: false, hideFee: false, hideOpLabel: false, - csvExportMode: false + csvExportMode: false, + collapsed: true }; static propTypes = { @@ -104,13 +105,10 @@ class ProposedOperation extends React.Component { block: PropTypes.number, hideDate: PropTypes.bool, hideFee: PropTypes.bool, - csvExportMode: PropTypes.bool + csvExportMode: PropTypes.bool, + collapsed: PropTypes.bool }; - // shouldComponentUpdate(nextProps) { - // return utils.are_equal_shallow(nextProps.op, this.props.op); - // } - linkToAccount(name_or_id) { if (!name_or_id) return -; return utils.is_object_id(name_or_id) ? ( @@ -129,1085 +127,34 @@ class ProposedOperation extends React.Component { ); } - render() { - let {op, proposer, current, block, hideExpiration, index} = this.props; - let line = null, - column = null, - color = "info"; - - switch ( - ops[op[0]] // For a list of trx types, see chain_types.coffee - ) { - case "transfer": - let memoComponent = null; - - if (op[1].memo) { - memoComponent = ; - } - - color = "success"; - op[1].amount.amount = parseFloat(op[1].amount.amount); - - column = ( - - - {memoComponent} - - ); - - break; - - case "limit_order_create": - color = "warning"; - - let isAsk = market_utils.isAskOp(op[1]); - - column = ( - - - - ); - break; - - case "limit_order_cancel": - color = "cancel"; - column = ( - - {this.linkToAccount(op[1].fee_paying_account)} -   - -  # - {op[1].order.substring(4)} - - ); - break; - - case "short_order_cancel": - color = "cancel"; - column = ( - - -   - {op[1].order} - - ); - break; - - case "call_order_update": - color = "warning"; - column = ( - - - - ); - break; - - case "key_create": - column = ( - - - - ); - break; - - case "account_create": - if (current === op[1].registrar) { - column = ( - - -   - {this.linkToAccount(op[1].name)} - - ); - } else { - column = ( - - {this.linkToAccount(op[1].name)} -   - -   - {this.linkToAccount(op[1].registrar)} - - ); - } - break; - - case "account_update": - column = ( - - - - ); - - break; - - case "account_whitelist": - let label = - op[1].new_listing === listings.no_listing - ? "unlisted_by" - : op[1].new_listing === listings.white_listed - ? "whitelisted_by" - : "blacklisted_by"; - column = ( - - - {({lister, listee}) => ( - - )} - - - ); - // if (current === op[1].authorizing_account) { - // column = ( - // - // - //  {this.linkToAccount(op[1].account_to_list)} - // - // ); - // } else { - // column = ( - // - // - //  {this.linkToAccount(op[1].authorizing_account)} - // - // ); - // } - break; - - case "account_upgrade": - if (op[1].upgrade_to_lifetime_member) { - column = ( - - {this.linkToAccount(op[1].account_to_upgrade)}{" "} -   - - - ); - } else { - column = ( - - {this.linkToAccount(op[1].account_to_upgrade)}{" "} -   - - - ); - } - break; - - case "account_transfer": - column = ( - - -   - {this.linkToAccount(op[1].account_id)} - -   - {this.linkToAccount(op[1].new_owner)} - - ); - break; - - case "asset_create": - color = "warning"; - column = ( - - ); - break; - - case "asset_update": - case "asset_update_bitasset": - color = "warning"; - column = ( - - ); - break; - - case "asset_update_feed_producers": - color = "warning"; - column = ( - - ); - break; - - case "asset_issue": - color = "warning"; - - if (op[1].memo) { - memoComponent = ; - } - - op[1].asset_to_issue.amount = parseInt( - op[1].asset_to_issue.amount, - 10 - ); - column = ( - - - {memoComponent} - - ); - break; - - case "asset_reserve": - column = ( - - - - ); - break; - - case "asset_fund_fee_pool": - color = "warning"; - let asset = ChainStore.getAsset(op[1].asset_id); - if (asset) asset = asset.get("symbol"); - else asset = op[1].asset_id; - column = ( - - {this.linkToAccount(op[1].from_account)}   - -   - - - ); - break; - - case "asset_settle": - color = "warning"; - column = ( - - - - ); - break; - - case "asset_global_settle": - color = "warning"; - column = ( - - -   - {this.linkToAsset(op[1].asset_to_settle)} -   - -   - - - ); - break; - - case "asset_publish_feed": - color = "warning"; - column = ( - - {this.linkToAccount(op[1].publisher)} -   - -   - - - ); - break; - - case "witness_create": - column = ( - - -   - {this.linkToAccount(op[1].witness_account)} - - ); - - break; - - case "witness_update": - column = ( - - -   - {this.linkToAccount(op[1].witness_account)} - - ); - - break; - - case "witness_withdraw_pay": - if (current === op[1].witness_account) { - column = ( - - -   - - -   - {this.linkToAccount(op[1].witness_account)} - - ); - } else { - column = ( - - -   - - -   - {this.linkToAccount(op[1].witness_account)} - - ); - } - break; - - case "proposal_create": - column = ( - - - - ); - break; - - case "proposal_update": - column = ( - - - - ); - break; - - case "proposal_delete": - column = ( - - - - ); - break; - - case "withdraw_permission_create": - column = ( - - -   - {this.linkToAccount(op[1].withdraw_from_account)} - -   - {this.linkToAccount(op[1].authorized_account)} - - ); - break; - - case "withdraw_permission_update": - column = ( - - -   - {this.linkToAccount(op[1].withdraw_from_account)} - -   - {this.linkToAccount(op[1].authorized_account)} - - ); - break; - - case "withdraw_permission_claim": - column = ( - - -   - {this.linkToAccount(op[1].withdraw_from_account)} - -   - {this.linkToAccount(op[1].withdraw_to_account)} - - ); - break; - - case "withdraw_permission_delete": - column = ( - - -   - {this.linkToAccount(op[1].withdraw_from_account)} - -   - {this.linkToAccount(op[1].authorized_account)} - - ); - break; - - case "fill_order": - color = "success"; - o = op[1]; - column = ( - - {this.linkToAccount(op[1].account_id)} -   - -   - -   - -   - -   - -   - - - ); - break; - - case "global_parameters_update": - column = ( - - - - ); - break; - - case "file_write": - column = ( - - - - ); - break; - - case "vesting_balance_create": - column = ( - -   - {this.linkToAccount(op[1].creator)} - -   - -   - {this.linkToAccount(op[1].owner)} - - ); - break; - - case "vesting_balance_withdraw": - column = ( - - ); - break; - - case "bond_create_offer": - column = ( - - -   - - - ); - break; - - case "bond_cancel_offer": - column = ( - - -   - {op[1].offer_id} - - ); - break; - - case "bond_accept_offer": - if (current === op[1].lender) { - column = ( - - -   - - -   - {this.linkToAccount(op[1].borrower)} - - ); - } else if (current === op[1].borrower) { - column = ( - - -   - - -   - {this.linkToAccount(op[1].lender)} - - ); - } - break; - - case "bond_claim_collateral": - if (current === op[1].lender) { - column = ( - - -   - - -   - {this.linkToAccount(op[1].claimer)} - - ); - } else if (current === op[1].claimer) { - column = ( - - -   - - -   - {this.linkToAccount(op[1].lender)} - - ); - } - break; - - case "worker_create": - column = ( - - -   - - - ); - break; - - case "balance_claim": - color = "success"; - op[1].total_claimed.amount = parseInt( - op[1].total_claimed.amount, - 10 - ); - column = ( - - {this.linkToAccount(op[1].deposit_to_account)} -   - - {({asset}) => ( - - )} - - - ); - break; - - case "committee_member_create": - column = ( - - -   - {this.linkToAccount(op[1].committee_member_account)} - - ); - break; - - case "transfer_to_blind": - column = ( - - {this.linkToAccount(op[1].from)} -   - -   - - - ); - break; - - case "transfer_from_blind": - column = ( - - {this.linkToAccount(op[1].to)} -   - -   - - - ); - break; - - case "asset_claim_fees": - color = "success"; - op[1].amount_to_claim.amount = parseInt( - op[1].amount_to_claim.amount, - 10 - ); - column = ( - - {this.linkToAccount(op[1].issuer)} -   - - {({asset}) => ( - - )} - - - ); - break; - - case "committee_member_update_global_parameters": - column = ( - - - - ); - break; + changeColor = newColor => { + const {label_color} = this.state; + if (label_color !== newColor) { + this.setState({label_color: newColor}); + } + }; - case "custom": - column = ( - - - - ); - break; + // TODO: add scu - case "override_transfer": - column = ( - - ); - break; + render() { + let { + op, + proposer, + block, + hideExpiration, + index, + csvExportMode + } = this.props; + const {label_color} = this.state; + let line = null, + column = null; - default: - console.log("unimplemented op:", op); - column = ( - - #{block} - - ); - } + column = opComponents(ops[op[0]], this.props, { + fromComponent: "proposed_operation", + linkToAccount: this.linkToAccount, + linkToAsset: this.linkToAsset, + changeColor: this.changeColor + }); if (!!proposer && index == 0) { column = ( @@ -1225,12 +172,12 @@ class ProposedOperation extends React.Component { /> : -
{column}
+
{column}
); } - if (this.props.csvExportMode) { + if (csvExportMode) { const globalObject = ChainStore.getObject("2.0.0"); const dynGlobalObject = ChainStore.getObject("2.1.0"); const block_time = utils.calc_block_time( @@ -1255,11 +202,11 @@ class ProposedOperation extends React.Component { line = column ? ( ); }); diff --git a/app/components/Blockchain/operations/AccountCreate.jsx b/app/components/Blockchain/operations/AccountCreate.jsx new file mode 100644 index 0000000000..a9bdf60b20 --- /dev/null +++ b/app/components/Blockchain/operations/AccountCreate.jsx @@ -0,0 +1,51 @@ +import React from "react"; +import Translate from "react-translate-component"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const AccountCreate = ({op, current, linkToAccount, fromComponent}) => { + if (fromComponent === "proposed_operation") { + if (current === op[1].registrar) { + return ( + + +   + {linkToAccount(op[1].name)} + + ); + } else { + return ( + + {linkToAccount(op[1].name)} +   + +   + {linkToAccount(op[1].registrar)} + + ); + } + } else { + return ( + + ); + } +}; diff --git a/app/components/Blockchain/operations/AccountTransfer.jsx b/app/components/Blockchain/operations/AccountTransfer.jsx new file mode 100644 index 0000000000..5687eaa66e --- /dev/null +++ b/app/components/Blockchain/operations/AccountTransfer.jsx @@ -0,0 +1,41 @@ +import React from "react"; +import Translate from "react-translate-component"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const AccountTransfer = ({op, linkToAccount, fromComponent}) => { + if (fromComponent === "proposed_operation") { + return ( + + +   + {linkToAccount(op[1].account_id)} + +   + {linkToAccount(op[1].new_owner)} + + ); + } else { + return ( + + + + ); + } +}; diff --git a/app/components/Blockchain/operations/AccountUpdate.jsx b/app/components/Blockchain/operations/AccountUpdate.jsx new file mode 100644 index 0000000000..75d3a47737 --- /dev/null +++ b/app/components/Blockchain/operations/AccountUpdate.jsx @@ -0,0 +1,183 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; +import {ChainStore} from "bitsharesjs"; + +const compareKeys = (prev, next) => { + let minus = prev.filter(x => !next.includes(x)); + let plus = next.filter(x => !prev.includes(x)); + + return {minus, plus}; +}; + +const getVotesName = item => { + if (item.id.startsWith("1.14")) { + // worker + let worker_account = ChainStore.getAccountName(item.worker_account); + return ( + "Worker " + + item.name + + (worker_account + ? " of " + worker_account + : " account " + item.worker_account) + ); + } else if (item.id.startsWith("1.6.")) { + let witness_account = ChainStore.getAccountName(item.witness_account); + return ( + "Witness " + + (witness_account + ? witness_account + : " account " + item.witness_account) + ); + } else { + let committee_member_account = ChainStore.getAccountName( + item.committee_member_account + ); + return ( + "Committee " + + (committee_member_account + ? committee_member_account + : " account " + item.committee_member_account) + ); + } +}; + +export const AccountUpdate = ({op, fromComponent, collapsed}) => { + const account = op[1].account; + + const votes = op[1].new_options ? op[1].new_options.votes : undefined; + const memo_key = op[1].new_options ? op[1].new_options.memo_key : undefined; + + const owner = op[1].owner ? op[1].owner : undefined; + const active = op[1].active ? op[1].active : undefined; + + let change = {}; + let votesPlusNames = []; + let votesMinusNames = []; + + if (collapsed == undefined) { + collapsed = true; + } + + if (fromComponent === "proposed_operation" && !collapsed) { + const _account = ChainStore.getAccount(account, false); + const _votes = _account + .get("options") + .get("votes") + .toArray(); + + if (votes) { + const votesIds = compareKeys(_votes, votes); + const votesPlusData = ChainStore.getObjectsByVoteIds(votesIds.plus); + const votesMinusData = ChainStore.getObjectsByVoteIds( + votesIds.minus + ); + + if (votesPlusData && votesMinusData) { + votesPlusData.forEach(item => { + if (item) { + const name = getVotesName(item.toJS()); + if (name) votesPlusNames.push(name); + } + }); + votesMinusData.forEach(item => { + if (item) { + const name = getVotesName(item.toJS()); + if (name) votesMinusNames.push(name); + } + }); + change.votes = {minus: votesMinusNames, plus: votesPlusNames}; + } + } + + if (owner) { + change.owner = {}; + const _owner_keys = _account + .get("owner") + .get("key_auths") + .map(a => a.get(0)) + .toArray(); + change.owner.keys = compareKeys( + _owner_keys, + owner.key_auths.map(x => x[0]) + ); + const _owner_accounts = _account + .get("owner") + .get("account_auths") + .map(a => a.get(0)) + .toArray(); + change.owner.accounts = compareKeys( + _owner_accounts, + owner.account_auths.map(x => x[0]) + ); + if ( + _account.get("owner").get("weight_threshold") !== + owner.weight_threshold + ) { + change.owner.weight_threshold = owner.weight_threshold; + } + } + if (active) { + change.active = {}; + const _active_keys = _account + .get("active") + .get("key_auths") + .map(a => a.get(0)) + .toArray(); + change.active.keys = compareKeys( + _active_keys, + active.key_auths.map(x => x[0]) + ); + const _active_accounts = _account + .get("active") + .get("account_auths") + .map(a => a.get(0)) + .toArray(); + change.active.accounts = compareKeys( + _active_accounts, + active.account_auths.map(x => x[0]) + ); + if ( + _account.get("active").get("weight_threshold") !== + active.weight_threshold + ) { + change.active.weight_threshold = owner.weight_threshold; + } + } + + if (memo_key) { + change.memo = {}; + const _memo = _account.get("options").get("memo_key"); + change.memo.keys = compareKeys([_memo], [memo_key]); + if ( + change.memo.keys.minus.length == 0 && + change.memo.keys.plus.length == 0 + ) { + change.memo = undefined; + } + } + } + + return ( + + + + ); +}; diff --git a/app/components/Blockchain/operations/AccountUpgrade.jsx b/app/components/Blockchain/operations/AccountUpgrade.jsx new file mode 100644 index 0000000000..fe7c19c4d2 --- /dev/null +++ b/app/components/Blockchain/operations/AccountUpgrade.jsx @@ -0,0 +1,48 @@ +import React from "react"; +import Translate from "react-translate-component"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const AccountUpgrade = ({op, linkToAccount, fromComponent}) => { + if (fromComponent === "proposed_operation") { + if (op[1].upgrade_to_lifetime_member) { + return ( + + {linkToAccount(op[1].account_to_upgrade)}   + + + ); + } else { + return ( + + {linkToAccount(op[1].account_to_upgrade)}   + + + ); + } + } else { + return ( + + + + ); + } +}; diff --git a/app/components/Blockchain/operations/AccountWhitelist.jsx b/app/components/Blockchain/operations/AccountWhitelist.jsx new file mode 100644 index 0000000000..056b5f59c4 --- /dev/null +++ b/app/components/Blockchain/operations/AccountWhitelist.jsx @@ -0,0 +1,52 @@ +import React from "react"; +import Translate from "react-translate-component"; +import BindToChainState from "../../Utility/BindToChainState"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const AccountWhitelist = ({op, fromComponent}) => { + let label = + op[1].new_listing === listings.no_listing + ? "unlisted_by" + : op[1].new_listing === listings.white_listed + ? "whitelisted_by" + : "blacklisted_by"; + if (fromComponent === "proposed_operation") { + return ( + + + {({lister, listee}) => ( + + )} + + + ); + } else { + return ( + + + + ); + } +}; diff --git a/app/components/Blockchain/operations/AssetClaimFees.jsx b/app/components/Blockchain/operations/AssetClaimFees.jsx new file mode 100644 index 0000000000..6401c22d1e --- /dev/null +++ b/app/components/Blockchain/operations/AssetClaimFees.jsx @@ -0,0 +1,34 @@ +import React from "react"; +import BindToChainState from "../../Utility/BindToChainState"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const AssetClaimFees = ({op, changeColor, linkToAccount}) => { + changeColor("success"); + op[1].amount_to_claim.amount = parseInt(op[1].amount_to_claim.amount, 10); + + return ( + + {linkToAccount(op[1].issuer)} +   + + {({asset}) => ( + + )} + + + ); +}; diff --git a/app/components/Blockchain/operations/AssetClaimPool.jsx b/app/components/Blockchain/operations/AssetClaimPool.jsx new file mode 100644 index 0000000000..f843f177d8 --- /dev/null +++ b/app/components/Blockchain/operations/AssetClaimPool.jsx @@ -0,0 +1,27 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const AssetClaimPool = ({op}) => { + return ( + + ); +}; diff --git a/app/components/Blockchain/operations/AssetCreate.jsx b/app/components/Blockchain/operations/AssetCreate.jsx new file mode 100644 index 0000000000..5076a9f1d1 --- /dev/null +++ b/app/components/Blockchain/operations/AssetCreate.jsx @@ -0,0 +1,43 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const AssetCreate = ({op, changeColor, fromComponent}) => { + changeColor("warning"); + if (fromComponent === "proposed_operation") { + return ( + + ); + } else { + return ( + + + + ); + } +}; diff --git a/app/components/Blockchain/operations/AssetFundFeePool.jsx b/app/components/Blockchain/operations/AssetFundFeePool.jsx new file mode 100644 index 0000000000..c50fd2e20c --- /dev/null +++ b/app/components/Blockchain/operations/AssetFundFeePool.jsx @@ -0,0 +1,63 @@ +import React from "react"; +import Translate from "react-translate-component"; +import {ChainStore} from "bitsharesjs"; +import FormattedAsset from "../../Utility/FormattedAsset"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const AssetFundFeePool = ({ + op, + changeColor, + linkToAccount, + fromComponent +}) => { + changeColor("warning"); + if (fromComponent === "proposed_operation") { + let asset = ChainStore.getAsset(op[1].asset_id); + if (asset) asset = asset.get("symbol"); + else asset = op[1].asset_id; + return ( + + {linkToAccount(op[1].from_account)}   + +   + + + ); + } else { + return ( + + + + ); + } +}; diff --git a/app/components/Blockchain/operations/AssetGlobalSettle.jsx b/app/components/Blockchain/operations/AssetGlobalSettle.jsx new file mode 100644 index 0000000000..826835db0d --- /dev/null +++ b/app/components/Blockchain/operations/AssetGlobalSettle.jsx @@ -0,0 +1,60 @@ +import React from "react"; +import Translate from "react-translate-component"; +import FormattedPrice from "../../Utility/FormattedPrice"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const AssetGlobalSettle = ({ + op, + changeColor, + linkToAsset, + fromComponent +}) => { + changeColor("warning"); + if (fromComponent === "proposed_operation") { + return ( + + +   + {linkToAsset(op[1].asset_to_settle)} +   + +   + + + ); + } else { + return ( + + + + ); + } +}; diff --git a/app/components/Blockchain/operations/AssetIssue.jsx b/app/components/Blockchain/operations/AssetIssue.jsx new file mode 100644 index 0000000000..33301b100c --- /dev/null +++ b/app/components/Blockchain/operations/AssetIssue.jsx @@ -0,0 +1,42 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; +import MemoText from "../MemoText"; + +export const AssetIssue = ({op, changeColor, fromComponent}) => { + changeColor("warning"); + let memoComponent; + if (op[1].memo) { + memoComponent = ; + } + op[1].asset_to_issue.amount = parseInt(op[1].asset_to_issue.amount, 10); + + return ( + + + {memoComponent} + + ); +}; diff --git a/app/components/Blockchain/operations/AssetPublishFeed.jsx b/app/components/Blockchain/operations/AssetPublishFeed.jsx new file mode 100644 index 0000000000..b8e02cd030 --- /dev/null +++ b/app/components/Blockchain/operations/AssetPublishFeed.jsx @@ -0,0 +1,49 @@ +import React from "react"; +import Translate from "react-translate-component"; +import FormattedPrice from "../../Utility/FormattedPrice"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const AssetPublishFeed = ({ + op, + changeColor, + linkToAccount, + fromComponent +}) => { + changeColor("warning"); + if (fromComponent === "proposed_operation") { + return ( + + {linkToAccount(op[1].publisher)} +   + +   + + + ); + } else { + return ( + + + + ); + } +}; diff --git a/app/components/Blockchain/operations/AssetReserve.jsx b/app/components/Blockchain/operations/AssetReserve.jsx new file mode 100644 index 0000000000..32a6e9e445 --- /dev/null +++ b/app/components/Blockchain/operations/AssetReserve.jsx @@ -0,0 +1,28 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const AssetReserve = ({op, fromComponent}) => { + return ( + + + + ); +}; diff --git a/app/components/Blockchain/operations/AssetSettle.jsx b/app/components/Blockchain/operations/AssetSettle.jsx new file mode 100644 index 0000000000..f7fd17ddd5 --- /dev/null +++ b/app/components/Blockchain/operations/AssetSettle.jsx @@ -0,0 +1,80 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const AssetSettle = ({op, result, changeColor, fromComponent}) => { + changeColor("warning"); + if (fromComponent === "proposed_operation") { + return ( + + + + ); + } else { + const baseAmount = op[1].amount; + const instantSettleCode = 2; + if (result && result[0] == instantSettleCode) { + const quoteAmount = result[1]; + return ( + + + + ); + } else { + return ( + + + + ); + } + } +}; diff --git a/app/components/Blockchain/operations/AssetSettleCancel.jsx b/app/components/Blockchain/operations/AssetSettleCancel.jsx new file mode 100644 index 0000000000..6ccbf09e7a --- /dev/null +++ b/app/components/Blockchain/operations/AssetSettleCancel.jsx @@ -0,0 +1,18 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const AssetSettleCancel = ({op}) => { + return ( + + ); +}; diff --git a/app/components/Blockchain/operations/AssetUpdate.jsx b/app/components/Blockchain/operations/AssetUpdate.jsx new file mode 100644 index 0000000000..37516aac4c --- /dev/null +++ b/app/components/Blockchain/operations/AssetUpdate.jsx @@ -0,0 +1,28 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const AssetUpdate = ({op, changeColor, fromComponent}) => { + changeColor("warning"); + + return ( + + ); +}; diff --git a/app/components/Blockchain/operations/AssetUpdateFeedProducers.jsx b/app/components/Blockchain/operations/AssetUpdateFeedProducers.jsx new file mode 100644 index 0000000000..1dba011b7b --- /dev/null +++ b/app/components/Blockchain/operations/AssetUpdateFeedProducers.jsx @@ -0,0 +1,46 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const AssetUpdateFeedProducers = ({op, changeColor, fromComponent}) => { + changeColor("warning"); + + if (fromComponent === "proposed_operation") { + return ( + + ); + } else { + return ( + + + + ); + } +}; diff --git a/app/components/Blockchain/operations/AssetUpdateIssuer.jsx b/app/components/Blockchain/operations/AssetUpdateIssuer.jsx new file mode 100644 index 0000000000..ae4e0edb26 --- /dev/null +++ b/app/components/Blockchain/operations/AssetUpdateIssuer.jsx @@ -0,0 +1,27 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const AssetUpdateIssuer = ({op}) => { + return ( + + ); +}; diff --git a/app/components/Blockchain/operations/BalanceClaim.jsx b/app/components/Blockchain/operations/BalanceClaim.jsx new file mode 100644 index 0000000000..3e7e812e90 --- /dev/null +++ b/app/components/Blockchain/operations/BalanceClaim.jsx @@ -0,0 +1,57 @@ +import React from "react"; +import Translate from "react-translate-component"; +import BindToChainState from "../../Utility/BindToChainState"; +import utils from "common/utils"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const BalanceClaim = ({ + op, + changeColor, + linkToAccount, + fromComponent +}) => { + changeColor("success"); + op[1].total_claimed.amount = parseInt(op[1].total_claimed.amount, 10); + + if (fromComponent === "proposed_operation") { + return ( + + {linkToAccount(op[1].deposit_to_account)} +   + + {({asset}) => ( + + )} + + + ); + } else { + return ( + + + + ); + } +}; diff --git a/app/components/Blockchain/operations/BidCollateral.jsx b/app/components/Blockchain/operations/BidCollateral.jsx new file mode 100644 index 0000000000..6735b668ca --- /dev/null +++ b/app/components/Blockchain/operations/BidCollateral.jsx @@ -0,0 +1,27 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const BidCollateral = ({op}) => { + return ( + + ); +}; diff --git a/app/components/Blockchain/operations/BondAcceptOffer.jsx b/app/components/Blockchain/operations/BondAcceptOffer.jsx new file mode 100644 index 0000000000..b3048fe3f5 --- /dev/null +++ b/app/components/Blockchain/operations/BondAcceptOffer.jsx @@ -0,0 +1,45 @@ +import React from "react"; +import Translate from "react-translate-component"; +import FormattedAsset from "../../Utility/FormattedAsset"; + +export const BondAcceptOffer = ({op, linkToAccount, current}) => { + if (current === op[1].lender) { + return ( + + +   + + +   + {linkToAccount(op[1].borrower)} + + ); + } else if (current === op[1].borrower) { + return ( + + +   + + +   + {linkToAccount(op[1].lender)} + + ); + } else { + return null; + } +}; diff --git a/app/components/Blockchain/operations/BondCancelOffer.jsx b/app/components/Blockchain/operations/BondCancelOffer.jsx new file mode 100644 index 0000000000..60e0a49958 --- /dev/null +++ b/app/components/Blockchain/operations/BondCancelOffer.jsx @@ -0,0 +1,12 @@ +import React from "react"; +import Translate from "react-translate-component"; + +export const BondCancelOffer = ({op}) => { + return ( + + +   + {op[1].offer_id} + + ); +}; diff --git a/app/components/Blockchain/operations/BondClaimCollaterial.jsx b/app/components/Blockchain/operations/BondClaimCollaterial.jsx new file mode 100644 index 0000000000..077bae13a2 --- /dev/null +++ b/app/components/Blockchain/operations/BondClaimCollaterial.jsx @@ -0,0 +1,45 @@ +import React from "react"; +import Translate from "react-translate-component"; +import FormattedAsset from "../../Utility/FormattedAsset"; + +export const BondClaimCollaterial = ({op, linkToAccount, current}) => { + if (current === op[1].lender) { + return ( + + +   + + +   + {linkToAccount(op[1].claimer)} + + ); + } else if (current === op[1].claimer) { + return ( + + +   + + +   + {linkToAccount(op[1].lender)} + + ); + } else { + return null; + } +}; diff --git a/app/components/Blockchain/operations/BondCreateOffer.jsx b/app/components/Blockchain/operations/BondCreateOffer.jsx new file mode 100644 index 0000000000..84c51ed7f8 --- /dev/null +++ b/app/components/Blockchain/operations/BondCreateOffer.jsx @@ -0,0 +1,17 @@ +import React from "react"; +import Translate from "react-translate-component"; +import FormattedAsset from "../../Utility/FormattedAsset"; + +export const BondCreateOffer = ({op}) => { + return ( + + +   + + + ); +}; diff --git a/app/components/Blockchain/operations/CallOrderUpdate.jsx b/app/components/Blockchain/operations/CallOrderUpdate.jsx new file mode 100644 index 0000000000..d109dc1bd1 --- /dev/null +++ b/app/components/Blockchain/operations/CallOrderUpdate.jsx @@ -0,0 +1,40 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const CallOrderUpdate = ({op, changeColor, fromComponent}) => { + changeColor("warning"); + + return ( + + + + ); +}; diff --git a/app/components/Blockchain/operations/CommitteeMemberUpdateGlobalParams.jsx b/app/components/Blockchain/operations/CommitteeMemberUpdateGlobalParams.jsx new file mode 100644 index 0000000000..88a1421e52 --- /dev/null +++ b/app/components/Blockchain/operations/CommitteeMemberUpdateGlobalParams.jsx @@ -0,0 +1,23 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const CommitteeMemberUpdateGlobalParams = ({fromComponent}) => { + return ( + + + + ); +}; diff --git a/app/components/Blockchain/operations/CommittyMemberCreate.jsx b/app/components/Blockchain/operations/CommittyMemberCreate.jsx new file mode 100644 index 0000000000..9801e1b902 --- /dev/null +++ b/app/components/Blockchain/operations/CommittyMemberCreate.jsx @@ -0,0 +1,19 @@ +import React from "react"; +import Translate from "react-translate-component"; + +export const CommittyMemberCreate = ({op, linkToAccount, fromComponent}) => { + return ( + + +   + {linkToAccount(op[1].committee_member_account)} + + ); +}; diff --git a/app/components/Blockchain/operations/Custom.jsx b/app/components/Blockchain/operations/Custom.jsx new file mode 100644 index 0000000000..d8ced1d40a --- /dev/null +++ b/app/components/Blockchain/operations/Custom.jsx @@ -0,0 +1,17 @@ +import React from "react"; +import Translate from "react-translate-component"; + +export const Custom = ({fromComponent}) => { + return ( + + + + ); +}; diff --git a/app/components/Blockchain/operations/DefaultOperation.jsx b/app/components/Blockchain/operations/DefaultOperation.jsx new file mode 100644 index 0000000000..68f4a3bdc9 --- /dev/null +++ b/app/components/Blockchain/operations/DefaultOperation.jsx @@ -0,0 +1,11 @@ +import React from "react"; +import {Link} from "react-router-dom"; + +export const DefaultOperation = ({op, block}) => { + console.log("unimplemented op:", op); + return ( + + #{block} + + ); +}; diff --git a/app/components/Blockchain/operations/FileWrite.jsx b/app/components/Blockchain/operations/FileWrite.jsx new file mode 100644 index 0000000000..7aa8023a9b --- /dev/null +++ b/app/components/Blockchain/operations/FileWrite.jsx @@ -0,0 +1,10 @@ +import React from "react"; +import Translate from "react-translate-component"; + +export const FileWrite = () => { + return ( + + + + ); +}; diff --git a/app/components/Blockchain/operations/FillOrder.jsx b/app/components/Blockchain/operations/FillOrder.jsx new file mode 100644 index 0000000000..0dd4873c05 --- /dev/null +++ b/app/components/Blockchain/operations/FillOrder.jsx @@ -0,0 +1,114 @@ +/* eslint-disable react/display-name */ +import React from "react"; +import Translate from "react-translate-component"; +import FormattedAsset from "../../Utility/FormattedAsset"; +import FormattedPrice from "../../Utility/FormattedPrice"; +import BindToChainState from "../../Utility/BindToChainState"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; +import marketUtils from "common/market_utils"; + +export const FillOrder = ({ + changeColor, + op, + linkToAccount, + marketDirections, + fromComponent +}) => { + changeColor("success"); + const o = op[1]; + if (fromComponent === "proposed_operation") { + return ( + + {linkToAccount(op.account_id)} +   + +   + +   + +   + +   + +   + + + ); + } else { + return ( + + + {({base, quote}) => { + const { + marketName, + first, + second + } = marketUtils.getMarketName(base, quote); + const inverted = marketDirections.get(marketName); + const isBid = + o.pays.asset_id === + (inverted ? first.get("id") : second.get("id")); + + let priceBase = isBid ? o.receives : o.pays; + let priceQuote = isBid ? o.pays : o.receives; + let amount = isBid ? o.receives : o.pays; + let receivedAmount = + o.fee.asset_id === amount.asset_id + ? amount.amount - o.fee.amount + : amount.amount; + + return ( + + ); + }} + + + ); + } +}; diff --git a/app/components/Blockchain/operations/GlobalParametersUpdate.jsx b/app/components/Blockchain/operations/GlobalParametersUpdate.jsx new file mode 100644 index 0000000000..8e4fa6956a --- /dev/null +++ b/app/components/Blockchain/operations/GlobalParametersUpdate.jsx @@ -0,0 +1,17 @@ +import React from "react"; +import Translate from "react-translate-component"; + +export const GlobalParametersUpdate = ({fromComponent}) => { + return ( + + + + ); +}; diff --git a/app/components/Blockchain/operations/HtlcCreate.jsx b/app/components/Blockchain/operations/HtlcCreate.jsx new file mode 100644 index 0000000000..f15af1926c --- /dev/null +++ b/app/components/Blockchain/operations/HtlcCreate.jsx @@ -0,0 +1,86 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; +import {Tooltip} from "bitshares-ui-style-guide"; +import {ChainStore} from "bitsharesjs"; +import utils from "common/utils"; +import counterpart from "counterpart"; + +export const HtlcCreate = ({op, block}) => { + const globalObject = ChainStore.getObject("2.0.0"); + const dynGlobalObject = ChainStore.getObject("2.1.0"); + let block_time = utils.calc_block_time( + block, + globalObject, + dynGlobalObject + ); + let estimated = false; + if (!block_time) { + block_time = utils.calc_block_time( + block, + globalObject, + dynGlobalObject, + true + ); + estimated = true; + } + + op[1].amount.amount = parseFloat(op[1].amount.amount); + + let expiryTime = new Date(); + + expiryTime.setTime( + block_time.getTime() + op[1].claim_period_seconds * 1000 + ); + return ( + + + + {estimated ? "*" : ""} + +
+ + + {counterpart.translate("htlc.preimage_hash") + + " (" + + op[1].preimage_size + + ", " + + op[1].preimage_hash[0] + + "): " + + op[1].preimage_hash[1]} + + +
+
+ ); +}; diff --git a/app/components/Blockchain/operations/HtlcExtend.jsx b/app/components/Blockchain/operations/HtlcExtend.jsx new file mode 100644 index 0000000000..5f65ea36bf --- /dev/null +++ b/app/components/Blockchain/operations/HtlcExtend.jsx @@ -0,0 +1,28 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const HtlcExtend = ({op}) => { + return ( + + + + ); +}; diff --git a/app/components/Blockchain/operations/HtlcRedeem.jsx b/app/components/Blockchain/operations/HtlcRedeem.jsx new file mode 100644 index 0000000000..7508c8013e --- /dev/null +++ b/app/components/Blockchain/operations/HtlcRedeem.jsx @@ -0,0 +1,39 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; +import {Tooltip} from "bitshares-ui-style-guide"; + +export const HtlcRedeem = ({op, changeColor}) => { + changeColor("success"); + return ( + + + + +
+ + + {counterpart.translate("htlc.preimage") + + ": " + + op[1].preimage} + + +
+
+ ); +}; diff --git a/app/components/Blockchain/operations/HtlcRedeemed.jsx b/app/components/Blockchain/operations/HtlcRedeemed.jsx new file mode 100644 index 0000000000..9ba1cd1183 --- /dev/null +++ b/app/components/Blockchain/operations/HtlcRedeemed.jsx @@ -0,0 +1,35 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const HtlcRedeemed = ({op}) => { + return ( + + + + ); +}; diff --git a/app/components/Blockchain/operations/HtlcRefund.jsx b/app/components/Blockchain/operations/HtlcRefund.jsx new file mode 100644 index 0000000000..21a30c1274 --- /dev/null +++ b/app/components/Blockchain/operations/HtlcRefund.jsx @@ -0,0 +1,24 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const HtlcRefund = ({op, changeColor}) => { + changeColor("warning"); + return ( + + + + ); +}; diff --git a/app/components/Blockchain/operations/KeyCreate.jsx b/app/components/Blockchain/operations/KeyCreate.jsx new file mode 100644 index 0000000000..c591d5bfd4 --- /dev/null +++ b/app/components/Blockchain/operations/KeyCreate.jsx @@ -0,0 +1,10 @@ +import React from "react"; +import Translate from "react-translate-component"; + +export const KeyCreate = () => { + return ( + + + + ); +}; diff --git a/app/components/Blockchain/operations/LimitOrderCancel.jsx b/app/components/Blockchain/operations/LimitOrderCancel.jsx new file mode 100644 index 0000000000..2935b6dac4 --- /dev/null +++ b/app/components/Blockchain/operations/LimitOrderCancel.jsx @@ -0,0 +1,45 @@ +import React from "react"; +import Translate from "react-translate-component"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const LimitOrderCancel = ({ + op, + changeColor, + fromComponent, + linkToAccount +}) => { + changeColor("cancel"); + + if (fromComponent === "proposed_operation") { + return ( + + {linkToAccount(op[1].fee_paying_account)} +   + +  # + {op[1].order.substring(4)} + + ); + } else { + return ( + + + + ); + } +}; diff --git a/app/components/Blockchain/operations/LimitOrderCreate.jsx b/app/components/Blockchain/operations/LimitOrderCreate.jsx new file mode 100644 index 0000000000..5cace48458 --- /dev/null +++ b/app/components/Blockchain/operations/LimitOrderCreate.jsx @@ -0,0 +1,127 @@ +/* eslint-disable react/display-name */ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; +import BindToChainState from "../../Utility/BindToChainState"; +import marketUtils from "common/market_utils"; +export const LimitOrderCreate = ({ + op, + changeColor, + fromComponent, + marketDirections, + result +}) => { + changeColor("warning"); + + if (fromComponent === "proposed_operation") { + let isAsk = market_utils.isAskOp(op[1]); + + return ( + + + + ); + } else { + let o = op[1]; + return ( + + + {({base, quote}) => { + const { + marketName, + first, + second + } = marketUtils.getMarketName(base, quote); + const inverted = marketDirections.get(marketName); + + const isBid = + o.amount_to_sell.asset_id === + (inverted ? first.get("id") : second.get("id")); + + let priceBase = isBid + ? o.amount_to_sell + : o.min_to_receive; + let priceQuote = isBid + ? o.min_to_receive + : o.amount_to_sell; + const amount = isBid + ? op[1].min_to_receive + : op[1].amount_to_sell; + let orderId = result + ? typeof result[1] == "string" + ? "#" + result[1].substring(4) + : "" + : ""; + + return ( + + ); + }} + + + ); + } +}; diff --git a/app/components/Blockchain/operations/OverrideTransfer.jsx b/app/components/Blockchain/operations/OverrideTransfer.jsx new file mode 100644 index 0000000000..bed0ef4dd2 --- /dev/null +++ b/app/components/Blockchain/operations/OverrideTransfer.jsx @@ -0,0 +1,24 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const OverrideTransfer = ({op, fromComponent}) => { + return ( + + ); +}; diff --git a/app/components/Blockchain/operations/ProposalCreate.jsx b/app/components/Blockchain/operations/ProposalCreate.jsx new file mode 100644 index 0000000000..8089152bb3 --- /dev/null +++ b/app/components/Blockchain/operations/ProposalCreate.jsx @@ -0,0 +1,69 @@ +import React from "react"; +import Translate from "react-translate-component"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; +import ProposedOperation from "../ProposedOperation"; + +const ShortObjectId = ({objectId}) => { + if (typeof objectId === "string") { + const parts = objectId.split("."); + const {length} = parts; + if (length > 0) return "#" + parts[length - 1]; + } + return objectId; +}; + +export const ProposalCreate = ({op, result, fromComponent}) => { + if (fromComponent === "proposed_operation") { + return ( + + + + ); + } else { + return ( +
+ + + ) : ( + "" + ), + arg: "proposal" + } + ]} + /> + : + +
+ {op[1] && + op[1].proposed_ops.map((o, index) => { + return ( + + ); + })} +
+
+ ); + } +}; diff --git a/app/components/Blockchain/operations/ProposalDelete.jsx b/app/components/Blockchain/operations/ProposalDelete.jsx new file mode 100644 index 0000000000..83a3d9b1b4 --- /dev/null +++ b/app/components/Blockchain/operations/ProposalDelete.jsx @@ -0,0 +1,44 @@ +import React from "react"; +import Translate from "react-translate-component"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +const ShortObjectId = ({objectId}) => { + if (typeof objectId === "string") { + const parts = objectId.split("."); + const {length} = parts; + if (length > 0) return "#" + parts[length - 1]; + } + return objectId; +}; + +export const ProposalDelete = ({op, fromComponent}) => { + if (fromComponent === "proposed_operation") { + return ( + + + + ); + } else { + return ( + + , + arg: "proposal" + } + ]} + /> + + ); + } +}; diff --git a/app/components/Blockchain/operations/ProposalUpdate.jsx b/app/components/Blockchain/operations/ProposalUpdate.jsx new file mode 100644 index 0000000000..5e663d5642 --- /dev/null +++ b/app/components/Blockchain/operations/ProposalUpdate.jsx @@ -0,0 +1,80 @@ +import React from "react"; +import Translate from "react-translate-component"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +const ShortObjectId = ({objectId}) => { + if (typeof objectId === "string") { + const parts = objectId.split("."); + const {length} = parts; + if (length > 0) return "#" + parts[length - 1]; + } + return objectId; +}; + +export const ProposalUpdate = ({op, linkToAccount, fromComponent}) => { + if (fromComponent === "proposed_operation") { + return ( + + + + ); + } else { + const fields = [ + "active_approvals_to_add", + "active_approvals_to_remove", + "owner_approvals_to_add", + "owner_approvals_to_remove", + "key_approvals_to_add", + "key_approvals_to_remove" + ]; + return ( +
+ + + ), + arg: "proposal" + } + ]} + /> + +
+ {fields.map(field => { + if (op[1][field].length) { + return ( +
+ +
    + {op[1][field].map(value => { + return ( +
  • + {field.startsWith("key") + ? value + : linkToAccount(value)} +
  • + ); + })} +
+
+ ); + } else return null; + })} +
+
+ ); + } +}; diff --git a/app/components/Blockchain/operations/ShortOrderCancel.jsx b/app/components/Blockchain/operations/ShortOrderCancel.jsx new file mode 100644 index 0000000000..831d625820 --- /dev/null +++ b/app/components/Blockchain/operations/ShortOrderCancel.jsx @@ -0,0 +1,14 @@ +import React from "react"; +import Translate from "react-translate-component"; + +export const ShortOrderCancel = ({op, changeColor}) => { + changeColor("cancel"); + + return ( + + +   + {op[1].order} + + ); +}; diff --git a/app/components/Blockchain/operations/Transfer.jsx b/app/components/Blockchain/operations/Transfer.jsx new file mode 100644 index 0000000000..eef6e5bfc5 --- /dev/null +++ b/app/components/Blockchain/operations/Transfer.jsx @@ -0,0 +1,43 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; +import MemoText from "../MemoText"; + +export const Transfer = ({op, proposer, index, changeColor}) => { + changeColor("success"); // color of a label + let memoComponent = null; + + if (op[1].memo) { + memoComponent = ; + } + op[1].amount.amount = parseFloat(op[1].amount.amount); + + return ( + +
+
+ + {memoComponent} +
+
+
+ ); +}; diff --git a/app/components/Blockchain/operations/TransferFromBlind.jsx b/app/components/Blockchain/operations/TransferFromBlind.jsx new file mode 100644 index 0000000000..6d30597880 --- /dev/null +++ b/app/components/Blockchain/operations/TransferFromBlind.jsx @@ -0,0 +1,26 @@ +import React from "react"; +import Translate from "react-translate-component"; +import FormattedAsset from "../../Utility/FormattedAsset"; + +export const TransferFromBlind = ({op, linkToAccount, fromComponent}) => { + return ( + + {linkToAccount(op[1].to)} +   + +   + + + ); +}; diff --git a/app/components/Blockchain/operations/TransferToBlind.jsx b/app/components/Blockchain/operations/TransferToBlind.jsx new file mode 100644 index 0000000000..025b52916b --- /dev/null +++ b/app/components/Blockchain/operations/TransferToBlind.jsx @@ -0,0 +1,26 @@ +import React from "react"; +import Translate from "react-translate-component"; +import FormattedAsset from "../../Utility/FormattedAsset"; + +export const TransferToBlind = ({op, linkToAccount, fromComponent}) => { + return ( + + {linkToAccount(op[1].from)} +   + +   + + + ); +}; diff --git a/app/components/Blockchain/operations/VestingBalanceCreate.jsx b/app/components/Blockchain/operations/VestingBalanceCreate.jsx new file mode 100644 index 0000000000..5b90ed487d --- /dev/null +++ b/app/components/Blockchain/operations/VestingBalanceCreate.jsx @@ -0,0 +1,44 @@ +import React from "react"; +import Translate from "react-translate-component"; +import FormattedAsset from "../../Utility/FormattedAsset"; + +export const VestingBalanceCreate = ({op, linkToAccount, fromComponent}) => { + if (fromComponent === "proposed_operation") { + return ( + +   + {linkToAccount(op[1].creator)} + +   + +   + {linkToAccount(op[1].owner)} + + ); + } else { + return ( + +   + {linkToAccount(op[1].creator)} + +   + +   + {linkToAccount(op[1].owner)} + + ); + } +}; diff --git a/app/components/Blockchain/operations/VestingBalanceWithdraw.jsx b/app/components/Blockchain/operations/VestingBalanceWithdraw.jsx new file mode 100644 index 0000000000..8223047ee9 --- /dev/null +++ b/app/components/Blockchain/operations/VestingBalanceWithdraw.jsx @@ -0,0 +1,22 @@ +import React from "react"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const VestingBalanceWithdraw = ({op, fromComponent}) => { + return ( + + ); +}; diff --git a/app/components/Blockchain/operations/WithdrawPermissionClaim.jsx b/app/components/Blockchain/operations/WithdrawPermissionClaim.jsx new file mode 100644 index 0000000000..b758095696 --- /dev/null +++ b/app/components/Blockchain/operations/WithdrawPermissionClaim.jsx @@ -0,0 +1,34 @@ +import React from "react"; +import Translate from "react-translate-component"; + +export const WithdrawPermissionClaim = ({op, linkToAccount, fromComponent}) => { + if (fromComponent === "proposed_operation") { + return ( + + +   + {linkToAccount(op[1].withdraw_from_account)} + +   + {linkToAccount(op[1].withdraw_to_account)} + + ); + } else { + return ( + + +   + {linkToAccount(op[1].withdraw_from_account)} + +   + {linkToAccount(op[1].withdraw_to_account)} + + ); + } +}; diff --git a/app/components/Blockchain/operations/WithdrawPermissionCreate.jsx b/app/components/Blockchain/operations/WithdrawPermissionCreate.jsx new file mode 100644 index 0000000000..a098699791 --- /dev/null +++ b/app/components/Blockchain/operations/WithdrawPermissionCreate.jsx @@ -0,0 +1,38 @@ +import React from "react"; +import Translate from "react-translate-component"; + +export const WithdrawPermissionCreate = ({ + op, + linkToAccount, + fromComponent +}) => { + if (fromComponent === "proposed_operation") { + return ( + + +   + {linkToAccount(op[1].withdraw_from_account)} + +   + {linkToAccount(op[1].authorized_account)} + + ); + } else { + return ( + + +   + {linkToAccount(op[1].withdraw_from_account)} + +   + {linkToAccount(op[1].authorized_account)} + + ); + } +}; diff --git a/app/components/Blockchain/operations/WithdrawPermissionDelete.jsx b/app/components/Blockchain/operations/WithdrawPermissionDelete.jsx new file mode 100644 index 0000000000..b1bef66bbb --- /dev/null +++ b/app/components/Blockchain/operations/WithdrawPermissionDelete.jsx @@ -0,0 +1,38 @@ +import React from "react"; +import Translate from "react-translate-component"; + +export const WithdrawPermissionDelete = ({ + op, + linkToAccount, + fromComponent +}) => { + if (fromComponent === "proposed_operation") { + return ( + + +   + {linkToAccount(op[1].withdraw_from_account)} + +   + {linkToAccount(op[1].authorized_account)} + + ); + } else { + return ( + + +   + {linkToAccount(op[1].withdraw_from_account)} + +   + {linkToAccount(op[1].authorized_account)} + + ); + } +}; diff --git a/app/components/Blockchain/operations/WithdrawPermissionUpdate.jsx b/app/components/Blockchain/operations/WithdrawPermissionUpdate.jsx new file mode 100644 index 0000000000..a58b77dfd3 --- /dev/null +++ b/app/components/Blockchain/operations/WithdrawPermissionUpdate.jsx @@ -0,0 +1,38 @@ +import React from "react"; +import Translate from "react-translate-component"; + +export const WithdrawPermissionUpdate = ({ + op, + linkToAccount, + fromComponent +}) => { + if (fromComponent === "proposed_operation") { + return ( + + +   + {linkToAccount(op[1].withdraw_from_account)} + +   + {linkToAccount(op[1].authorized_account)} + + ); + } else { + return ( + + +   + {linkToAccount(op[1].withdraw_from_account)} + +   + {linkToAccount(op[1].authorized_account)} + + ); + } +}; diff --git a/app/components/Blockchain/operations/WitnessCreate.jsx b/app/components/Blockchain/operations/WitnessCreate.jsx new file mode 100644 index 0000000000..37b652d946 --- /dev/null +++ b/app/components/Blockchain/operations/WitnessCreate.jsx @@ -0,0 +1,30 @@ +import React from "react"; +import Translate from "react-translate-component"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const WitnessCreate = ({op, linkToAccount, fromComponent}) => { + if (fromComponent === "proposed_operation") { + return ( + + +   + {linkToAccount(op[1].witness_account)} + + ); + } else { + return ( + + + + ); + } +}; diff --git a/app/components/Blockchain/operations/WitnessUpdate.jsx b/app/components/Blockchain/operations/WitnessUpdate.jsx new file mode 100644 index 0000000000..1f6538891c --- /dev/null +++ b/app/components/Blockchain/operations/WitnessUpdate.jsx @@ -0,0 +1,30 @@ +import React from "react"; +import Translate from "react-translate-component"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const WitnessUpdate = ({op, linkToAccount, fromComponent}) => { + if (fromComponent === "proposed_operation") { + return ( + + +   + {linkToAccount(op[1].witness_account)} + + ); + } else { + return ( + + + + ); + } +}; diff --git a/app/components/Blockchain/operations/WitnessWithdrawPay.jsx b/app/components/Blockchain/operations/WitnessWithdrawPay.jsx new file mode 100644 index 0000000000..d1919dfbd8 --- /dev/null +++ b/app/components/Blockchain/operations/WitnessWithdrawPay.jsx @@ -0,0 +1,77 @@ +import React from "react"; +import Translate from "react-translate-component"; +import FormattedAsset from "../../Utility/FormattedAsset"; + +export const WitnessWithdrawPay = ({ + op, + current, + linkToAccount, + fromComponent +}) => { + if (fromComponent === "proposed_operation") { + if (current === op[1].witness_account) { + return ( + + +   + + +   + {linkToAccount(op[1].witness_account)} + + ); + } else { + return ( + + +   + + +   + {linkToAccount(op[1].witness_account)} + + ); + } + } else { + if (current === op[1].witness_account) { + return ( + + +   + + +   + {linkToAccount(op[1].witness_account)} + + ); + } else { + return ( + + +   + + +   + {linkToAccount(op[1].witness_account)} + + ); + } + } +}; diff --git a/app/components/Blockchain/operations/WorkerCreate.jsx b/app/components/Blockchain/operations/WorkerCreate.jsx new file mode 100644 index 0000000000..ab604bffc6 --- /dev/null +++ b/app/components/Blockchain/operations/WorkerCreate.jsx @@ -0,0 +1,46 @@ +import React from "react"; +import Translate from "react-translate-component"; +import FormattedAsset from "../../Utility/FormattedAsset"; +import TranslateWithLinks from "../../Utility/TranslateWithLinks"; + +export const WorkerCreate = ({op, fromComponent}) => { + if (fromComponent === "proposed_operation") { + return ( + + +   + + + ); + } else { + return ( + + + + ); + } +}; diff --git a/app/components/Blockchain/operations/index.js b/app/components/Blockchain/operations/index.js new file mode 100644 index 0000000000..624006990f --- /dev/null +++ b/app/components/Blockchain/operations/index.js @@ -0,0 +1,242 @@ +import React from "react"; +import {Transfer} from "./Transfer"; +import {LimitOrderCreate} from "./LimitOrderCreate"; +import {LimitOrderCancel} from "./LimitOrderCancel"; +import {ShortOrderCancel} from "./ShortOrderCancel"; +import {CallOrderUpdate} from "./CallOrderUpdate"; +import {KeyCreate} from "./KeyCreate"; +import {AccountCreate} from "./AccountCreate"; +import {AccountUpdate} from "./AccountUpdate"; +import {AccountWhitelist} from "./AccountWhitelist"; +import {AccountUpgrade} from "./AccountUpgrade"; +import {AccountTransfer} from "./AccountTransfer"; +import {AssetCreate} from "./AssetCreate"; +import {AssetUpdate} from "./AssetUpdate"; +import {AssetUpdateFeedProducers} from "./AssetUpdateFeedProducers"; +import {AssetIssue} from "./AssetIssue"; +import {AssetReserve} from "./AssetReserve"; +import {AssetFundFeePool} from "./AssetFundFeePool"; +import {AssetSettle} from "./AssetSettle"; +import {AssetSettleCancel} from "./AssetSettleCancel"; +import {AssetGlobalSettle} from "./AssetGlobalSettle"; +import {AssetPublishFeed} from "./AssetPublishFeed"; +import {AssetClaimPool} from "./AssetClaimPool"; +import {AssetUpdateIssuer} from "./AssetUpdateIssuer"; +import {WitnessCreate} from "./WitnessCreate"; +import {WitnessUpdate} from "./WitnessUpdate"; +import {WitnessWithdrawPay} from "./WitnessWithdrawPay"; +import {ProposalCreate} from "./ProposalCreate"; +import {ProposalUpdate} from "./ProposalUpdate"; +import {ProposalDelete} from "./ProposalDelete"; +import {WithdrawPermissionCreate} from "./WithdrawPermissionCreate"; +import {WithdrawPermissionUpdate} from "./WithdrawPermissionUpdate"; +import {WithdrawPermissionClaim} from "./WithdrawPermissionClaim"; +import {WithdrawPermissionDelete} from "./WithdrawPermissionDelete"; +import {FillOrder} from "./FillOrder"; +import {GlobalParametersUpdate} from "./GlobalParametersUpdate"; +import {FileWrite} from "./FileWrite"; +import {VestingBalanceCreate} from "./VestingBalanceCreate"; +import {VestingBalanceWithdraw} from "./VestingBalanceWithdraw"; +import {BondCreateOffer} from "./BondCreateOffer"; +import {BondCancelOffer} from "./BondCancelOffer"; +import {BondAcceptOffer} from "./BondAcceptOffer"; +import {BondClaimCollaterial} from "./BondClaimCollaterial"; +import {WorkerCreate} from "./WorkerCreate"; +import {BalanceClaim} from "./BalanceClaim"; +import {CommittyMemberCreate} from "./CommittyMemberCreate"; +import {TransferToBlind} from "./TransferToBlind"; +import {TransferFromBlind} from "./TransferFromBlind"; +import {AssetClaimFees} from "./AssetClaimFees"; +import {CommitteeMemberUpdateGlobalParams} from "./CommitteeMemberUpdateGlobalParams"; +import {Custom} from "./Custom"; +import {OverrideTransfer} from "./OverrideTransfer"; +import {DefaultOperation} from "./DefaultOperation"; +import {BidCollateral} from "./BidCollateral"; +import {HtlcCreate} from "./HtlcCreate"; +import {HtlcExtend} from "./HtlcExtend"; +import {HtlcRedeem} from "./HtlcRedeem"; +import {HtlcRedeemed} from "./HtlcRedeemed"; +import {HtlcRefund} from "./HtlcRefund"; + +export default function opComponents(opType, props, opts) { + switch (opType) { + case "transfer": + return ; + case "limit_order_create": + return ; + case "limit_order_cancel": + return ; + + case "short_order_cancel": + return ; + + case "call_order_update": + return ; + + case "key_create": + return ; + + case "account_create": + return ; + + case "account_update": + return ; + + case "account_whitelist": + return ; + + case "account_upgrade": + return ; + + case "account_transfer": + return ; + + case "asset_create": + return ; + + case "asset_update": + case "asset_update_bitasset": + return ; + /* -------------------------------------------------------------------------------------------- */ + case "asset_update_feed_producers": + return ; + + case "asset_issue": + return ; + + case "asset_reserve": + return ; + + case "asset_fund_fee_pool": + return ; + + case "asset_settle": + return ; + + case "asset_settle_cancel": + return ; + + case "asset_global_settle": + return ; + + case "asset_publish_feed": + return ; + + case "asset_claim_pool": + return ; + + case "asset_update_issuer": + return ; + + case "witness_create": + return ; + + case "witness_update": + return ; + + case "witness_withdraw_pay": + return ; + + case "proposal_create": + return ; + + case "proposal_update": + return ; + + case "proposal_delete": + return ; + + case "withdraw_permission_create": + return ; + + case "withdraw_permission_update": + return ; + + case "withdraw_permission_claim": + return ; + + case "withdraw_permission_delete": + return ; + + case "fill_order": + return ; + + case "global_parameters_update": + return ( + + ); + + case "file_write": + return ; + + case "vesting_balance_create": + return ; + + case "vesting_balance_withdraw": + return ; + + case "bond_create_offer": + return ; + + case "bond_cancel_offer": + return ; + + case "bond_accept_offer": + return ; + + case "bond_claim_collateral": + return ; + + case "worker_create": + return ; + + case "balance_claim": + return ; + + case "committee_member_create": + return ; + + case "transfer_to_blind": + return ; + + case "transfer_from_blind": + return ; + + case "asset_claim_fees": + return ; + + case "committee_member_update_global_parameters": + return ( + + ); + + case "custom": + return ; + + case "override_transfer": + return ; + + case "bid_collateral": + return ; + + case "htlc_create": + return ; + + case "htlc_redeem": + return ; + + case "htlc_redeemed": + return ; + + case "htlc_extend": + return ; + + case "htlc_refund": + return ; + + default: + return ; + } +} diff --git a/app/components/Dashboard/MarketsTable.jsx b/app/components/Dashboard/MarketsTable.jsx index 85ecf17ba5..d070651e5e 100644 --- a/app/components/Dashboard/MarketsTable.jsx +++ b/app/components/Dashboard/MarketsTable.jsx @@ -311,10 +311,10 @@ class MarketsTable extends React.Component { let changeClass = !marketStats ? "" : parseFloat(marketStats.change) > 0 - ? "change-up" - : parseFloat(marketStats.change) < 0 - ? "change-down" - : ""; + ? "change-up" + : parseFloat(marketStats.change) < 0 + ? "change-down" + : ""; let marketID = `${quote}_${base}`; diff --git a/app/components/DepositWithdraw/openledger/OpenLedgerFiatDepositWithdrawal.jsx b/app/components/DepositWithdraw/openledger/OpenLedgerFiatDepositWithdrawal.jsx index 194872a7a8..086932d9f3 100644 --- a/app/components/DepositWithdraw/openledger/OpenLedgerFiatDepositWithdrawal.jsx +++ b/app/components/DepositWithdraw/openledger/OpenLedgerFiatDepositWithdrawal.jsx @@ -13,12 +13,12 @@ import WithdrawFiatOpenLedger from "./WithdrawFiatOpenLedger"; import PropTypes from "prop-types"; /* -* -* -* BE AWARE BaseModal USED IN THIS CODE WAS REMOVED AT ALL -* -* -* */ + * + * + * BE AWARE BaseModal USED IN THIS CODE WAS REMOVED AT ALL + * + * + * */ class OpenLedgerFiatDepositWithdrawCurrency extends React.Component { static propTypes = { diff --git a/app/components/Exchange/BuySell.jsx b/app/components/Exchange/BuySell.jsx index 86b1cfee86..c57c02023e 100644 --- a/app/components/Exchange/BuySell.jsx +++ b/app/components/Exchange/BuySell.jsx @@ -49,13 +49,13 @@ class BuySell extends React.Component { } /* - * Force re-rendering component when state changes. - * This is required for an updated value of component width - * - * It will trigger a re-render twice - * - Once when state is changed - * - Once when forceReRender is set to false - */ + * Force re-rendering component when state changes. + * This is required for an updated value of component width + * + * It will trigger a re-render twice + * - Once when state is changed + * - Once when forceReRender is set to false + */ _forceRender(np) { if (this.state.forceReRender) { this.setState({ diff --git a/app/components/Exchange/Exchange.jsx b/app/components/Exchange/Exchange.jsx index a629405a05..e8ee13c1ba 100644 --- a/app/components/Exchange/Exchange.jsx +++ b/app/components/Exchange/Exchange.jsx @@ -530,13 +530,13 @@ class Exchange extends React.Component { } /* - * Force re-rendering component when state changes. - * This is required for an updated value of component width - * - * It will trigger a re-render twice - * - Once when state is changed - * - Once when forceReRender is set to false - */ + * Force re-rendering component when state changes. + * This is required for an updated value of component width + * + * It will trigger a re-render twice + * - Once when state is changed + * - Once when forceReRender is set to false + */ _forceRender(np, ns) { if (this.state.forceReRender) { this.setState({ @@ -1517,9 +1517,9 @@ class Exchange extends React.Component { _orderbookClick(order) { const isBid = order.isBid(); /* - * Because we are using a bid order to construct an ask and vice versa, - * totalToReceive becomes forSale, and totalForSale becomes toReceive - */ + * Because we are using a bid order to construct an ask and vice versa, + * totalToReceive becomes forSale, and totalForSale becomes toReceive + */ let forSale = order.totalToReceive({noCache: true}); // let toReceive = order.totalForSale({noCache: true}); let toReceive = forSale.times(order.sellPrice()); @@ -2008,8 +2008,8 @@ class Exchange extends React.Component { latest.getPrice() === second_latest.getPrice() ? "" : latest.getPrice() - second_latest.getPrice() > 0 - ? "change-up" - : "change-down"; + ? "change-up" + : "change-down"; } // Fees @@ -2086,7 +2086,7 @@ class Exchange extends React.Component { }; let buyForm = isFrozen ? null : tinyScreen && - !this.state.mobileKey.includes("buySellTab") ? null : ( + !this.state.mobileKey.includes("buySellTab") ? null : ( 1200 - ? "medium-6 large-6 xlarge-4" - : centerContainerWidth > 800 - ? "medium-6" - : "", + ? "medium-6 large-6 xlarge-4" + : centerContainerWidth > 800 + ? "medium-6" + : "", "small-12 exchange-padded middle-content", flipBuySell ? `order-${buySellTop ? 2 : 3} large-order-${ @@ -2252,7 +2252,7 @@ class Exchange extends React.Component { ); let sellForm = isFrozen ? null : tinyScreen && - !this.state.mobileKey.includes("buySellTab") ? null : ( + !this.state.mobileKey.includes("buySellTab") ? null : ( 1200 - ? "medium-6 large-6 xlarge-4" - : centerContainerWidth > 800 - ? "medium-6" - : "", + ? "medium-6 large-6 xlarge-4" + : centerContainerWidth > 800 + ? "medium-6" + : "", "small-12 exchange-padded middle-content", flipBuySell ? `order-${buySellTop ? 1 : 2} large-order-${ @@ -2493,8 +2493,8 @@ class Exchange extends React.Component { centerContainerWidth > 1200 ? "xlarge-8" : centerContainerWidth > 800 - ? "" - : "", + ? "" + : "", "medium-12 large-12", "small-12 grid-block orderbook no-padding align-spaced no-overflow wrap shrink", `order-${buySellTop ? 3 : 1} xlarge-order-${ @@ -2505,8 +2505,8 @@ class Exchange extends React.Component { centerContainerWidth > 1200 ? "medium-6" : centerContainerWidth > 800 - ? "medium-6 large-6" - : "", + ? "medium-6 large-6" + : "", "small-12 middle-content", !tinyScreen ? "exchange-padded" : "" )} @@ -2553,8 +2553,8 @@ class Exchange extends React.Component { ? centerContainerWidth > 1200 ? "medium-6 large-6 xlarge-4" : centerContainerWidth > 800 - ? "medium-6" - : "" + ? "medium-6" + : "" : "medium-12", "no-padding no-overflow middle-content small-12 order-6" )} @@ -2585,8 +2585,8 @@ class Exchange extends React.Component { ? centerContainerWidth > 1200 ? "medium-6 large-6 xlarge-4" : centerContainerWidth > 800 - ? "medium-6" - : "" + ? "medium-6" + : "" : "medium-12", "no-padding no-overflow middle-content small-12", verticalOrderBook || verticalOrderForm @@ -2621,8 +2621,8 @@ class Exchange extends React.Component { ? centerContainerWidth > 1200 ? "medium-6 large-6 xlarge-4" : centerContainerWidth > 800 - ? "medium-6" - : "" + ? "medium-6" + : "" : "medium-12", "no-padding no-overflow middle-content small-12 order-7" )} @@ -2660,8 +2660,8 @@ class Exchange extends React.Component { ? centerContainerWidth > 1200 ? "medium-6 large-6 xlarge-4" : centerContainerWidth > 800 - ? "medium-6" - : "" + ? "medium-6" + : "" : "medium-12", "no-padding no-overflow middle-content small-12 order-8" )} @@ -3019,10 +3019,10 @@ class Exchange extends React.Component { ? "medium-12 xlarge-4" : "medium-6 xlarge-4 " : centerContainerWidth > 800 - ? groupTabsCount == 1 - ? "medium-12" - : "medium-6" - : "", + ? groupTabsCount == 1 + ? "medium-12" + : "medium-6" + : "", "small-12 order-5", verticalOrderBook ? "xlarge-order-5" : "", !verticalOrderBook && !verticalOrderForm @@ -3050,10 +3050,10 @@ class Exchange extends React.Component { ? "medium-12 xlarge-4" : "medium-6 xlarge-4 " : centerContainerWidth > 800 - ? groupTabsCount == 1 - ? "medium-12" - : "medium-6" - : "", + ? groupTabsCount == 1 + ? "medium-12" + : "medium-6" + : "", "small-12 order-6" )} style={{paddingRight: 5}} @@ -3072,7 +3072,7 @@ class Exchange extends React.Component {
1200 && - (verticalOrderBook || verticalOrderBook) + (verticalOrderBook || verticalOrderBook) ? "xlarge-order-6 xlarge-8 order-9" : "", "small-12 grid-block orderbook no-padding align-spaced no-overflow wrap" diff --git a/app/components/Exchange/ExchangeHeader.jsx b/app/components/Exchange/ExchangeHeader.jsx index 5c5d27048d..81e283db23 100644 --- a/app/components/Exchange/ExchangeHeader.jsx +++ b/app/components/Exchange/ExchangeHeader.jsx @@ -94,15 +94,15 @@ export default class ExchangeHeader extends React.Component { parseFloat(dayChange) === 0 || isNaN(dayChange) ? "" : parseFloat(dayChange) < 0 - ? "negative" - : "positive"; + ? "negative" + : "positive"; const volumeBase = marketStats.get("volumeBase"); const volumeQuote = marketStats.get("volumeQuote"); const dayChangeWithSign = isNaN(dayChange) ? undefined : dayChange > 0 - ? "+" + dayChange - : dayChange; + ? "+" + dayChange + : dayChange; const volume24h = this.state.volumeShowQuote ? volumeQuote : volumeBase; const volume24hAsset = this.state.volumeShowQuote @@ -154,8 +154,8 @@ export default class ExchangeHeader extends React.Component { baseId == "1.3.0" ? quoteAsset : quoteId == "1.3.0" - ? baseAsset - : quoteAsset; + ? baseAsset + : quoteAsset; // globally settled if (possibleBitAsset.get("bitasset").get("settlement_fund") > 0) { @@ -276,8 +276,7 @@ export default class ExchangeHeader extends React.Component {
) : ( - {`${quoteSymbol} : ${baseSymbol}`} + {`${quoteSymbol} : ${baseSymbol}`} )}
diff --git a/app/components/Exchange/MyOpenOrders.jsx b/app/components/Exchange/MyOpenOrders.jsx index e51d5da50c..8755b5f259 100644 --- a/app/components/Exchange/MyOpenOrders.jsx +++ b/app/components/Exchange/MyOpenOrders.jsx @@ -139,8 +139,8 @@ class OrderRow extends React.Component { let tdClass = isCall ? "orderHistoryCall" : isBid - ? "orderHistoryBid" - : "orderHistoryAsk"; + ? "orderHistoryBid" + : "orderHistoryAsk"; let priceSymbol = showSymbols ? ( {` ${base.get("symbol")}/${quote.get("symbol")}`} diff --git a/app/components/Exchange/Personalize.jsx b/app/components/Exchange/Personalize.jsx index d24939b9d4..b9663f05e7 100644 --- a/app/components/Exchange/Personalize.jsx +++ b/app/components/Exchange/Personalize.jsx @@ -192,89 +192,85 @@ class Personalize extends React.Component {
- {!this.props.tinyScreen && - chartType == "price_chart" && ( -
-
-
- -   - - - -   - - - -
-
-
- +
+
+ +   + -
+ > + + +   + + + +
- )} +
+ +
+
+ )} - {!this.props.tinyScreen && - chartType == "price_chart" && ( -
-
-
- -   - - - -   - - - -
-
-
- +
+
+ +   + -
+ > + + +   + + + +
- )} +
+ +
+
+ )}
@@ -314,46 +310,45 @@ class Personalize extends React.Component { - {!this.props.tinyScreen && - !this.props.smallScreen && ( -
-
-
- -   - - - -
-
-
- -
-
- )} + + + + +
+ +
+ + )} {/* Orientation Order Form */} {(!this.props.tinyScreen && @@ -664,52 +659,48 @@ class Personalize extends React.Component {
)} - {!this.props.tinyScreen && - !this.props.smallScreen && ( -
-
-
- -   - - - -
-
-
- -
-
- )} + + + + +
+ +
+ + )} {!this.props.tinyScreen && (
diff --git a/app/components/Explorer/Assets.jsx b/app/components/Explorer/Assets.jsx index 856a609bcb..a6af52db59 100644 --- a/app/components/Explorer/Assets.jsx +++ b/app/components/Explorer/Assets.jsx @@ -36,8 +36,8 @@ class Assets extends React.Component { typeof accountStorage.get(`totalAssets_${chainID}`) != "object" ? accountStorage.get(`totalAssets_${chainID}`) : chainID && chainID === "4018d784" - ? 3000 - : 50, // mainnet has 3000+ assets, other chains may not have that many + ? 3000 + : 50, // mainnet has 3000+ assets, other chains may not have that many assetsFetched: 0, activeFilter: "market", filterSearch: props.filterSearch || "", @@ -158,8 +158,8 @@ class Assets extends React.Component { return a.symbol > b.symbol ? 1 : a.symbol < b.symbol - ? -1 - : 0; + ? -1 + : 0; }, render: item => { return ( @@ -196,8 +196,8 @@ class Assets extends React.Component { return a.currentSupply > b.currentSupply ? 1 : a.currentSupply < b.currentSupply - ? -1 - : 0; + ? -1 + : 0; }, render: (item, record) => { return ( @@ -242,8 +242,8 @@ class Assets extends React.Component { (description.market ? description.market : coreAsset - ? coreAsset.get("symbol") - : "BTS"); + ? coreAsset.get("symbol") + : "BTS"); dataSource.push({ symbol: asset.symbol, @@ -266,8 +266,8 @@ class Assets extends React.Component { return a.symbol > b.symbol ? 1 : a.symbol < b.symbol - ? -1 - : 0; + ? -1 + : 0; }, render: item => { return ( @@ -304,8 +304,8 @@ class Assets extends React.Component { return a.currentSupply > b.currentSupply ? 1 : a.currentSupply < b.currentSupply - ? -1 - : 0; + ? -1 + : 0; }, render: (item, record) => { return ( @@ -351,8 +351,8 @@ class Assets extends React.Component { (description.market ? description.market : coreAsset - ? coreAsset.get("symbol") - : "BTS"); + ? coreAsset.get("symbol") + : "BTS"); dataSource.push({ symbol: asset.symbol, @@ -404,8 +404,8 @@ class Assets extends React.Component { (description.market ? description.market : coreAsset - ? coreAsset.get("symbol") - : "BTS"); + ? coreAsset.get("symbol") + : "BTS"); return { asset, diff --git a/app/components/Layout/Footer.jsx b/app/components/Layout/Footer.jsx index 3d59f95369..d4de1e5ac0 100644 --- a/app/components/Layout/Footer.jsx +++ b/app/components/Layout/Footer.jsx @@ -613,12 +613,11 @@ class Footer extends React.Component { }} >
- {connected && - activeNode.testNet && ( - - {" "} - - )} + {connected && activeNode.testNet && ( + + {" "} + + )} {!connected ? ( @@ -638,10 +637,10 @@ class Footer extends React.Component { {!connected ? "-" : !activeNode.ping - ? "-" - : parseInt( - activeNode.ping - ) + "ms"} + ? "-" + : parseInt( + activeNode.ping + ) + "ms"}  /  diff --git a/app/components/Modal/BorrowModal.jsx b/app/components/Modal/BorrowModal.jsx index ebcafd7df2..4fde9d1724 100755 --- a/app/components/Modal/BorrowModal.jsx +++ b/app/components/Modal/BorrowModal.jsx @@ -529,12 +529,14 @@ class BorrowModalContent extends React.Component { }; if (props && props.hasCallOrders && props.call_orders) { - currentPosition = props.call_orders.filter(a => !!a).find(a => { - return ( - a.getIn(["call_price", "quote", "asset_id"]) === - props.quote_asset.get("id") - ); - }); + currentPosition = props.call_orders + .filter(a => !!a) + .find(a => { + return ( + a.getIn(["call_price", "quote", "asset_id"]) === + props.quote_asset.get("id") + ); + }); currentPosition = !!currentPosition ? currentPosition.toJS() @@ -856,8 +858,8 @@ class BorrowModalContent extends React.Component { (errors.below_maintenance ? "has-error" : errors.close_maintenance - ? "has-warning" - : "") + ? "has-warning" + : "") } > diff --git a/app/components/Modal/DirectDebitClaimModal.jsx b/app/components/Modal/DirectDebitClaimModal.jsx index 424b8f50e9..4363cbbaf0 100644 --- a/app/components/Modal/DirectDebitClaimModal.jsx +++ b/app/components/Modal/DirectDebitClaimModal.jsx @@ -290,20 +290,16 @@ class DirectDebitClaimModal extends React.Component { content: state.memo } }).then(({fee, hasBalance, hasPoolBalance}) => { - shouldPayFeeWithAssetAsync(from_account, fee).then( - should => - should - ? this.setState( - {fee_asset_id: asset_id}, - this._updateFee - ) - : this.setState({ - feeAmount: fee, - fee_asset_id: fee.asset_id, - hasBalance, - hasPoolBalance, - error: !hasBalance || !hasPoolBalance - }) + shouldPayFeeWithAssetAsync(from_account, fee).then(should => + should + ? this.setState({fee_asset_id: asset_id}, this._updateFee) + : this.setState({ + feeAmount: fee, + fee_asset_id: fee.asset_id, + hasBalance, + hasPoolBalance, + error: !hasBalance || !hasPoolBalance + }) ); }); } @@ -643,10 +639,10 @@ class DirectDebitClaimModal extends React.Component { fee_asset_types.length && feeAmount ? feeAmount.asset_id : fee_asset_types.length === 1 - ? fee_asset_types[0] - : fee_asset_id - ? fee_asset_id - : fee_asset_types[0] + ? fee_asset_types[0] + : fee_asset_id + ? fee_asset_id + : fee_asset_types[0] } assets={fee_asset_types} display_balance={balance_fee} diff --git a/app/components/Modal/DirectDebitModal.jsx b/app/components/Modal/DirectDebitModal.jsx index 8f9a0dcbd8..83280dd417 100644 --- a/app/components/Modal/DirectDebitModal.jsx +++ b/app/components/Modal/DirectDebitModal.jsx @@ -379,20 +379,16 @@ class DirectDebitModal extends React.Component { content: null } }).then(({fee, hasBalance, hasPoolBalance}) => { - shouldPayFeeWithAssetAsync(from_account, fee).then( - should => - should - ? this.setState( - {fee_asset_id: asset_id}, - this._updateFee - ) - : this.setState({ - feeAmount: fee, - fee_asset_id: fee.asset_id, - hasBalance, - hasPoolBalance, - error: !hasBalance || !hasPoolBalance - }) + shouldPayFeeWithAssetAsync(from_account, fee).then(should => + should + ? this.setState({fee_asset_id: asset_id}, this._updateFee) + : this.setState({ + feeAmount: fee, + fee_asset_id: fee.asset_id, + hasBalance, + hasPoolBalance, + error: !hasBalance || !hasPoolBalance + }) ); }); } @@ -651,8 +647,8 @@ class DirectDebitModal extends React.Component { asset_types.length > 0 && asset ? asset.get("id") : asset_id - ? asset_id - : asset_types[0] + ? asset_id + : asset_types[0] } assets={asset_types} display_balance={balance} @@ -751,10 +747,10 @@ class DirectDebitModal extends React.Component { fee_asset_types.length && feeAmount ? feeAmount.asset_id : fee_asset_types.length === 1 - ? fee_asset_types[0] - : fee_asset_id - ? fee_asset_id - : fee_asset_types[0] + ? fee_asset_types[0] + : fee_asset_id + ? fee_asset_id + : fee_asset_types[0] } assets={fee_asset_types} display_balance={balance_fee} diff --git a/app/components/Modal/SendModal.jsx b/app/components/Modal/SendModal.jsx index 30034fa960..8968847c66 100644 --- a/app/components/Modal/SendModal.jsx +++ b/app/components/Modal/SendModal.jsx @@ -410,22 +410,21 @@ class SendModal extends React.Component { content: state.memo } }).then(({fee, hasBalance, hasPoolBalance}) => - shouldPayFeeWithAssetAsync(from_account, fee).then( - should => - should - ? this.setState( - { - fee_asset_id: asset_id - }, - this._updateFee - ) - : this.setState({ - feeAmount: fee, - fee_asset_id: fee.asset_id, - hasBalance, - hasPoolBalance, - error: !hasBalance || !hasPoolBalance - }) + shouldPayFeeWithAssetAsync(from_account, fee).then(should => + should + ? this.setState( + { + fee_asset_id: asset_id + }, + this._updateFee + ) + : this.setState({ + feeAmount: fee, + fee_asset_id: fee.asset_id, + hasBalance, + hasPoolBalance, + error: !hasBalance || !hasPoolBalance + }) ) ); } @@ -786,8 +785,8 @@ class SendModal extends React.Component { asset_types.length > 0 && asset ? asset.get("id") : asset_id - ? asset_id - : asset_types[0] + ? asset_id + : asset_types[0] } assets={asset_types} display_balance={balance} @@ -841,10 +840,10 @@ class SendModal extends React.Component { fee_asset_types.length && feeAmount ? feeAmount.asset_id : fee_asset_types.length === 1 - ? fee_asset_types[0] - : fee_asset_id - ? fee_asset_id - : fee_asset_types[0] + ? fee_asset_types[0] + : fee_asset_id + ? fee_asset_id + : fee_asset_types[0] } assets={fee_asset_types} display_balance={balance_fee} diff --git a/app/components/Modal/SettleModal.jsx b/app/components/Modal/SettleModal.jsx index f3fad202f8..b20812894c 100644 --- a/app/components/Modal/SettleModal.jsx +++ b/app/components/Modal/SettleModal.jsx @@ -1,4 +1,4 @@ -import React, { Fragment } from "react"; +import React, {Fragment} from "react"; import Immutable from "immutable"; import PropTypes from "prop-types"; import Translate from "react-translate-component"; @@ -16,7 +16,6 @@ import {Alert, Form, Modal, Button, Tooltip} from "bitshares-ui-style-guide"; import utils from "common/utils"; import AssetWrapper from "../Utility/AssetWrapper"; - const WorthLessSettlementWarning = withWorthLessSettlementFlag( ({ worthLessSettlement, @@ -156,21 +155,22 @@ class ModalContent extends React.Component { } getSettlementInfo() { - const { getDynamicObject, asset, core } = this.props; + const {getDynamicObject, asset, core} = this.props; const dynamic = getDynamicObject(asset.get("dynamic_asset_data_id")); - const currentSupply = dynamic && dynamic.size ? - dynamic.get("current_supply") : - 0; - const maintenanceInterval = core && core.size ? - core.getIn(["parameters", "maintenance_interval"]) : - 0; + const currentSupply = + dynamic && dynamic.size ? dynamic.get("current_supply") : 0; + const maintenanceInterval = + core && core.size + ? core.getIn(["parameters", "maintenance_interval"]) + : 0; const bitAsset = asset.get("bitasset").toJS(); const currentSettled = bitAsset.force_settled_volume; - const maxSettlementVolume = currentSupply * + const maxSettlementVolume = + currentSupply * (bitAsset.options.maximum_force_settlement_volume / 10000); - const remainingVolume = !currentSettled ? - maxSettlementVolume : - maxSettlementVolume - currentSettled; + const remainingVolume = !currentSettled + ? maxSettlementVolume + : maxSettlementVolume - currentSettled; const settlementDelay = bitAsset.options.force_settlement_delay_sec; return { maxSettlementVolume, @@ -331,9 +331,12 @@ class ModalContent extends React.Component { maintenanceInterval } = this.getSettlementInfo(); - const estimatedDelay = !isGlobalSettled ? (settlementDelay + - Math.floor(amount / maxSettlementVolume) * - maintenanceInterval) / 3600 : 0; + const estimatedDelay = !isGlobalSettled + ? (settlementDelay + + Math.floor(amount / maxSettlementVolume) * + maintenanceInterval) / + 3600 + : 0; return ( @@ -391,12 +397,12 @@ class ModalContent extends React.Component { assets={[assetID]} tabIndex={1} style={ - amount > remainingVolume ? - { "margin-bottom": "0" } : - {} + amount > remainingVolume + ? {"margin-bottom": "0"} + : {} } /> - {amount > remainingVolume ? + {amount > remainingVolume ? ( -
+
-
: - null} - + + ) : null}
); @@ -423,7 +428,7 @@ class ModalContent extends React.Component { ModalContent = AssetWrapper(ModalContent, { propNames: ["asset", "core"], withDynamic: true, - defaultProps: { core: "2.0.0" } + defaultProps: {core: "2.0.0"} }); class SettleModal extends React.Component { diff --git a/app/components/News.jsx b/app/components/News.jsx index 38944fe2ca..075f255ad5 100644 --- a/app/components/News.jsx +++ b/app/components/News.jsx @@ -179,13 +179,12 @@ class News extends React.Component {
{isWrong && } {isLoading ? : null} - {!isWrong && - !isLoading && ( - - )} + {!isWrong && !isLoading && ( + + )}
diff --git a/app/components/Settings/SettingsEntry.jsx b/app/components/Settings/SettingsEntry.jsx index 86029fb2f4..d319871563 100644 --- a/app/components/Settings/SettingsEntry.jsx +++ b/app/components/Settings/SettingsEntry.jsx @@ -122,21 +122,20 @@ export default class SettingsEntry extends React.Component { - {!!value.allow && - Notify.needsPermission && ( - - - - )} + {!!value.allow && Notify.needsPermission && ( + + + + )} ); diff --git a/app/components/Showcases/DirectDebit.jsx b/app/components/Showcases/DirectDebit.jsx index 8955d4587d..95520de734 100644 --- a/app/components/Showcases/DirectDebit.jsx +++ b/app/components/Showcases/DirectDebit.jsx @@ -305,8 +305,8 @@ class DirectDebit extends Component { return a.expires > b.expires ? 1 : a.expires < b.expires - ? -1 - : 0; + ? -1 + : 0; } }, { diff --git a/app/components/Utility/BindToChainState.jsx b/app/components/Utility/BindToChainState.jsx index b86b6cc749..03b32c5d77 100644 --- a/app/components/Utility/BindToChainState.jsx +++ b/app/components/Utility/BindToChainState.jsx @@ -573,10 +573,10 @@ function BindToChainState(Component, options = {}) { let stateChanged = false; /* - * are_equal_shallow won't correctly compare null to undefined, so - * we need to work around it by assigning a non-falsy value instead - * of null before making the comparison - */ + * are_equal_shallow won't correctly compare null to undefined, so + * we need to work around it by assigning a non-falsy value instead + * of null before making the comparison + */ function replaceNull(state) { let temp = {}; for (let key in state) { diff --git a/app/components/Utility/LoadingButton.jsx b/app/components/Utility/LoadingButton.jsx index b0103161aa..d181188cdc 100644 --- a/app/components/Utility/LoadingButton.jsx +++ b/app/components/Utility/LoadingButton.jsx @@ -154,8 +154,8 @@ class LoadingButton extends React.Component { return this.processingOnClick ? this.state.loading : this.props.isLoading == null - ? false - : this.props.isLoading; + ? false + : this.props.isLoading; } render() { diff --git a/app/components/Utility/TranslateWithLinks.jsx b/app/components/Utility/TranslateWithLinks.jsx index 0cccca8839..1f7835795b 100644 --- a/app/components/Utility/TranslateWithLinks.jsx +++ b/app/components/Utility/TranslateWithLinks.jsx @@ -139,6 +139,217 @@ export default class TranslateWithLinks extends React.Component { ); break; + case "change": + if (key.value && Object.keys(key.value).length > 0) { + const {votes, active, owner, memo} = key.value; + const voteDiv = votes && ( +
+ + {votes.minus.length ? ( +
+ {"- " + + counterpart.translate( + "proposal.remove" + ) + + " "}{" "} + {votes.minus.join(", ")} +
+ ) : null} + {votes.plus.length ? ( +
+ {"- " + + counterpart.translate( + "proposal.add" + ) + + " "}{" "} + {votes.plus.join(", ")} +
+ ) : null} +
+ ); + const warning = (active || owner || memo) && ( +
+ + {", "} + + {"!"} +
+ ); + const activeDiv = active && ( + + +
+ {active.keys.plus.length > 0 || + (active.accounts.plus.length > + 0 && ( +
+ {"- " + + counterpart.translate( + "proposal.add" + ) + + " "} + {active.keys.plus.join( + ", " + )}{" "} + {active.accounts.plus.map( + _tmp => ( + + {this.linkToAccount( + _tmp + )} + + ) + )} +
+ ))} + {active.keys.minus.length > 0 || + (active.accounts.minus.length > + 0 && ( +
+ {"- " + + counterpart.translate( + "proposal.remove" + ) + + " "} + {active.keys.minus.join( + ", " + )}{" "} + {active.accounts.minus.map( + _tmp => ( + + {this.linkToAccount( + _tmp + )} + + ) + )} +
+ ))} + {active.weight_threshold && ( +
+ {"- " + + counterpart.translate( + "proposal.set_threshold", + { + threshold: + active.weight_threshold + } + )} +
+ )} +
+
+ ); + const ownerDiv = owner && ( + + +
+ {owner.keys.plus.length > 0 || + (owner.accounts.plus.length > 0 && ( +
+ {"- " + + counterpart.translate( + "proposal.add" + ) + + " "} + {owner.keys.plus.join(", ")}{" "} + {owner.accounts.plus.map( + _tmp => ( + + {this.linkToAccount( + _tmp + )} + + ) + )} +
+ ))} + {owner.keys.minus.length > 0 || + (owner.accounts.minus.length > + 0 && ( +
+ {"- " + + counterpart.translate( + "proposal.remove" + ) + + " "} + {owner.keys.minus.join( + ", " + )}{" "} + {owner.accounts.minus.map( + _tmp => ( + + {this.linkToAccount( + _tmp + )} + + ) + )} +
+ ))} + {owner.weight_threshold && ( +
+ {"- " + + counterpart.translate( + "proposal.set_threshold", + { + threshold: + owner.weight_threshold + } + )} +
+ )} +
+
+ ); + const memoDiv = memo && + (memo.keys.plus.length > 0 || + memo.keys.minus.length > 0) && ( +
+ + {memo.keys.plus.length > 0 && ( +
+ {" "} + + {memo.keys.plus.join(", ")} +
+ )} + {memo.keys.minus.length > 0 && ( +
+ {" "} + - {memo.keys.minus.join(", ")} +
+ )} +
+ ); + value = ( +
+ {warning} + {voteDiv} + {activeDiv} + {ownerDiv} + {memoDiv} +
+ ); + } else { + value = ""; + } + break; case "date": if (key.value === null) { value = "-"; diff --git a/app/components/Utility/withWorthLessSettlementFlag.jsx b/app/components/Utility/withWorthLessSettlementFlag.jsx index 46473774c7..8e51a621ba 100644 --- a/app/components/Utility/withWorthLessSettlementFlag.jsx +++ b/app/components/Utility/withWorthLessSettlementFlag.jsx @@ -35,11 +35,10 @@ const withWorthLessSettlementFlag = WrappedComponent => const realMarketPricePromise = Apis.instance() .db_api() .exec("get_order_book", [shortBackingAssetId, assetId, 1]) - .then( - orderBook => - orderBook.bids.length === 0 - ? 0 - : Number(orderBook.bids[0].price) + .then(orderBook => + orderBook.bids.length === 0 + ? 0 + : Number(orderBook.bids[0].price) ); let feedPrice = null; diff --git a/app/lib/common/MarketClasses.js b/app/lib/common/MarketClasses.js index d473bb20b1..61c51c3e60 100644 --- a/app/lib/common/MarketClasses.js +++ b/app/lib/common/MarketClasses.js @@ -137,10 +137,10 @@ class Asset { temp = (this.amount * p.quote.amount) / p.base.amount; amount = Math.floor(temp); /* - * Sometimes prices are inexact for the relevant amounts, in the case - * of bids this means we need to round up in order to pay 1 sat more - * than the floored price, if we don't do this the orders don't match - */ + * Sometimes prices are inexact for the relevant amounts, in the case + * of bids this means we need to round up in order to pay 1 sat more + * than the floored price, if we don't do this the orders don't match + */ if (isBid && temp !== amount) { amount += 1; } @@ -154,10 +154,10 @@ class Asset { temp = (this.amount * p.base.amount) / p.quote.amount; amount = Math.floor(temp); /* - * Sometimes prices are inexact for the relevant amounts, in the case - * of bids this means we need to round up in order to pay 1 sat more - * than the floored price, if we don't do this the orders don't match - */ + * Sometimes prices are inexact for the relevant amounts, in the case + * of bids this means we need to round up in order to pay 1 sat more + * than the floored price, if we don't do this the orders don't match + */ if (isBid && temp !== amount) { amount += 1; } @@ -231,10 +231,10 @@ class Price { setPriceFromReal(real, base = this.base, quote = this.quote) { if (real && typeof real === "number") { /* - * In order to make large numbers work properly, we assume numbers - * larger than 100k do not need more than 5 decimals. Without this we - * quickly encounter JavaScript floating point errors for large numbers. - */ + * In order to make large numbers work properly, we assume numbers + * larger than 100k do not need more than 5 decimals. Without this we + * quickly encounter JavaScript floating point errors for large numbers. + */ if (real > 100000) { real = limitByPrecision(real, 5); @@ -642,10 +642,10 @@ class CallOrder { precisionToRatio(assets[this.collateral_id].precision); /* - * The call price is DEBT * MCR / COLLATERAL. - * Since bitshares-core 3.0.0 this is no longer done by the witness_node. - * Deal with the MCR (maintenance collateral ratio) here. - */ + * The call price is DEBT * MCR / COLLATERAL. + * Since bitshares-core 3.0.0 this is no longer done by the witness_node. + * Deal with the MCR (maintenance collateral ratio) here. + */ let base = new Asset({ asset_id: this.collateral_id, @@ -809,20 +809,20 @@ class CallOrder { let max_debt_to_cover = this._getMaxDebtToCover(), max_debt_to_cover_int; /* - * We may calculate like this: if max_debt_to_cover has no fractional - * component (e.g. 5.00 as opposed to 5.23), plus it by one Satoshi; - * otherwise, round it up. An effectively same approach is to round - * down then add one Satoshi onto the result: - */ + * We may calculate like this: if max_debt_to_cover has no fractional + * component (e.g. 5.00 as opposed to 5.23), plus it by one Satoshi; + * otherwise, round it up. An effectively same approach is to round + * down then add one Satoshi onto the result: + */ if (Math.round(max_debt_to_cover) !== max_debt_to_cover) { max_debt_to_cover_int = Math.floor(max_debt_to_cover) + 1; } /* - * With max_debt_to_cover_int in integer, max_amount_to_sell_int in - * integer can be calculated as: max_amount_to_sell_int = - * round_up(max_debt_to_cover_int / match_price) - */ + * With max_debt_to_cover_int in integer, max_amount_to_sell_int in + * integer can be calculated as: max_amount_to_sell_int = + * round_up(max_debt_to_cover_int / match_price) + */ let max_collateral_to_sell_int = Math.ceil( max_debt_to_cover_int / match_price ); @@ -842,12 +842,12 @@ class CallOrder { } /* - * Assume a USD:BTS market - * The call order will always be selling BTS in order to buy USD - * The asset being sold is always the collateral, which is call_price.base.asset_id. - * The amount being sold depends on how big the debt is, only enough - * collateral will be sold to cover the debt - */ + * Assume a USD:BTS market + * The call order will always be selling BTS in order to buy USD + * The asset being sold is always the collateral, which is call_price.base.asset_id. + * The amount being sold depends on how big the debt is, only enough + * collateral will be sold to cover the debt + */ amountForSale(isBid = this.isBid()) { /* BSIP38: @@ -899,25 +899,25 @@ class CallOrder { let orderDebt = order.iSum ? order.debt : orderUseCR - ? order.max_debt_to_cover.getAmount() - : order.amountToReceive().getAmount(); + ? order.max_debt_to_cover.getAmount() + : order.amountToReceive().getAmount(); let newOrderDebt = newOrder.iSum ? newOrder.debt : newOrderUseCR - ? newOrder.max_debt_to_cover.getAmount() - : newOrder.amountToReceive().getAmount(); + ? newOrder.max_debt_to_cover.getAmount() + : newOrder.amountToReceive().getAmount(); /* Determine which collateral values to use */ let orderCollateral = order.iSum ? order.collateral : orderUseCR - ? order.max_collateral_to_sell.getAmount() - : order.amountForSale().getAmount(); + ? order.max_collateral_to_sell.getAmount() + : order.amountForSale().getAmount(); let newOrderCollateral = newOrder.iSum ? newOrder.collateral : newOrderUseCR - ? newOrder.max_collateral_to_sell.getAmount() - : newOrder.amountForSale().getAmount(); + ? newOrder.max_collateral_to_sell.getAmount() + : newOrder.amountForSale().getAmount(); newOrder.debt = newOrderDebt + orderDebt; newOrder.collateral = newOrderCollateral + orderCollateral; @@ -1232,8 +1232,8 @@ class FillOrder { this.className = this.isCall ? "orderHistoryCall" : this.isBid - ? "orderHistoryBid" - : "orderHistoryAsk"; + ? "orderHistoryBid" + : "orderHistoryAsk"; this.time = fill.time && new Date(utils.makeISODateString(fill.time)); this.block = fill.block; this.account = fill.op.account || fill.op.account_id; diff --git a/app/routerTransition.js b/app/routerTransition.js index 6696da7d49..af452d2027 100644 --- a/app/routerTransition.js +++ b/app/routerTransition.js @@ -485,9 +485,9 @@ class RouterTransitioner { }); /* - * We've somehow filtered out all nodes, revert to the full list of - * nodes in that case - */ + * We've somehow filtered out all nodes, revert to the full list of + * nodes in that case + */ if (!filtered.length) { console.warn("No nodes length, returning all of them"); return this.getAllApiServers(); diff --git a/app/stores/MarketsStore.js b/app/stores/MarketsStore.js index 24ae417bb5..ea45e92148 100644 --- a/app/stores/MarketsStore.js +++ b/app/stores/MarketsStore.js @@ -294,10 +294,10 @@ class MarketsStore { this.activeMarket = result.market; newMarket = true; /* - * To prevent the callback from DataFeed to be called with new data - * before subscribeBars in DataFeed has been updated, we clear the - * callback subscription here - */ + * To prevent the callback from DataFeed to be called with new data + * before subscribeBars in DataFeed has been updated, we clear the + * callback subscription here + */ this.unsubscribe("subscribeBars"); } @@ -662,11 +662,11 @@ class MarketsStore { }; /* - * If the feed price changed, we need to check whether the orders - * being margin called have changed and filter accordingly. To do so - * we recreate the marketCallOrders map from scratch using the - * previously fetched data and the new feed price. - */ + * If the feed price changed, we need to check whether the orders + * being margin called have changed and filter accordingly. To do so + * we recreate the marketCallOrders map from scratch using the + * previously fetched data and the new feed price. + */ this.marketCallOrders = this.marketCallOrders.clear(); this.allCallOrders.forEach(call => { // ChainStore._updateObject(call, false, false); @@ -1103,9 +1103,9 @@ class MarketsStore { _saveMarketStats() { /* - * Only save stats once every 30s to limit writes and - * allMarketStats JS conversions - */ + * Only save stats once every 30s to limit writes and + * allMarketStats JS conversions + */ if (!this.saveStatsTimeout) { this.saveStatsTimeout = setTimeout(() => { marketStorage.set("allMarketStats", this.allMarketStats.toJS());