Skip to content

Commit

Permalink
Fix Preimage failure of Null amount for Tangle (#10833)
Browse files Browse the repository at this point in the history
* Fix possible Null value

* Fix the problem in Preimage instead of FormatBalance

* remove console
  • Loading branch information
TarikGul authored Aug 15, 2024
1 parent 053b8d1 commit 2053ad1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/page-preimages/src/Preimages/Call.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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
/>
Expand Down

0 comments on commit 2053ad1

Please sign in to comment.