Make waitForTransaction part of BaseBlockchain
This commit is contained in:
@@ -184,24 +184,10 @@ export class Address {
|
||||
let payload = sha256.hash(bytes);
|
||||
|
||||
if (type === 'P2SH20') {
|
||||
// Make sure length is 20 bytes.
|
||||
if (bytes.length !== 20) {
|
||||
throw new Error(
|
||||
`Invalid payload length. Received '${bytes.length}', expected 20 for P2SH20`,
|
||||
);
|
||||
}
|
||||
|
||||
// RIPEMD160 the SHA256 hash.
|
||||
payload = ripemd160.hash(payload);
|
||||
} else if (type === 'P2SH32') {
|
||||
// Make sure length is 32 bytes.
|
||||
if (bytes.length !== 32) {
|
||||
throw new Error(
|
||||
`Invalid payload length. Received '${bytes.length}', expected 32 for P2SH20`,
|
||||
);
|
||||
}
|
||||
|
||||
// SHA256 Hash the SHA256 hash a seconr time.
|
||||
// SHA256 Hash the SHA256 hash a second time.
|
||||
payload = sha256.hash(payload);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { Bytes } from './bytes.js';
|
||||
|
||||
import { assembleBytecodeBCH, disassembleBytecodeBCH } from '@bitauth/libauth';
|
||||
import {
|
||||
assembleBytecodeBCH,
|
||||
disassembleBytecodeBCH,
|
||||
compileCashAssembly,
|
||||
} from '@bitauth/libauth';
|
||||
|
||||
/**
|
||||
* Script Entity.
|
||||
@@ -109,6 +113,21 @@ export class Script {
|
||||
return new this(assembleResult.bytecode);
|
||||
}
|
||||
|
||||
// NOTE: In its current form, this is pretty useless because it does not allow OP_CODES.
|
||||
// Disabling because it will probably just cause confusion.
|
||||
/*
|
||||
public static fromCashASM(cashASM: string) {
|
||||
const result = compileCashAssembly(cashASM);
|
||||
|
||||
if (typeof result === 'string') {
|
||||
// TODO: Make error more detailed.
|
||||
throw new Error(`Failed to parse CashASM: ${result}`);
|
||||
}
|
||||
|
||||
return new this(result);
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a Script Entity from the given bytes (as hexadecimal string).
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user