Skip to content

Commit

Permalink
fix: asset conversion checks and update default selected asset value (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ap211unitech authored Feb 28, 2025
1 parent 48540da commit d1ac40d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/react-hooks/src/ctx/PayWithAsset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ function PayWithAssetProvider ({ children }: Props): React.ReactElement<Props> {
api.registry.metadata.extrinsic.signedExtensions.some(
(a) => a.identifier.toString() === 'ChargeAssetTxPayment'
) &&
api.tx.assetConversion && completeAssetInfos.length > 0,
[api.registry.metadata.extrinsic.signedExtensions, api.tx.assetConversion, completeAssetInfos.length]
!!api.tx.assetConversion &&
!!api.call.assetConversionApi &&
completeAssetInfos.length > 0,
[api.call.assetConversionApi, api.registry.metadata.extrinsic.signedExtensions, api.tx.assetConversion, completeAssetInfos.length]
);

useEffect(() => {
Expand Down
3 changes: 1 addition & 2 deletions packages/react-signer/src/PayWithAsset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface Props {
const PayWithAsset = ({ onChangeFeeAsset }: Props) => {
const { t } = useTranslation();
const { api } = useApi();
const [selectedAssetValue, setSelectedAssetValue] = useState('0');
const [selectedAssetValue, setSelectedAssetValue] = useState('-1');

const { assetOptions, isDisabled, onChange, selectedFeeAsset } = usePayWithAsset();

Expand Down Expand Up @@ -55,7 +55,6 @@ const PayWithAsset = ({ onChangeFeeAsset }: Props) => {
useEffect(() => {
if (selectedFeeAsset) {
onChangeFeeAsset((e) =>
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
({
...e,
assetId: getFeeAssetLocation(api, selectedFeeAsset),
Expand Down

0 comments on commit d1ac40d

Please sign in to comment.