Skip to content

Commit

Permalink
Merge pull request #769 from interlay/tom/fix/xcm-validation-messages
Browse files Browse the repository at this point in the history
Tom/fix/xcm validation messages
  • Loading branch information
tomjeatt authored Dec 19, 2022
2 parents e840065 + eee2deb commit 5782c6a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
8 changes: 8 additions & 0 deletions src/assets/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -553,5 +553,13 @@
"amount_must_be_at_most": "Amount to {{action}} must be at most {{amount}}",
"please_enter_no_higher_available_balance": "Please enter an amount no higher than your available balance",
"field_amount": "{{field}} amount"
},
"xcm_transfer": {
"validation": {
"insufficient_funds": "Insufficient balance to transfer",
"balance_lower_minimum": "Transferable balance is lower than the minimum",
"transfer_more_than_minimum": "Must transfer more than the minimum amount of {{ amount }}",
"transfer_less_than_maximum": "Must transfer less than the maximum amount of {{ amount }}"
}
}
}
12 changes: 8 additions & 4 deletions src/pages/Transfer/CrossChainTransferForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,17 @@ const CrossChainTransferForm = (): JSX.Element => {
const maxInputToBig = Big(inputConfigs.maxInput.toString());

if (balanceMonetaryAmount.lt(transferAmount)) {
return t('insufficient_funds');
return t('xcm_transfer.validation.insufficient_funds');
} else if (minInputToBig.gt(transferableBalance)) {
return 'Transferable balance is lower than minimum';
return t('xcm_transfer.validation.balance_lower_minimum');
} else if (minInputToBig.gt(transferAmount.toBig())) {
return 'Must transfer more than [minInput] (taking into account ed, fees)';
return t('xcm_transfer.validation.transfer_more_than_minimum', {
amount: `${inputConfigs.minInput.toString()} ${currency.symbol}`
});
} else if (maxInputToBig.lt(transferAmount.toBig())) {
return 'Must transfer less than maximum';
return t('xcm_transfer.validation.transfer_less_than_maximum', {
amount: `${inputConfigs.maxInput.toString()} ${currency.symbol}`
});
} else {
return undefined;
}
Expand Down

2 comments on commit 5782c6a

@vercel
Copy link

@vercel vercel bot commented on 5782c6a Dec 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 5782c6a Dec 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.