diff --git a/app/actions/transaction-actions.js b/app/actions/transaction-actions.js index ad2f08c..fbcc49e 100644 --- a/app/actions/transaction-actions.js +++ b/app/actions/transaction-actions.js @@ -86,7 +86,6 @@ export const formatTransaction = async (type, operation, blockNumber, resultId, } const block = await Services.getEcho().api.getBlock(blockNumber); - const feeAsset = await Services.getEcho().api.getObject(operation.getIn(['fee', 'asset_id'])); let { name, options } = Object.values(OPERATIONS).find((i) => i.value === type); @@ -98,12 +97,16 @@ export const formatTransaction = async (type, operation, blockNumber, resultId, type, name, timestamp: block.timestamp, - fee: { + }; + + if (operation.get('fee')) { + const feeAsset = await Services.getEcho().api.getObject(operation.getIn(['fee', 'asset_id'])); + object.fee = { amount: operation.getIn(['fee', 'amount']), precision: feeAsset.precision, symbol: feeAsset.symbol, - }, - }; + }; + } if (CONTRACT_TYPES.includes(type)) { const result = await Services.getEcho().api.getContractResult(resultId); @@ -138,8 +141,9 @@ export const formatTransaction = async (type, operation, blockNumber, resultId, value: field, id: field, }; + case OPTION_TYPES.ECHO_ASSET: case OPTION_TYPES.ASSET: - response = await Services.getEcho().api.getObject(field); + response = await Services.getEcho().api.getObject(field || ECHO_ASSET_ID); return { ...base, @@ -257,11 +261,11 @@ const getFilteredHistory = async (filter, offset = 0, count = DEFAULT_HISTORY_CO ); let transactions = items.map(({ - id, body, transaction, result, + id, body, transaction, result, virtual, block, }) => formatTransaction( Number(id), fromJS(body), - transaction.block.round, + virtual ? block.round : transaction.block.round, result, selectedAccounts, )); @@ -319,10 +323,7 @@ export const setDefaultFilters = () => async (dispatch, getState) => { coins = coins.map((i) => ({ ...i, selected: true })); filter = filter.set('coins', fromJS(coins)); - // TODO: delete slice after adding new operation to graphql - const oldOperations = Object.keys(OPERATIONS).slice(0, Object.keys(OPERATIONS).length - 7); - - filter = filter.set('types', fromJS(oldOperations.map((type) => ({ + filter = filter.set('types', fromJS(Object.keys(OPERATIONS).map((type) => ({ type, name: OPERATIONS[type].name, selected: true, @@ -449,7 +450,7 @@ export const loadMoreTransactions = () => async (dispatch, getState) => { * @returns {Function} */ export const setNewTransaction = ({ - id, body, transaction, result, + id, body, transaction, result, virtual, block, }) => async (dispatch, getState) => { const selectedAccounts = getState().wallet.getIn(['history', 'filter', 'accounts']) @@ -459,7 +460,7 @@ export const setNewTransaction = ({ const operation = await formatTransaction( Number(id), fromJS(body), - transaction.block.round, + virtual ? block.round : transaction.block.round, result, selectedAccounts, ); diff --git a/app/components/history/index.jsx b/app/components/history/index.jsx index 7e7f22b..a28b375 100644 --- a/app/components/history/index.jsx +++ b/app/components/history/index.jsx @@ -226,7 +226,7 @@ class History extends React.Component {
  • { /* left */ - transaction.get('subject') ? ( + transaction.get('from') && transaction.get('subject') ? ( ) : null } diff --git a/app/constants/transaction-constants.js b/app/constants/transaction-constants.js index 5a9ca45..61fe0ef 100644 --- a/app/constants/transaction-constants.js +++ b/app/constants/transaction-constants.js @@ -14,6 +14,7 @@ export const OPTION_TYPES = { CONTRACT_ADDRESS: 'eth_address', EETH_ASSET: 'eEth', ERC20_TOKEN: 'erc20_token', + ECHO_ASSET: 'ECHO', }; export const CONTRACT_TYPES = [ @@ -147,7 +148,7 @@ export const OPERATIONS = { asset: null, }, }, - asset_bitasset_update: { + asset_update_bitasset: { value: OPERATIONS_IDS.ASSET_UPDATE_BITASSET, name: 'operations.asset_bitasset_update.title', options: { @@ -429,6 +430,26 @@ export const OPERATIONS = { }, }, }, + balance_unfreeze: { + value: OPERATIONS_IDS.BALANCE_UNFREEZE, + name: 'operations.balance_unfreeze.title', + options: { + from: { + field: 'account', + type: OPTION_TYPES.ACCOUNT, + label: 'operations.balance_unfreeze.from', + }, + subject: null, + amount: { + field: 'amount.amount', + type: OPTION_TYPES.NUMBER, + }, + asset: { + field: 'amount.asset_id', + type: OPTION_TYPES.ASSET, + }, + }, + }, override_transfer: { value: OPERATIONS_IDS.OVERRIDE_TRANSFER, name: 'operations.override_transfer.title', @@ -1011,5 +1032,23 @@ export const OPERATIONS = { asset: null, }, }, - + block_reward_operation: { + value: OPERATIONS_IDS.BLOCK_REWARD, + name: 'operations.block_reward.title', + options: { + from: null, + subject: { + field: 'reciever', + type: OPTION_TYPES.ACCOUNT, + label: 'operations.block_reward.subject', + }, + amount: { + field: 'amount', + type: OPTION_TYPES.NUMBER, + }, + asset: { + type: OPTION_TYPES.ECHO_ASSET, + }, + }, + }, }; diff --git a/app/services/queries/transaction-queries.js b/app/services/queries/transaction-queries.js index ee521a5..1ac1a80 100644 --- a/app/services/queries/transaction-queries.js +++ b/app/services/queries/transaction-queries.js @@ -14,7 +14,11 @@ export const getHistoryByAccounts = (accounts, assets, tokens, operations, offse round } }, - result + result, + block { + round + }, + virtual }, total } diff --git a/app/services/subscriptions/transaction-subscriptions.js b/app/services/subscriptions/transaction-subscriptions.js index 918f591..817ea74 100644 --- a/app/services/subscriptions/transaction-subscriptions.js +++ b/app/services/subscriptions/transaction-subscriptions.js @@ -33,7 +33,11 @@ export const newOperation = (filter) => { round } }, - result + result, + block { + round + }, + virtual } } `; diff --git a/app/translations/en.json b/app/translations/en.json index eb20eb1..1eb6a0a 100644 --- a/app/translations/en.json +++ b/app/translations/en.json @@ -288,6 +288,10 @@ "title": "Freeze balance", "from": "Account" }, + "balance_unfreeze": { + "title": "Unfreeze balance", + "from": "Account" + }, "override_transfer": { "title": "Override transfer", "from": "From", @@ -425,6 +429,10 @@ "sidechain_btc_aggregate": { "title": "Aggregate BTC", "subject": "Transaction ID" + }, + "block_reward": { + "title": "Block reward", + "subject": "Account" } }, diff --git a/app/translations/ru.json b/app/translations/ru.json index e71ca6a..c9ebb94 100644 --- a/app/translations/ru.json +++ b/app/translations/ru.json @@ -307,6 +307,10 @@ "title": "Заморозить баланс", "from": "Аккаунт" }, + "balance_unfreeze": { + "title": "Разморозить баланс", + "from": "Аккаунт" + }, "override_transfer": { "title": "Отменить перевод", "from": "Отправитель", @@ -444,7 +448,11 @@ "sidechain_btc_aggregate": { "title": "Объединение BTC", "subject": "ID транзакции" - } + }, + "block_reward": { + "title": "Вознаграждение за блок", + "subject": "Аккаунт" + } }, "send": { diff --git a/package.json b/package.json index 6a80e50..ccd7f8d 100644 --- a/package.json +++ b/package.json @@ -271,7 +271,7 @@ "connected-react-router": "^5.0.1", "crypto-random-string": "^1.0.0", "devtron": "^1.4.0", - "echojs-lib": "^1.8.1-rc.3", + "echojs-lib": "^1.8.1-rc.5", "echojs-ping": "^0.1.5", "electron-debug": "^2.0.0", "electron-log": "^2.2.17",