@ledgerhq/coin-internet_computer
Version:
Ledger Internet Computer integration
24 lines • 895 B
JavaScript
import { log } from "@ledgerhq/logs";
function resolver(signerContext) {
return async (deviceId, { path, verify }) => {
log("debug", "start getAddress process");
const { r } = await signerContext(deviceId, async (signer) => {
const r = verify
? await signer.showAddressAndPubKey(path)
: await signer.getAddressAndPubKey(path);
return { r };
});
if (!r.address || !r.publicKey) {
console.error("Failed to get address from device");
throw Error("Failed to get address from device");
}
return {
path,
address: Buffer.from(r.address).toString("hex"),
principalText: r.principalText,
publicKey: Buffer.from(r.publicKey).toString("hex"),
};
};
}
export default resolver;
//# sourceMappingURL=getAddress.js.map