Blockchain Traits
This commit is contained in:
@@ -226,6 +226,21 @@ export class Address {
|
||||
return this.fromRedeemScript(Bytes.fromHex(hex).toBytes(), type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to instantiate Address from Locking Bytecode.
|
||||
*
|
||||
* @param lockscript The lockscript as bytes or hex.
|
||||
*
|
||||
* @throws {Error} If lock script cannot be decoded into an address.
|
||||
*
|
||||
* @returns Instance of Address.
|
||||
*/
|
||||
public static fromLockscript(lockscript: string | Uint8Array) {
|
||||
return lockscript instanceof Uint8Array
|
||||
? this.fromLockscriptBytes(lockscript)
|
||||
: this.fromLockscriptHex(lockscript);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to instantiate Address from Locking Bytecode.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user