@ledgerhq/coin-internet_computer
Version:
Ledger Internet Computer integration
26 lines • 991 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const logs_1 = require("@ledgerhq/logs");
function resolver(signerContext) {
return async (deviceId, { path, verify }) => {
(0, logs_1.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"),
};
};
}
exports.default = resolver;
//# sourceMappingURL=getAddress.js.map