28 lines
644 B
JavaScript
28 lines
644 B
JavaScript
import { Transaction } from '@xo/primitives';
|
|
import { Blockchain, WalletHD } from '@xo/wallet';
|
|
|
|
const blockchain = new Blockchain(
|
|
['bch.imaginary.cash', 'cashnode.bch.ninja', 'electrum.imaginary.cash'],
|
|
'Test App',
|
|
'1.5',
|
|
);
|
|
|
|
await blockchain.start();
|
|
|
|
const wallet = WalletHD.fromMnemonic(
|
|
'harsh gospel job ordinary garden clay eight cactus replace general prison permit',
|
|
blockchain,
|
|
);
|
|
|
|
await wallet.scan();
|
|
|
|
const transactions = wallet.getTransactions();
|
|
|
|
transactions.forEach((tx) => {
|
|
blockchain.commitTransaction(tx);
|
|
});
|
|
|
|
console.log(blockchain.pendingTransactions.deriveUtxoState());
|
|
|
|
console.log(wallet.privateKey());
|