XO wallet integration
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
import {
|
||||
WalletUTXOs,
|
||||
type InputTemplateBCH,
|
||||
type TransactionTemplate,
|
||||
type WalletAddresses,
|
||||
type WalletBlockchain,
|
||||
type WalletTransactions,
|
||||
} from './types.js';
|
||||
|
||||
import { type BlockchainUTXOs } from '../blockchain/index.js';
|
||||
import { type Activities } from '../storage/index.js';
|
||||
import { type Activities, type BaseStore } from '../storage/index.js';
|
||||
import { EventEmitter } from '../utils/index.js';
|
||||
|
||||
import { type TokenBalances, type Address } from '@xocash/primitives';
|
||||
|
||||
export type WalletEvents = {
|
||||
shouldMonitorUpdated: boolean;
|
||||
addressesUpdated: WalletAddresses;
|
||||
transactionsUpdated: WalletTransactions;
|
||||
unspentsUpdated: BlockchainUTXOs;
|
||||
stateUpdated: string | null;
|
||||
@@ -30,6 +33,13 @@ export type WalletEvents = {
|
||||
export abstract class BaseWallet<
|
||||
WalletEventsType extends WalletEvents = WalletEvents,
|
||||
> extends EventEmitter<WalletEventsType> {
|
||||
static readonly deriveKey: (keyName: string) => Promise<Uint8Array>;
|
||||
|
||||
// Dependencies.
|
||||
abstract readonly activities: Activities;
|
||||
abstract readonly blockchain: WalletBlockchain;
|
||||
abstract readonly cache: BaseStore;
|
||||
|
||||
/**
|
||||
* Get the ID for this wallet.
|
||||
*/
|
||||
@@ -50,11 +60,6 @@ export abstract class BaseWallet<
|
||||
*/
|
||||
abstract getSigningKey(): Promise<Uint8Array>;
|
||||
|
||||
/**
|
||||
* Get the activities implementation
|
||||
*/
|
||||
abstract getActivities(): Promise<Activities>;
|
||||
|
||||
/**
|
||||
* Start monitoring this wallet for any transaction activity.
|
||||
*/
|
||||
@@ -109,7 +114,7 @@ export abstract class BaseWallet<
|
||||
* May as well just getUnspentDirectives() from the local state instead of fetch.
|
||||
* Likewise for balances.
|
||||
*/
|
||||
abstract getUnspentDirectives(): Promise<Array<InputTemplateBCH>>;
|
||||
abstract getUnspentDirectives(): Promise<WalletUTXOs>;
|
||||
|
||||
/**
|
||||
* Get the satoshi balance of this wallet.
|
||||
|
||||
Reference in New Issue
Block a user