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

Commit

Permalink
fix bch address convert issue (#1847)
Browse files Browse the repository at this point in the history
  • Loading branch information
hzheng-ledger authored and lambertkevin committed Apr 8, 2022
1 parent d78a214 commit 6b17a19
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/families/bitcoin/logic.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import cashaddr from "cashaddrjs";
import bchaddr from "bchaddrjs";
import { Currency, isValidAddress } from "./wallet-btc";
import { RecipientRequired, InvalidAddress } from "@ledgerhq/errors";
import type { Account, CryptoCurrency, CryptoCurrencyIds } from "./../../types";
Expand Down Expand Up @@ -143,8 +142,8 @@ type CoinLogic = {
injectGetAddressParams?: (arg0: Account) => any;
};

const bchToCashaddrAddressWithoutPrefix = (recipient) =>
recipient ? bchaddr.toCashAddress(recipient).split(":")[1] : recipient;
export const bchToCashaddrAddressWithoutPrefix = (recipient) =>
recipient ? recipient.substring(recipient.indexOf(":") + 1) : recipient;

export const perCoinLogic: Record<
CryptoCurrencyIds,
Expand Down
4 changes: 3 additions & 1 deletion src/families/bitcoin/specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,9 @@ const bitcoinLikeMutations = ({
test: ({ account }) => {
expect(
account.bitcoinResources?.utxos
.filter((u) => u.blockHeight && u.blockHeight < account.blockHeight) // Exclude pending UTXOs and the Utxos just written into new block
.filter(
(u) => u.blockHeight && u.blockHeight < account.blockHeight - 10
) // Exclude pending UTXOs and the Utxos just written into new block (10 blocks time)
.reduce((p, c) => p.plus(c.value), new BigNumber(0))
.toString()
).toBe("0");
Expand Down

0 comments on commit 6b17a19

Please sign in to comment.