chaingate
Version:
A complete TypeScript library for connecting to and making transactions on different blockchains
34 lines (33 loc) • 1.81 kB
TypeScript
import { Transports } from '../Currencies/CurrencyWallet/Transports';
import { CurrencyWallet } from '../Currencies/CurrencyWallet/CurrencyWallet';
import { AllCurrencies, CurrencyModules } from '../Currencies/CurrencyModules';
import { Client } from '@hey-api/client-fetch';
import { GlobalMarketsResponse } from '../Client';
import { TtlCache } from '../InternalUtils/TtlCache';
export type WalletOf<C extends keyof typeof CurrencyModules> = InstanceType<(typeof CurrencyModules)[C]['wallet']>;
export type InfoOf<C extends keyof typeof CurrencyModules> = (typeof CurrencyModules)[C]['info'];
export type SerializedWallet = {
format: 'ChainGate Serialize Wallet Format Version 2';
walletType: string;
walletUniqueId: string;
};
export declare abstract class Wallet<SupportedCurrencies extends (typeof AllCurrencies)[number]> {
protected abstract supportedCurrencies: readonly SupportedCurrencies[];
readonly client: Client;
protected readonly transports: Transports;
protected readonly markets: TtlCache<GlobalMarketsResponse>;
protected constructor(client: Client, transports: Transports, markets: TtlCache<GlobalMarketsResponse>);
currency<C extends SupportedCurrencies>(id: C): WalletOf<C>;
get allCurrencies(): Array<CurrencyWallet<InfoOf<SupportedCurrencies>>>;
abstract getWalletUniqueId(): Promise<string>;
protected abstract serializeInternal(): Promise<SerializedWallet>;
serialize(): Promise<string>;
getAllBalances(): Promise<{
currency: InfoOf<SupportedCurrencies>;
balance: {
confirmed: import("..").CurrencyAmount<InfoOf<SupportedCurrencies>>;
unconfirmed: import("..").CurrencyAmount<InfoOf<SupportedCurrencies>>;
};
}[]>;
static isSerializedWallet(serialized: object): boolean;
}