Files
xo-stack/examples/node/index.js
T
James Zuccon f66de86eb3 WIP
Signed-off-by: James Zuccon <zuccon@gmail.com>
2024-09-06 15:54:50 +10:00

28 lines
645 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.broadcastTransaction(tx);
});
console.log(blockchain.pendingTransactions.deriveUtxoState());
console.log(wallet.privateKey());