UNPKG

chaingate

Version:

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

42 lines (41 loc) 1.99 kB
import { UtxoFee } from './UtxoFee'; import { Address } from '../../../../Wallet/entities/Address'; import { Transaction } from '../../Transaction'; import { FeeLevel } from '../../FeeLevel'; import { NetworkParams } from './NetworkParams'; import { PrivateKeyProvider } from '../../Transports'; import { UtxoBroadcastedTransaction } from './UtxoBroadcastedTransaction'; import { CurrencyAmount } from '../../../CurrencyUtils'; import { UtxoCurrencyUtils } from '../../../CurrencyUtils/abstract/UtxoCurrencyUtils/UtxoCurrencyUtils'; import { CurrencyInfo } from '../../../CurrencyInfo'; import Decimal from 'decimal.js'; type DefaultUnit<T extends { symbol: string; }> = T['symbol']; export type Txo = { txid: string; amount: Decimal; n: number; script: Uint8Array; }; export type TxVout = { amount: Decimal; address: Address; }; export declare abstract class UtxoTransaction<CI extends CurrencyInfo> extends Transaction<CI> { private readonly utils; protected _suggestedFees: Record<FeeLevel, UtxoFee<CI>>; private readonly state; protected readonly privateKeyProvider: PrivateKeyProvider; protected readonly networkParams: NetworkParams; protected readonly addressToNative: (arg: string) => string | null; protected constructor(utils: UtxoCurrencyUtils<CI>, fromAddress: Address, toAddress: Address, amount: CurrencyAmount<CI>, networkParams: NetworkParams, privateKeyProvider: PrivateKeyProvider, addressToNative?: (arg: string) => string); broadcast(fee: FeeLevel | UtxoFee<CI>): Promise<UtxoBroadcastedTransaction<CI>>; fee(fee: string | CurrencyAmount<CI>, unit: `${DefaultUnit<CI>}/kB` | `${DefaultUnit<CI>}/byte` | 'satoshi/kB' | 'satoshi/byte'): Promise<UtxoFee<CI>>; protected buildSuggestedFees(): Promise<Record<FeeLevel, UtxoFee<CI>>>; private feePerKb; private findUtxos; private createTransaction; protected abstract sign(inputs: Txo[], outputs: TxVout[]): Promise<Uint8Array>; } export {};