@@ -1,3 +1,4 @@
|
||||
import { Transaction } from '@xo/primitives';
|
||||
import { AddressNotification, ElectrumRequest } from './blockchain-types.js';
|
||||
|
||||
import { ElectrumClient } from '@electrum-cash/network';
|
||||
@@ -75,6 +76,22 @@ export class Blockchain {
|
||||
return response;
|
||||
}
|
||||
|
||||
// TODO: async commit() method
|
||||
// This won't actually broadcast, this will just commit the transaction to our graph.
|
||||
// The reason we want this is because, for protos like BIP70, we want service to verify the tx and broadcast it.
|
||||
// And we just want to be able to monitor whether service did the needful (broadcasted it).
|
||||
// This should accept options: { waitForSeen: boolean }
|
||||
async commitTransaction(
|
||||
transaction: Transaction,
|
||||
opts: { waitUntilSeen: boolean } = { waitUntilSeen: true }
|
||||
) {
|
||||
console.log(transaction);
|
||||
console.log(opts);
|
||||
}
|
||||
|
||||
// TODO: async broadcast() method
|
||||
// This should accept options: { waitForSeen: boolean }
|
||||
|
||||
async subscribeAddress(address: string, callback: AddressCallback) {
|
||||
await this.electrumClient.subscribe(
|
||||
'blockchain.address.subscribe',
|
||||
|
||||
Reference in New Issue
Block a user