Resolve "feat(Primitives): Have Bytes Primitive extends Uint8Array (if possible)"
This commit is contained in:
@@ -73,7 +73,7 @@ export class BlockHeader {
|
||||
* @throws Error if the hex string length is not 160
|
||||
*/
|
||||
static fromHex(hex: string): BlockHeader {
|
||||
return this.fromBytes(Bytes.fromHex(hex).toBytes());
|
||||
return this.fromBytes(Bytes.fromHex(hex).toUint8Array());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,7 +119,7 @@ export class BlockHeader {
|
||||
* @returns 160-character hex string representing the block header
|
||||
*/
|
||||
toHex(): string {
|
||||
return Bytes.fromBytes(this.toBytes()).toHex();
|
||||
return Bytes.fromBytes(this.bytes).toHex();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -207,7 +207,7 @@ export class BlockHeader {
|
||||
* @returns 32-byte array containing the block hash
|
||||
*/
|
||||
getHash(): Uint8Array {
|
||||
return hash256(this.toBytes()).toReversed();
|
||||
return hash256(this.bytes).toReversed();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user