From 68ad193a73fbe191f5828b7eec5b80d73b4f0bf2 Mon Sep 17 00:00:00 2001 From: Lathan Britz Date: Wed, 22 May 2024 12:29:41 -0400 Subject: [PATCH 01/11] breakdown tab for payments and offercreates --- package-lock.json | 101 ++++-- package.json | 3 +- public/locales/ca-CA/translations.json | 7 +- public/locales/en-US/translations.json | 7 +- .../BreakDownTab/breakDownTab.scss | 119 +++++++ .../Transactions/BreakDownTab/index.tsx | 303 ++++++++++++++++++ src/containers/Transactions/index.tsx | 10 + 7 files changed, 519 insertions(+), 31 deletions(-) create mode 100644 src/containers/Transactions/BreakDownTab/breakDownTab.scss create mode 100644 src/containers/Transactions/BreakDownTab/index.tsx diff --git a/package-lock.json b/package-lock.json index 7b1f75f3a..3d3492750 100644 --- a/package-lock.json +++ b/package-lock.json @@ -59,7 +59,8 @@ "vite-plugin-html": "^3.2.0", "vite-plugin-svgr": "^4.2.0", "vite-tsconfig-paths": "^4.2.0", - "xrpl-client": "^2.1.0" + "xrpl-client": "^2.1.0", + "xrpl-tx-path-parser": "github:shortthefomo/xrpl-tx-path-parser#dev" }, "devDependencies": { "@babel/eslint-parser": "^7.22.6", @@ -5351,7 +5352,6 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", - "dev": true, "dependencies": { "@noble/hashes": "1.3.2" }, @@ -5521,7 +5521,6 @@ "version": "1.3.2", "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.2.tgz", "integrity": "sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA==", - "dev": true, "dependencies": { "@noble/curves": "~1.2.0", "@noble/hashes": "~1.3.2", @@ -5535,7 +5534,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz", "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==", - "dev": true, "dependencies": { "@noble/hashes": "~1.3.0", "@scure/base": "~1.1.0" @@ -6878,12 +6876,33 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/@xrplf/secret-numbers/-/secret-numbers-1.0.0.tgz", "integrity": "sha512-qsCLGyqe1zaq9j7PZJopK+iGTGRbk6akkg6iZXJJgxKwck0C5x5Gnwlb1HKYGOwPKyrXWpV6a2YmcpNpUFctGg==", - "dev": true, "dependencies": { "@xrplf/isomorphic": "^1.0.0", "ripple-keypairs": "^2.0.0" } }, + "node_modules/@xrplkit/amount": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@xrplkit/amount/-/amount-1.2.3.tgz", + "integrity": "sha512-poV7ym7EhjAlEGym9Kc3AHuy3uuhVW3qnl2KDr8D4zk7hANj7aG6l1XdtWIAGAgBpHnvPEaOG7+llPRRv1irZw==", + "dependencies": { + "@xrplkit/xfl": "2.0.2" + } + }, + "node_modules/@xrplkit/txmeta": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@xrplkit/txmeta/-/txmeta-1.3.1.tgz", + "integrity": "sha512-iJNtLgXTpbuYBI0VDsXJhi3MHxmsCdWsI3OumETk+21HjxDw1AmPGmVHWu8q8turFth1qzRIAtHjxLHDl307sg==", + "dependencies": { + "@xrplkit/amount": "1.2.3", + "@xrplkit/xfl": "2.0.2" + } + }, + "node_modules/@xrplkit/xfl": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@xrplkit/xfl/-/xfl-2.0.2.tgz", + "integrity": "sha512-OUZZzSoXSxYxuhBcz08Wb9Xme71PkFYejk3vq4jPzdXreVhF71ZrM6nSObHFgasC8/srWKoqiS37CnB2Ht3k/g==" + }, "node_modules/abab": { "version": "2.0.5", "dev": true, @@ -9825,10 +9844,9 @@ } }, "node_modules/decimal.js": { - "version": "10.3.1", - "dev": true, - "license": "MIT", - "peer": true + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", + "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==" }, "node_modules/decimal.js-light": { "version": "2.5.1", @@ -23893,7 +23911,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/ripple-binary-codec/-/ripple-binary-codec-2.0.0.tgz", "integrity": "sha512-zakENc9A5dlW85uzrmQHrJehymhL59ftggboRNrjxFDJdlNJ6DSE210P3ys/9kL0oVtOzFnTrOPFfxHZeOsA/Q==", - "dev": true, "dependencies": { "@xrplf/isomorphic": "^1.0.0", "bignumber.js": "^9.0.0", @@ -23907,7 +23924,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/ripple-keypairs/-/ripple-keypairs-2.0.0.tgz", "integrity": "sha512-b5rfL2EZiffmklqZk1W+dvSy97v3V/C7936WxCCgDynaGPp7GE6R2XO7EU9O2LlM/z95rj870IylYnOQs+1Rag==", - "dev": true, "dependencies": { "@noble/curves": "^1.0.0", "@xrplf/isomorphic": "^1.0.0", @@ -27964,7 +27980,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/xrpl/-/xrpl-3.0.0.tgz", "integrity": "sha512-QC+dNx3tvMEn9IrxcXFFa0rWwvBwACkGFNKl+W2miMGYnlgSiIsnjdqwtG2WRs0Pyxs5dd9nBTQHyQ1BPxZ78A==", - "dev": true, "dependencies": { "@scure/bip32": "^1.3.1", "@scure/bip39": "^1.2.1", @@ -27990,11 +28005,20 @@ "websocket": "^1.0.34" } }, + "node_modules/xrpl-tx-path-parser": { + "version": "1.0.4", + "resolved": "git+ssh://git@github.com/shortthefomo/xrpl-tx-path-parser.git#8f5f4d5bc3bc83c6fffedf9bfe172d5a3c9d1c76", + "license": "ISC", + "dependencies": { + "@xrplkit/txmeta": "^1.3.1", + "decimal.js": "^10.4.3", + "xrpl": "^3.0.0" + } + }, "node_modules/xrpl/node_modules/cross-fetch": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", - "dev": true, "dependencies": { "node-fetch": "^2.6.12" } @@ -28002,8 +28026,7 @@ "node_modules/xrpl/node_modules/eventemitter3": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", - "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", - "dev": true + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" }, "node_modules/y18n": { "version": "4.0.3", @@ -31558,7 +31581,6 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", - "dev": true, "requires": { "@noble/hashes": "1.3.2" } @@ -31665,7 +31687,6 @@ "version": "1.3.2", "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.2.tgz", "integrity": "sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA==", - "dev": true, "requires": { "@noble/curves": "~1.2.0", "@noble/hashes": "~1.3.2", @@ -31676,7 +31697,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz", "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==", - "dev": true, "requires": { "@noble/hashes": "~1.3.0", "@scure/base": "~1.1.0" @@ -32576,12 +32596,33 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/@xrplf/secret-numbers/-/secret-numbers-1.0.0.tgz", "integrity": "sha512-qsCLGyqe1zaq9j7PZJopK+iGTGRbk6akkg6iZXJJgxKwck0C5x5Gnwlb1HKYGOwPKyrXWpV6a2YmcpNpUFctGg==", - "dev": true, "requires": { "@xrplf/isomorphic": "^1.0.0", "ripple-keypairs": "^2.0.0" } }, + "@xrplkit/amount": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@xrplkit/amount/-/amount-1.2.3.tgz", + "integrity": "sha512-poV7ym7EhjAlEGym9Kc3AHuy3uuhVW3qnl2KDr8D4zk7hANj7aG6l1XdtWIAGAgBpHnvPEaOG7+llPRRv1irZw==", + "requires": { + "@xrplkit/xfl": "2.0.2" + } + }, + "@xrplkit/txmeta": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@xrplkit/txmeta/-/txmeta-1.3.1.tgz", + "integrity": "sha512-iJNtLgXTpbuYBI0VDsXJhi3MHxmsCdWsI3OumETk+21HjxDw1AmPGmVHWu8q8turFth1qzRIAtHjxLHDl307sg==", + "requires": { + "@xrplkit/amount": "1.2.3", + "@xrplkit/xfl": "2.0.2" + } + }, + "@xrplkit/xfl": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@xrplkit/xfl/-/xfl-2.0.2.tgz", + "integrity": "sha512-OUZZzSoXSxYxuhBcz08Wb9Xme71PkFYejk3vq4jPzdXreVhF71ZrM6nSObHFgasC8/srWKoqiS37CnB2Ht3k/g==" + }, "abab": { "version": "2.0.5", "dev": true @@ -34648,9 +34689,9 @@ } }, "decimal.js": { - "version": "10.3.1", - "dev": true, - "peer": true + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", + "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==" }, "decimal.js-light": { "version": "2.5.1" @@ -44266,7 +44307,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/ripple-binary-codec/-/ripple-binary-codec-2.0.0.tgz", "integrity": "sha512-zakENc9A5dlW85uzrmQHrJehymhL59ftggboRNrjxFDJdlNJ6DSE210P3ys/9kL0oVtOzFnTrOPFfxHZeOsA/Q==", - "dev": true, "requires": { "@xrplf/isomorphic": "^1.0.0", "bignumber.js": "^9.0.0", @@ -44277,7 +44317,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/ripple-keypairs/-/ripple-keypairs-2.0.0.tgz", "integrity": "sha512-b5rfL2EZiffmklqZk1W+dvSy97v3V/C7936WxCCgDynaGPp7GE6R2XO7EU9O2LlM/z95rj870IylYnOQs+1Rag==", - "dev": true, "requires": { "@noble/curves": "^1.0.0", "@xrplf/isomorphic": "^1.0.0", @@ -46953,7 +46992,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/xrpl/-/xrpl-3.0.0.tgz", "integrity": "sha512-QC+dNx3tvMEn9IrxcXFFa0rWwvBwACkGFNKl+W2miMGYnlgSiIsnjdqwtG2WRs0Pyxs5dd9nBTQHyQ1BPxZ78A==", - "dev": true, "requires": { "@scure/bip32": "^1.3.1", "@scure/bip39": "^1.2.1", @@ -46971,7 +47009,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", - "dev": true, "requires": { "node-fetch": "^2.6.12" } @@ -46979,8 +47016,7 @@ "eventemitter3": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", - "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", - "dev": true + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" } } }, @@ -46993,6 +47029,15 @@ "websocket": "^1.0.34" } }, + "xrpl-tx-path-parser": { + "version": "git+ssh://git@github.com/shortthefomo/xrpl-tx-path-parser.git#8f5f4d5bc3bc83c6fffedf9bfe172d5a3c9d1c76", + "from": "xrpl-tx-path-parser@github:shortthefomo/xrpl-tx-path-parser#dev", + "requires": { + "@xrplkit/txmeta": "^1.3.1", + "decimal.js": "^10.4.3", + "xrpl": "^3.0.0" + } + }, "y18n": { "version": "4.0.3", "dev": true, diff --git a/package.json b/package.json index 9a0de5711..9065f14e3 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,8 @@ "vite-plugin-html": "^3.2.0", "vite-plugin-svgr": "^4.2.0", "vite-tsconfig-paths": "^4.2.0", - "xrpl-client": "^2.1.0" + "xrpl-client": "^2.1.0", + "xrpl-tx-path-parser": "github:shortthefomo/xrpl-tx-path-parser#dev" }, "devDependencies": { "@babel/eslint-parser": "^7.22.6", diff --git a/public/locales/ca-CA/translations.json b/public/locales/ca-CA/translations.json index 1e7efac16..8c7a11d27 100644 --- a/public/locales/ca-CA/translations.json +++ b/public/locales/ca-CA/translations.json @@ -75,6 +75,7 @@ "not_found_default_title": "No s'ha trobat la pàgina", "not_found_check_url": "Si us plau, comproba l'URL", "not_found": "No s'ha trobat", + "breakdown": "Breakdown", "buy": "Compra", "sell": "Ven", "price": "Preu", @@ -522,5 +523,9 @@ "note": "Nota", "indicate_unl": "indica un validador en una UNL", "transaction_tokens_involved": " i ", - "transaction_tokens_swapped": " per " + "transaction_tokens_swapped": " per ", + "graph_dependant_currency": "*Graph is dependant on the currency used.", + "incomplete_transaction": "Incomplete transaction", + "liquidity_source": "Liquidity Source", + "balance_changes": "Balance Changes" } diff --git a/public/locales/en-US/translations.json b/public/locales/en-US/translations.json index 9d7630114..9af853fcb 100644 --- a/public/locales/en-US/translations.json +++ b/public/locales/en-US/translations.json @@ -76,6 +76,7 @@ "not_found_default_title": "Page Not Found", "not_found_check_url": "Please double check your URL", "not_found": "Not found", + "breakdown": "Breakdown", "buy": "Buy", "sell": "Sell", "price": "Price", @@ -522,5 +523,9 @@ "note": "Note", "indicate_unl": "indicates a validator on an UNL", "transaction_tokens_involved": " and ", - "transaction_tokens_swapped": " for " + "transaction_tokens_swapped": " for ", + "graph_dependant_currency": "*Graph is dependant on the currency used.", + "incomplete_transaction": "Incomplete transaction", + "liquidity_source": "Liquidity Source", + "balance_changes": "Balance Changes" } diff --git a/src/containers/Transactions/BreakDownTab/breakDownTab.scss b/src/containers/Transactions/BreakDownTab/breakDownTab.scss new file mode 100644 index 000000000..2dd19fa67 --- /dev/null +++ b/src/containers/Transactions/BreakDownTab/breakDownTab.scss @@ -0,0 +1,119 @@ +@import '../../shared/css/variables'; + +.breakdown-body { + margin-top: 20px; + color: $black-40; + font-size: 12px; + letter-spacing: 0px; +} + +.detail-section { + padding: 5px 15px; + border-bottom: 1px solid $black-70; + margin: 0px 0px 30px; + + &:last-child { + border: none; + } + + &.no-border { + border: none; + } +} + +.title { + margin-bottom: 4px; + color: $white; + font-size: 16px; + text-transform: capitalize; + @include bold; + + span { + margin-left: 8px; + font-size: 10px; + line-height: 18px; + } +} + +.flex { + display: flex; +} + +.rectangle-container { + min-height: 200px; + // margin-top: 100px; +} + +:root{ + --max-height: 80%; +} + +// Build the cylinder +$circle-height: 9px; + +.rectangle-row { + position: relative; + display: block; + height: 50px; +} + +.rectangle { + position: relative; + left: 0; + display: block; + width: $circle-height; + height: 30px; + box-sizing: border-box; + border-top: solid 2px var(--cylinder-color); + border-bottom: solid 2px var(--cylinder-color); + margin-top: 10px; + margin-left: 10px; + animation: grow 600ms 1.5s ease both; + background: linear-gradient(to right, #271527, var(--cylinder-color)); + // transform: rotate(90deg); +} + +.margin-text { + position: relative; + display: block; + border-bottom: dashed 1px $white; + font-weight: bold; + text-align: right; + text-transform: capitalize; + // transform: rotate(-180deg); + // writing-mode: vertical-rl; +} + +.rectangle::before, +.rectangle::after { + position: absolute; + top: -2px; + right: -3px; + width: $circle-height; + height: 30px; + box-sizing: border-box; + border: solid 2px var(--cylinder-color); + border-radius: 50%; + content: ''; +} + +.rectangle::before { + left: calc(-1 * $circle-height / 2); + background: #271527; +} + +.rectangle::after { + z-index: -1; + right: calc(-1 * $circle-height / 2); + background: var(--cylinder-color); +} + +@keyframes grow { + 0% { + width: 0; + } + + 100% { + width: calc(var(--max-height) * var(--percent-value)); // Change this to make things ✨ + } +} diff --git a/src/containers/Transactions/BreakDownTab/index.tsx b/src/containers/Transactions/BreakDownTab/index.tsx new file mode 100644 index 000000000..31decba57 --- /dev/null +++ b/src/containers/Transactions/BreakDownTab/index.tsx @@ -0,0 +1,303 @@ +import { FC, useState } from 'react' +import { useTranslation } from 'react-i18next' +import parsePayment from 'xrpl-tx-path-parser' +import { Account } from '../../shared/components/Account' +import { Amount } from '../../shared/components/Amount' +import { formatAmount } from '../../../rippled/lib/txSummary/formatAmount' +import Currency from '../../shared/components/Currency' + +import './breakDownTab.scss' + +// import { +// createSourceAmount, +// createPaymentDefaultPaths, +// amountToBalance, +// } from 'xrpl-tx-path-parser' + +export const BreakDownTab: FC<{ data: any }> = ({ data }) => { + const { t } = useTranslation() + const [selectedView, setView] = useState('source') + + const hexToString = (hex: string) => { + let string = '' + for (let i = 0; i < hex.length; i += 2) { + const part = hex.substring(i, i + 2) + const code = parseInt(part, 16) + if (!isNaN(code) && code !== 0) { + string += String.fromCharCode(code) + } + } + return string + } + const BalanceChange: FC<{ + data: any + label: Boolean + type: String + }> = ({ data, label, type }) => { + const balances = [] + data.forEach((change, index) => { + change.value *= -1 + + let balanceLabel = + type === 'direct' ? 'recieved' : change.value < 0 ? 'sold' : 'bought' + if (type === 'direct') { + change.value *= -1 + } + if (!label) { + balanceLabel = '' + } + balances.push( +
  • + {balanceLabel} +
  • , + ) + }) + + return
      {balances}
    + } + // eslint-disable-next-line react/no-unstable-nested-components + const Transaction: FC<{ parsed: any; account: Account }> = ({ + parsed, + account, + }) => { + const changes = [] + parsed.accountBalanceChanges.forEach((change, index) => { + if (account !== change.account) { + let type: String = 'direct' + if (change.isAMM) { + type = 'amm' + } + if (change.isOffer) { + type = 'dex' + } + if (change.isRippling) { + type = 'rippling' + } + changes.push( +

    + {type} +

    , + + , + ) + } + }) + + return
    {changes}
    + } + + // eslint-disable-next-line react/no-unstable-nested-components + const Cylindars: FC<{ parsed: any; account: Account }> = ({ + parsed, + account, + }) => { + const sum = { + amm: 0, + rippling: 0, + dex: 0, + direct: 0, + total: 0, + } + parsed.accountBalanceChanges.forEach((change) => { + if (account !== change.account) { + change.balances.forEach((balance) => { + // if (parsed.sourceAmount.currency === balance.currency) { + if ( + (selectedView === 'source' && + parsed.destinationAmount.currency === balance.currency) || + (selectedView === 'destination' && + parsed.sourceAmount.currency === balance.currency) + ) { + if (change.isAMM) { + sum.amm += balance.value * -1 + sum.total += balance.value * -1 + } + if (change.isOffer) { + sum.dex += balance.value * -1 + sum.total += balance.value * -1 + } + if (change.isDirect) { + sum.direct += balance.value * 1 + sum.total += balance.value * 1 + } + if (change.isRippling && balance.value * 1 > 0) { + sum.rippling += + selectedView === 'destination' + ? balance.value * -1 + : balance.value * 1 + } + } + }) + } + }) + + const NON_STANDARD_CODE_LENGTH = 40 + const XRP = 'XRP' + const LP_TOKEN_IDENTIFIER = '03' + const destinationCurrencyCode = + parsed.destinationAmount.currency?.length === NON_STANDARD_CODE_LENGTH && + parsed.destinationAmount.currency?.substring(0, 2) !== LP_TOKEN_IDENTIFIER + ? hexToString(parsed.destinationAmount.currency) + : parsed.destinationAmount.currency + const sourceCurrencyCode = + parsed.sourceAmount.currency?.length === NON_STANDARD_CODE_LENGTH && + parsed.sourceAmount.currency?.substring(0, 2) !== LP_TOKEN_IDENTIFIER + ? hexToString(parsed.sourceAmount.currency) + : parsed.sourceAmount.currency + + return ( +
    + {/*
    + AMM: {sum.amm} {(sum.amm / sum.total) * 100} +
    +
    + RIPPLING: {sum.rippling} {(sum.rippling / sum.total) * 100} +
    +
    + DEX: {sum.dex} {(sum.dex / sum.total) * 100} +
    +
    + DIRECT: {sum.direct} {(sum.direct / sum.total) * 100} +
    +
    TOTAL: {sum.total}
    */} + + +

    {t('graph_dependant_currency')}

    +
    +
    + + AMM ({Math.round((sum.amm / sum.total) * 100)}%) + +
    +
    +
    + + RIPPLING ({Math.round((sum.rippling / sum.total) * 100)}%) + +
    +
    +
    + + DEX ({Math.round((sum.dex / sum.total) * 100)}%) + +
    +
    +
    + + DIRECT ({Math.round((sum.direct / sum.total) * 100)}%) + +
    +
    +
    + + TOTAL{' '} + + +
    +
    + ) + } + + const renderData = () => { + data.tx.meta = data.meta + // delete mutate.meta + try { + const parsed = parsePayment(data.tx) + if ( + parsed.sourceAmount.value === '0' && + data.tx.TransactionType === 'OfferCreate' + ) { + return

    {t('The offer has not crossed anything yet.')}

    + } + + return ( +
    +
    +
    {data.tx.TransactionType}
    +
    + Source: +
    +
    + +
    +
    +
    + Destination: +
    +
    + +
    +
    +
    +
    {t('liquidity_source')}
    + +
    +
    +
    {t('balance_changes')}
    + +
    + {/* < + // debug.... + div className="detail-section"> +
    {JSON.stringify(parsed, null, 2)}
    +
    */} +
    + ) + } catch (e) { + return

    {t('incomplete_transaction')}

    + } + } + + return
    {renderData()}
    +} diff --git a/src/containers/Transactions/index.tsx b/src/containers/Transactions/index.tsx index b5de8319f..22d5161aa 100644 --- a/src/containers/Transactions/index.tsx +++ b/src/containers/Transactions/index.tsx @@ -9,6 +9,7 @@ import { Tabs } from '../shared/components/Tabs' import { NOT_FOUND, BAD_REQUEST, HASH_REGEX, CTID_REGEX } from '../shared/utils' import { SimpleTab } from './SimpleTab' import { DetailTab } from './DetailTab' +import { BreakDownTab } from './BreakDownTab' import './transaction.scss' import { AnalyticsFields, useAnalytics } from '../shared/analytics' import SocketContext from '../shared/SocketContext' @@ -115,6 +116,12 @@ export const Transaction = () => { function renderTabs() { const tabs = ['simple', 'detailed', 'raw'] + if ( + data.raw.tx.TransactionType === 'OfferCreate' || + data.raw.tx.TransactionType === 'Payment' + ) { + tabs.push('breakdown') + } const mainPath = buildPath(TRANSACTION_ROUTE, { identifier }) return } @@ -125,6 +132,9 @@ export const Transaction = () => { let body switch (tab) { + case 'breakdown': + body = + break case 'detailed': body = break From 842cbe75a83ef139ef0a846b6b05fde90f5d7bb9 Mon Sep 17 00:00:00 2001 From: Lathan Britz Date: Wed, 22 May 2024 12:56:08 -0400 Subject: [PATCH 02/11] color code breakdown and add missing transation labels --- public/locales/ca-CA/translations.json | 6 ++++- public/locales/en-US/translations.json | 6 ++++- .../BreakDownTab/breakDownTab.scss | 24 +++++++++++++++++++ .../Transactions/BreakDownTab/index.tsx | 23 ++++++++++++------ 4 files changed, 50 insertions(+), 9 deletions(-) diff --git a/public/locales/ca-CA/translations.json b/public/locales/ca-CA/translations.json index 8c7a11d27..894cfd305 100644 --- a/public/locales/ca-CA/translations.json +++ b/public/locales/ca-CA/translations.json @@ -527,5 +527,9 @@ "graph_dependant_currency": "*Graph is dependant on the currency used.", "incomplete_transaction": "Incomplete transaction", "liquidity_source": "Liquidity Source", - "balance_changes": "Balance Changes" + "balance_changes": "Balance Changes", + "direct": "direct", + "dex": "dex", + "amm": "amm", + "rippling": "rippling" } diff --git a/public/locales/en-US/translations.json b/public/locales/en-US/translations.json index 9af853fcb..ad03d229a 100644 --- a/public/locales/en-US/translations.json +++ b/public/locales/en-US/translations.json @@ -527,5 +527,9 @@ "graph_dependant_currency": "*Graph is dependant on the currency used.", "incomplete_transaction": "Incomplete transaction", "liquidity_source": "Liquidity Source", - "balance_changes": "Balance Changes" + "balance_changes": "Balance Changes", + "direct": "direct", + "dex": "dex", + "amm": "amm", + "rippling": "rippling" } diff --git a/src/containers/Transactions/BreakDownTab/breakDownTab.scss b/src/containers/Transactions/BreakDownTab/breakDownTab.scss index 2dd19fa67..16acfc3d3 100644 --- a/src/containers/Transactions/BreakDownTab/breakDownTab.scss +++ b/src/containers/Transactions/BreakDownTab/breakDownTab.scss @@ -35,6 +35,30 @@ } } +.badge { + padding: 5px; + padding-top: 3px; + border-radius: 5px; + color: $black; + + &.amm { + background-color: #ff198b; + + } + + &.dex { + background-color: #19a3ff; + } + + &.direct { + background-color: #9a52ff; + } + + &.rippling { + background-color: #32e685; + } +} + .flex { display: flex; } diff --git a/src/containers/Transactions/BreakDownTab/index.tsx b/src/containers/Transactions/BreakDownTab/index.tsx index 31decba57..f2ae68ae3 100644 --- a/src/containers/Transactions/BreakDownTab/index.tsx +++ b/src/containers/Transactions/BreakDownTab/index.tsx @@ -63,19 +63,28 @@ export const BreakDownTab: FC<{ data: any }> = ({ data }) => { const changes = [] parsed.accountBalanceChanges.forEach((change, index) => { if (account !== change.account) { - let type: String = 'direct' + let type: String = '' + let span_class: String = '' + if (change.isDirect) { + type = 'direct' + span_class = 'badge direct' + } if (change.isAMM) { type = 'amm' + span_class = 'badge amm' } if (change.isOffer) { type = 'dex' + span_class = 'badge dex' } if (change.isRippling) { type = 'rippling' + span_class = 'badge rippling' } changes.push(

    - {type} + {type}{' '} +

    , = ({ data }) => { }} /> - AMM ({Math.round((sum.amm / sum.total) * 100)}%) + {t('amm')} ({Math.round((sum.amm / sum.total) * 100)}%)
    @@ -199,7 +208,7 @@ export const BreakDownTab: FC<{ data: any }> = ({ data }) => { }} /> - RIPPLING ({Math.round((sum.rippling / sum.total) * 100)}%) + {t('rippling')} ({Math.round((sum.rippling / sum.total) * 100)}%)
    @@ -211,7 +220,7 @@ export const BreakDownTab: FC<{ data: any }> = ({ data }) => { }} /> - DEX ({Math.round((sum.dex / sum.total) * 100)}%) + {t('dex')} ({Math.round((sum.dex / sum.total) * 100)}%)
    @@ -223,7 +232,7 @@ export const BreakDownTab: FC<{ data: any }> = ({ data }) => { }} /> - DIRECT ({Math.round((sum.direct / sum.total) * 100)}%) + {t('direct')} ({Math.round((sum.direct / sum.total) * 100)}%)
    @@ -235,7 +244,7 @@ export const BreakDownTab: FC<{ data: any }> = ({ data }) => { }} /> - TOTAL{' '} + {t('total')}{' '} Date: Wed, 22 May 2024 14:02:00 -0400 Subject: [PATCH 03/11] Update public/locales/ca-CA/translations.json fix spelling Co-authored-by: Mayukha Vadari --- public/locales/ca-CA/translations.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/locales/ca-CA/translations.json b/public/locales/ca-CA/translations.json index 894cfd305..601d4ffb8 100644 --- a/public/locales/ca-CA/translations.json +++ b/public/locales/ca-CA/translations.json @@ -524,7 +524,7 @@ "indicate_unl": "indica un validador en una UNL", "transaction_tokens_involved": " i ", "transaction_tokens_swapped": " per ", - "graph_dependant_currency": "*Graph is dependant on the currency used.", + "graph_dependant_currency": "*Graph is dependent on the currency used.", "incomplete_transaction": "Incomplete transaction", "liquidity_source": "Liquidity Source", "balance_changes": "Balance Changes", From a453001ab084627b6cb12e854a9701e10620d791 Mon Sep 17 00:00:00 2001 From: Fomo <508629+shortthefomo@users.noreply.github.com> Date: Wed, 22 May 2024 14:02:35 -0400 Subject: [PATCH 04/11] Update src/containers/Transactions/index.tsx use of ternary Co-authored-by: Mayukha Vadari --- src/containers/Transactions/index.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/containers/Transactions/index.tsx b/src/containers/Transactions/index.tsx index 22d5161aa..aa884387b 100644 --- a/src/containers/Transactions/index.tsx +++ b/src/containers/Transactions/index.tsx @@ -115,13 +115,7 @@ export const Transaction = () => { } function renderTabs() { - const tabs = ['simple', 'detailed', 'raw'] - if ( - data.raw.tx.TransactionType === 'OfferCreate' || - data.raw.tx.TransactionType === 'Payment' - ) { - tabs.push('breakdown') - } + const tabs = (data.raw.tx.TransactionType === 'OfferCreate' || data.raw.tx.TransactionType === 'Payment') ? ['simple', 'breakdown', 'detailed', 'raw'] ? ['simple', 'detailed', 'raw'] const mainPath = buildPath(TRANSACTION_ROUTE, { identifier }) return } From ba3879469dce65da5ce20ac7cdc18cad19032b21 Mon Sep 17 00:00:00 2001 From: Lathan Britz Date: Wed, 22 May 2024 14:08:55 -0400 Subject: [PATCH 05/11] missed two more translation labels --- public/locales/ca-CA/translations.json | 6 ++++-- public/locales/en-US/translations.json | 6 ++++-- src/containers/Transactions/BreakDownTab/index.tsx | 8 ++++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/public/locales/ca-CA/translations.json b/public/locales/ca-CA/translations.json index 601d4ffb8..5c46543b4 100644 --- a/public/locales/ca-CA/translations.json +++ b/public/locales/ca-CA/translations.json @@ -524,12 +524,14 @@ "indicate_unl": "indica un validador en una UNL", "transaction_tokens_involved": " i ", "transaction_tokens_swapped": " per ", - "graph_dependant_currency": "*Graph is dependent on the currency used.", + "graph_dependent_currency": "*Graph is dependent on the currency used.", "incomplete_transaction": "Incomplete transaction", "liquidity_source": "Liquidity Source", "balance_changes": "Balance Changes", "direct": "direct", "dex": "dex", "amm": "amm", - "rippling": "rippling" + "rippling": "rippling", + "sold": "sold", + "bought": "bought" } diff --git a/public/locales/en-US/translations.json b/public/locales/en-US/translations.json index ad03d229a..7f9bf7403 100644 --- a/public/locales/en-US/translations.json +++ b/public/locales/en-US/translations.json @@ -524,12 +524,14 @@ "indicate_unl": "indicates a validator on an UNL", "transaction_tokens_involved": " and ", "transaction_tokens_swapped": " for ", - "graph_dependant_currency": "*Graph is dependant on the currency used.", + "graph_dependent_currency": "*Graph is dependent on the currency used.", "incomplete_transaction": "Incomplete transaction", "liquidity_source": "Liquidity Source", "balance_changes": "Balance Changes", "direct": "direct", "dex": "dex", "amm": "amm", - "rippling": "rippling" + "rippling": "rippling", + "sold": "sold", + "bought": "bought" } diff --git a/src/containers/Transactions/BreakDownTab/index.tsx b/src/containers/Transactions/BreakDownTab/index.tsx index f2ae68ae3..cadfd6791 100644 --- a/src/containers/Transactions/BreakDownTab/index.tsx +++ b/src/containers/Transactions/BreakDownTab/index.tsx @@ -39,7 +39,11 @@ export const BreakDownTab: FC<{ data: any }> = ({ data }) => { change.value *= -1 let balanceLabel = - type === 'direct' ? 'recieved' : change.value < 0 ? 'sold' : 'bought' + type === 'direct' + ? 'recieved' + : change.value < 0 + ? t('sold') + : t('bought') if (type === 'direct') { change.value *= -1 } @@ -186,7 +190,7 @@ export const BreakDownTab: FC<{ data: any }> = ({ data }) => { {destinationCurrencyCode} {t('destination')} -

    {t('graph_dependant_currency')}

    +

    {t('graph_dependent_currency')}

    Date: Wed, 22 May 2024 16:38:17 -0400 Subject: [PATCH 06/11] fix turnary --- src/containers/Transactions/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/containers/Transactions/index.tsx b/src/containers/Transactions/index.tsx index aa884387b..0342dfc75 100644 --- a/src/containers/Transactions/index.tsx +++ b/src/containers/Transactions/index.tsx @@ -115,7 +115,11 @@ export const Transaction = () => { } function renderTabs() { - const tabs = (data.raw.tx.TransactionType === 'OfferCreate' || data.raw.tx.TransactionType === 'Payment') ? ['simple', 'breakdown', 'detailed', 'raw'] ? ['simple', 'detailed', 'raw'] + const tabs = + data.raw.tx.TransactionType === 'OfferCreate' || + data.raw.tx.TransactionType === 'Payment' + ? ['simple', 'breakdown', 'detailed', 'raw'] + : ['simple', 'detailed', 'raw'] const mainPath = buildPath(TRANSACTION_ROUTE, { identifier }) return } From 9bc78b812b9b422069f2fd2b5ca46d5c8ec26811 Mon Sep 17 00:00:00 2001 From: Lathan Britz Date: Thu, 23 May 2024 08:43:30 -0400 Subject: [PATCH 07/11] use non dev version of xrpl-tx-path-parser changes have been comitted --- package-lock.json | 14 +++-- package.json | 2 +- public/locales/ca-CA/translations.json | 3 +- public/locales/en-US/translations.json | 3 +- .../Transactions/BreakDownTab/index.tsx | 56 ++++++++----------- src/containers/Transactions/index.tsx | 1 + .../Transactions/test/Transaction.test.tsx | 5 +- 7 files changed, 40 insertions(+), 44 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3d3492750..bd7859205 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@vitejs/plugin-react": "^4.2.1", "@xrplf/isomorphic": "^1.0.0-beta.1", "@xrplf/prettier-config": "^1.9.1", + "@xrplkit/txmeta": "^1.3.1", "assert": "^2.1.0", "autoprefixer": "^10.4.17", "axios": "^1.6.5", @@ -60,7 +61,7 @@ "vite-plugin-svgr": "^4.2.0", "vite-tsconfig-paths": "^4.2.0", "xrpl-client": "^2.1.0", - "xrpl-tx-path-parser": "github:shortthefomo/xrpl-tx-path-parser#dev" + "xrpl-tx-path-parser": "^1.0.5" }, "devDependencies": { "@babel/eslint-parser": "^7.22.6", @@ -28006,9 +28007,9 @@ } }, "node_modules/xrpl-tx-path-parser": { - "version": "1.0.4", - "resolved": "git+ssh://git@github.com/shortthefomo/xrpl-tx-path-parser.git#8f5f4d5bc3bc83c6fffedf9bfe172d5a3c9d1c76", - "license": "ISC", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/xrpl-tx-path-parser/-/xrpl-tx-path-parser-1.0.5.tgz", + "integrity": "sha512-eQTdv/OKe5MIjOuiYB6FseUtiD8WOqYTmAGfOkHn4DWn233ES/970Yr10QPTrQoWtoA5forroXSiXBse6xxvow==", "dependencies": { "@xrplkit/txmeta": "^1.3.1", "decimal.js": "^10.4.3", @@ -47030,8 +47031,9 @@ } }, "xrpl-tx-path-parser": { - "version": "git+ssh://git@github.com/shortthefomo/xrpl-tx-path-parser.git#8f5f4d5bc3bc83c6fffedf9bfe172d5a3c9d1c76", - "from": "xrpl-tx-path-parser@github:shortthefomo/xrpl-tx-path-parser#dev", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/xrpl-tx-path-parser/-/xrpl-tx-path-parser-1.0.5.tgz", + "integrity": "sha512-eQTdv/OKe5MIjOuiYB6FseUtiD8WOqYTmAGfOkHn4DWn233ES/970Yr10QPTrQoWtoA5forroXSiXBse6xxvow==", "requires": { "@xrplkit/txmeta": "^1.3.1", "decimal.js": "^10.4.3", diff --git a/package.json b/package.json index 9065f14e3..2cc88639f 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "vite-plugin-svgr": "^4.2.0", "vite-tsconfig-paths": "^4.2.0", "xrpl-client": "^2.1.0", - "xrpl-tx-path-parser": "github:shortthefomo/xrpl-tx-path-parser#dev" + "xrpl-tx-path-parser": "^1.0.5" }, "devDependencies": { "@babel/eslint-parser": "^7.22.6", diff --git a/public/locales/ca-CA/translations.json b/public/locales/ca-CA/translations.json index 5c46543b4..f063221ed 100644 --- a/public/locales/ca-CA/translations.json +++ b/public/locales/ca-CA/translations.json @@ -533,5 +533,6 @@ "amm": "amm", "rippling": "rippling", "sold": "sold", - "bought": "bought" + "bought": "bought", + "no_cross": "The offer has not crossed anything yet" } diff --git a/public/locales/en-US/translations.json b/public/locales/en-US/translations.json index 7f9bf7403..d846e9368 100644 --- a/public/locales/en-US/translations.json +++ b/public/locales/en-US/translations.json @@ -533,5 +533,6 @@ "amm": "amm", "rippling": "rippling", "sold": "sold", - "bought": "bought" + "bought": "bought", + "no_cross": "The offer has not crossed anything yet" } diff --git a/src/containers/Transactions/BreakDownTab/index.tsx b/src/containers/Transactions/BreakDownTab/index.tsx index cadfd6791..3e0e92ce7 100644 --- a/src/containers/Transactions/BreakDownTab/index.tsx +++ b/src/containers/Transactions/BreakDownTab/index.tsx @@ -1,25 +1,17 @@ import { FC, useState } from 'react' import { useTranslation } from 'react-i18next' -import parsePayment from 'xrpl-tx-path-parser' +import pathParser from 'xrpl-tx-path-parser' import { Account } from '../../shared/components/Account' import { Amount } from '../../shared/components/Amount' import { formatAmount } from '../../../rippled/lib/txSummary/formatAmount' -import Currency from '../../shared/components/Currency' - import './breakDownTab.scss' -// import { -// createSourceAmount, -// createPaymentDefaultPaths, -// amountToBalance, -// } from 'xrpl-tx-path-parser' - export const BreakDownTab: FC<{ data: any }> = ({ data }) => { const { t } = useTranslation() const [selectedView, setView] = useState('source') const hexToString = (hex: string) => { - let string = '' + let string: string = '' for (let i = 0; i < hex.length; i += 2) { const part = hex.substring(i, i + 2) const code = parseInt(part, 16) @@ -35,24 +27,25 @@ export const BreakDownTab: FC<{ data: any }> = ({ data }) => { type: String }> = ({ data, label, type }) => { const balances = [] - data.forEach((change, index) => { - change.value *= -1 + data.forEach((change: any, index: any) => { + const amount = change + amount.value *= -1 - let balanceLabel = + let balanceLabel: string = type === 'direct' ? 'recieved' - : change.value < 0 + : amount.value < 0 ? t('sold') : t('bought') if (type === 'direct') { - change.value *= -1 + amount.value *= -1 } if (!label) { balanceLabel = '' } balances.push( -
  • - {balanceLabel} +
  • + {balanceLabel}
  • , ) }) @@ -60,39 +53,39 @@ export const BreakDownTab: FC<{ data: any }> = ({ data }) => { return
      {balances}
    } // eslint-disable-next-line react/no-unstable-nested-components - const Transaction: FC<{ parsed: any; account: Account }> = ({ + const Transaction: FC<{ parsed: any; account: any }> = ({ parsed, account, }) => { const changes = [] parsed.accountBalanceChanges.forEach((change, index) => { if (account !== change.account) { - let type: String = '' - let span_class: String = '' + let type: string = '' + let spanClass: string = '' if (change.isDirect) { type = 'direct' - span_class = 'badge direct' + spanClass = 'badge direct' } if (change.isAMM) { type = 'amm' - span_class = 'badge amm' + spanClass = 'badge amm' } if (change.isOffer) { type = 'dex' - span_class = 'badge dex' + spanClass = 'badge dex' } if (change.isRippling) { type = 'rippling' - span_class = 'badge rippling' + spanClass = 'badge rippling' } changes.push( -

    - {type}{' '} +

    + {type}{' '}

    , = ({ data }) => { } // eslint-disable-next-line react/no-unstable-nested-components - const Cylindars: FC<{ parsed: any; account: Account }> = ({ + const Cylindars: FC<{ parsed: any; account: any }> = ({ parsed, account, }) => { @@ -119,7 +112,6 @@ export const BreakDownTab: FC<{ data: any }> = ({ data }) => { parsed.accountBalanceChanges.forEach((change) => { if (account !== change.account) { change.balances.forEach((balance) => { - // if (parsed.sourceAmount.currency === balance.currency) { if ( (selectedView === 'source' && parsed.destinationAmount.currency === balance.currency) || @@ -150,7 +142,6 @@ export const BreakDownTab: FC<{ data: any }> = ({ data }) => { }) const NON_STANDARD_CODE_LENGTH = 40 - const XRP = 'XRP' const LP_TOKEN_IDENTIFIER = '03' const destinationCurrencyCode = parsed.destinationAmount.currency?.length === NON_STANDARD_CODE_LENGTH && @@ -264,14 +255,13 @@ export const BreakDownTab: FC<{ data: any }> = ({ data }) => { const renderData = () => { data.tx.meta = data.meta - // delete mutate.meta try { - const parsed = parsePayment(data.tx) + const parsed = pathParser(data.tx) if ( parsed.sourceAmount.value === '0' && data.tx.TransactionType === 'OfferCreate' ) { - return

    {t('The offer has not crossed anything yet.')}

    + return

    {t('no_cross')}

    } return ( diff --git a/src/containers/Transactions/index.tsx b/src/containers/Transactions/index.tsx index 0342dfc75..3fb30d601 100644 --- a/src/containers/Transactions/index.tsx +++ b/src/containers/Transactions/index.tsx @@ -116,6 +116,7 @@ export const Transaction = () => { function renderTabs() { const tabs = + data === undefined || data.raw.tx.TransactionType === 'OfferCreate' || data.raw.tx.TransactionType === 'Payment' ? ['simple', 'breakdown', 'detailed', 'raw'] diff --git a/src/containers/Transactions/test/Transaction.test.tsx b/src/containers/Transactions/test/Transaction.test.tsx index 774d3da56..cf0a1b388 100644 --- a/src/containers/Transactions/test/Transaction.test.tsx +++ b/src/containers/Transactions/test/Transaction.test.tsx @@ -137,8 +137,9 @@ describe('Transaction container', () => { expect(wrapper.find('.tabs').length).toBe(1) expect(wrapper.find('a.tab').length).toBe(3) expect(wrapper.find('a.tab').at(0).props().title).toBe('simple') - expect(wrapper.find('a.tab').at(1).props().title).toBe('detailed') - expect(wrapper.find('a.tab').at(2).props().title).toBe('raw') + expect(wrapper.find('a.tab').at(1).props().title).toBe('breakdown') + expect(wrapper.find('a.tab').at(2).props().title).toBe('detailed') + expect(wrapper.find('a.tab').at(3).props().title).toBe('raw') expect(wrapper.find('a.tab.selected').text()).toEqual('simple') wrapper.unmount() }) From c8573fbbdc1429c1f74984e84e450c1fecd9c18b Mon Sep 17 00:00:00 2001 From: Lathan Britz Date: Fri, 24 May 2024 16:36:38 -0400 Subject: [PATCH 08/11] add testes --- package-lock.json | 33 +- package.json | 2 + .../Transactions/BreakDownTab/index.tsx | 36 +- .../Transactions/test/BreakDownTab.test.tsx | 76 +++ .../Transactions/test/Transaction.test.tsx | 2 +- .../test/mock_data/PaymentBreakdown.json | 476 ++++++++++++++++++ 6 files changed, 602 insertions(+), 23 deletions(-) create mode 100644 src/containers/Transactions/test/BreakDownTab.test.tsx create mode 100644 src/containers/Transactions/test/mock_data/PaymentBreakdown.json diff --git a/package-lock.json b/package-lock.json index bd7859205..f39c8ccbe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "@xrplf/isomorphic": "^1.0.0-beta.1", "@xrplf/prettier-config": "^1.9.1", "@xrplkit/txmeta": "^1.3.1", + "@xrplkit/xfl": "^2.1.0", "assert": "^2.1.0", "autoprefixer": "^10.4.17", "axios": "^1.6.5", @@ -6890,6 +6891,11 @@ "@xrplkit/xfl": "2.0.2" } }, + "node_modules/@xrplkit/amount/node_modules/@xrplkit/xfl": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@xrplkit/xfl/-/xfl-2.0.2.tgz", + "integrity": "sha512-OUZZzSoXSxYxuhBcz08Wb9Xme71PkFYejk3vq4jPzdXreVhF71ZrM6nSObHFgasC8/srWKoqiS37CnB2Ht3k/g==" + }, "node_modules/@xrplkit/txmeta": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/@xrplkit/txmeta/-/txmeta-1.3.1.tgz", @@ -6899,11 +6905,16 @@ "@xrplkit/xfl": "2.0.2" } }, - "node_modules/@xrplkit/xfl": { + "node_modules/@xrplkit/txmeta/node_modules/@xrplkit/xfl": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/@xrplkit/xfl/-/xfl-2.0.2.tgz", "integrity": "sha512-OUZZzSoXSxYxuhBcz08Wb9Xme71PkFYejk3vq4jPzdXreVhF71ZrM6nSObHFgasC8/srWKoqiS37CnB2Ht3k/g==" }, + "node_modules/@xrplkit/xfl": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@xrplkit/xfl/-/xfl-2.1.0.tgz", + "integrity": "sha512-CgRztE77c0hsZ57aPxwQg0vC6gSP/3Hz7cdzUQJSMBTy+b3VK/rGs+rMrmd9CY68jvVyTrhRpq6EgUPDBsywIg==" + }, "node_modules/abab": { "version": "2.0.5", "dev": true, @@ -32608,6 +32619,13 @@ "integrity": "sha512-poV7ym7EhjAlEGym9Kc3AHuy3uuhVW3qnl2KDr8D4zk7hANj7aG6l1XdtWIAGAgBpHnvPEaOG7+llPRRv1irZw==", "requires": { "@xrplkit/xfl": "2.0.2" + }, + "dependencies": { + "@xrplkit/xfl": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@xrplkit/xfl/-/xfl-2.0.2.tgz", + "integrity": "sha512-OUZZzSoXSxYxuhBcz08Wb9Xme71PkFYejk3vq4jPzdXreVhF71ZrM6nSObHFgasC8/srWKoqiS37CnB2Ht3k/g==" + } } }, "@xrplkit/txmeta": { @@ -32617,12 +32635,19 @@ "requires": { "@xrplkit/amount": "1.2.3", "@xrplkit/xfl": "2.0.2" + }, + "dependencies": { + "@xrplkit/xfl": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@xrplkit/xfl/-/xfl-2.0.2.tgz", + "integrity": "sha512-OUZZzSoXSxYxuhBcz08Wb9Xme71PkFYejk3vq4jPzdXreVhF71ZrM6nSObHFgasC8/srWKoqiS37CnB2Ht3k/g==" + } } }, "@xrplkit/xfl": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@xrplkit/xfl/-/xfl-2.0.2.tgz", - "integrity": "sha512-OUZZzSoXSxYxuhBcz08Wb9Xme71PkFYejk3vq4jPzdXreVhF71ZrM6nSObHFgasC8/srWKoqiS37CnB2Ht3k/g==" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@xrplkit/xfl/-/xfl-2.1.0.tgz", + "integrity": "sha512-CgRztE77c0hsZ57aPxwQg0vC6gSP/3Hz7cdzUQJSMBTy+b3VK/rGs+rMrmd9CY68jvVyTrhRpq6EgUPDBsywIg==" }, "abab": { "version": "2.0.5", diff --git a/package.json b/package.json index 2cc88639f..de14e9896 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,8 @@ "@vitejs/plugin-react": "^4.2.1", "@xrplf/isomorphic": "^1.0.0-beta.1", "@xrplf/prettier-config": "^1.9.1", + "@xrplkit/txmeta": "^1.3.1", + "@xrplkit/xfl": "^2.1.0", "assert": "^2.1.0", "autoprefixer": "^10.4.17", "axios": "^1.6.5", diff --git a/src/containers/Transactions/BreakDownTab/index.tsx b/src/containers/Transactions/BreakDownTab/index.tsx index 3e0e92ce7..338c479ad 100644 --- a/src/containers/Transactions/BreakDownTab/index.tsx +++ b/src/containers/Transactions/BreakDownTab/index.tsx @@ -26,7 +26,7 @@ export const BreakDownTab: FC<{ data: any }> = ({ data }) => { label: Boolean type: String }> = ({ data, label, type }) => { - const balances = [] + const balances: string[] = [] data.forEach((change: any, index: any) => { const amount = change amount.value *= -1 @@ -43,11 +43,7 @@ export const BreakDownTab: FC<{ data: any }> = ({ data }) => { if (!label) { balanceLabel = '' } - balances.push( -
  • - {balanceLabel} -
  • , - ) + balances.push(
  • {balanceLabel}
  • ) }) return
      {balances}
    @@ -57,7 +53,7 @@ export const BreakDownTab: FC<{ data: any }> = ({ data }) => { parsed, account, }) => { - const changes = [] + const changes: string[] = [] parsed.accountBalanceChanges.forEach((change, index) => { if (account !== change.account) { let type: string = '' @@ -254,32 +250,36 @@ export const BreakDownTab: FC<{ data: any }> = ({ data }) => { } const renderData = () => { - data.tx.meta = data.meta + if (data === undefined || data.tx === undefined) { + return null + } + + const mutated = data + mutated.tx.meta = data.meta try { - const parsed = pathParser(data.tx) + const parsed = pathParser(mutated.tx) if ( parsed.sourceAmount.value === '0' && - data.tx.TransactionType === 'OfferCreate' + mutated.tx.TransactionType === 'OfferCreate' ) { return

    {t('no_cross')}

    } - return (
    -
    {data.tx.TransactionType}
    -
    +
    {mutated.tx.TransactionType}
    +
    Source:
    -
    - +
    +

    -
    +
    Destination:
    -
    - +
    +
    diff --git a/src/containers/Transactions/test/BreakDownTab.test.tsx b/src/containers/Transactions/test/BreakDownTab.test.tsx new file mode 100644 index 000000000..0a0f829d4 --- /dev/null +++ b/src/containers/Transactions/test/BreakDownTab.test.tsx @@ -0,0 +1,76 @@ +import { mount } from 'enzyme' +import { I18nextProvider } from 'react-i18next' +import { BrowserRouter as Router } from 'react-router-dom' + +import EnableAmendment from './mock_data/EnableAmendment.json' +import Payment from './mock_data/PaymentBreakdown.json' +import { BreakDownTab } from '../BreakDownTab' +import i18n from '../../../i18n/testConfig' + +describe('BreakdownTab container', () => { + const createWrapper = (tx) => + mount( + + + + + , + ) + + it('renders EnableAmendment without crashing', () => { + const wrapper = createWrapper(EnableAmendment) + wrapper.unmount() + }) + + it('renders breakdown tab information', () => { + const wrapper = createWrapper(Payment) + + console.log(Payment) + + expect(wrapper.find('.breakdown-body').length).toBe(1) + expect(wrapper.find('.detail-section').length).toBe(3) + + expect(wrapper.find('.source-account').length).toBe(1) + expect(wrapper.find('.source-amount').length).toBe(1) + expect(wrapper.find('.destination-account').length).toBe(1) + expect(wrapper.find('.destination-amount').length).toBe(1) + + expect( + wrapper.contains(
    liquidity_source
    ), + ).toBe(true) + + expect(wrapper.contains()).toBe( + true, + ) + expect( + wrapper.contains(), + ).toBe(true) + + expect(wrapper.contains(

    graph_dependent_currency

    )).toBe(true) + + expect( + wrapper.contains(amm (98%)), + ).toBe(true) + expect( + wrapper.contains(rippling (0%)), + ).toBe(true) + expect( + wrapper.contains(dex (2%)), + ).toBe(true) + expect( + wrapper.contains(direct (0%)), + ).toBe(true) + + expect(wrapper.contains(
    balance_changes
    )).toBe( + true, + ) + expect(wrapper.contains(dex)).toBe(true) + expect( + wrapper.contains(rippling), + ).toBe(true) + expect(wrapper.contains(amm)).toBe(true) + + console.log(wrapper.debug()) + wrapper.unmount() + }) +}) diff --git a/src/containers/Transactions/test/Transaction.test.tsx b/src/containers/Transactions/test/Transaction.test.tsx index cf0a1b388..6f65b23e5 100644 --- a/src/containers/Transactions/test/Transaction.test.tsx +++ b/src/containers/Transactions/test/Transaction.test.tsx @@ -135,7 +135,7 @@ describe('Transaction container', () => { ) expect(summary.contains()).toBe(true) expect(wrapper.find('.tabs').length).toBe(1) - expect(wrapper.find('a.tab').length).toBe(3) + expect(wrapper.find('a.tab').length).toBe(4) expect(wrapper.find('a.tab').at(0).props().title).toBe('simple') expect(wrapper.find('a.tab').at(1).props().title).toBe('breakdown') expect(wrapper.find('a.tab').at(2).props().title).toBe('detailed') diff --git a/src/containers/Transactions/test/mock_data/PaymentBreakdown.json b/src/containers/Transactions/test/mock_data/PaymentBreakdown.json new file mode 100644 index 000000000..0c7223914 --- /dev/null +++ b/src/containers/Transactions/test/mock_data/PaymentBreakdown.json @@ -0,0 +1,476 @@ +{ + "hash": "9D6DC95E7B95F7302EBF711F9384B51666E3D98D5B177A6EF0C0250D7F3410D2", + "ledger_index": 88213902, + "date": 1716575361000, + "tx": { + "Account": "rBrnBoVq2ZBrq53ns1pNCCnsnhFizf59Lj", + "Amount": "149343627", + "DeliverMax": "149343627", + "DeliverMin": "146356755", + "Destination": "rBrnBoVq2ZBrq53ns1pNCCnsnhFizf59Lj", + "Fee": "12", + "Flags": 131072, + "LastLedgerSequence": 88213910, + "Memos": [ + { + "Memo": { + "MemoData": "5472616E73616374696F6E20696E6974696174656420627920786D61676E657469632E6F7267" + } + } + ], + "SendMax": { + "currency": "USD", + "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", + "value": "79.6770766125" + }, + "Sequence": 88196798, + "SigningPubKey": "021738EBB3F528A186919463A8B4C31BADDE35B579B1F2F86DF4383547AE7865C9", + "SourceTag": 10011010, + "TransactionType": "Payment", + "TxnSignature": "304402205B749EEE748F7EB49BBA734558ADB257FB83B60C7224A7B6CAD9C910619486F202206EE3C12787A085AEFADC6E053824562A48DB2072E5F19D57C6D41415A5DBE5FB", + "ctid": "C542098E000D0000", + "date": 1716575361000, + "hash": "undefined", + "inLedger": "undefined", + "ledger_index": "undefined", + "meta": { + "AffectedNodes": [ + { + "ModifiedNode": { + "FinalFields": { + "Account": "rsFaWztpAqZKoBSLTuhrhYfBV4nwYg7TFP", + "Balance": "56685726", + "Flags": 0, + "OwnerCount": 13, + "Sequence": 75621582 + }, + "LedgerEntryType": "AccountRoot", + "LedgerIndex": "13CD16752E004F76B468237B2F44DA9CFCA143A28C8EB6686D6A05695C8C3F7B", + "PreviousFields": { "Balance": "59581035", "OwnerCount": 14 }, + "PreviousTxnID": "BE19A57B91862555B86A59A6331E2B56D3156CF18C5E1F74340D3CAFEE909D2F", + "PreviousTxnLgrSeq": 88213895 + } + }, + { + "ModifiedNode": { + "FinalFields": { + "Account": "rBrnBoVq2ZBrq53ns1pNCCnsnhFizf59Lj", + "Balance": "6284089037", + "Flags": 0, + "OwnerCount": 4, + "Sequence": 88196799 + }, + "LedgerEntryType": "AccountRoot", + "LedgerIndex": "181A3BAD298B55A47F4F9A0247D638F33BFF7DEDC7A1ECD1392C2ADF9A3F46C9", + "PreviousFields": { "Balance": "6134969072", "Sequence": 88196798 }, + "PreviousTxnID": "3CFE806B69A8FA91F8965B905BDCDD614B89AF8DC4B8E941D994F00CC1E57BBC", + "PreviousTxnLgrSeq": 88213878 + } + }, + { + "DeletedNode": { + "FinalFields": { + "Account": "rsFaWztpAqZKoBSLTuhrhYfBV4nwYg7TFP", + "BookDirectory": "DFA3B6DDAB58C7E8E5D944E736DA4B7046C30E4F460FD9DE4E12F1B0AE6A0FB3", + "BookNode": "0", + "Flags": 0, + "OwnerNode": "0", + "PreviousTxnID": "BE19A57B91862555B86A59A6331E2B56D3156CF18C5E1F74340D3CAFEE909D2F", + "PreviousTxnLgrSeq": 88213895, + "Sequence": 75621581, + "TakerGets": "0", + "TakerPays": { + "currency": "USD", + "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", + "value": "0" + } + }, + "LedgerEntryType": "Offer", + "LedgerIndex": "6AB7F7F338C9FFF65323CCAEF7E38FE93D45D6F67E0ABF11822216D1A90DF89E", + "PreviousFields": { + "TakerGets": "2895309", + "TakerPays": { + "currency": "USD", + "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", + "value": "1.543863643330838" + } + } + } + }, + { + "ModifiedNode": { + "FinalFields": { + "Balance": { + "currency": "USD", + "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", + "value": "-222732.5928364204" + }, + "Flags": 16908288, + "HighLimit": { + "currency": "USD", + "issuer": "rHUpaqUPbwzKZdzQ8ZQCme18FrgW9pB4am", + "value": "0" + }, + "HighNode": "0", + "LowLimit": { + "currency": "USD", + "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", + "value": "0" + }, + "LowNode": "bd7" + }, + "LedgerEntryType": "RippleState", + "LedgerIndex": "832F2523220A304ECEB7B2AE3E0D30829ACBCA0A31722FA8D952CC5BE7D9478B", + "PreviousFields": { + "Balance": { + "currency": "USD", + "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", + "value": "-222654.5789600612" + } + }, + "PreviousTxnID": "3CFE806B69A8FA91F8965B905BDCDD614B89AF8DC4B8E941D994F00CC1E57BBC", + "PreviousTxnLgrSeq": 88213878 + } + }, + { + "ModifiedNode": { + "FinalFields": { + "AMMID": "EF95AD04AF97DF0DD76C5C624F93EF6F5479CDF8F30FAE612F1D434B5D6A914B", + "Account": "rHUpaqUPbwzKZdzQ8ZQCme18FrgW9pB4am", + "Balance": "417539550052", + "Flags": 26214400, + "OwnerCount": 1, + "Sequence": 86795414 + }, + "LedgerEntryType": "AccountRoot", + "LedgerIndex": "B21B05E69AFB3F98B8D6F8066A69C4B189F3D804D8BE896AE11E60189AAFAD51", + "PreviousFields": { "Balance": "417685774720" }, + "PreviousTxnID": "3CFE806B69A8FA91F8965B905BDCDD614B89AF8DC4B8E941D994F00CC1E57BBC", + "PreviousTxnLgrSeq": 88213878 + } + }, + { + "ModifiedNode": { + "FinalFields": { + "Balance": { + "currency": "USD", + "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", + "value": "-15.22762820406059" + }, + "Flags": 2228224, + "HighLimit": { + "currency": "USD", + "issuer": "rsFaWztpAqZKoBSLTuhrhYfBV4nwYg7TFP", + "value": "1000000000" + }, + "HighNode": "0", + "LowLimit": { + "currency": "USD", + "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", + "value": "0" + }, + "LowNode": "b09" + }, + "LedgerEntryType": "RippleState", + "LedgerIndex": "CFCB7153408413FDB9A4B5AD3530680442200FA6F620711A80567DD1A965FD96", + "PreviousFields": { + "Balance": { + "currency": "USD", + "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", + "value": "-13.68376456072975" + } + }, + "PreviousTxnID": "BE19A57B91862555B86A59A6331E2B56D3156CF18C5E1F74340D3CAFEE909D2F", + "PreviousTxnLgrSeq": 88213895 + } + }, + { + "ModifiedNode": { + "FinalFields": { + "Flags": 0, + "Owner": "rsFaWztpAqZKoBSLTuhrhYfBV4nwYg7TFP", + "RootIndex": "D838BBCEB616863B8BDCF5F5A638245459F3697855EB03F80BD09DA6F256D011" + }, + "LedgerEntryType": "DirectoryNode", + "LedgerIndex": "D838BBCEB616863B8BDCF5F5A638245459F3697855EB03F80BD09DA6F256D011" + } + }, + { + "ModifiedNode": { + "FinalFields": { + "Balance": { + "currency": "USD", + "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", + "value": "-6450000000000000e-26" + }, + "Flags": 2228224, + "HighLimit": { + "currency": "USD", + "issuer": "rBrnBoVq2ZBrq53ns1pNCCnsnhFizf59Lj", + "value": "0" + }, + "HighNode": "0", + "LowLimit": { + "currency": "USD", + "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", + "value": "0" + }, + "LowNode": "bea" + }, + "LedgerEntryType": "RippleState", + "LedgerIndex": "DE51B19CCC570DB23F7A831943C8D874FB1928E513EC88090A543E32340AE813", + "PreviousFields": { + "Balance": { + "currency": "USD", + "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", + "value": "-79.6770766125645" + } + }, + "PreviousTxnID": "3CFE806B69A8FA91F8965B905BDCDD614B89AF8DC4B8E941D994F00CC1E57BBC", + "PreviousTxnLgrSeq": 88213878 + } + }, + { + "DeletedNode": { + "FinalFields": { + "ExchangeRate": "4e12f1b0ae6a0fb3", + "Flags": 0, + "RootIndex": "DFA3B6DDAB58C7E8E5D944E736DA4B7046C30E4F460FD9DE4E12F1B0AE6A0FB3", + "TakerGetsCurrency": "0000000000000000000000000000000000000000", + "TakerGetsIssuer": "0000000000000000000000000000000000000000", + "TakerPaysCurrency": "0000000000000000000000005553440000000000", + "TakerPaysIssuer": "0A20B3C85F482532A9578DBB3950B85CA06594D1" + }, + "LedgerEntryType": "DirectoryNode", + "LedgerIndex": "DFA3B6DDAB58C7E8E5D944E736DA4B7046C30E4F460FD9DE4E12F1B0AE6A0FB3" + } + } + ], + "DeliveredAmount": "149119977", + "TransactionIndex": 13, + "TransactionResult": "tesSUCCESS", + "delivered_amount": "149119977" + }, + "validated": "undefined", + "metaData": "undefined", + "status": "undefined" + }, + "meta": { + "AffectedNodes": [ + { + "ModifiedNode": { + "FinalFields": { + "Account": "rsFaWztpAqZKoBSLTuhrhYfBV4nwYg7TFP", + "Balance": "56685726", + "Flags": 0, + "OwnerCount": 13, + "Sequence": 75621582 + }, + "LedgerEntryType": "AccountRoot", + "LedgerIndex": "13CD16752E004F76B468237B2F44DA9CFCA143A28C8EB6686D6A05695C8C3F7B", + "PreviousFields": { "Balance": "59581035", "OwnerCount": 14 }, + "PreviousTxnID": "BE19A57B91862555B86A59A6331E2B56D3156CF18C5E1F74340D3CAFEE909D2F", + "PreviousTxnLgrSeq": 88213895 + } + }, + { + "ModifiedNode": { + "FinalFields": { + "Account": "rBrnBoVq2ZBrq53ns1pNCCnsnhFizf59Lj", + "Balance": "6284089037", + "Flags": 0, + "OwnerCount": 4, + "Sequence": 88196799 + }, + "LedgerEntryType": "AccountRoot", + "LedgerIndex": "181A3BAD298B55A47F4F9A0247D638F33BFF7DEDC7A1ECD1392C2ADF9A3F46C9", + "PreviousFields": { "Balance": "6134969072", "Sequence": 88196798 }, + "PreviousTxnID": "3CFE806B69A8FA91F8965B905BDCDD614B89AF8DC4B8E941D994F00CC1E57BBC", + "PreviousTxnLgrSeq": 88213878 + } + }, + { + "DeletedNode": { + "FinalFields": { + "Account": "rsFaWztpAqZKoBSLTuhrhYfBV4nwYg7TFP", + "BookDirectory": "DFA3B6DDAB58C7E8E5D944E736DA4B7046C30E4F460FD9DE4E12F1B0AE6A0FB3", + "BookNode": "0", + "Flags": 0, + "OwnerNode": "0", + "PreviousTxnID": "BE19A57B91862555B86A59A6331E2B56D3156CF18C5E1F74340D3CAFEE909D2F", + "PreviousTxnLgrSeq": 88213895, + "Sequence": 75621581, + "TakerGets": "0", + "TakerPays": { + "currency": "USD", + "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", + "value": "0" + } + }, + "LedgerEntryType": "Offer", + "LedgerIndex": "6AB7F7F338C9FFF65323CCAEF7E38FE93D45D6F67E0ABF11822216D1A90DF89E", + "PreviousFields": { + "TakerGets": "2895309", + "TakerPays": { + "currency": "USD", + "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", + "value": "1.543863643330838" + } + } + } + }, + { + "ModifiedNode": { + "FinalFields": { + "Balance": { + "currency": "USD", + "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", + "value": "-222732.5928364204" + }, + "Flags": 16908288, + "HighLimit": { + "currency": "USD", + "issuer": "rHUpaqUPbwzKZdzQ8ZQCme18FrgW9pB4am", + "value": "0" + }, + "HighNode": "0", + "LowLimit": { + "currency": "USD", + "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", + "value": "0" + }, + "LowNode": "bd7" + }, + "LedgerEntryType": "RippleState", + "LedgerIndex": "832F2523220A304ECEB7B2AE3E0D30829ACBCA0A31722FA8D952CC5BE7D9478B", + "PreviousFields": { + "Balance": { + "currency": "USD", + "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", + "value": "-222654.5789600612" + } + }, + "PreviousTxnID": "3CFE806B69A8FA91F8965B905BDCDD614B89AF8DC4B8E941D994F00CC1E57BBC", + "PreviousTxnLgrSeq": 88213878 + } + }, + { + "ModifiedNode": { + "FinalFields": { + "AMMID": "EF95AD04AF97DF0DD76C5C624F93EF6F5479CDF8F30FAE612F1D434B5D6A914B", + "Account": "rHUpaqUPbwzKZdzQ8ZQCme18FrgW9pB4am", + "Balance": "417539550052", + "Flags": 26214400, + "OwnerCount": 1, + "Sequence": 86795414 + }, + "LedgerEntryType": "AccountRoot", + "LedgerIndex": "B21B05E69AFB3F98B8D6F8066A69C4B189F3D804D8BE896AE11E60189AAFAD51", + "PreviousFields": { "Balance": "417685774720" }, + "PreviousTxnID": "3CFE806B69A8FA91F8965B905BDCDD614B89AF8DC4B8E941D994F00CC1E57BBC", + "PreviousTxnLgrSeq": 88213878 + } + }, + { + "ModifiedNode": { + "FinalFields": { + "Balance": { + "currency": "USD", + "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", + "value": "-15.22762820406059" + }, + "Flags": 2228224, + "HighLimit": { + "currency": "USD", + "issuer": "rsFaWztpAqZKoBSLTuhrhYfBV4nwYg7TFP", + "value": "1000000000" + }, + "HighNode": "0", + "LowLimit": { + "currency": "USD", + "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", + "value": "0" + }, + "LowNode": "b09" + }, + "LedgerEntryType": "RippleState", + "LedgerIndex": "CFCB7153408413FDB9A4B5AD3530680442200FA6F620711A80567DD1A965FD96", + "PreviousFields": { + "Balance": { + "currency": "USD", + "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", + "value": "-13.68376456072975" + } + }, + "PreviousTxnID": "BE19A57B91862555B86A59A6331E2B56D3156CF18C5E1F74340D3CAFEE909D2F", + "PreviousTxnLgrSeq": 88213895 + } + }, + { + "ModifiedNode": { + "FinalFields": { + "Flags": 0, + "Owner": "rsFaWztpAqZKoBSLTuhrhYfBV4nwYg7TFP", + "RootIndex": "D838BBCEB616863B8BDCF5F5A638245459F3697855EB03F80BD09DA6F256D011" + }, + "LedgerEntryType": "DirectoryNode", + "LedgerIndex": "D838BBCEB616863B8BDCF5F5A638245459F3697855EB03F80BD09DA6F256D011" + } + }, + { + "ModifiedNode": { + "FinalFields": { + "Balance": { + "currency": "USD", + "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", + "value": "-6450000000000000e-26" + }, + "Flags": 2228224, + "HighLimit": { + "currency": "USD", + "issuer": "rBrnBoVq2ZBrq53ns1pNCCnsnhFizf59Lj", + "value": "0" + }, + "HighNode": "0", + "LowLimit": { + "currency": "USD", + "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", + "value": "0" + }, + "LowNode": "bea" + }, + "LedgerEntryType": "RippleState", + "LedgerIndex": "DE51B19CCC570DB23F7A831943C8D874FB1928E513EC88090A543E32340AE813", + "PreviousFields": { + "Balance": { + "currency": "USD", + "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", + "value": "-79.6770766125645" + } + }, + "PreviousTxnID": "3CFE806B69A8FA91F8965B905BDCDD614B89AF8DC4B8E941D994F00CC1E57BBC", + "PreviousTxnLgrSeq": 88213878 + } + }, + { + "DeletedNode": { + "FinalFields": { + "ExchangeRate": "4e12f1b0ae6a0fb3", + "Flags": 0, + "RootIndex": "DFA3B6DDAB58C7E8E5D944E736DA4B7046C30E4F460FD9DE4E12F1B0AE6A0FB3", + "TakerGetsCurrency": "0000000000000000000000000000000000000000", + "TakerGetsIssuer": "0000000000000000000000000000000000000000", + "TakerPaysCurrency": "0000000000000000000000005553440000000000", + "TakerPaysIssuer": "0A20B3C85F482532A9578DBB3950B85CA06594D1" + }, + "LedgerEntryType": "DirectoryNode", + "LedgerIndex": "DFA3B6DDAB58C7E8E5D944E736DA4B7046C30E4F460FD9DE4E12F1B0AE6A0FB3" + } + } + ], + "DeliveredAmount": "149119977", + "TransactionIndex": 13, + "TransactionResult": "tesSUCCESS", + "delivered_amount": "149119977" + } +} From 4468cfa79d66f92a5f2576d00b4be57364f166a6 Mon Sep 17 00:00:00 2001 From: Lathan Britz Date: Fri, 24 May 2024 16:45:42 -0400 Subject: [PATCH 09/11] remove debug --- src/containers/Transactions/test/BreakDownTab.test.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/containers/Transactions/test/BreakDownTab.test.tsx b/src/containers/Transactions/test/BreakDownTab.test.tsx index 0a0f829d4..4505cf561 100644 --- a/src/containers/Transactions/test/BreakDownTab.test.tsx +++ b/src/containers/Transactions/test/BreakDownTab.test.tsx @@ -25,7 +25,7 @@ describe('BreakdownTab container', () => { it('renders breakdown tab information', () => { const wrapper = createWrapper(Payment) - console.log(Payment) + // console.log(Payment) expect(wrapper.find('.breakdown-body').length).toBe(1) expect(wrapper.find('.detail-section').length).toBe(3) @@ -70,7 +70,7 @@ describe('BreakdownTab container', () => { ).toBe(true) expect(wrapper.contains(amm)).toBe(true) - console.log(wrapper.debug()) + // console.log(wrapper.debug()) wrapper.unmount() }) }) From 317314524fc1cdb5eab417095eacb8d23c3ee82b Mon Sep 17 00:00:00 2001 From: Lathan Britz Date: Fri, 24 May 2024 16:59:19 -0400 Subject: [PATCH 10/11] revert unwanted change --- src/containers/Transactions/BreakDownTab/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/containers/Transactions/BreakDownTab/index.tsx b/src/containers/Transactions/BreakDownTab/index.tsx index 338c479ad..126b5e57c 100644 --- a/src/containers/Transactions/BreakDownTab/index.tsx +++ b/src/containers/Transactions/BreakDownTab/index.tsx @@ -43,7 +43,11 @@ export const BreakDownTab: FC<{ data: any }> = ({ data }) => { if (!label) { balanceLabel = '' } - balances.push(
  • {balanceLabel}
  • ) + balances.push( +
  • + {balanceLabel} +
  • , + ) }) return
      {balances}
    From 0a7c68dd787311694465c847f1d96a2bb41d8934 Mon Sep 17 00:00:00 2001 From: Lathan Britz Date: Fri, 24 May 2024 18:37:27 -0400 Subject: [PATCH 11/11] more test --- .../Transactions/BreakDownTab/index.tsx | 6 +- .../Transactions/test/BreakDownTab.test.tsx | 37 +- .../test/mock_data/PaymentBreakdown.json | 466 ++++++------------ 3 files changed, 173 insertions(+), 336 deletions(-) diff --git a/src/containers/Transactions/BreakDownTab/index.tsx b/src/containers/Transactions/BreakDownTab/index.tsx index 126b5e57c..697caaa14 100644 --- a/src/containers/Transactions/BreakDownTab/index.tsx +++ b/src/containers/Transactions/BreakDownTab/index.tsx @@ -45,7 +45,8 @@ export const BreakDownTab: FC<{ data: any }> = ({ data }) => { } balances.push(
  • - {balanceLabel} + {balanceLabel}{' '} +
  • , ) }) @@ -290,7 +291,7 @@ export const BreakDownTab: FC<{ data: any }> = ({ data }) => {
    {t('liquidity_source')}
    -
    +
    {t('balance_changes')}
    @@ -302,6 +303,7 @@ export const BreakDownTab: FC<{ data: any }> = ({ data }) => {
    ) } catch (e) { + // console.log(e) return

    {t('incomplete_transaction')}

    } } diff --git a/src/containers/Transactions/test/BreakDownTab.test.tsx b/src/containers/Transactions/test/BreakDownTab.test.tsx index 4505cf561..928f7ddf7 100644 --- a/src/containers/Transactions/test/BreakDownTab.test.tsx +++ b/src/containers/Transactions/test/BreakDownTab.test.tsx @@ -39,23 +39,23 @@ describe('BreakdownTab container', () => { wrapper.contains(
    liquidity_source
    ), ).toBe(true) - expect(wrapper.contains()).toBe( + expect(wrapper.contains()).toBe( true, ) expect( - wrapper.contains(), + wrapper.contains(), ).toBe(true) expect(wrapper.contains(

    graph_dependent_currency

    )).toBe(true) expect( - wrapper.contains(amm (98%)), + wrapper.contains(amm (100%)), ).toBe(true) expect( - wrapper.contains(rippling (0%)), + wrapper.contains(rippling (100%)), ).toBe(true) expect( - wrapper.contains(dex (2%)), + wrapper.contains(dex (0%)), ).toBe(true) expect( wrapper.contains(direct (0%)), @@ -64,13 +64,38 @@ describe('BreakdownTab container', () => { expect(wrapper.contains(
    balance_changes
    )).toBe( true, ) - expect(wrapper.contains(dex)).toBe(true) + + expect(wrapper.contains(dex)).toBe(false) + expect(wrapper.contains(direct)).toBe( + false, + ) expect( wrapper.contains(rippling), ).toBe(true) expect(wrapper.contains(amm)).toBe(true) + const balanceChanges = wrapper.find('.balance-changes') + expect(balanceChanges.find('BalanceChange')).toHaveLength(2) // console.log(wrapper.debug()) + + expect( + balanceChanges.contains( + 26.79746261, + ), + ).toBe(true) + expect( + balanceChanges.contains( + -26.877855, + ), + ).toBe(true) + expect( + balanceChanges.contains( + -50.624692, + ), + ).toBe(true) + wrapper.unmount() }) + + // console.log(balanceChanges.debug()) }) diff --git a/src/containers/Transactions/test/mock_data/PaymentBreakdown.json b/src/containers/Transactions/test/mock_data/PaymentBreakdown.json index 0c7223914..6336382c0 100644 --- a/src/containers/Transactions/test/mock_data/PaymentBreakdown.json +++ b/src/containers/Transactions/test/mock_data/PaymentBreakdown.json @@ -1,35 +1,40 @@ { - "hash": "9D6DC95E7B95F7302EBF711F9384B51666E3D98D5B177A6EF0C0250D7F3410D2", - "ledger_index": 88213902, - "date": 1716575361000, "tx": { - "Account": "rBrnBoVq2ZBrq53ns1pNCCnsnhFizf59Lj", - "Amount": "149343627", - "DeliverMax": "149343627", - "DeliverMin": "146356755", - "Destination": "rBrnBoVq2ZBrq53ns1pNCCnsnhFizf59Lj", + "Account": "r3GphWJaShhd1RNFnCaGMVyMawYcKHXCvo", + "Amount": { + "currency": "5553444300000000000000000000000000000000", + "issuer": "rcEGREd8NmkKRE8GE424sksyt1tJVFZwu", + "value": "1000000000000000e2" + }, + "DeliverMax": { + "currency": "5553444300000000000000000000000000000000", + "issuer": "rcEGREd8NmkKRE8GE424sksyt1tJVFZwu", + "value": "1000000000000000e2" + }, + "DeliverMin": { + "currency": "5553444300000000000000000000000000000000", + "issuer": "rcEGREd8NmkKRE8GE424sksyt1tJVFZwu", + "value": "25.639817695" + }, + "Destination": "r3GphWJaShhd1RNFnCaGMVyMawYcKHXCvo", "Fee": "12", "Flags": 131072, - "LastLedgerSequence": 88213910, + "LastLedgerSequence": 88214940, "Memos": [ { "Memo": { - "MemoData": "5472616E73616374696F6E20696E6974696174656420627920786D61676E657469632E6F7267" + "MemoData": "53574150205472616E73616374696F6E20696E69746961746564207669612058506D61726B65742E636F6D" } } ], - "SendMax": { - "currency": "USD", - "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", - "value": "79.6770766125" - }, - "Sequence": 88196798, - "SigningPubKey": "021738EBB3F528A186919463A8B4C31BADDE35B579B1F2F86DF4383547AE7865C9", - "SourceTag": 10011010, + "SendMax": "50624692", + "Sequence": 88214147, + "SigningPubKey": "02F00DADAD94C694359D9FB84163D390CDC418BDA6313A139945C09D2277B39B55", + "SourceTag": 20221212, "TransactionType": "Payment", - "TxnSignature": "304402205B749EEE748F7EB49BBA734558ADB257FB83B60C7224A7B6CAD9C910619486F202206EE3C12787A085AEFADC6E053824562A48DB2072E5F19D57C6D41415A5DBE5FB", - "ctid": "C542098E000D0000", - "date": 1716575361000, + "TxnSignature": "30450221009510B1D5C84A82D870C2827F6A82E6E8AE930778A75D2623D1E8D8280368D6D602207B74F93375275265AB59988748DD1D34F758960EE8FEE5C572A8E84A71205C0F", + "ctid": "C5420D9400120000", + "date": 1716579292000, "hash": "undefined", "inLedger": "undefined", "ledger_index": "undefined", @@ -38,218 +43,119 @@ { "ModifiedNode": { "FinalFields": { - "Account": "rsFaWztpAqZKoBSLTuhrhYfBV4nwYg7TFP", - "Balance": "56685726", + "Account": "r3GphWJaShhd1RNFnCaGMVyMawYcKHXCvo", + "Balance": "15877383", "Flags": 0, - "OwnerCount": 13, - "Sequence": 75621582 + "OwnerCount": 1, + "Sequence": 88214148 }, "LedgerEntryType": "AccountRoot", - "LedgerIndex": "13CD16752E004F76B468237B2F44DA9CFCA143A28C8EB6686D6A05695C8C3F7B", - "PreviousFields": { "Balance": "59581035", "OwnerCount": 14 }, - "PreviousTxnID": "BE19A57B91862555B86A59A6331E2B56D3156CF18C5E1F74340D3CAFEE909D2F", - "PreviousTxnLgrSeq": 88213895 - } - }, - { - "ModifiedNode": { - "FinalFields": { - "Account": "rBrnBoVq2ZBrq53ns1pNCCnsnhFizf59Lj", - "Balance": "6284089037", - "Flags": 0, - "OwnerCount": 4, - "Sequence": 88196799 - }, - "LedgerEntryType": "AccountRoot", - "LedgerIndex": "181A3BAD298B55A47F4F9A0247D638F33BFF7DEDC7A1ECD1392C2ADF9A3F46C9", - "PreviousFields": { "Balance": "6134969072", "Sequence": 88196798 }, - "PreviousTxnID": "3CFE806B69A8FA91F8965B905BDCDD614B89AF8DC4B8E941D994F00CC1E57BBC", - "PreviousTxnLgrSeq": 88213878 - } - }, - { - "DeletedNode": { - "FinalFields": { - "Account": "rsFaWztpAqZKoBSLTuhrhYfBV4nwYg7TFP", - "BookDirectory": "DFA3B6DDAB58C7E8E5D944E736DA4B7046C30E4F460FD9DE4E12F1B0AE6A0FB3", - "BookNode": "0", - "Flags": 0, - "OwnerNode": "0", - "PreviousTxnID": "BE19A57B91862555B86A59A6331E2B56D3156CF18C5E1F74340D3CAFEE909D2F", - "PreviousTxnLgrSeq": 88213895, - "Sequence": 75621581, - "TakerGets": "0", - "TakerPays": { - "currency": "USD", - "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", - "value": "0" - } - }, - "LedgerEntryType": "Offer", - "LedgerIndex": "6AB7F7F338C9FFF65323CCAEF7E38FE93D45D6F67E0ABF11822216D1A90DF89E", - "PreviousFields": { - "TakerGets": "2895309", - "TakerPays": { - "currency": "USD", - "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", - "value": "1.543863643330838" - } - } + "LedgerIndex": "4ACE281E26640B951CB4A23768CA6C7E1B0F602053B3C86A653847FE5A5AA1ED", + "PreviousFields": { "Balance": "66502087", "Sequence": 88214147 }, + "PreviousTxnID": "6947EB21D0A745A96F9B2F9B5BABFFE43CE66AF8488365DBC112BC38F8FAC0EA", + "PreviousTxnLgrSeq": 88214779 } }, { "ModifiedNode": { "FinalFields": { "Balance": { - "currency": "USD", + "currency": "5553444300000000000000000000000000000000", "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", - "value": "-222732.5928364204" + "value": "-26.79746261485543" }, - "Flags": 16908288, + "Flags": 2228224, "HighLimit": { - "currency": "USD", - "issuer": "rHUpaqUPbwzKZdzQ8ZQCme18FrgW9pB4am", - "value": "0" + "currency": "5553444300000000000000000000000000000000", + "issuer": "r3GphWJaShhd1RNFnCaGMVyMawYcKHXCvo", + "value": "775905" }, "HighNode": "0", "LowLimit": { - "currency": "USD", - "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", + "currency": "5553444300000000000000000000000000000000", + "issuer": "rcEGREd8NmkKRE8GE424sksyt1tJVFZwu", "value": "0" }, - "LowNode": "bd7" + "LowNode": "14f" }, "LedgerEntryType": "RippleState", - "LedgerIndex": "832F2523220A304ECEB7B2AE3E0D30829ACBCA0A31722FA8D952CC5BE7D9478B", + "LedgerIndex": "5F1DFBA426DB53A57ECEFE3EAEB804107DA1B899D4A90C794E577E5082D7C125", "PreviousFields": { "Balance": { - "currency": "USD", + "currency": "5553444300000000000000000000000000000000", "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", - "value": "-222654.5789600612" + "value": "0" } }, - "PreviousTxnID": "3CFE806B69A8FA91F8965B905BDCDD614B89AF8DC4B8E941D994F00CC1E57BBC", - "PreviousTxnLgrSeq": 88213878 + "PreviousTxnID": "6947EB21D0A745A96F9B2F9B5BABFFE43CE66AF8488365DBC112BC38F8FAC0EA", + "PreviousTxnLgrSeq": 88214779 } }, { "ModifiedNode": { "FinalFields": { - "AMMID": "EF95AD04AF97DF0DD76C5C624F93EF6F5479CDF8F30FAE612F1D434B5D6A914B", - "Account": "rHUpaqUPbwzKZdzQ8ZQCme18FrgW9pB4am", - "Balance": "417539550052", + "AMMID": "383669860F36CDD7BF543C0711DD523E35F60ACA22C8AAD8FDDBB2632C4C5821", + "Account": "rGHt6LT5v9DVaEAmFzj5ciuxuj41ZjLofs", + "Balance": "534441055888", "Flags": 26214400, "OwnerCount": 1, - "Sequence": 86795414 + "Sequence": 86795379 }, "LedgerEntryType": "AccountRoot", - "LedgerIndex": "B21B05E69AFB3F98B8D6F8066A69C4B189F3D804D8BE896AE11E60189AAFAD51", - "PreviousFields": { "Balance": "417685774720" }, - "PreviousTxnID": "3CFE806B69A8FA91F8965B905BDCDD614B89AF8DC4B8E941D994F00CC1E57BBC", - "PreviousTxnLgrSeq": 88213878 + "LedgerIndex": "AEAC617A4934A4E1029581A159AF8EB3356E4DE3C52324D9D5A73C00B8828BCF", + "PreviousFields": { "Balance": "534390431196" }, + "PreviousTxnID": "1FADA966F7F1E8465E17DE2F83216663BE8360B172AC3A0D13FC81757C64AC42", + "PreviousTxnLgrSeq": 88214747 } }, { "ModifiedNode": { "FinalFields": { "Balance": { - "currency": "USD", + "currency": "5553444300000000000000000000000000000000", "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", - "value": "-15.22762820406059" - }, - "Flags": 2228224, - "HighLimit": { - "currency": "USD", - "issuer": "rsFaWztpAqZKoBSLTuhrhYfBV4nwYg7TFP", - "value": "1000000000" + "value": "-284983.085646821" }, - "HighNode": "0", - "LowLimit": { - "currency": "USD", - "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", - "value": "0" - }, - "LowNode": "b09" - }, - "LedgerEntryType": "RippleState", - "LedgerIndex": "CFCB7153408413FDB9A4B5AD3530680442200FA6F620711A80567DD1A965FD96", - "PreviousFields": { - "Balance": { - "currency": "USD", - "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", - "value": "-13.68376456072975" - } - }, - "PreviousTxnID": "BE19A57B91862555B86A59A6331E2B56D3156CF18C5E1F74340D3CAFEE909D2F", - "PreviousTxnLgrSeq": 88213895 - } - }, - { - "ModifiedNode": { - "FinalFields": { - "Flags": 0, - "Owner": "rsFaWztpAqZKoBSLTuhrhYfBV4nwYg7TFP", - "RootIndex": "D838BBCEB616863B8BDCF5F5A638245459F3697855EB03F80BD09DA6F256D011" - }, - "LedgerEntryType": "DirectoryNode", - "LedgerIndex": "D838BBCEB616863B8BDCF5F5A638245459F3697855EB03F80BD09DA6F256D011" - } - }, - { - "ModifiedNode": { - "FinalFields": { - "Balance": { - "currency": "USD", - "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", - "value": "-6450000000000000e-26" - }, - "Flags": 2228224, + "Flags": 16908288, "HighLimit": { - "currency": "USD", - "issuer": "rBrnBoVq2ZBrq53ns1pNCCnsnhFizf59Lj", + "currency": "5553444300000000000000000000000000000000", + "issuer": "rGHt6LT5v9DVaEAmFzj5ciuxuj41ZjLofs", "value": "0" }, "HighNode": "0", "LowLimit": { - "currency": "USD", - "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", + "currency": "5553444300000000000000000000000000000000", + "issuer": "rcEGREd8NmkKRE8GE424sksyt1tJVFZwu", "value": "0" }, - "LowNode": "bea" + "LowNode": "10a" }, "LedgerEntryType": "RippleState", - "LedgerIndex": "DE51B19CCC570DB23F7A831943C8D874FB1928E513EC88090A543E32340AE813", + "LedgerIndex": "CDE55A8290DF221A643F51798BE6294A69384066D1ECFB7C2B9BEE2004B38D63", "PreviousFields": { "Balance": { - "currency": "USD", + "currency": "5553444300000000000000000000000000000000", "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", - "value": "-79.6770766125645" + "value": "-285009.9635018237" } }, - "PreviousTxnID": "3CFE806B69A8FA91F8965B905BDCDD614B89AF8DC4B8E941D994F00CC1E57BBC", - "PreviousTxnLgrSeq": 88213878 - } - }, - { - "DeletedNode": { - "FinalFields": { - "ExchangeRate": "4e12f1b0ae6a0fb3", - "Flags": 0, - "RootIndex": "DFA3B6DDAB58C7E8E5D944E736DA4B7046C30E4F460FD9DE4E12F1B0AE6A0FB3", - "TakerGetsCurrency": "0000000000000000000000000000000000000000", - "TakerGetsIssuer": "0000000000000000000000000000000000000000", - "TakerPaysCurrency": "0000000000000000000000005553440000000000", - "TakerPaysIssuer": "0A20B3C85F482532A9578DBB3950B85CA06594D1" - }, - "LedgerEntryType": "DirectoryNode", - "LedgerIndex": "DFA3B6DDAB58C7E8E5D944E736DA4B7046C30E4F460FD9DE4E12F1B0AE6A0FB3" + "PreviousTxnID": "1FADA966F7F1E8465E17DE2F83216663BE8360B172AC3A0D13FC81757C64AC42", + "PreviousTxnLgrSeq": 88214747 } } ], - "DeliveredAmount": "149119977", - "TransactionIndex": 13, + "DeliveredAmount": { + "currency": "5553444300000000000000000000000000000000", + "issuer": "rcEGREd8NmkKRE8GE424sksyt1tJVFZwu", + "value": "26.79746261485543" + }, + "TransactionIndex": 18, "TransactionResult": "tesSUCCESS", - "delivered_amount": "149119977" + "delivered_amount": { + "currency": "5553444300000000000000000000000000000000", + "issuer": "rcEGREd8NmkKRE8GE424sksyt1tJVFZwu", + "value": "26.79746261485543" + } }, "validated": "undefined", "metaData": "undefined", @@ -260,217 +166,121 @@ { "ModifiedNode": { "FinalFields": { - "Account": "rsFaWztpAqZKoBSLTuhrhYfBV4nwYg7TFP", - "Balance": "56685726", + "Account": "r3GphWJaShhd1RNFnCaGMVyMawYcKHXCvo", + "Balance": "15877383", "Flags": 0, - "OwnerCount": 13, - "Sequence": 75621582 + "OwnerCount": 1, + "Sequence": 88214148 }, "LedgerEntryType": "AccountRoot", - "LedgerIndex": "13CD16752E004F76B468237B2F44DA9CFCA143A28C8EB6686D6A05695C8C3F7B", - "PreviousFields": { "Balance": "59581035", "OwnerCount": 14 }, - "PreviousTxnID": "BE19A57B91862555B86A59A6331E2B56D3156CF18C5E1F74340D3CAFEE909D2F", - "PreviousTxnLgrSeq": 88213895 - } - }, - { - "ModifiedNode": { - "FinalFields": { - "Account": "rBrnBoVq2ZBrq53ns1pNCCnsnhFizf59Lj", - "Balance": "6284089037", - "Flags": 0, - "OwnerCount": 4, - "Sequence": 88196799 - }, - "LedgerEntryType": "AccountRoot", - "LedgerIndex": "181A3BAD298B55A47F4F9A0247D638F33BFF7DEDC7A1ECD1392C2ADF9A3F46C9", - "PreviousFields": { "Balance": "6134969072", "Sequence": 88196798 }, - "PreviousTxnID": "3CFE806B69A8FA91F8965B905BDCDD614B89AF8DC4B8E941D994F00CC1E57BBC", - "PreviousTxnLgrSeq": 88213878 - } - }, - { - "DeletedNode": { - "FinalFields": { - "Account": "rsFaWztpAqZKoBSLTuhrhYfBV4nwYg7TFP", - "BookDirectory": "DFA3B6DDAB58C7E8E5D944E736DA4B7046C30E4F460FD9DE4E12F1B0AE6A0FB3", - "BookNode": "0", - "Flags": 0, - "OwnerNode": "0", - "PreviousTxnID": "BE19A57B91862555B86A59A6331E2B56D3156CF18C5E1F74340D3CAFEE909D2F", - "PreviousTxnLgrSeq": 88213895, - "Sequence": 75621581, - "TakerGets": "0", - "TakerPays": { - "currency": "USD", - "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", - "value": "0" - } - }, - "LedgerEntryType": "Offer", - "LedgerIndex": "6AB7F7F338C9FFF65323CCAEF7E38FE93D45D6F67E0ABF11822216D1A90DF89E", - "PreviousFields": { - "TakerGets": "2895309", - "TakerPays": { - "currency": "USD", - "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", - "value": "1.543863643330838" - } - } + "LedgerIndex": "4ACE281E26640B951CB4A23768CA6C7E1B0F602053B3C86A653847FE5A5AA1ED", + "PreviousFields": { "Balance": "66502087", "Sequence": 88214147 }, + "PreviousTxnID": "6947EB21D0A745A96F9B2F9B5BABFFE43CE66AF8488365DBC112BC38F8FAC0EA", + "PreviousTxnLgrSeq": 88214779 } }, { "ModifiedNode": { "FinalFields": { "Balance": { - "currency": "USD", + "currency": "5553444300000000000000000000000000000000", "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", - "value": "-222732.5928364204" + "value": "-26.79746261485543" }, - "Flags": 16908288, + "Flags": 2228224, "HighLimit": { - "currency": "USD", - "issuer": "rHUpaqUPbwzKZdzQ8ZQCme18FrgW9pB4am", - "value": "0" + "currency": "5553444300000000000000000000000000000000", + "issuer": "r3GphWJaShhd1RNFnCaGMVyMawYcKHXCvo", + "value": "775905" }, "HighNode": "0", "LowLimit": { - "currency": "USD", - "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", + "currency": "5553444300000000000000000000000000000000", + "issuer": "rcEGREd8NmkKRE8GE424sksyt1tJVFZwu", "value": "0" }, - "LowNode": "bd7" + "LowNode": "14f" }, "LedgerEntryType": "RippleState", - "LedgerIndex": "832F2523220A304ECEB7B2AE3E0D30829ACBCA0A31722FA8D952CC5BE7D9478B", + "LedgerIndex": "5F1DFBA426DB53A57ECEFE3EAEB804107DA1B899D4A90C794E577E5082D7C125", "PreviousFields": { "Balance": { - "currency": "USD", + "currency": "5553444300000000000000000000000000000000", "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", - "value": "-222654.5789600612" + "value": "0" } }, - "PreviousTxnID": "3CFE806B69A8FA91F8965B905BDCDD614B89AF8DC4B8E941D994F00CC1E57BBC", - "PreviousTxnLgrSeq": 88213878 + "PreviousTxnID": "6947EB21D0A745A96F9B2F9B5BABFFE43CE66AF8488365DBC112BC38F8FAC0EA", + "PreviousTxnLgrSeq": 88214779 } }, { "ModifiedNode": { "FinalFields": { - "AMMID": "EF95AD04AF97DF0DD76C5C624F93EF6F5479CDF8F30FAE612F1D434B5D6A914B", - "Account": "rHUpaqUPbwzKZdzQ8ZQCme18FrgW9pB4am", - "Balance": "417539550052", + "AMMID": "383669860F36CDD7BF543C0711DD523E35F60ACA22C8AAD8FDDBB2632C4C5821", + "Account": "rGHt6LT5v9DVaEAmFzj5ciuxuj41ZjLofs", + "Balance": "534441055888", "Flags": 26214400, "OwnerCount": 1, - "Sequence": 86795414 + "Sequence": 86795379 }, "LedgerEntryType": "AccountRoot", - "LedgerIndex": "B21B05E69AFB3F98B8D6F8066A69C4B189F3D804D8BE896AE11E60189AAFAD51", - "PreviousFields": { "Balance": "417685774720" }, - "PreviousTxnID": "3CFE806B69A8FA91F8965B905BDCDD614B89AF8DC4B8E941D994F00CC1E57BBC", - "PreviousTxnLgrSeq": 88213878 + "LedgerIndex": "AEAC617A4934A4E1029581A159AF8EB3356E4DE3C52324D9D5A73C00B8828BCF", + "PreviousFields": { "Balance": "534390431196" }, + "PreviousTxnID": "1FADA966F7F1E8465E17DE2F83216663BE8360B172AC3A0D13FC81757C64AC42", + "PreviousTxnLgrSeq": 88214747 } }, { "ModifiedNode": { "FinalFields": { "Balance": { - "currency": "USD", + "currency": "5553444300000000000000000000000000000000", "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", - "value": "-15.22762820406059" - }, - "Flags": 2228224, - "HighLimit": { - "currency": "USD", - "issuer": "rsFaWztpAqZKoBSLTuhrhYfBV4nwYg7TFP", - "value": "1000000000" - }, - "HighNode": "0", - "LowLimit": { - "currency": "USD", - "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", - "value": "0" + "value": "-284983.085646821" }, - "LowNode": "b09" - }, - "LedgerEntryType": "RippleState", - "LedgerIndex": "CFCB7153408413FDB9A4B5AD3530680442200FA6F620711A80567DD1A965FD96", - "PreviousFields": { - "Balance": { - "currency": "USD", - "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", - "value": "-13.68376456072975" - } - }, - "PreviousTxnID": "BE19A57B91862555B86A59A6331E2B56D3156CF18C5E1F74340D3CAFEE909D2F", - "PreviousTxnLgrSeq": 88213895 - } - }, - { - "ModifiedNode": { - "FinalFields": { - "Flags": 0, - "Owner": "rsFaWztpAqZKoBSLTuhrhYfBV4nwYg7TFP", - "RootIndex": "D838BBCEB616863B8BDCF5F5A638245459F3697855EB03F80BD09DA6F256D011" - }, - "LedgerEntryType": "DirectoryNode", - "LedgerIndex": "D838BBCEB616863B8BDCF5F5A638245459F3697855EB03F80BD09DA6F256D011" - } - }, - { - "ModifiedNode": { - "FinalFields": { - "Balance": { - "currency": "USD", - "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", - "value": "-6450000000000000e-26" - }, - "Flags": 2228224, + "Flags": 16908288, "HighLimit": { - "currency": "USD", - "issuer": "rBrnBoVq2ZBrq53ns1pNCCnsnhFizf59Lj", + "currency": "5553444300000000000000000000000000000000", + "issuer": "rGHt6LT5v9DVaEAmFzj5ciuxuj41ZjLofs", "value": "0" }, "HighNode": "0", "LowLimit": { - "currency": "USD", - "issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", + "currency": "5553444300000000000000000000000000000000", + "issuer": "rcEGREd8NmkKRE8GE424sksyt1tJVFZwu", "value": "0" }, - "LowNode": "bea" + "LowNode": "10a" }, "LedgerEntryType": "RippleState", - "LedgerIndex": "DE51B19CCC570DB23F7A831943C8D874FB1928E513EC88090A543E32340AE813", + "LedgerIndex": "CDE55A8290DF221A643F51798BE6294A69384066D1ECFB7C2B9BEE2004B38D63", "PreviousFields": { "Balance": { - "currency": "USD", + "currency": "5553444300000000000000000000000000000000", "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji", - "value": "-79.6770766125645" + "value": "-285009.9635018237" } }, - "PreviousTxnID": "3CFE806B69A8FA91F8965B905BDCDD614B89AF8DC4B8E941D994F00CC1E57BBC", - "PreviousTxnLgrSeq": 88213878 - } - }, - { - "DeletedNode": { - "FinalFields": { - "ExchangeRate": "4e12f1b0ae6a0fb3", - "Flags": 0, - "RootIndex": "DFA3B6DDAB58C7E8E5D944E736DA4B7046C30E4F460FD9DE4E12F1B0AE6A0FB3", - "TakerGetsCurrency": "0000000000000000000000000000000000000000", - "TakerGetsIssuer": "0000000000000000000000000000000000000000", - "TakerPaysCurrency": "0000000000000000000000005553440000000000", - "TakerPaysIssuer": "0A20B3C85F482532A9578DBB3950B85CA06594D1" - }, - "LedgerEntryType": "DirectoryNode", - "LedgerIndex": "DFA3B6DDAB58C7E8E5D944E736DA4B7046C30E4F460FD9DE4E12F1B0AE6A0FB3" + "PreviousTxnID": "1FADA966F7F1E8465E17DE2F83216663BE8360B172AC3A0D13FC81757C64AC42", + "PreviousTxnLgrSeq": 88214747 } } ], - "DeliveredAmount": "149119977", - "TransactionIndex": 13, + "DeliveredAmount": { + "currency": "5553444300000000000000000000000000000000", + "issuer": "rcEGREd8NmkKRE8GE424sksyt1tJVFZwu", + "value": "26.79746261485543" + }, + "TransactionIndex": 18, "TransactionResult": "tesSUCCESS", - "delivered_amount": "149119977" - } + "delivered_amount": { + "currency": "5553444300000000000000000000000000000000", + "issuer": "rcEGREd8NmkKRE8GE424sksyt1tJVFZwu", + "value": "26.79746261485543" + } + }, + "hash": "2C9C11811DFC51263267F7D5AA81C807876B905A99AE52321C582D8E186B7E12", + "ledger_index": 88214932, + "date": 1716579292000 }