Skip to content

Commit

Permalink
Merge pull request #1695 from oasisprotocol/csillag/fix-encryption-di…
Browse files Browse the repository at this point in the history
…splay

Also consider oasis_encryption_envelope for TXs
  • Loading branch information
csillag authored Jan 15, 2025
2 parents 92da8ac + 6122012 commit 309c695
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
1 change: 1 addition & 0 deletions .changelog/1695.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Correctly display encryption data for oasis-style encrypted transactions
6 changes: 5 additions & 1 deletion src/app/components/Transactions/RuntimeTransactions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ export const RuntimeTransactions: FC<TransactionsProps> = ({
...(verbose && canHaveEncryption
? [
{
content: <TransactionEncryptionStatus envelope={transaction.encryption_envelope} />,
content: (
<TransactionEncryptionStatus
envelope={transaction.encryption_envelope ?? transaction.oasis_encryption_envelope}
/>
),
key: 'encrypted',
},
]
Expand Down
27 changes: 14 additions & 13 deletions src/app/pages/RuntimeTransactionDetailPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export const RuntimeTransactionDetailView: FC<{
// @ts-expect-error Ignore index type error
const amountSymbolPriceInfo = tokenPrices[transaction?.amount_symbol]
const gasPrice = getGasPrice({ fee: transaction?.charged_fee, gasUsed: transaction?.gas_used.toString() })
const envelope = transaction?.encryption_envelope ?? transaction?.oasis_encryption_envelope

return (
<>
Expand Down Expand Up @@ -154,7 +155,7 @@ export const RuntimeTransactionDetailView: FC<{

<dt>{t('transactions.encryption.format')}</dt>
<dd>
<TransactionEncryptionStatus envelope={transaction.encryption_envelope} withText={true} />
<TransactionEncryptionStatus envelope={envelope} withText={true} />
</dd>

<dt>{t('common.timestamp')}</dt>
Expand Down Expand Up @@ -259,7 +260,7 @@ export const RuntimeTransactionDetailView: FC<{
</>
)}

{!transaction.encryption_envelope && transaction.body?.init_code && (
{!envelope && transaction.body?.init_code && (
<>
<dt>{t('transaction.rawData')}</dt>
<dd>
Expand All @@ -268,55 +269,55 @@ export const RuntimeTransactionDetailView: FC<{
</>
)}

{transaction.encryption_envelope && (
{envelope && (
<>
{transaction.encryption_envelope.public_key !== undefined && (
{envelope.public_key !== undefined && (
<>
<dt>{t('transactions.encryption.publicKey')}</dt>
<dd>
<Typography variant="mono" sx={{ overflowWrap: 'anywhere' }}>
{transaction.encryption_envelope.public_key}
{envelope.public_key}
</Typography>
</dd>
</>
)}

{transaction.encryption_envelope.data_nonce !== undefined && (
{envelope.data_nonce !== undefined && (
<>
<dt>{t('transactions.encryption.dataNonce')}</dt>
<dd>
<Typography variant="mono" sx={{ overflowWrap: 'anywhere' }}>
{transaction.encryption_envelope.data_nonce}
{envelope.data_nonce}
</Typography>
</dd>
</>
)}

{transaction.encryption_envelope.data !== undefined && (
{envelope.data !== undefined && (
<>
<dt>{t('transactions.encryption.encryptedData')}</dt>
<dd>
<LongDataDisplay data={transaction.encryption_envelope.data} />
<LongDataDisplay data={envelope.data} />
</dd>
</>
)}

{transaction.encryption_envelope.result_nonce !== undefined && (
{envelope.result_nonce !== undefined && (
<>
<dt>{t('transactions.encryption.resultNonce')}</dt>
<dd>
<Typography variant="mono" sx={{ fontWeight: 400 }}>
{transaction.encryption_envelope.result_nonce}
{envelope.result_nonce}
</Typography>
</dd>
</>
)}

{transaction.encryption_envelope.result !== undefined && (
{envelope.result !== undefined && (
<>
<dt>{t('transactions.encryption.encryptedResult')}</dt>
<dd>
<LongDataDisplay data={transaction.encryption_envelope.result} fontWeight={400} />
<LongDataDisplay data={envelope.result} fontWeight={400} />
</dd>
</>
)}
Expand Down

0 comments on commit 309c695

Please sign in to comment.