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
+6 -6
View File
@@ -10,7 +10,7 @@ import {
* Script Entity.
*/
export class Script {
public readonly bytes: Uint8Array;
protected readonly bytes: Uint8Array;
/**
* Construct a new Script
@@ -32,8 +32,8 @@ export class Script {
*/
public static from(script: Uint8Array | string) {
return script instanceof Uint8Array
? Script.fromBytes(script)
: Script.fromHex(script);
? this.fromBytes(script)
: this.fromHex(script);
}
/**
@@ -46,7 +46,7 @@ export class Script {
* @returns {Script} The created Script Entity.
*/
public static fromBytes(bytes: Uint8Array): Script {
return new Script(bytes);
return new this(bytes);
}
/**
@@ -73,7 +73,7 @@ export class Script {
}
// Return new Script Entity from the assembled bytecode.
return new Script(assembleResult.bytecode);
return new this(assembleResult.bytecode);
}
/**
@@ -95,7 +95,7 @@ export class Script {
const scriptBin = hexToBin(hex);
// Return new Script entity constructed from the binary.
return new Script(scriptBin);
return new this(scriptBin);
}
/**