Misc Primitive Fixes

This commit is contained in:
Jim Hamill
2025-01-15 03:05:53 +00:00
parent 9348648584
commit a51da6770f
15 changed files with 119 additions and 109 deletions
+5 -5
View File
@@ -15,7 +15,7 @@ import {
*/
export class PublicKey {
// The raw bytes representing the Public Key.
public readonly bytes: Uint8Array;
protected readonly bytes: Uint8Array;
/**
* Construct a new Public Key.
@@ -37,8 +37,8 @@ export class PublicKey {
*/
public static from(publicKey: Uint8Array | string) {
return publicKey instanceof Uint8Array
? PublicKey.fromBytes(publicKey)
: PublicKey.fromHex(publicKey);
? this.fromBytes(publicKey)
: this.fromHex(publicKey);
}
/**
@@ -56,7 +56,7 @@ export class PublicKey {
throw new Error(`Invalid Public Key.`);
}
return new PublicKey(publicKeyBytes);
return new this(publicKeyBytes);
}
/**
@@ -80,7 +80,7 @@ export class PublicKey {
const publicKey = hexToBin(publicKeyHex);
// Create a Public Key Entity from the binary.
return new PublicKey(publicKey);
return new this(publicKey);
}
/**