UNPKG

chaingate

Version:

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

112 lines (111 loc) 3.73 kB
import { CurrencyUtils } from '../../CurrencyUtils'; import { CurrencyInfo } from '../../../CurrencyInfo'; import { UtxoNetworkKey } from '../../../../Client'; import { CurrencyAmount } from '../../CurrencyAmount'; import { NetworkParams } from './NetworkParams'; import { ChainGateContext } from '../../ChainGateContext'; import Decimal from 'decimal.js'; type TxoCache = { txid: string; n: number; amount: Decimal; script: Uint8Array; address: string; }; export declare abstract class UtxoCurrencyUtils<CI extends CurrencyInfo> extends CurrencyUtils<CI> { protected readonly network: UtxoNetworkKey; protected readonly networkParams: NetworkParams; protected readonly signHeader: string; protected readonly addressToNative: (arg: string) => string | null; protected constructor(context: ChainGateContext, currencyInfo: CI, network: UtxoNetworkKey, networkParams: NetworkParams, signHeader: string, addressToNative?: (arg: string) => string); addressUtxos(address: string, page?: number): Promise<{ page: number; utxos: { txid: string; script: Uint8Array<ArrayBufferLike>; amount: CurrencyAmount<CI>; n: number; }[]; }>; addressBalance(address: string): Promise<{ confirmed: CurrencyAmount<CI>; unconfirmed: CurrencyAmount<CI>; }>; addressHistory(address: string, page?: number): Promise<{ transactions: { amount: CurrencyAmount<CI>; addressBalance: CurrencyAmount<CI>; txid: string; height: number; }[]; page: number; }>; broadcastTransaction(transactionRaw: string | Uint8Array): Promise<{ transactionId: string; }>; transactionDetails(transactionId: string): Promise<{ blockHeight: number; fee: CurrencyAmount<CI>; feePerKb: CurrencyAmount<CI>; timestamp: number; inputs: { address: string; amount: CurrencyAmount<CI>; n: Decimal; script: Uint8Array<ArrayBufferLike>; scriptSig: Uint8Array<ArrayBufferLike>; }[]; outputs: { address: string; amount: CurrencyAmount<CI>; n: Decimal; script: Uint8Array<ArrayBufferLike>; }[]; rawTransaction: string; }>; getFeeRate(): Promise<{ low: { feePerKb: CurrencyAmount<CI>; confirmationTimeSecs: number; }; normal: { feePerKb: CurrencyAmount<CI>; confirmationTimeSecs: number; }; high: { feePerKb: CurrencyAmount<CI>; confirmationTimeSecs: number; }; maximum: { feePerKb: CurrencyAmount<CI>; confirmationTimeSecs: number; }; }>; latestBlock(): Promise<import("../../../../Client").Block>; mempoolTransactions(): Promise<import("../../../../Client").TxoMempoolResponse>; blockByHeight(blockHeight: number): Promise<{ txs: Array<string>; difficulty: number; nonce: number; sizeBytes: number; timestamp: number; height: number; parentHash: string; hash: string; }>; blockByHash(blockHash: string): Promise<{ txs: Array<string>; difficulty: number; nonce: number; sizeBytes: number; timestamp: number; height: number; parentHash: string; hash: string; }>; getUtxoCache(): Array<TxoCache>; getSpentTxoCache(): Array<TxoCache>; addressToScript(address: string): Uint8Array; scriptToAddress(script: Uint8Array): string; } export {};