UNPKG

@ledgerhq/coin-cardano

Version:
26 lines 1.22 kB
import { utils as TyphonUtils } from "@stricahq/typhonjs"; import { getBipPathFromString, getBipPathString } from "./logic"; import { StakeChain } from "./types"; import { STAKING_ADDRESS_INDEX } from "./constants"; import { getNetworkParameters } from "./networks"; const resolver = (signerContext) => { return async (deviceId, { path, verify, currency }) => { const spendingPath = getBipPathFromString(path); const stakingPathString = getBipPathString({ account: spendingPath.account, chain: StakeChain.stake, index: STAKING_ADDRESS_INDEX, }); const networkParams = getNetworkParameters(currency.id); const r = await signerContext(deviceId, signer => signer.getAddress({ path, stakingPathString, networkParams, verify })); const address = TyphonUtils.getAddressFromHex(Buffer.from(r.addressHex, "hex")); return { address: address.getBech32(), // Here, we use publicKey hash, as cardano app doesn't export the public key publicKey: address.paymentCredential.hash.toString("hex"), path, }; }; }; export default resolver; //# sourceMappingURL=hw-getAddress.js.map