diff --git a/web/cashtab/src/components/Common/Ticker.js b/web/cashtab/src/components/Common/Ticker.js --- a/web/cashtab/src/components/Common/Ticker.js +++ b/web/cashtab/src/components/Common/Ticker.js @@ -11,7 +11,7 @@ prefixes: ['bitcoincash', 'ecash'], coingeckoId: 'bitcoin-cash-abc-2', defaultFee: 5.01, - dust: 0.00001, // The minimum amount of BCHA that can be sent by the app + dust: '0.00000546', // The minimum amount of BCHA that can be sent by the app blockExplorerUrl: 'https://explorer.bitcoinabc.org', blockExplorerUrlTestnet: 'https://texplorer.bitcoinabc.org', tokenName: 'Bitcoin ABC SLP', diff --git a/web/cashtab/src/hooks/__tests__/useBCH.test.js b/web/cashtab/src/hooks/__tests__/useBCH.test.js --- a/web/cashtab/src/hooks/__tests__/useBCH.test.js +++ b/web/cashtab/src/hooks/__tests__/useBCH.test.js @@ -7,6 +7,7 @@ import BCHJS from '@psf/bch-js'; // TODO: should be removed when external lib not needed anymore import { currency } from '../../components/Common/Ticker'; import sendBCH from '../__mocks__/sendBCH'; +import BigNumber from 'bignumber.js'; describe('useBCH hook', () => { it('gets Rest Api Url on testnet', () => { @@ -159,7 +160,11 @@ .mockResolvedValue(expectedTxId); const failedSendBch = sendBch(BCH, wallet, utxos, { addresses, - values: [0.00000546 - 0.00000001], + values: [ + new BigNumber(currency.dust) + .minus(new BigNumber('0.00000001')) + .toString(), + ], }); expect(failedSendBch).rejects.toThrow(new Error('dust')); const nullValuesSendBch = await sendBch(BCH, wallet, utxos, { diff --git a/web/cashtab/src/hooks/useBCH.js b/web/cashtab/src/hooks/useBCH.js --- a/web/cashtab/src/hooks/useBCH.js +++ b/web/cashtab/src/hooks/useBCH.js @@ -427,7 +427,7 @@ ); // If user is attempting to send less than minimum accepted by the backend - if (value.lt(new BigNumber('0.00000546'))) { + if (value.lt(new BigNumber(currency.dust))) { // Throw the same error given by the backend attempting to broadcast such a tx throw new Error('dust'); }