-
Notifications
You must be signed in to change notification settings - Fork 25
Batch transactions - Add support #621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
f88df6c
ea99f92
1bd8ffc
9548555
2ec6f45
4c0476a
e047b81
e72ea0f
be9d382
92f0aef
159a45e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| import React from 'react' | ||
| import { TData } from '../Table' | ||
|
|
||
| import { TransactionCard } from './TransactionCard' | ||
| import { AddressWithIconFilled, amountFormatWithIcon, shortAddress } from '../../utils/format' | ||
| import Link from 'next/link' | ||
|
|
||
| // Component to display transaction flags with tooltips | ||
| const TransactionFlags = ({ flags }) => { | ||
| if (!flags || typeof flags !== 'object') return <span className="grey">None</span> | ||
|
|
||
| const activeFlags = [] | ||
|
|
||
| // Check each flag in the specification.flags object | ||
| Object.entries(flags).forEach(([flagName, isActive]) => { | ||
| if (isActive === true) { | ||
| activeFlags.push(flagName) | ||
| } | ||
| }) | ||
|
|
||
| if (activeFlags.length === 0) { | ||
| return <span className="grey">None</span> | ||
| } | ||
|
|
||
| return ( | ||
| <> | ||
| <div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}> | ||
| {activeFlags.map((flag, index) => ( | ||
| <div key={index}> | ||
| <span className="no-brake"> | ||
| <span className="flag">{flag}</span> | ||
| </span> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </> | ||
| ) | ||
| } | ||
|
|
||
| export const TransactionBatch = ({ data, pageFiatRate, selectedCurrency }) => { | ||
| if (!data) return null | ||
| const { specification } = data | ||
|
|
||
| return ( | ||
| <TransactionCard | ||
| data={data} | ||
| pageFiatRate={pageFiatRate} | ||
| selectedCurrency={selectedCurrency} | ||
| notFullySupported={true} | ||
| > | ||
| <tr> | ||
| <TData>Initiated by</TData> | ||
| <TData> | ||
| <AddressWithIconFilled data={specification.source} name="address" /> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that seems used wrong
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make sure there is specification.sourceDetails - otherwise contact Ildar to add it. |
||
| </TData> | ||
| </tr> | ||
| <tr> | ||
| <TData>Flags</TData> | ||
| <TData> | ||
| <TransactionFlags flags={specification.flags} txType={data?.tx?.TransactionType} /> | ||
| </TData> | ||
| </tr> | ||
| {specification?.transactions?.map((transaction, index) => ( | ||
| <React.Fragment key={transaction.id || index}> | ||
| <tr> | ||
| <TData className="bold"> | ||
| Transaction {index + 1} | ||
| </TData> | ||
| </tr> | ||
| <tr> | ||
| <TData style={{ paddingLeft: '30px' }}>ID</TData> | ||
| <TData> | ||
| <Link href={`/tx/${transaction.id}`}> | ||
|
||
| {shortAddress(transaction.id)} | ||
| </Link> | ||
| </TData> | ||
| </tr> | ||
| <tr> | ||
| <TData style={{ paddingLeft: '30px' }}>Type</TData> | ||
| <TData> | ||
| <span className="bold">{transaction?.type}</span> | ||
| </TData> | ||
| </tr> | ||
| <tr> | ||
| <TData style={{ paddingLeft: '30px' }}>Sequence</TData> | ||
| <TData> | ||
| #{transaction?.sequence} | ||
| </TData> | ||
| </tr> | ||
| <tr> | ||
| <TData style={{ paddingLeft: '30px' }}>Flags</TData> | ||
| <TData> | ||
| <TransactionFlags flags={transaction.specification.flags} txType={transaction.type} /> | ||
| </TData> | ||
| </tr> | ||
| { | ||
| transaction.specification.destination && | ||
| <tr> | ||
| <TData style={{ paddingLeft: '30px' }}>Destination</TData> | ||
| <TData> | ||
| <AddressWithIconFilled data={transaction.specification.destination} name="address" /> | ||
| </TData> | ||
| </tr> | ||
| } | ||
| { | ||
| transaction.specification?.source?.maxAmount && | ||
| <tr> | ||
| <TData style={{ paddingLeft: '30px' }}>Max Amount</TData> | ||
|
||
| <TData> | ||
| {amountFormatWithIcon({ amount: transaction.specification?.source?.maxAmount })} | ||
| </TData> | ||
| </tr> | ||
| } | ||
| </React.Fragment> | ||
| ))} | ||
| </TransactionCard> | ||
| ) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have the functionn in utils showFlags - please reuse it