From 799bc1a3cb8c9e392f5b91fd134900e05112edd5 Mon Sep 17 00:00:00 2001 From: Borislav Itskov Date: Thu, 24 Oct 2024 10:43:37 +0300 Subject: [PATCH] always return a checksummed address for the schnorr evm address --- src/core/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/index.ts b/src/core/index.ts index 6b0d0c9..1ef7782 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -4,6 +4,7 @@ import ecurve, { Point } from 'ecurve' import bigi from 'bigi' import { InternalNoncePairs, InternalNonces, InternalPublicNonces, InternalSignature } from './types' import { KeyPair } from '../types' +import { getAddress } from 'ethers/lib/utils' const curve = ecurve.getCurveByName('secp256k1') @@ -288,7 +289,7 @@ export const _generateSchnorrAddr = (combinedPublicKey: Buffer): string => { } const px = ethers.utils.hexlify(combinedPublicKey.subarray(1,33)) - return '0x' + px.slice(px.length - 40, px.length) + return getAddress('0x' + px.slice(px.length - 40, px.length)) } export const _sign = (privateKey: Buffer, hash: string): InternalSignature => {