|
|
@ -4,7 +4,7 @@ import invariant from 'invariant' |
|
|
|
import CommNodeHid from '@ledgerhq/hw-transport-node-hid' |
|
|
|
import type Transport from '@ledgerhq/hw-transport' |
|
|
|
import type { IPCSend } from 'types/electron' |
|
|
|
import getAdressFromCurrency from './getAddressForCurrency' |
|
|
|
import getAddressForCurrency from './getAddressForCurrency' |
|
|
|
|
|
|
|
export default async ( |
|
|
|
send: IPCSend, |
|
|
@ -22,9 +22,9 @@ export default async ( |
|
|
|
}, |
|
|
|
) => { |
|
|
|
try { |
|
|
|
invariant(currencyId, 'currencyId is defined') |
|
|
|
invariant(currencyId, 'currencyId "%s" not defined', currencyId) |
|
|
|
const transport: Transport<*> = await CommNodeHid.open(devicePath) |
|
|
|
const resolver = getAdressFromCurrency(currencyId) |
|
|
|
const resolver = getAddressForCurrency(currencyId) |
|
|
|
const address = await resolver(transport, currencyId, accountPath, options) |
|
|
|
if (accountPath && accountAddress && address !== accountAddress) { |
|
|
|
throw new Error('Account address is different than device address') |
|
|
|