diff --git a/examples/eth-pm-wallet-encryption/src/GetEncryptionPublicKey.tsx b/examples/eth-pm-wallet-encryption/src/GetEncryptionPublicKey.tsx index d7746b22e2..3242d0c61f 100644 --- a/examples/eth-pm-wallet-encryption/src/GetEncryptionPublicKey.tsx +++ b/examples/eth-pm-wallet-encryption/src/GetEncryptionPublicKey.tsx @@ -23,9 +23,14 @@ export default function GetEncryptionPublicKey({ method: 'eth_getEncryptionPublicKey', params: [address], }) - .then((key: string) => { + .then((key: string | undefined) => { console.log('Encryption Public key:', key); + if (typeof key !== 'string') { + console.error('Could not get encryption key'); + return; + } + setEncPublicKey(Buffer.from(key, 'base64')); }) .catch((error) => {