Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Commit

Permalink
check for cashAdrr in isValidRecipient
Browse files Browse the repository at this point in the history
  • Loading branch information
valpinkman committed Jun 20, 2019
1 parent 56fc5d3 commit c14af76
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/libcore/isValidRecipient.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow

import { InvalidAddress } from "@ledgerhq/errors";
import { InvalidAddress, CashAddrNotSupported } from "@ledgerhq/errors";
import type { CryptoCurrency } from "../types";
import { withLibcoreF } from "./access";
import customAddressValidationByFamily from "../generated/customAddressValidation";
Expand All @@ -24,6 +24,10 @@ export const isValidRecipient: F = withLibcoreF(core => async arg => {
return Promise.resolve(null);
}

if (recipient.startsWith("bitcoincash:")) {
return Promise.reject(new CashAddrNotSupported());
}

return Promise.reject(
new InvalidAddress(null, { currencyName: currency.name })
);
Expand Down

0 comments on commit c14af76

Please sign in to comment.