diff --git a/components/Transaction/TransactionCredential.js b/components/Transaction/TransactionCredential.js new file mode 100644 index 000000000..b2261bc5b --- /dev/null +++ b/components/Transaction/TransactionCredential.js @@ -0,0 +1,153 @@ +import { TData } from '../Table' +import { TransactionCard } from './TransactionCard' +import { AddressWithIconFilled, fullDateAndTime } from '../../utils/format' +import { decode } from '../../utils' +import CopyButton from '../UI/CopyButton' + +const CredentialList = ({ credentials, title }) => { + if (!credentials || credentials.length === 0) return null + + return ( + + {title} + +
+ {credentials.map((credential, index) => ( +
+
+
+ Issuer: +
+
+ +
+
+
+ Type: {credential.type || Unknown} +
+
+ ))} +
+
+ + ) +} + +export const TransactionCredential = ({ data, pageFiatRate, selectedCurrency }) => { + if (!data) return null + const { specification, outcome, tx } = data + const txType = tx?.TransactionType + const isDepositPreauth = txType === 'DepositPreauth' + + return ( + + + + Initiated by + {txType === 'CredentialCreate' && ( + <> +
+ issuer + + )} + {outcome?.credentialChanges.subject === specification?.source && ( + <> +
+ subject + + )} +
+ + + + + {isDepositPreauth && tx.Authorize && ( + + Authorize + + + + + )} + {isDepositPreauth && tx.Unauthorize && ( + + Unauthorize + + + + + )} + {!isDepositPreauth && ( + <> + {specification.issuer && ( + + Issuer + + + + + )} + {specification?.subject && ( + + Subject + + + + + )} + + Credential type + + {outcome?.credentialChanges?.credentialType}{' '} + + + + {outcome?.credentialChanges?.flags && ( + + Flag + + + {outcome.credentialChanges.flags.accepted ? 'Accepted' : 'Not accepted'} + + + + )} + + )} + + + {!isDepositPreauth && specification?.expiration && ( + + Expiration + {fullDateAndTime(specification.expiration, 'ripple')} + + )} + {!isDepositPreauth && specification?.uri && ( + + URI + {decode(specification.uri)} + + )} +
+ ) +} diff --git a/components/Transaction/index.js b/components/Transaction/index.js index e722479d6..dd44f773f 100644 --- a/components/Transaction/index.js +++ b/components/Transaction/index.js @@ -4,6 +4,7 @@ export { TransactionDetails } from './TransactionDetails' export { TransactionAccountDelete } from './TransactionAccountDelete' export { TransactionAccountSet } from './TransactionAccountSet' export { TransactionCheck } from './TransactionCheck' +export { TransactionCredential } from './TransactionCredential' export { TransactionDelegateSet } from './TransactionDelegateSet' export { TransactionEscrow } from './TransactionEscrow' export { TransactionNFToken } from './TransactionNFToken' diff --git a/pages/transaction/[id].js b/pages/transaction/[id].js index d60efc2f2..618af7840 100644 --- a/pages/transaction/[id].js +++ b/pages/transaction/[id].js @@ -12,6 +12,7 @@ import { TransactionAccountSet, TransactionAMM, TransactionCheck, + TransactionCredential, TransactionDID, TransactionEscrow, TransactionImport, @@ -94,6 +95,8 @@ export default function Transaction({ data, selectedCurrency }) { TransactionComponent = TransactionAMM } else if (txType?.includes('Check')) { TransactionComponent = TransactionCheck + } else if (txType === 'CredentialCreate' || txType === 'CredentialAccept' || txType === 'CredentialDelete' || txType === 'DepositPreauth') { + TransactionComponent = TransactionCredential } else if (txType?.includes('Escrow')) { TransactionComponent = TransactionEscrow } else if (txType === 'Import') {