|
@ -3,9 +3,13 @@ |
|
|
import type { CryptoCurrency } from '@ledgerhq/live-common/lib/types' |
|
|
import type { CryptoCurrency } from '@ledgerhq/live-common/lib/types' |
|
|
import Btc from '@ledgerhq/hw-app-btc' |
|
|
import Btc from '@ledgerhq/hw-app-btc' |
|
|
import type Transport from '@ledgerhq/hw-transport' |
|
|
import type Transport from '@ledgerhq/hw-transport' |
|
|
import { BtcUnmatchedApp } from 'config/errors' |
|
|
import { BtcUnmatchedApp, UpdateYourApp } from 'config/errors' |
|
|
import getBitcoinLikeInfo from '../devices/getBitcoinLikeInfo' |
|
|
import getBitcoinLikeInfo from '../devices/getBitcoinLikeInfo' |
|
|
|
|
|
|
|
|
|
|
|
const oldP2SH = { |
|
|
|
|
|
digibyte: 5, |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
export default async ( |
|
|
export default async ( |
|
|
transport: Transport<*>, |
|
|
transport: Transport<*>, |
|
|
currency: CryptoCurrency, |
|
|
currency: CryptoCurrency, |
|
@ -25,6 +29,13 @@ export default async ( |
|
|
if (bitcoinLikeInfo) { |
|
|
if (bitcoinLikeInfo) { |
|
|
const { P2SH, P2PKH } = await getBitcoinLikeInfo(transport) |
|
|
const { P2SH, P2PKH } = await getBitcoinLikeInfo(transport) |
|
|
if (P2SH !== bitcoinLikeInfo.P2SH || P2PKH !== bitcoinLikeInfo.P2PKH) { |
|
|
if (P2SH !== bitcoinLikeInfo.P2SH || P2PKH !== bitcoinLikeInfo.P2PKH) { |
|
|
|
|
|
if ( |
|
|
|
|
|
currency.id in oldP2SH && |
|
|
|
|
|
P2SH === oldP2SH[currency.id] && |
|
|
|
|
|
P2PKH === bitcoinLikeInfo.P2PKH |
|
|
|
|
|
) { |
|
|
|
|
|
throw new UpdateYourApp(`UpdateYourApp ${currency.id}`, currency) |
|
|
|
|
|
} |
|
|
throw new BtcUnmatchedApp(`BtcUnmatchedApp ${currency.id}`, currency) |
|
|
throw new BtcUnmatchedApp(`BtcUnmatchedApp ${currency.id}`, currency) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|