From 4cd969f82eb4a5d8c08feb59c42fb3e7195af50e Mon Sep 17 00:00:00 2001 From: Janek Rahrt Date: Mon, 13 Dec 2021 14:56:59 +0100 Subject: [PATCH] fix: add jsdoc comment --- src/types.ts | 2 +- src/utils/ellipticCurve.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/types.ts b/src/types.ts index ebc0501d9..bced5ba60 100644 --- a/src/types.ts +++ b/src/types.ts @@ -14,8 +14,8 @@ export type Status = | 'NOT_RECEIVED' | 'RECEIVED' | 'PENDING' - | 'ACCEPTED_ON_L1' | 'ACCEPTED_ON_L2' + | 'ACCEPTED_ON_L1' | 'REJECTED'; export type TransactionStatus = 'TRANSACTION_RECEIVED'; export type Type = 'DEPLOY' | 'INVOKE_FUNCTION'; diff --git a/src/utils/ellipticCurve.ts b/src/utils/ellipticCurve.ts index 26635da04..7ccfe81c1 100644 --- a/src/utils/ellipticCurve.ts +++ b/src/utils/ellipticCurve.ts @@ -53,6 +53,12 @@ export function getStarkKey(keyPair: KeyPair): string { return addHexPrefix(sanitizeBytes((keyPair as any).pub.getX().toString(16), 2)); } +/** + * Takes a public key and casts it into `elliptic` KeyPair format. + * + * @param publicKey - public key which should get casted to a KeyPair + * @returns keyPair with public key only, which can be used to verify signatures, but cant sign anything + */ export function getKeyPairFromPublicKey(publicKey: BigNumberish): KeyPair { const publicKeyBn = toBN(publicKey); return ec.keyFromPublic(removeHexPrefix(toHex(publicKeyBn)), 'hex');