UNPKG

chaingate

Version:

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

34 lines (33 loc) 1.82 kB
import { Client } from '@hey-api/client-fetch'; import { CurrencyInfo } from '../CurrencyInfo'; import { CurrencyAmount } from './CurrencyAmount'; import { TtlCache } from '../../InternalUtils/TtlCache'; import { GlobalMarketsResponse } from '../../Client'; import { FiatCurrencies } from '../FiatCurrencies'; import { NumberLike } from '../../InternalUtils/NumberLike'; import { PublicKey } from '../../Wallet/entities/PublicKey'; import { PrivateKey } from '../../Wallet/entities/Secret/implementations/PrivateKey'; type DefaultUnit<T extends { symbol: string; }> = T['symbol']; type MinimalUnit<T extends { minimalUnitSymbol: string; }> = T['minimalUnitSymbol']; export declare abstract class CurrencyUtils<CI extends CurrencyInfo> { protected readonly client: Client; protected readonly markets: TtlCache<GlobalMarketsResponse>; readonly currencyInfo: CI; protected constructor(client: Client, currencyInfo: CI, markets: TtlCache<GlobalMarketsResponse>); abstract addressBalance(address: string): Promise<{ confirmed: CurrencyAmount<CI>; unconfirmed: CurrencyAmount<CI>; }>; abstract publicKeyToAddress(publicKey: PublicKey): string; abstract signMessage(message: string | Uint8Array, privateKey: PrivateKey): Promise<string>; abstract verifySignedMessage(message: string, signature: string, address: string): Promise<boolean>; protected buildAmount(baseAmount: NumberLike): CurrencyAmount<CI>; amount(amount: NumberLike, unit: DefaultUnit<CI> | MinimalUnit<CI>): CurrencyAmount<CI>; amountFiat(amountFiat: NumberLike, fiatCurrency: (typeof FiatCurrencies)[number], useCache?: boolean): Promise<CurrencyAmount<CI>>; fiatRate(fiatCurrency: (typeof FiatCurrencies)[number], useCache?: boolean): Promise<import("decimal.js").Decimal>; } export {};