diff --git a/.vscode/settings.json b/.vscode/settings.json index 58030eb8b..5b0f9bb6d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -58,7 +58,7 @@ "chopa", "chopb", "cimode", - "Clawback", + "clawback", "clsx", "ctid", "CUSTOMNETWORK", @@ -76,13 +76,16 @@ "nftoken", "nodemodules", "pageview", + "paychannel", "paychannels", - "Permissioned", + "permissioned", + "setfee", "stylelint", "svgr", "topojson", "trustlines", "Txns", + "unauth", "VITE", "Xahau", "xchain", diff --git a/public/locales/ca-CA/translations.json b/public/locales/ca-CA/translations.json index bb5a0e4c4..748046e4b 100644 --- a/public/locales/ca-CA/translations.json +++ b/public/locales/ca-CA/translations.json @@ -37,7 +37,6 @@ "30D": "30D", "total_transactions": "# de Txns", "total_fees": "Total de comissions", - "async_component_timedout": "La càrrega del component ha trigat més del que s'esperava", "async_component_failed": "Error en carregar el component", "account_not_found": "No s'ha trobat el compte", "account_empty_title": "No s'ha proporcionat l'ID del compte", diff --git a/public/locales/en-US/translations.json b/public/locales/en-US/translations.json index 1b1acce98..e19f7052f 100644 --- a/public/locales/en-US/translations.json +++ b/public/locales/en-US/translations.json @@ -38,7 +38,6 @@ "30D": "30D", "total_transactions": "# of Txns", "total_fees": "Total Fees", - "async_component_timedout": "Loading component took longer than expected", "async_component_failed": "Failed to load Component", "account_not_found": "Account not found", "account_empty_title": "No account ID was supplied", @@ -275,7 +274,7 @@ "number_of_affected_node": "It affected {{count}} nodes in the ledger:", "nodes_type": "{{action}} nodes", "node_meta_type": "It {{action}} a node with type", - "transaction_balance_line_one": "It <1><0>{{action}} a <3><0>{{currency}} RippleState node between <5><0>{{account}} and <7><0>{{counterAccount}}", + "transaction_balance_line_one": "It <1><0>{{action}} a <4><0>{{currency}} RippleState node between <6><0>{{account}} and <8><0>{{counterAccount}}", "transaction_balance_line_two": "Balance changed by <1><0>{{change}} from <3><0>{{previousBalance}} to <5><0>{{finalBalance}}", "transaction_outstanding_balance_line_two": "Outstanding balance changed by <1><0>{{change}} from <3><0>{{previousBalance}} to <5><0>{{finalBalance}}", "transaction_owned_directory": "It {{action}} a DirectoryNode node owned by", @@ -287,13 +286,13 @@ "account_balance_increased": "Balance increased by <1><0>{{difference}}<1><0>{{currency}} from <3><0>{{previous}}<1><0>{{currency}} to <5><0>{{final}}<1><0>{{currency}}", "account_balance_decreased": "Balance decreased by <1><0>{{difference}}<1><0>{{currency}} from <3><0>{{previous}}<1><0>{{currency}} to <5><0>{{final}}<1><0>{{currency}}", "decreased_from_to": "decreased by <1><0>{{change}} from <3><0>{{previous}} to <5><0>{{final}}", - "offer_node_meta": "It <1><0>{{action}} a <3><0>{{pair}} offer node owned by <5><0>{{account}} with sequence # <7><0>{{sequence}}", + "offer_node_meta": "It {{action}} a / offer node owned by with sequence # {{sequence}}", "offer_replaces": "This offer replaces the existing offer #", - "offer_partially_filled": "The offer was partially filled", - "offer_filled": "The offer was filled", - "offer_cancelled": "The offer was cancelled", + "offer_partially_filled": "The offer was partially filled.", + "offer_filled": "The offer was filled.", + "offer_cancelled": "The offer was cancelled.", "offer_replaced": "This offer was replaced by the new offer #", - "offer_lack_of_funds": "The offer was partially filled, then cancelled due to lack of funds", + "offer_lack_of_funds": "The offer was partially filled, then cancelled due to lack of funds.", "transaction_sequence": "The transaction's sequence number is", "trust_set_description": "It establishes <1><0>{{amount}} as the maximum amount of <3><0>{{currency}} from <5><0>{{issuer}} that <7><0>{{account}} is willing to hold", "payment_desc_line_1": "The payment is from to ", diff --git a/public/locales/es-ES/translations.json b/public/locales/es-ES/translations.json index 58b59c84e..13a6d8ca4 100644 --- a/public/locales/es-ES/translations.json +++ b/public/locales/es-ES/translations.json @@ -37,7 +37,6 @@ "30D": "30D", "total_transactions": "# de Txs", "total_fees": "Comisiones Totales", - "async_component_timedout": "Cargar el componente tomó más tiempo del esperado", "async_component_failed": "Fallo al cargar Componente", "account_not_found": "Cuenta no encontrada", "account_empty_title": "El ID de la cuenta no fue facilitado", diff --git a/public/locales/fr-FR/translations.json b/public/locales/fr-FR/translations.json index 181a1da01..ce386f151 100644 --- a/public/locales/fr-FR/translations.json +++ b/public/locales/fr-FR/translations.json @@ -37,7 +37,6 @@ "30D": "30J", "total_transactions": "# de Txns", "total_fees": "Frais Totaux", - "async_component_timedout": "Le chargement du composant a pris plus de temps que prévu", "async_component_failed": "Impossible de charger le composant", "account_not_found": "Compte non trouvé", "account_empty_title": "Aucun id de compte n'a été fourni", diff --git a/public/locales/ja-JP/translations.json b/public/locales/ja-JP/translations.json index 47d94efd3..f394343b8 100644 --- a/public/locales/ja-JP/translations.json +++ b/public/locales/ja-JP/translations.json @@ -37,7 +37,6 @@ "30D": "30日", "total_transactions": "トランザクション数", "total_fees": "合計トランザクション手数料", - "async_component_timedout": "コンポーネントの読み込みに通常以上の時間がかかりました", "async_component_failed": "コンポーネントの読み込みに失敗しました", "account_not_found": "アカウントが見つかりません", "account_empty_title": "アカウントIDが入力されていません", diff --git a/public/locales/ko-KR/translations.json b/public/locales/ko-KR/translations.json index e701bfa39..53d5bfb10 100644 --- a/public/locales/ko-KR/translations.json +++ b/public/locales/ko-KR/translations.json @@ -38,7 +38,6 @@ "30D": "30일", "total_transactions": "트랜잭션 수", "total_fees": "총 수수료", - "async_component_timedout": "컴포넌트 로딩이 예상보다 오래 걸렸습니다", "async_component_failed": "컴포넌트 로드 실패", "account_not_found": "계정을 찾을 수 없습니다", "account_empty_title": "계정 ID가 제공되지 않았습니다", diff --git a/public/locales/my-MM/translations.json b/public/locales/my-MM/translations.json index 0a2cc50e4..86e62cacb 100644 --- a/public/locales/my-MM/translations.json +++ b/public/locales/my-MM/translations.json @@ -38,7 +38,6 @@ "30D": "၃၀ရက်", "total_transactions": "ငွေလွှဲမှု အရေအတွက်", "total_fees": "စုစုပေါင်း အခကြေးငွေ", - "async_component_timedout": "ကော်မပိုနင့် ဖွင့်ရန် မျှော်လင့်ထားသည်ထက် ပိုကြာနေပါသည်", "async_component_failed": "ကော်မပိုနင့် ဖွင့်၍မရပါ", "account_not_found": "အကောင့် မတွေ့ရှိပါ", "account_empty_title": "အကောင့် ID ထည့်သွင်းထားခြင်း မရှိပါ", diff --git a/src/containers/Transactions/DetailTab/Meta/Offer.tsx b/src/containers/Transactions/DetailTab/Meta/Offer.tsx index 7d2099c14..e0eb69e24 100644 --- a/src/containers/Transactions/DetailTab/Meta/Offer.tsx +++ b/src/containers/Transactions/DetailTab/Meta/Offer.tsx @@ -7,6 +7,7 @@ import { } from '../../../shared/transactionUtils' import { localizeNumber } from '../../../shared/utils' import { Account } from '../../../shared/components/Account' +import Currency from '../../../shared/components/Currency' import type { MetaRenderFunctionWithTx, MetaNode } from './types' const normalize = (value: number | string, currency: string): string => @@ -30,21 +31,18 @@ const renderChanges = ( const changePays = normalize(prevPays - finalPays, paysCurrency) const changeGets = normalize(prevGets - finalGets, getsCurrency) - const renderIssuer = (issuer) => - issuer ? ( - <> - . - - - ) : null - if (prevPays && finalPays) { const options = { ...CURRENCY_OPTIONS, currency: paysCurrency } meta.push(
  • TakerPays - {paysCurrency} - {renderIssuer(final.TakerPays.issuer)}{' '} + + + {' '} decreased by {{ change: localizeNumber(changePays, language, options) }} @@ -77,8 +75,13 @@ const renderChanges = ( meta.push(
  • TakerGets - {getsCurrency} - {renderIssuer(final.TakerGets.issuer)}{' '} + + + {' '} decreased by {{ change: localizeNumber(changeGets, language, options) }} @@ -128,9 +131,6 @@ const render: MetaRenderFunctionWithTx = ( ) const invert = CURRENCY_ORDER.indexOf(getsCurrency) > CURRENCY_ORDER.indexOf(paysCurrency) - const pair = invert - ? `${getsCurrency}/${paysCurrency}` - : `${paysCurrency}/${getsCurrency}` if ( action === 'created' && @@ -188,12 +188,29 @@ const render: MetaRenderFunctionWithTx = ( return (
  • - - It {action} a {pair} - owned by - - with sequence # {{ sequence: fields.Sequence }} - + + ), + Currency2: ( + + ), + Account: , + }} + />
      {lines}
  • ) diff --git a/src/containers/Transactions/DetailTab/Meta/RippleState.tsx b/src/containers/Transactions/DetailTab/Meta/RippleState.tsx index df9baac8d..d6a1decb6 100644 --- a/src/containers/Transactions/DetailTab/Meta/RippleState.tsx +++ b/src/containers/Transactions/DetailTab/Meta/RippleState.tsx @@ -4,6 +4,7 @@ import { localizeNumber, computeRippleStateBalanceChange, } from '../../../shared/utils' +import Currency from '../../../shared/components/Currency' import type { MetaRenderFunction } from './types' const render: MetaRenderFunction = (_t, language, action, node, index) => { @@ -19,8 +20,11 @@ const render: MetaRenderFunction = (_t, language, action, node, index) => { const line1 = ( - It {action} a {currency} - ripplestate node between + It {action} a{' '} + + + + RippleState node between and diff --git a/src/containers/Transactions/DetailTab/Meta/index.tsx b/src/containers/Transactions/DetailTab/Meta/index.tsx index a7a6cc226..39ebf7ed3 100644 --- a/src/containers/Transactions/DetailTab/Meta/index.tsx +++ b/src/containers/Transactions/DetailTab/Meta/index.tsx @@ -1,5 +1,6 @@ import { FC } from 'react' import { useTranslation } from 'react-i18next' +import { TFunction } from 'i18next' import renderAccountRoot from './AccountRoot' import renderDirectoryNode from './DirectoryNode' import renderOffer from './Offer' @@ -10,7 +11,12 @@ import renderMPTokenIssuance from './MPTokenIssuance' import { groupAffectedNodes } from '../../../shared/transactionUtils' import { useLanguage } from '../../../shared/hooks' -const renderDefault = (t, action, node, index) => ( +const renderDefault = ( + t: TFunction<'translations', undefined>, + action: string, + node: any, + index: number, +) => (
  • {t('node_meta_type', { action })} {node.LedgerEntryType}
  • @@ -20,7 +26,7 @@ export const TransactionMeta: FC<{ data: any }> = ({ data }) => { const language = useLanguage() const { t } = useTranslation() - const renderNodesMeta = (action, list, tx) => { + const renderNodesMeta = (action: string, list: any[], tx: any) => { const meta = list.map((node, index) => { switch (node.LedgerEntryType) { case 'AccountRoot': diff --git a/src/containers/Transactions/test/Meta.test.tsx b/src/containers/Transactions/test/Meta.test.tsx index 65077b327..73aab48d7 100644 --- a/src/containers/Transactions/test/Meta.test.tsx +++ b/src/containers/Transactions/test/Meta.test.tsx @@ -36,7 +36,7 @@ describe('TransactionMeta container', () => { const listItems = container.querySelectorAll('li') - // Check first list item contains expected content + // Check first list item contains expected content (AccountRoot) expect(listItems[0]).toHaveTextContent('owned_account_root') expect(listItems[0]).toHaveTextContent('rUmustd4TbkjaEuS7S1damozpBEREgRz9z') expect(listItems[0]).toHaveTextContent('Balance decreased by') @@ -62,10 +62,8 @@ describe('TransactionMeta container', () => { expect(listItems[6]).toHaveTextContent('transaction_owned_directory') expect(listItems[6]).toHaveTextContent('rETx8GBiH6fxhTcfHM9fGeyShqxozyD3xe') - // Check offer modification - expect(listItems[7]).toHaveTextContent('XRP/CNY') - expect(listItems[7]).toHaveTextContent('rEGoBvzusE2MkDn3yrgZc817XiwRofqoJq') - expect(listItems[7]).toHaveTextContent('1181517') + // Check first offer modification + expect(listItems[7]).toHaveTextContent('offer_node_meta') expect(listItems[8]).toHaveTextContent('offer_partially_filled') @@ -79,11 +77,7 @@ describe('TransactionMeta container', () => { ) // Check second offer modification - expect(listItems[11]).toHaveTextContent('XRP/CNY') - expect(listItems[11]).toHaveTextContent( - 'rUmustd4TbkjaEuS7S1damozpBEREgRz9z', - ) - expect(listItems[11]).toHaveTextContent('5804') + expect(listItems[11]).toHaveTextContent('offer_node_meta') expect(listItems[12]).toHaveTextContent('offer_partially_filled') @@ -95,7 +89,7 @@ describe('TransactionMeta container', () => { // Check ripplestate nodes expect(listItems[15]).toHaveTextContent('CNY') - expect(listItems[15]).toHaveTextContent('ripplestate') + expect(listItems[15]).toHaveTextContent('RippleState') expect(listItems[15]).toHaveTextContent( 'rUmustd4TbkjaEuS7S1damozpBEREgRz9z', ) @@ -103,17 +97,17 @@ describe('TransactionMeta container', () => { expect(listItems[16]).toHaveTextContent('Balance changed by') expect(listItems[17]).toHaveTextContent('CNY') - expect(listItems[17]).toHaveTextContent('ripplestate') + expect(listItems[17]).toHaveTextContent('RippleState') expect(listItems[18]).toHaveTextContent('Balance changed by') expect(listItems[19]).toHaveTextContent('CNY') - expect(listItems[19]).toHaveTextContent('ripplestate') + expect(listItems[19]).toHaveTextContent('RippleState') expect(listItems[20]).toHaveTextContent('Balance changed by') expect(listItems[21]).toHaveTextContent('CNY') - expect(listItems[21]).toHaveTextContent('ripplestate') + expect(listItems[21]).toHaveTextContent('RippleState') expect(listItems[22]).toHaveTextContent('Balance changed by') }) diff --git a/src/containers/shared/components/Transaction/OfferCancel/test/OfferCreateDescription.test.tsx b/src/containers/shared/components/Transaction/OfferCancel/test/OfferCancelDescription.test.tsx similarity index 100% rename from src/containers/shared/components/Transaction/OfferCancel/test/OfferCreateDescription.test.tsx rename to src/containers/shared/components/Transaction/OfferCancel/test/OfferCancelDescription.test.tsx diff --git a/src/containers/shared/components/Transaction/OfferCancel/test/OfferCreateSimple.test.tsx b/src/containers/shared/components/Transaction/OfferCancel/test/OfferCancelSimple.test.tsx similarity index 100% rename from src/containers/shared/components/Transaction/OfferCancel/test/OfferCreateSimple.test.tsx rename to src/containers/shared/components/Transaction/OfferCancel/test/OfferCancelSimple.test.tsx diff --git a/src/containers/shared/components/Transaction/OfferCancel/test/OfferCreateTableDetail.test.tsx b/src/containers/shared/components/Transaction/OfferCancel/test/OfferCancelTableDetail.test.tsx similarity index 100% rename from src/containers/shared/components/Transaction/OfferCancel/test/OfferCreateTableDetail.test.tsx rename to src/containers/shared/components/Transaction/OfferCancel/test/OfferCancelTableDetail.test.tsx diff --git a/src/containers/shared/components/Transaction/OfferCreate/Description.tsx b/src/containers/shared/components/Transaction/OfferCreate/Description.tsx index 10764b7c8..eb3b463ee 100644 --- a/src/containers/shared/components/Transaction/OfferCreate/Description.tsx +++ b/src/containers/shared/components/Transaction/OfferCreate/Description.tsx @@ -4,7 +4,6 @@ import { DATE_OPTIONS, CURRENCY_ORDER, XRP_BASE, - normalizeAmount, } from '../../../transactionUtils' import { Account } from '../../Account' import { @@ -12,6 +11,9 @@ import { TransactionDescriptionProps, } from '../types' import { convertRippleDate } from '../../../../../rippled/lib/utils' +import Currency from '../../Currency' +import { Amount } from '../../Amount' +import { formatAmount } from '../../../../../rippled/lib/txSummary/formatAmount' const normalize = (amount: any) => amount.value || amount / XRP_BASE @@ -33,9 +35,37 @@ const Description: TransactionDescriptionComponent = ( if (invert) { rate = 1 / rate - pair = `${getsCurrency}/${paysCurrency}` + pair = ( + + + / + + + ) } else { - pair = `${paysCurrency}/${getsCurrency}` + pair = ( + + + / + + + ) } const renderLine4 = () => { @@ -66,13 +96,11 @@ const Description: TransactionDescriptionComponent = ( offered to pay - {normalizeAmount(data.tx.TakerGets, language)} - {data.tx.TakerGets.currency || 'XRP'} + in order to receive - {normalizeAmount(data.tx.TakerPays, language)} - {data.tx.TakerPays.currency || 'XRP'} +
    @@ -80,7 +108,7 @@ const Description: TransactionDescriptionComponent = ( {t('offer_create_desc_line_2')} {rate.toPrecision(5)} - {pair} + {pair} {data.tx.OfferSequence && ( diff --git a/src/containers/shared/components/Transaction/OfferCreate/test/OfferCreateDescription.test.tsx b/src/containers/shared/components/Transaction/OfferCreate/test/OfferCreateDescription.test.tsx index 4e5ea5ee3..0b9921e84 100644 --- a/src/containers/shared/components/Transaction/OfferCreate/test/OfferCreateDescription.test.tsx +++ b/src/containers/shared/components/Transaction/OfferCreate/test/OfferCreateDescription.test.tsx @@ -11,7 +11,7 @@ describe('OfferCreate: Description', () => { const { container, unmount } = renderComponent(OfferCreate) expect(container.innerHTML).toBe( - '
    The accountoffered to pay1,080,661.95882CSCin order to receive\uE9001,764.293151XRP
    offer_create_desc_line_2 612.52XRP/CSC
    offer_create_desc_line_3 44866443
    The offer expiresMay 18, 2022 at 5:28:16 PM UTCunless cancelled before', + '
    The accountoffered to pay1,080,661.95882 CSC.rCSCManTZ8ME9EoLrSHHYKW8PPwWMgkwrin order to receive1,764.293151 XRP
    offer_create_desc_line_2 612.52XRP/CSC.rCSCManTZ8ME9EoLrSHHYKW8PPwWMgkwr
    offer_create_desc_line_3 44866443
    The offer expiresMay 18, 2022 at 5:28:16 PM UTCunless cancelled before', ) unmount() }) @@ -22,7 +22,7 @@ describe('OfferCreate: Description', () => { ) expect(container.innerHTML).toBe( - '
    The accountoffered to pay\uE90017,588.363594XRPin order to receive$6,101.33033905USD
    offer_create_desc_line_2 0.34690XRP/USD
    offer_create_desc_line_3 80543309
    ', + '
    The accountoffered to pay17,588.363594 XRPin order to receive$6,101.33033905 USD.rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B
    offer_create_desc_line_2 0.34690XRP/USD.rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B
    offer_create_desc_line_3 80543309
    ', ) unmount() }) @@ -33,7 +33,7 @@ describe('OfferCreate: Description', () => { ) expect(container.innerHTML).toBe( - '
    The accountoffered to pay\uE90017,588.363594XRPin order to receive$10.00USD
    offer_create_desc_line_2 0.00056856XRP/USD
    offer_create_desc_line_5: 4A4879496CFF23CA32242D50DA04DDB41F4561167276A62AF21899F83DF28812
    ', + '
    The accountoffered to pay17,588.363594 XRPin order to receive$10.00 USD.rnybsH3BZKKCG7fwPzTeLtGejnq6UQyNCC
    offer_create_desc_line_2 0.00056856XRP/USD.rnybsH3BZKKCG7fwPzTeLtGejnq6UQyNCC
    offer_create_desc_line_5: 4A4879496CFF23CA32242D50DA04DDB41F4561167276A62AF21899F83DF28812
    ', ) unmount() })