Skip to content

Commit

Permalink
Merge branch 'staging' into upgrade-status-stablize
Browse files Browse the repository at this point in the history
  • Loading branch information
pdp2121 authored Sep 3, 2024
2 parents 4d77add + 6dd21e5 commit 3b0f780
Show file tree
Hide file tree
Showing 11 changed files with 1,114 additions and 1,076 deletions.
2,068 changes: 1,030 additions & 1,038 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
"bunyan": "^1.8.15",
"classnames": "^2.5.1",
"compression": "^1.7.4",
"d3": "^7.8.5",
"d3": "^7.9.0",
"d3-geo": "^3.1.0",
"d3-hexbin": "^0.2.2",
"d3-scale": "^4.0.2",
"debug": "^4.3.1",
"debug": "^4.3.6",
"dotenv": "^16.4.5",
"enzyme": "3.11.0",
"enzyme-adapter-react-17-updated": "^1.0.2",
Expand All @@ -40,7 +40,7 @@
"react-query": "^3.39.3",
"react-redux": "^8.1.3",
"react-router": "^6.12.1",
"react-router-dom": "^6.24.0",
"react-router-dom": "^6.26.1",
"react18-json-view": "^0.2.7",
"recharts": "^2.12.6",
"redux": "^5.0.1",
Expand All @@ -58,7 +58,7 @@
},
"devDependencies": {
"@babel/eslint-parser": "^7.22.6",
"@babel/preset-env": "^7.24.5",
"@babel/preset-env": "^7.25.3",
"@babel/preset-react": "^7.24.7",
"@types/create-hash": "^1.2.2",
"@types/enzyme": "^3.10.12",
Expand Down Expand Up @@ -89,7 +89,7 @@
"lint-staged": "^15.2.5",
"mock-socket": "^9.1.5",
"moxios": "^0.4.0",
"nodemon": "^3.0.1",
"nodemon": "^3.1.4",
"npm-run-all": "^4.1.5",
"prettier": "^3.3.2",
"react-error-overlay": "6.0.11",
Expand All @@ -105,7 +105,7 @@
"stylelint-scss": "^5.3.2",
"ts-jest": "^26.5.6",
"ts-node": "^10.9.2",
"typescript": "^4.9.4",
"typescript": "^4.9.5",
"xrpl": "^3.1.0"
},
"resolutions": {
Expand Down
8 changes: 8 additions & 0 deletions src/containers/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ export const AppWrapper = () => {
path={updatePath('/ledgers')}
element={<Navigate to={updatePath('/')} replace />}
/>
<Route
path={updatePath('/index.html')}
element={<Navigate to={updatePath('/')} replace />}
/>
<Route
path={updatePath('/index.htm')}
element={<Navigate to={updatePath('/')} replace />}
/>
{/* End: Redirects */}
{mode === 'custom' && (
<Route path="/" element={<CustomNetworkHome />} />
Expand Down
36 changes: 35 additions & 1 deletion src/containers/App/test/App.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jest.mock('../../../rippled', () => {
...originalModule,
getTransaction: () =>
Promise.resolve({
raw: formatTransaction({
processed: formatTransaction({
TransactionType: 'OfferCreate',
meta: {
TransactionResult: 'tecKILLED',
Expand Down Expand Up @@ -161,6 +161,40 @@ describe('App container', () => {
])
})

it('renders ledger explorer page from index.html redirect', async () => {
wrapper = createWrapper('/index.html')
await flushPromises()
await flushPromises()
wrapper.update()

expect(document.title).toEqual('xrpl_explorer | ledgers')
expect(window.dataLayer).toEqual([
{
page_path: '/',
page_title: `xrpl_explorer | ledgers`,
event: 'screen_view',
network: 'mainnet',
},
])
})

it('renders ledger explorer page from index.htm redirect', async () => {
wrapper = createWrapper('/index.html')
await flushPromises()
await flushPromises()
wrapper.update()

expect(document.title).toEqual('xrpl_explorer | ledgers')
expect(window.dataLayer).toEqual([
{
page_path: '/',
page_title: `xrpl_explorer | ledgers`,
event: 'screen_view',
network: 'mainnet',
},
])
})

it('renders not found page', () => {
wrapper = createWrapper('/zzz')
return new Promise((r) => setTimeout(r, 10)).then(() => {
Expand Down
20 changes: 10 additions & 10 deletions src/containers/Transactions/SimpleTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ export const SimpleTab: FC<{ data: any; width: number }> = ({
</>
)

const { raw } = data
const { processed } = data
const numberOptions = { ...CURRENCY_OPTIONS, currency: 'XRP' }
const time = localizeDate(new Date(raw.date), language, DATE_OPTIONS)
const ledgerIndex = raw.ledger_index
const fee = raw.tx.Fee
const time = localizeDate(new Date(processed.date), language, DATE_OPTIONS)
const ledgerIndex = processed.ledger_index
const fee = processed.tx.Fee
? localizeNumber(
Number.parseFloat(raw.tx.Fee) / XRP_BASE,
Number.parseFloat(processed.tx.Fee) / XRP_BASE,
language,
numberOptions,
)
Expand All @@ -88,16 +88,16 @@ export const SimpleTab: FC<{ data: any; width: number }> = ({
time,
ledgerIndex,
fee,
raw.tx.Account,
raw.tx.Sequence,
raw.tx.TicketSequence,
!!raw.tx.EmitDetails,
processed.tx.Account,
processed.tx.Sequence,
processed.tx.TicketSequence,
!!processed.tx.EmitDetails,
)

return (
<div className="simple-body simple-body-tx">
<div className="rows">
<Simple type={raw.tx.TransactionType} data={data.summary} />
<Simple type={processed.tx.TransactionType} data={data.summary} />
{width < BREAKPOINTS.landscape && rowIndex}
</div>
{width >= BREAKPOINTS.landscape && (
Expand Down
26 changes: 13 additions & 13 deletions src/containers/Transactions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ export const Transaction = () => {
const { width } = useWindowSize()

useEffect(() => {
if (!data?.raw) return
if (!data?.processed) return

const type = data?.raw.tx.TransactionType
const status = data?.raw.meta.TransactionResult
const type = data?.processed.tx.TransactionType
const status = data?.processed.meta.TransactionResult

const transactionProperties: AnalyticsFields = {
transaction_action: getAction(type),
Expand All @@ -91,22 +91,22 @@ export const Transaction = () => {
}

trackScreenLoaded(transactionProperties)
}, [identifier, data?.raw, tab, trackScreenLoaded])
}, [identifier, data?.processed, tab, trackScreenLoaded])

function renderSummary() {
const type = data?.raw.tx.TransactionType
const type = data?.processed.tx.TransactionType
return (
<div className="summary">
<div className="type">{type}</div>
<TxStatus status={data?.raw.meta.TransactionResult} />
<div className="txid" title={data?.raw.hash}>
<TxStatus status={data?.processed.meta.TransactionResult} />
<div className="txid" title={data?.processed.hash}>
<div className="title">{t('hash')}: </div>
{data?.raw.hash}
{data?.processed.hash}
</div>
{data?.raw.tx.ctid && (
<div className="txid" title={data.raw.tx.ctid}>
{data?.processed.tx.ctid && (
<div className="txid" title={data.processed.tx.ctid}>
<div className="title">CTID: </div>
{data.raw.tx.ctid}
{data.processed.tx.ctid}
</div>
)}
</div>
Expand All @@ -126,7 +126,7 @@ export const Transaction = () => {

switch (tab) {
case 'detailed':
body = <DetailTab data={data.raw} />
body = <DetailTab data={data.processed} />
break
case 'raw':
body = <JsonView data={data.raw} />
Expand All @@ -149,7 +149,7 @@ export const Transaction = () => {
if (isError) {
const message = getErrorMessage(error)
body = <NoMatch title={message.title} hints={message.hints} />
} else if (data?.raw && data?.raw.hash) {
} else if (data?.processed && data?.processed.hash) {
body = renderTransaction()
} else if (!identifier) {
body = (
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Transactions/test/SimpleTab.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('SimpleTab container', () => {
<Router>
<I18nextProvider i18n={i18n}>
<SimpleTab
data={{ raw: tx, summary: summarize(tx, true).details }}
data={{ processed: tx, summary: summarize(tx, true).details }}
width={width}
/>
</I18nextProvider>
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Transactions/test/Transaction.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describe('Transaction container', () => {

beforeEach(async () => {
const transaction = {
raw: mockTransaction,
processed: mockTransaction,
summary: mockTransactionSummary,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('UNLModify: Simple', () => {
<QuickHarness i18n={i18n}>
<SimpleTab
data={{
raw: mockUNLModifyDisable,
processed: mockUNLModifyDisable,
summary: summarizeTransaction(mockUNLModifyDisable, true).details,
}}
width={800}
Expand Down
1 change: 1 addition & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="google-site-verification" content="k8jb6KQfitguHqeR97svoRnnsgzvs3a0FliHbESVDk4" />
<meta name="description" content="Discover the XRP Ledger with this open source explorer. Check account balances, transactions, validators, nodes and analyze blockchain activity.">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
Expand Down
13 changes: 8 additions & 5 deletions src/rippled/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ const log = logger({ name: 'transactions' })
const getTransaction = (transactionId, rippledSocket) => {
log.info(`get tx: ${transactionId}`)
return getRippledTransaction(rippledSocket, transactionId)
.then((response) => formatTransaction(response))
.then((data) => ({
summary: summarizeTransaction(data, true).details,
raw: data,
}))
.then((data) => {
const formattedTransaction = formatTransaction(data)
return {
summary: summarizeTransaction(formattedTransaction, true).details,
processed: formattedTransaction,
raw: data,
}
})
.catch((error) => {
log.error(error.toString())
throw error
Expand Down

0 comments on commit 3b0f780

Please sign in to comment.