- 'Rejects price if minimum token accept costs 1 nanosatoshi less than dust, xec price',
+ 'Accepts price if minimum token accept costs 1 nanosatoshi less than dust, xec price, because price validation does not depend on min buy qty, instead this is handled by qty validation',
xecListPrice: '5.45999999999',
selectedCurrency: 'XEC',
fiatPrice: null,
minBuyTokenQty: 1,
tokenDecimals: 0,
- returned:
- 'Minimum buy costs 5.45999999999 XEC, must be at least 5.46 XEC',
+ returned: false,
},
{
description:
@@ -2645,8 +2644,7 @@
fiatPrice: 1,
minBuyTokenQty: 1,
tokenDecimals: 0,
- returned:
- 'Minimum buy costs 5.45999999999 XEC, must be at least 5.46 XEC',
+ returned: false,
},
{
description: 'Accepts the lowest possible price for XEC input',
@@ -2912,4 +2910,78 @@
},
],
},
+ getAgoraMinBuyError: {
+ expectedReturns: [
+ {
+ description:
+ 'We reject a min qty that is higher than the offered qty',
+ xecListPrice: '1',
+ selectedCurrency: 'XEC',
+ fiatPrice: 1,
+ minBuyTokenQty: '2',
+ offeredTokenQty: '1',
+ tokenDecimals: 0,
+ tokenProtocol: 'ALP',
+ tokenBalance: '100',
+ userLocale: 'en-US',
+ returned:
+ 'The min buy must be less than or equal to the offered quantity',
+ },
+ {
+ description:
+ 'We can pass on an error from isValidTokenSendOrBurnAmount',
+ xecListPrice: '1',
+ selectedCurrency: 'XEC',
+ fiatPrice: 1,
+ minBuyTokenQty: '0', // 0 is invalid
+ offeredTokenQty: '1',
+ tokenDecimals: 0,
+ tokenProtocol: 'ALP',
+ tokenBalance: '100',
+ userLocale: 'en-US',
+ returned: 'Amount must be greater than 0',
+ },
+ {
+ description: 'We give the required min qty if input is too low',
+ xecListPrice: '1',
+ selectedCurrency: 'XEC',
+ fiatPrice: 1,
+ minBuyTokenQty: '1', // 0 is invalid
+ offeredTokenQty: '100',
+ tokenDecimals: 0,
+ tokenProtocol: 'ALP',
+ tokenBalance: '100',
+ userLocale: 'en-US',
+ returned: `Total cost of minimum buy below dust. Min offered qty must be at least 6.`,
+ },
+ {
+ description:
+ 'We give the required min qty if input is too low with decimals',
+ xecListPrice: '1',
+ selectedCurrency: 'XEC',
+ fiatPrice: 1,
+ minBuyTokenQty: '1', // 0 is invalid
+ offeredTokenQty: '100',
+ tokenDecimals: 9,
+ tokenProtocol: 'ALP',
+ tokenBalance: '100',
+ userLocale: 'en-US',
+ returned: `Total cost of minimum buy below dust. Min offered qty must be at least 5.46.`,
+ },
+ {
+ description:
+ 'We give the required min qty if input is too low for a locale that does not use a period for decimal places',
+ xecListPrice: '1',
+ selectedCurrency: 'XEC',
+ fiatPrice: 1,
+ minBuyTokenQty: '1', // 0 is invalid
+ offeredTokenQty: '100',
+ tokenDecimals: 9,
+ tokenProtocol: 'ALP',
+ tokenBalance: '100',
+ userLocale: 'fr-FR',
+ returned: `Total cost of minimum buy below dust. Min offered qty must be at least 5,46.`,