fix(governance): fix time delay notice for withdrawal of 0.00 assets (#3740)
Co-authored-by: Bartłomiej Głownia <bglownia@gmail.com>
This commit is contained in:
parent
fae61c28ca
commit
2c7934a8c7
@ -44,7 +44,7 @@ export class CollateralBridge {
|
||||
is_asset_listed(address: string) {
|
||||
return this.contract.is_asset_listed(address);
|
||||
}
|
||||
get_withdraw_threshold(assetSource: string) {
|
||||
get_withdraw_threshold(assetSource: string): Promise<BigNumber> {
|
||||
return this.contract.get_withdraw_threshold(assetSource);
|
||||
}
|
||||
default_withdraw_delay() {
|
||||
|
@ -70,13 +70,14 @@ const WithdrawDelayNotification = ({
|
||||
return (
|
||||
<Notification
|
||||
intent={Intent.Warning}
|
||||
key={symbol}
|
||||
testId={
|
||||
threshold.isFinite()
|
||||
? 'amount-withdrawal-delay-notification'
|
||||
: 'withdrawals-delay-notification'
|
||||
threshold.isEqualTo(0)
|
||||
? 'withdrawals-delay-notification'
|
||||
: 'amount-withdrawal-delay-notification'
|
||||
}
|
||||
message={[
|
||||
!threshold.isFinite()
|
||||
threshold.isEqualTo(0)
|
||||
? t('All %s withdrawals are subject to a %s delay.', replacements)
|
||||
: t('Withdrawals of %s %s or more will be delayed for %s.', [
|
||||
formatNumber(threshold, decimals),
|
||||
@ -166,10 +167,7 @@ export const WithdrawForm = ({
|
||||
};
|
||||
|
||||
const showWithdrawDelayNotification =
|
||||
delay &&
|
||||
selectedAsset &&
|
||||
(!threshold.isFinite() ||
|
||||
new BigNumber(amount).isGreaterThanOrEqualTo(threshold));
|
||||
delay && selectedAsset && new BigNumber(amount).isGreaterThan(threshold);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
@ -120,7 +120,7 @@ describe('WithdrawManager', () => {
|
||||
it('shows withdraw delay notification if amount greater than threshold', async () => {
|
||||
render(generateJsx(props));
|
||||
fireEvent.change(screen.getByLabelText('Amount'), {
|
||||
target: { value: '1000' },
|
||||
target: { value: '1001' },
|
||||
});
|
||||
expect(
|
||||
await screen.findByTestId('amount-withdrawal-delay-notification')
|
||||
@ -128,7 +128,7 @@ describe('WithdrawManager', () => {
|
||||
});
|
||||
|
||||
it('shows withdraw delay notification if threshold is 0', async () => {
|
||||
withdrawAsset.threshold = new BigNumber(Infinity);
|
||||
withdrawAsset.threshold = new BigNumber(0);
|
||||
render(generateJsx(props));
|
||||
fireEvent.change(screen.getByLabelText('Amount'), {
|
||||
target: { value: '0.01' },
|
||||
|
Loading…
Reference in New Issue
Block a user