From 95ab5d5aa28a6cda0757783b37c14e34f360b923 Mon Sep 17 00:00:00 2001 From: Ansonhkg Date: Fri, 12 Apr 2024 21:21:54 +0100 Subject: [PATCH] fix: case when pkp public key is not set --- .../src/lib/lit-node-client-nodejs.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts index f01403cd8f..3c5b9de0cd 100644 --- a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts +++ b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts @@ -2474,10 +2474,12 @@ export class LitNodeClientNodeJs // Compute the address from the public key if it's provided. Otherwise, the node will compute it. const pkpEthAddress = (function () { - // prefix '0x' if it's not already prefixed - const hexedPkpPublicKey = hexPrefixed(params.pkpPublicKey!); + if (params.pkpPublicKey) { + // prefix '0x' if it's not already prefixed + const hexedPkpPublicKey = hexPrefixed(params.pkpPublicKey); - if (hexedPkpPublicKey) return computeAddress(hexedPkpPublicKey); + if (hexedPkpPublicKey) return computeAddress(hexedPkpPublicKey); + } // This will be populated by the node, using dummy value for now. return '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2';