import { type Scope } from 'effect'; import { type Observable } from 'rxjs'; import { type Runtime } from '../Runtime.js'; import { type AnyVersionedVariantArray, type StateOf, type VariantRecord } from './Variant.js'; import { type HList, type Poly } from '@midnightntwrk/wallet-sdk-utilities'; import { type ProtocolState } from '@midnightntwrk/wallet-sdk-abstractions'; /** Defines the static portion of base wallet class definition */ export interface BaseWalletClass { readonly configuration: Readonly; new (runtime: Runtime, scope: Scope.CloseableScope): WalletLike; allVariants(): TVariants; allVariantsRecord(): VariantRecord; startEmpty>(walletClass: T): WalletOf; startFirst>(walletClass: T, state: StateOf>): WalletOf; start, Tag extends string | symbol>(walletClass: T, tag: Tag, state: StateOf; }>>): WalletOf; } /** Defines the static portion of wallet-like definition */ export interface WalletClassLike> extends BaseWalletClass { new (runtime: Runtime, scope: Scope.CloseableScope): TWallet; } export type AnyWalletClass = WalletClassLike>; export type WalletOf = T extends WalletClassLike ? TWallet : never; /** * Defines a base wallet-like implementation. * * @typeParam TVariants Underlying variants */ export interface WalletLike { readonly runtime: Runtime; readonly runtimeScope: Scope.CloseableScope; /** A stream of state changes over any amount of time that have been processed by the wallet. */ readonly rawState: Observable>>>; /** Stops the wallet */ stop(): Promise; }