From 524861ffb9fc6223add524cfd87104371eb98956 Mon Sep 17 00:00:00 2001 From: pandablue0809 Date: Mon, 22 Sep 2025 01:39:05 +0900 Subject: [PATCH 1/5] add full support in credentials --- .../Transaction/TransactionCredential.js | 152 ++++++++++++++++++ components/Transaction/index.js | 1 + pages/transaction/[id].js | 3 + 3 files changed, 156 insertions(+) create mode 100644 components/Transaction/TransactionCredential.js diff --git a/components/Transaction/TransactionCredential.js b/components/Transaction/TransactionCredential.js new file mode 100644 index 000000000..62be980a1 --- /dev/null +++ b/components/Transaction/TransactionCredential.js @@ -0,0 +1,152 @@ +import { TData } from '../Table' + +import { TransactionCard } from './TransactionCard' +import { AddressWithIconFilled } from '../../utils/format' + +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 + + + + + {isDepositPreauth && tx.Authorize && ( + + Authorize + + + + + )} + {isDepositPreauth && tx.Unauthorize && ( + + Unauthorize + + + + + )} + {!isDepositPreauth && ( + <> + {txType === 'CredentialDelete' && ( + + Account + + + + + )} + + + {txType === 'CredentialCreate' ? 'Account' : 'Issuer'} + + + + + + + + {txType === 'CredentialCreate' || txType === 'CredentialDelete' ? 'Subject' : 'Account'} + + + + + + + Credential Type + {outcome?.credentialChanges?.credentialType} + + {outcome?.credentialChanges?.flags && ( + + Flags + +
+
Accepted: + {outcome.credentialChanges.flags.accepted ? 'Yes' : 'No'} +
+
+
+ + )} + + )} + + + {!isDepositPreauth && specification?.expiration !== undefined && ( + + Expiration + {specification.expiration} + + )} + {!isDepositPreauth && specification?.uri && ( + + URI + + {specification.uri.startsWith('http') ? ( + + {specification.uri} + + ) : ( + 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') { From 1c3dd81c669e5dee3786e97387fd07c79f5f449c Mon Sep 17 00:00:00 2001 From: Viacheslav Bakshaev Date: Sun, 12 Oct 2025 14:56:37 +0200 Subject: [PATCH 2/5] CredentialCreate updates --- .../Transaction/TransactionCredential.js | 100 ++++++++---------- 1 file changed, 46 insertions(+), 54 deletions(-) diff --git a/components/Transaction/TransactionCredential.js b/components/Transaction/TransactionCredential.js index 62be980a1..4d751d442 100644 --- a/components/Transaction/TransactionCredential.js +++ b/components/Transaction/TransactionCredential.js @@ -1,7 +1,9 @@ import { TData } from '../Table' import { TransactionCard } from './TransactionCard' -import { AddressWithIconFilled } from '../../utils/format' +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 @@ -12,27 +14,38 @@ const CredentialList = ({ credentials, title }) => {
{credentials.map((credential, index) => ( -
-
-
+
+
+
Issuer:
-
+
-
Type: {credential.type || Unknown}
+
+ Type: {credential.type || Unknown} +
))}
@@ -48,11 +61,7 @@ export const TransactionCredential = ({ data, pageFiatRate, selectedCurrency }) const isDepositPreauth = txType === 'DepositPreauth' return ( - + Initiated by @@ -86,65 +95,48 @@ export const TransactionCredential = ({ data, pageFiatRate, selectedCurrency }) )} - - {txType === 'CredentialCreate' ? 'Account' : 'Issuer'} - + {txType === 'CredentialCreate' ? 'Account' : 'Issuer'} - - {txType === 'CredentialCreate' || txType === 'CredentialDelete' ? 'Subject' : 'Account'} - + {txType === 'CredentialCreate' || txType === 'CredentialDelete' ? 'Subject' : 'Account'} Credential Type - {outcome?.credentialChanges?.credentialType} + + {decode(outcome?.credentialChanges?.credentialType)}{' '} + + {outcome?.credentialChanges?.flags && ( - Flags + Flag -
-
Accepted: - {outcome.credentialChanges.flags.accepted ? 'Yes' : 'No'} -
-
+ + {outcome.credentialChanges.flags.accepted ? 'Accepted' : 'Not accepted'} +
)} )} - - - {!isDepositPreauth && specification?.expiration !== undefined && ( + + + {!isDepositPreauth && specification?.expiration && ( Expiration - {specification.expiration} + {fullDateAndTime(specification.expiration, 'ripple')} )} {!isDepositPreauth && specification?.uri && ( URI - - {specification.uri.startsWith('http') ? ( - - {specification.uri} - - ) : ( - specification.uri - )} - + {decode(specification.uri)} )}
From 77ca33dd0d599fded84816260ecee56b04f7442a Mon Sep 17 00:00:00 2001 From: Viacheslav Bakshaev Date: Sun, 12 Oct 2025 15:04:02 +0200 Subject: [PATCH 3/5] CredentialCreate fixes --- .../Transaction/TransactionCredential.js | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/components/Transaction/TransactionCredential.js b/components/Transaction/TransactionCredential.js index 4d751d442..a001d4269 100644 --- a/components/Transaction/TransactionCredential.js +++ b/components/Transaction/TransactionCredential.js @@ -63,7 +63,15 @@ export const TransactionCredential = ({ data, pageFiatRate, selectedCurrency }) return ( - Initiated by + + Initiated by + {txType === 'CredentialCreate' && ( + <> +
+ issuer + + )} +
@@ -94,12 +102,14 @@ export const TransactionCredential = ({ data, pageFiatRate, selectedCurrency }) )} - - {txType === 'CredentialCreate' ? 'Account' : 'Issuer'} - - - - + {txType !== 'CredentialCreate' && ( + + Issuer + + + + + )} {txType === 'CredentialCreate' || txType === 'CredentialDelete' ? 'Subject' : 'Account'} From 72155186d2036a1df32cfe366490aa7fef20df47 Mon Sep 17 00:00:00 2001 From: Viacheslav Bakshaev Date: Sun, 12 Oct 2025 15:21:51 +0200 Subject: [PATCH 4/5] CredentialCreate - hydration and subject details fixes --- components/Transaction/TransactionCredential.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/components/Transaction/TransactionCredential.js b/components/Transaction/TransactionCredential.js index a001d4269..4bbed421c 100644 --- a/components/Transaction/TransactionCredential.js +++ b/components/Transaction/TransactionCredential.js @@ -1,5 +1,4 @@ import { TData } from '../Table' - import { TransactionCard } from './TransactionCard' import { AddressWithIconFilled, fullDateAndTime } from '../../utils/format' import { decode } from '../../utils' @@ -113,13 +112,13 @@ export const TransactionCredential = ({ data, pageFiatRate, selectedCurrency }) {txType === 'CredentialCreate' || txType === 'CredentialDelete' ? 'Subject' : 'Account'} - + - Credential Type + Credential type - {decode(outcome?.credentialChanges?.credentialType)}{' '} + {decode(outcome?.credentialChanges?.credentialType)}{' '} From 96e07f23f4a0f1c7de8f78427b9d2999e1790c91 Mon Sep 17 00:00:00 2001 From: Viacheslav Bakshaev Date: Sun, 12 Oct 2025 15:52:57 +0200 Subject: [PATCH 5/5] CredentialDelete fixes --- .../Transaction/TransactionCredential.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/components/Transaction/TransactionCredential.js b/components/Transaction/TransactionCredential.js index 4bbed421c..b2261bc5b 100644 --- a/components/Transaction/TransactionCredential.js +++ b/components/Transaction/TransactionCredential.js @@ -70,6 +70,12 @@ export const TransactionCredential = ({ data, pageFiatRate, selectedCurrency }) issuer )} + {outcome?.credentialChanges.subject === specification?.source && ( + <> +
+ subject + + )}
@@ -93,32 +99,26 @@ export const TransactionCredential = ({ data, pageFiatRate, selectedCurrency }) )} {!isDepositPreauth && ( <> - {txType === 'CredentialDelete' && ( + {specification.issuer && ( - Account + Issuer - + )} - {txType !== 'CredentialCreate' && ( + {specification?.subject && ( - Issuer + Subject - + )} - - {txType === 'CredentialCreate' || txType === 'CredentialDelete' ? 'Subject' : 'Account'} - - - - Credential type - {decode(outcome?.credentialChanges?.credentialType)}{' '} + {outcome?.credentialChanges?.credentialType}{' '}