UNPKG

chaingate

Version:

A complete TypeScript library for connecting to and making transactions on different blockchains

65 lines (64 loc) 3.43 kB
import { ChainGateClient } from 'chaingate-client'; import { Arbitrum } from './entities/Currency/implementations/Arbitrum'; import { Avalanche } from './entities/Currency/implementations/Avalanche'; import { Base } from './entities/Currency/implementations/Base'; import { BNBChain } from './entities/Currency/implementations/BNBChain'; import { Ethereum } from './entities/Currency/implementations/Ethereum/Ethereum'; import { FantomOpera } from './entities/Currency/implementations/FantomOpera'; import { Polygon } from './entities/Currency/implementations/Polygon'; import { Bitcoin } from './entities/Currency/implementations/Bitcoin/Bitcoin'; import { BitcoinTestnet } from './entities/Currency/implementations/BitcoinTestnet/BitcoinTestnet'; import { Dogecoin } from './entities/Currency/implementations/Dogecoin/Dogecoin'; import { Litecoin } from './entities/Currency/implementations/Litecoin/Litecoin'; import { BitcoinCash } from './entities/Currency/implementations/BitcoinCash/BitcoinCash'; import { CurrencyProviders } from './entities/Currency/CurrencyProviders'; import { Currency } from './entities/Currency/Currency'; export type SerializedWallet = { format: 'ChainGate Serialize Wallet Format Version 2'; walletType: string; walletUniqueId: string; }; export declare const EvmCurrencies: readonly ["arbitrum", "avalanche", "base", "bnbChain", "ethereum", "fantomOpera", "polygon"]; export declare const UtxoCurrencies: readonly ["bitcoin", "bitcoinTestnet", "dogecoin", "litecoin", "bitcoinCash"]; export declare const Currencies: ("arbitrum" | "avalanche" | "base" | "bitcoin" | "bitcoinCash" | "bitcoinTestnet" | "dogecoin" | "ethereum" | "litecoin" | "polygon" | "bnbChain" | "fantomOpera")[]; export type EvmCurrencies = typeof EvmCurrencies[number]; export type UtxoCurrencies = typeof UtxoCurrencies[number]; export type AllCurrencies = EvmCurrencies | UtxoCurrencies; export type CurrencyMap = { 'arbitrum': Arbitrum; 'avalanche': Avalanche; 'base': Base; 'bnbChain': BNBChain; 'ethereum': Ethereum; 'fantomOpera': FantomOpera; 'polygon': Polygon; 'bitcoin': Bitcoin; 'bitcoinTestnet': BitcoinTestnet; 'dogecoin': Dogecoin; 'litecoin': Litecoin; 'bitcoinCash': BitcoinCash; }; export declare abstract class Wallet<SupportedCurrencies extends AllCurrencies> { readonly apiClient: ChainGateClient; protected readonly currencyProviders: CurrencyProviders; protected abstract supportedCurrencies: readonly SupportedCurrencies[]; protected constructor(apiClient: ChainGateClient, currencyProviders: CurrencyProviders); abstract currency<T extends SupportedCurrencies>(currency: T): CurrencyMap[T]; get allCurrencies(): Currency[]; abstract getWalletUniqueId(): Promise<string>; protected abstract serializeInternal(): Promise<SerializedWallet>; serialize(): Promise<string>; /** * Retrieves the balances for all supported currencies. * * @returns A promise that resolves to an array of currency balances. */ getAllBalances(): Promise<{ currency: import("./entities/Currency/CurrencyInfo").CurrencyInfo; balance: { confirmed: import("./entities/Currency/CurrencyAmount").CurrencyAmount; unconfirmed: import("./entities/Currency/CurrencyAmount").CurrencyAmount; }; }[]>; static isSerializedWallet(serialized: object): boolean; }