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 6fc51d9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 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 @@ -17,6 +17,11 @@ export const isValidRecipient: F = withLibcoreF(core => async arg => {
return res;
}
const { currency, recipient } = arg;

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

const poolInstance = core.getPoolInstance();
const currencyCore = await poolInstance.getCurrency(currency.id);
const value = await core.Address.isValid(recipient, currencyCore);
Expand Down

0 comments on commit 6fc51d9

Please sign in to comment.