|
@@ -390,12 +390,13 @@ const calculateWalletChars = () => round(width.value / 114, 0); |
|
|
|
|
|
|
|
|
const hasInvalidValues = () => { |
|
|
const hasInvalidValues = () => { |
|
|
if (!fund.value) throw new Error('Fund was not loaded!'); |
|
|
if (!fund.value) throw new Error('Fund was not loaded!'); |
|
|
return [pk, amount].every((v) => v.value !== undefined && v.value !== '') |
|
|
|
|
|
&& (amount.value!.isZero() |
|
|
|
|
|
|| amount.value! > amountAvailable.value |
|
|
|
|
|
|| amount.value!.lt(fund.value.fundInfo.minContribution) |
|
|
|
|
|
|| (acctBalance.value && amt.value!.gt(acctBalance.value)) |
|
|
|
|
|
|| unknownAcct.value); |
|
|
|
|
|
|
|
|
if ([pk, amount].some((v) => v.value === undefined || v.value === '')) return false; |
|
|
|
|
|
if (!pk.value || !amount.value) throw new Error('One or more validation values were undefined'); |
|
|
|
|
|
return (amount.value.isZero() |
|
|
|
|
|
|| amount.value > amountAvailable.value |
|
|
|
|
|
|| amount.value.lt(fund.value.fundInfo.minContribution) |
|
|
|
|
|
|| (acctBalance.value && amount.value.gt(acctBalance.value)) |
|
|
|
|
|
|| unknownAcct.value); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const invalidContributionForm = computed(() => hasInvalidValues()); |
|
|
const invalidContributionForm = computed(() => hasInvalidValues()); |
|
@@ -526,7 +527,7 @@ const makeContribution = async () => { |
|
|
if (!loading.value.contribution && pk.value |
|
|
if (!loading.value.contribution && pk.value |
|
|
&& amount.value && amount.value <= amountAvailable.value) { |
|
|
&& amount.value && amount.value <= amountAvailable.value) { |
|
|
loading.value.contribution = true; |
|
|
loading.value.contribution = true; |
|
|
await contribute(sanitize(pk.value), amount.value!.toNumber(), fund.value.fundInfo.id); |
|
|
|
|
|
|
|
|
await contribute(sanitize(pk.value), amount.value.toNumber(), fund.value.fundInfo.id); |
|
|
loading.value.contribution = false; |
|
|
loading.value.contribution = false; |
|
|
pk.value = ''; |
|
|
pk.value = ''; |
|
|
amt.value = undefined; |
|
|
amt.value = undefined; |
|
|