Make Blockchain from methods inheritable
This commit is contained in:
@@ -24,8 +24,10 @@ import {
|
||||
// Local Blockchain Adapter.
|
||||
// This simulates the BCH Blockchain.
|
||||
export class BlockchainInMemory extends BaseBlockchain {
|
||||
static from() {
|
||||
return new BlockchainInMemory();
|
||||
static async from<T extends typeof BlockchainInMemory>(this: T) {
|
||||
const blockchain = new this();
|
||||
await blockchain.start();
|
||||
return blockchain as InstanceType<T>;
|
||||
}
|
||||
|
||||
private transactions: BlockchainTransactions;
|
||||
|
||||
Reference in New Issue
Block a user