Fix Preimage failure of Null amount for Tangle (#10833)

* Fix possible Null value

* Fix the problem in Preimage instead of FormatBalance

* remove console
This commit is contained in:
Tarik Gul 2024-08-14 17:57:40 -07:00 committed by GitHub
parent 053b8d1723
commit 2053ad1e59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,6 +8,7 @@ import React from 'react';
import { AddressMini, MarkError, MarkWarning } from '@polkadot/react-components';
import { ZERO_ACCOUNT } from '@polkadot/react-hooks/useWeight';
import { CallExpander } from '@polkadot/react-params';
import { Null } from '@polkadot/types-codec';
import { useTranslation } from '../translate.js';
@ -48,7 +49,9 @@ function PreimageCall ({ className = '', value }: Props): React.ReactElement<Pro
? value.deposit
? (
<AddressMini
balance={value.deposit.amount}
// HACK: In the rare case that the value is passed down as a Null Codec type as seen with Tangle
// We ensure to handle that case. ref: https://github.com/polkadot-js/apps/issues/10793
balance={!(value.deposit.amount instanceof Null) ? value.deposit.amount : undefined}
value={value.deposit.who}
withBalance
/>