Skip to content

Commit

Permalink
Add Credentials and PermissionedDomain tx Support (#1118)
Browse files Browse the repository at this point in the history
## High Level Overview of Change

<!--
Please include a summary/list of the changes.
If too broad, please consider splitting into multiple PRs.
-->

Adds CredentialCreate, CredentialAccept, CredentialDelete,
PermissionedDomainDelete, and PermissionedDomainSet transaction pages to
the explorer.

### Context of Change

<!--
Please include the context of a change.
If a bug fix, when was the bug introduced? What was the behavior?
If a new feature, why was this architecture chosen? What were the
alternatives?
If a refactor, how is this better than the previous implementation?

If there is a design document for this feature, please link it here.
-->


https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0070d-credentials


https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0080d-permissioned-domains



### Type of Change

<!--
Please check relevant options, delete irrelevant ones.
-->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Refactor (non-breaking change that only restructures code)
- [ ] Tests (You added tests for code that already exists, or your new
feature included in this PR)
- [ ] Documentation Updates
- [ ] Translation Updates
- [ ] Release

### TypeScript/Hooks Update

<!--
In an effort to modernize the codebase, you should convert the files
that you work with to React Hooks and TypeScript.
If this is not possible (e.g. it's too many changes, touching too many
files, etc.) please explain why here.
-->

- [ ] Updated files to React Hooks
- [ ] Updated files to TypeScript

## Before / After

<!--
If just refactoring / back-end changes, this can be just an in-English
description of the change at a technical level.
If a UI change, screenshots should be included.


-->
CredentialAccept Simple
<img width="1465" alt="Screenshot 2025-02-20 at 1 29 42 PM"
src="https://github.com/user-attachments/assets/f4bf274a-a945-4ace-b659-d30912c39ff6"
/>

CredentialCreate Simple
<img width="1427" alt="Screenshot 2025-02-20 at 1 31 04 PM"
src="https://github.com/user-attachments/assets/42f3df6c-ef65-4432-920a-ebb9c05e9d2d"
/>

CredentialDelete Simple
<img width="1323" alt="Screenshot 2025-02-20 at 1 31 50 PM"
src="https://github.com/user-attachments/assets/6d5ec4d7-2466-4105-bc52-db705903c33e"
/>

CredentialAccept TableDetail
<img width="992" alt="Screenshot 2025-02-20 at 1 52 37 PM"
src="https://github.com/user-attachments/assets/702af132-9e7c-47f0-bf26-5530545ee949"
/>

CredentialCreate TableDetail
<img width="1087" alt="Screenshot 2025-02-20 at 1 53 56 PM"
src="https://github.com/user-attachments/assets/945bd71e-aa4e-4b08-a9a0-144c65fe38d1"
/>

CredentialDelete TableDetail
<img width="1014" alt="Screenshot 2025-02-20 at 1 58 52 PM"
src="https://github.com/user-attachments/assets/1198099b-448c-46c1-b76c-8870dc92f789"
/>


PermissionedDomainSet Simple
<img width="1101" alt="Screenshot 2025-02-20 at 5 10 59 PM"
src="https://github.com/user-attachments/assets/6258417b-25b7-4eeb-b920-aede1c3de02c"
/>

PermissionedDomainDelete Simple
<img width="1134" alt="Screenshot 2025-02-20 at 5 11 56 PM"
src="https://github.com/user-attachments/assets/f72d146f-99dd-4c1a-9de9-e38cbb50b97f"
/>

PermissionedDomainSet TableDetail

PermissionedDomainDelete TableDetail




## Test Plan

<!--
Please describe the tests that you ran to verify your changes and
provide instructions so that others can reproduce.
-->

<!--
## Future Tasks
For future tasks related to PR.
-->

---------

Co-authored-by: Kenny Lei <[email protected]>
  • Loading branch information
achowdhry-ripple and kennyzlei authored Feb 25, 2025
1 parent baaf892 commit 7173dfb
Show file tree
Hide file tree
Showing 39 changed files with 1,137 additions and 40 deletions.
54 changes: 17 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"ts-jest": "^26.5.6",
"ts-node": "^10.9.2",
"typescript": "^4.9.5",
"xrpl": "^3.1.0"
"xrpl": "^4.2.0"
},
"resolutions": {
"jest-environment-jsdom": "29.3.1"
Expand Down
11 changes: 11 additions & 0 deletions public/locales/ca-CA/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@
"transaction_type_name_CheckCancel": "Cancel·lar Check",
"transaction_type_name_CheckCash": "Cobrar Check",
"transaction_type_name_CheckCreate": "Crear de Check",
"transaction_type_name_CredentialAccept": null,
"transaction_type_name_CredentialCreate": null,
"transaction_type_name_CredentialDelete": null,
"transaction_type_name_DIDDelete": "Eliminar DID",
"transaction_type_name_DIDSet": "Establir DID",
"transaction_type_name_DepositPreauth": "Preautoritzar Diposit",
Expand All @@ -179,6 +182,8 @@
"transaction_type_name_PaymentChannelClaim": "Reclamar al Canal de Pagament",
"transaction_type_name_PaymentChannelCreate": "Crear Canal de Pagament",
"transaction_type_name_PaymentChannelFund": "Dipositar en Canal de Pagament",
"transaction_type_name_PermissionedDomainDelete": null,
"transaction_type_name_PermissionedDomainSet": null,
"transaction_type_name_SetHook": "Establir Hook",
"transaction_type_name_SetRegularKey": "Establir Clau Regular",
"transaction_type_name_SignerListSet": "Etablir Llista de Signantst",
Expand Down Expand Up @@ -562,5 +567,11 @@
"enable_amendment_name": null,
"amendment_status": null,
"expected_date": null,
"credential_type": null,
"credential_issuer": null,
"subject": null,
"expiration": null,
"domain_id": null,
"accepted_credentials": null,
"action_from_and": null
}
14 changes: 13 additions & 1 deletion public/locales/en-US/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@
"transaction_type_name_CheckCancel": "Check Cancel",
"transaction_type_name_CheckCash": "Check Cash",
"transaction_type_name_CheckCreate": "Check Create",
"transaction_type_name_CredentialAccept": "Credential Accept",
"transaction_type_name_CredentialCreate": "Credential Create",
"transaction_type_name_CredentialDelete": "Credential Delete",
"transaction_type_name_DIDDelete": "DID Delete",
"transaction_type_name_DIDSet": "DID Set",
"transaction_type_name_DepositPreauth": "Deposit Preauth",
Expand All @@ -186,6 +189,8 @@
"transaction_type_name_PaymentChannelClaim": "Payment Channel Claim",
"transaction_type_name_PaymentChannelCreate": "Payment Channel Create",
"transaction_type_name_PaymentChannelFund": "Payment Channel Fund",
"transaction_type_name_PermissionedDomainDelete": "Permissioned Domain Delete",
"transaction_type_name_PermissionedDomainSet": "Permissioned Domain Set",
"transaction_type_name_SetHook": "Set Hook",
"transaction_type_name_SetRegularKey": "Set Regular Key",
"transaction_type_name_SignerListSet": "Signer List Set",
Expand Down Expand Up @@ -544,7 +549,7 @@
"deleted": "Deleted",
"holders": "HOLDERS: {{holders}}",
"trustlines": " TRUSTLINES: {{trustlines}}",
"website": "Wesbite",
"website": "Website",
"mpt_issuance_id": "MPT Issuance ID",
"asset_scale": "Asset Scale",
"metadata": "Metadata",
Expand All @@ -562,5 +567,12 @@
"search_results_banner": "Token search by name and account is now available! Try searching for USD",
"enable_amendment_name": "Amendment Name",
"amendment_status": "Amendment Status",
"expected_date": "Expected Date",
"credential_type": "Credential Type",
"credential_issuer": "Credential Issuer",
"subject": "Subject",
"expiration": "Expiration",
"domain_id": "Domain ID",
"accepted_credentials": "Accepted Credentials",
"expected_date": "Expected Date"
}
13 changes: 12 additions & 1 deletion public/locales/es-ES/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@
"transaction_type_name_CheckCancel": "Cancelar Cheque",
"transaction_type_name_CheckCash": "Cobrar Cheque",
"transaction_type_name_CheckCreate": "Crear Cheque",
"transaction_type_name_CredentialAccept": null,
"transaction_type_name_CredentialCreate": null,
"transaction_type_name_CredentialDelete": null,
"transaction_type_name_DepositPreauth": "Preautorizar Depósito",
"transaction_type_name_Error_Cases": "Casos de Error",
"transaction_type_name_EscrowCancel": "Cancelar Depósito",
Expand All @@ -176,6 +179,8 @@
"transaction_type_name_PaymentChannelClaim": "Reclamar Canal de Pago",
"transaction_type_name_PaymentChannelCreate": "Crear Canal de Pago",
"transaction_type_name_PaymentChannelFund": "Añadir Fondos a Canal de Pago",
"transaction_type_name_PermissionedDomainDelete": null,
"transaction_type_name_PermissionedDomainSet": null,
"transaction_type_name_SetHook": "Añadir Hook",
"transaction_type_name_SetRegularKey": "Configurar Clave Normal",
"transaction_type_name_SignerListSet": "Configurar Lista de Firmantes",
Expand Down Expand Up @@ -558,5 +563,11 @@
"enable_amendment_name": null,
"amendment_status": null,
"expected_date": null,
"action_from_and": null
"credential_type": null,
"credential_issuer": null,
"subject": null,
"expiration": null,
"domain_id": null,
"accepted_credentials": null
"action_from_and": null,
}
11 changes: 11 additions & 0 deletions public/locales/fr-FR/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@
"transaction_type_name_CheckCancel": "Chèque annulé",
"transaction_type_name_CheckCash": "Chèque remis",
"transaction_type_name_CheckCreate": "Chèque créé",
"transaction_type_name_CredentialAccept": null,
"transaction_type_name_CredentialCreate": null,
"transaction_type_name_CredentialDelete": null,
"transaction_type_name_DepositPreauth": "Dépôt préautorisé",
"transaction_type_name_Error_Cases": "Cas d'erreur",
"transaction_type_name_EscrowCancel": "séquestre annulé",
Expand All @@ -178,6 +181,8 @@
"transaction_type_name_PaymentChannelClaim": "Canal de paiement réclamé",
"transaction_type_name_PaymentChannelCreate": "Canal de paiement créé",
"transaction_type_name_PaymentChannelFund": "Canal provisionné",
"transaction_type_name_PermissionedDomainDelete": null,
"transaction_type_name_PermissionedDomainSet": null,
"transaction_type_name_SetRegularKey": "Clé régulière définie",
"transaction_type_name_SignerListSet": "Liste de signataires établie",
"transaction_type_name_TicketCreate": "Ticket créé",
Expand Down Expand Up @@ -559,5 +564,11 @@
"enable_amendment_name": null,
"amendment_status": null,
"expected_date": null,
"credential_type": null,
"credential_issuer": null,
"subject": null,
"expiration": null,
"domain_id": null,
"accepted_credentials": null,
"action_from_and": null
}
11 changes: 11 additions & 0 deletions public/locales/ja-JP/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@
"transaction_type_name_CheckCancel": "チェックの取消",
"transaction_type_name_CheckCash": "チェックの現金化",
"transaction_type_name_CheckCreate": "チェックの作成",
"transaction_type_name_CredentialAccept": null,
"transaction_type_name_CredentialCreate": null,
"transaction_type_name_CredentialDelete": null,
"transaction_type_name_DepositPreauth": "入金の事前承認",
"transaction_type_name_Error_Cases": "エラーケース",
"transaction_type_name_EscrowCancel": "エスクローの取消",
Expand All @@ -178,6 +181,8 @@
"transaction_type_name_PaymentChannelClaim": "ペイメントチャネル請求",
"transaction_type_name_PaymentChannelCreate": "ペイメントチャネル作成",
"transaction_type_name_PaymentChannelFund": "ペイメントチャネル資金",
"transaction_type_name_PermissionedDomainDelete": null,
"transaction_type_name_PermissionedDomainSet": null,
"transaction_type_name_SetHook": "Hookの設定",
"transaction_type_name_SetRegularKey": "レギュラーキーの設定",
"transaction_type_name_SignerListSet": "署名者リスト設定",
Expand Down Expand Up @@ -558,5 +563,11 @@
"enable_amendment_name": null,
"amendment_status": null,
"expected_date": null,
"credential_type": null,
"credential_issuer": null,
"subject": null,
"expiration": null,
"domain_id": null,
"accepted_credentials": null,
"action_from_and": null
}
11 changes: 11 additions & 0 deletions public/locales/ko-KR/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@
"transaction_type_name_CheckCancel": "수표 취소",
"transaction_type_name_CheckCash": "수표 현금화",
"transaction_type_name_CheckCreate": "수표 생성",
"transaction_type_name_CredentialAccept": null,
"transaction_type_name_CredentialCreate": null,
"transaction_type_name_CredentialDelete": null,
"transaction_type_name_DepositPreauth": "예치 인증",
"transaction_type_name_Error_Cases": "오류 사례",
"transaction_type_name_EscrowCancel": "에스크로 취소",
Expand All @@ -179,6 +182,8 @@
"transaction_type_name_PaymentChannelClaim": "결제 채널 청구",
"transaction_type_name_PaymentChannelCreate": "결제 채널 생성",
"transaction_type_name_PaymentChannelFund": "결제 채널 펀딩",
"transaction_type_name_PermissionedDomainDelete": null,
"transaction_type_name_PermissionedDomainSet": null,
"transaction_type_name_SetHook": "Hook 설정",
"transaction_type_name_SetRegularKey": "일반 키 설정",
"transaction_type_name_SignerListSet": "서명자 목록 설정",
Expand Down Expand Up @@ -556,5 +561,11 @@
"enable_amendment_name": null,
"amendment_status": null,
"expected_date": null,
"credential_type": null,
"credential_issuer": null,
"subject": null,
"expiration": null,
"domain_id": null,
"accepted_credentials": null,
"action_from_and": null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { useTranslation } from 'react-i18next'
import { type CredentialAccept } from 'xrpl'
import { TransactionSimpleComponent, TransactionSimpleProps } from '../types'
import { SimpleRow } from '../SimpleRow'
import { convertHexToString } from '../../../../../rippled/lib/utils'

export const Simple: TransactionSimpleComponent = (
props: TransactionSimpleProps<CredentialAccept>,
) => {
const { t } = useTranslation()
const { data } = props
const { Issuer: issuer, CredentialType: credentialType } = data.instructions

return (
<>
<SimpleRow label={t('issuer')} data-test="issuer">
{issuer}
</SimpleRow>

<SimpleRow label={t('credential_type')} data-test="credential-type">
{convertHexToString(credentialType)}
</SimpleRow>
</>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { useTranslation } from 'react-i18next'
import { type CredentialAccept } from 'xrpl'
import { TransactionTableDetailProps } from '../types'
import { convertHexToString } from '../../../../../rippled/lib/utils'

export const TableDetail = ({
instructions,
}: TransactionTableDetailProps<CredentialAccept>) => {
const { t } = useTranslation()
const { Issuer: issuer, CredentialType: credentialType } = instructions
return (
<div className="credentialAccept">
<div data-test="issuer">
<span className="label">{t('issuer')}: </span>
<span className="case-sensitive">{issuer}</span>
</div>

<div data-test="credential-type">
<span className="label">{t('credential_type')}: </span>
<span className="case-sensitive">
{convertHexToString(credentialType)}
</span>
</div>
</div>
)
}
Loading

0 comments on commit 7173dfb

Please sign in to comment.