chaingate
Version:
A complete TypeScript library for connecting to and making transactions on different blockchains
36 lines (35 loc) • 1.87 kB
TypeScript
import { ChainGateClient, UtxoApi } from 'chaingate-client';
import { UtxoFee } from './UtxoFee';
import Decimal from 'decimal.js';
import { Address } from '../../../Address';
import { CurrencyAmount } from '../../CurrencyAmount';
import { Txo } from './Txo';
import { CurrencyPreparedTransaction } from '../../CurrencyPreparedTransaction';
import { FeeLevel } from '../../FeeLevel';
import { NetworkParams } from './NetworkParams';
import { PrivateKeyProvider } from '../../CurrencyProviders';
import { CurrencyInfo } from '../../CurrencyInfo';
import { UtxoConfirmedTransaction } from './UtxoConfirmedTransaction';
export type TxVout = {
amount: Decimal;
address: Address;
};
export declare abstract class UtxoPreparedTransaction<DefaultUnit extends string> extends CurrencyPreparedTransaction {
private readonly api;
private readonly currencyInfo;
private readonly client;
protected _suggestedFees: Record<FeeLevel, UtxoFee>;
private readonly state;
protected readonly privateKeyProvider: PrivateKeyProvider;
protected readonly networkParams: NetworkParams;
protected constructor(api: UtxoApi, client: ChainGateClient, currencyInfo: CurrencyInfo, fromAddress: Address, toAddress: Address, amount: CurrencyAmount, networkParams: NetworkParams, privateKeyProvider: PrivateKeyProvider);
broadcast(fee: FeeLevel | UtxoFee): Promise<UtxoConfirmedTransaction>;
fee(fee: string | CurrencyAmount, unit: `${DefaultUnit}/kB` | `${DefaultUnit}/byte` | 'satoshi/kB' | 'satoshi/byte'): Promise<UtxoFee>;
protected buildSuggestedFees(): Promise<Record<FeeLevel, UtxoFee>>;
private retrieveFeeRates;
private feePerKb;
private findUtxos;
private createTransaction;
protected abstract toLegacyAddress(address: Address): string;
protected abstract sign(inputs: Txo[], outputs: TxVout[]): Promise<Uint8Array>;
}