/// <reference types="node" />
import { KeyPair, TransactionInfo } from "./types";
import { DictPair, RawGtv } from "../gtv/types";
import { Web3PromiEvent } from "../promiEvent/promiEvents";
import { StatusObject } from "../restclient/types";
import { ClientConfig, Operation, QueryCallback, QueryObject, SignatureProvider, SignedTransaction, Transaction, TransactionReceipt } from "./types";
import { GTX } from "../gtx/types";
import { ConfirmationProof } from "../blockchainClient/types";
export interface Queryable {
    /**
     * Performs an asynchronous query to the Rell backend. Returns either a resolved or rejected promise. The input is the name of the query followed by the arguments of the
     * query as an optional input argument.
     *
     * @template TReturn - The type of the query return value.
     * @template TArgs - The type of the query arguments. Defaults to `DictPair`.
     * @param nameOrQueryObject - the name of the query in Rell or a QueryObject containing name and args
     * @param args - The query argument following this pattern: { arg1: argValue1, arg2: argvalue2 }
     * @param callback - A callback function to handle the query response. Parameters (error, signedTx).
     * @returns - A promise that resolves with the query result.
     */
    query<TReturn extends RawGtv, TArgs extends DictPair | undefined = DictPair>(nameOrQueryObject: string | QueryObject<TReturn, TArgs>, args?: TArgs, callback?: QueryCallback<TReturn>): Promise<TReturn>;
}
export interface IClient extends Queryable {
    config: ClientConfig;
    /**
     * Signs a transaction using the provided signing method. The signature provider must contain a public key and a `sign` function that returns the signature of a digest.
     *
     * @param transaction - The transaction or signed transaction to be signed.
     * @param signMethod - The signing method, either a KeyPair or a SignatureProvider. A signature provider with a `sign` callback and a `pubkey` or a key pair where `pubKey`is optional.
     * @param callback - A callback function to handle the signing result. Parameters (error, signedTx)
     * * @returns - A promise that resolves with the signed transaction.
     */
    signTransaction(transaction: Transaction | SignedTransaction, signMethod: KeyPair | SignatureProvider, callback?: (error: Error, signedTx: Buffer) => void): Promise<SignedTransaction>;
    /**
     * Sends a transaction to the blockchain.
     *
     * @param transaction - The signed transaction, transaction, or operation to send.
     * @param callback - A callback function to handle the transaction receipt. Parameter (error, transactionReceipt).
     * @returns - A Web3PromiEvent that resolves with the transaction receipt.
     */
    sendTransaction(transaction: Transaction | SignedTransaction | Operation, callback?: (error: Error, transactionReceipt: TransactionReceipt) => void): Web3PromiEvent<TransactionReceipt, {
        sent: TransactionReceipt;
    }>;
    /**
     * Signs and sends a transaction for inclusion in a block. It adds a nop
     * if missing.
     * @param transaction - The operation or transaction to sign and send.
     * @param signMethod - The signing method, either a KeyPair or a SignatureProvider. A signature provider with a `sign` callback and a `pubkey` or a key pair where `pubKey`is optional.
     * @param callback - A callback function to handle the transaction receipt.
     * @returns - A Web3PromiEvent that resolves with the transaction receipt.
     *
     */
    signAndSendUniqueTransaction(transaction: Operation | Transaction, signMethod: KeyPair | SignatureProvider, callback?: (error: Error, transactionReceipt: TransactionReceipt) => void): Web3PromiEvent<TransactionReceipt, {
        sent: TransactionReceipt;
    }>;
    /**
     * Retrieves a transaction given its transaction RID.
     *
     * @param transactionRid - The transaction RID.
     * @param callback - A callback function to handle the serialized message. Parameters (error, serializedMessage) if first
     * parameter is not null, an error occurred.
     * If first parameter is null, then the second parameter is a buffer
     * with the serialized client message. If no such client message exists,
     * the callback will be called with (null, null).
     * @returns- A promise that resolves with the serialized message of the transaction.
     */
    getTransaction(transactionRid: Buffer, callback?: (error: Error, serializedMessage: Buffer) => void): Promise<Buffer>;
    /**
     * Retrieves the status of a transaction given its transaction RID.
     *
     * @param transactionRid - The transaction RID.
     * @param callback - A callback function to handle the response body. Taking parameters (error, responseBody). If error is null
     * then responseBody is an object on the form
     * { status: '<confirmed|waiting|rejected|unknown>' }
     * If error is not null, then responseBody
     * is an object with the string property 'error'.
     * @returns - A promise that resolves with the status object of the transaction.
     *
     */
    getTransactionStatus: (transactionRid: Buffer, callback?: (error: Error, responseBody: StatusObject) => void) => Promise<StatusObject>;
    /**
     * Adds an operation containing a nonce which makes the transaction unique.
     *
     * @param transaction - The transaction to sign and send.
     */
    addNop(transaction: Transaction): Transaction;
    /**
     * Calculates and returns the transaction RID, i.e., the merkle root hash of the transaction.
     * @param transaction The transaction to sign and send
     */
    getTransactionRid(transaction: Transaction | SignedTransaction | Operation): Buffer;
    /**
     * Fetch info about transactions from a chain.
     *
     * @param limit - Limit number of transactions returned. Minimum value is 0 and maximum 600. Defaults to 25.
     * @param beforeTime - Return only transactions before this time.
     * @param callback - A callback function to handle the response body. Taking parameters (error, responseBody). If error is null
     * then responseBody is an object of type TransactionInfo[].
     * If error is not null, then responseBody
     * is an object with the string property 'error'.
     * @returns - A promise that resolves with an array of transaction information.
     *
     */
    getTransactionsInfo(limit?: number, beforeTime?: Date, callback?: (error: Error, responseBody: TransactionInfo[]) => void): Promise<TransactionInfo[]>;
    /**
     * Fetch info about a transaction from a chain.
     *
     * @param transactionRID - The transaction RID.
     * @param callback - A callback function to handle the response body. Taking parameters (error, responseBody). If error is null
     * then responseBody is an object of type TransactionInfo.
     * If error is not null, then responseBody
     * is an object with the string property 'error'.
     * @returns - A promise that resolves with the transaction information.
     *
     */
    getTransactionInfo(transactionRid: Buffer, callback?: (error: Error, responseBody: TransactionInfo) => void): Promise<TransactionInfo>;
    /**
     * Fetch number of successful transactions for a chain.
     *
     * @param callback - A callback function to handle the response body. Taking parameters (error, responseBody). If error is null
     * then responseBody is a number.
     * If error is not null, then responseBody
     * is an object with the string property 'error'.
     * @returns - A promise that resolves with the number of successful transactions.
     *
     */
    getTransactionCount(callback?: (error: Error, responseBody: number) => void): Promise<number>;
    /**
     * Encodes the transaction using ASN.1.
     * @returns the transaction encoded
     */
    encodeTransaction(transaction: Transaction): Buffer;
    /**
     * Decodes the transaction using ASN.1.
     * @returns the transaction decoded in GTX format
     */
    decodeTransactionToGtx(transaction: Buffer): GTX;
    /**
     * Retrieves the client node URL pool.
     *
     * @returns An array of the client node URL pool.
     */
    getClientNodeUrlPool(): string[];
    getConfirmationProof(txRID: Buffer, callback?: (error: Error, responseObjectProof: ConfirmationProof) => void): Promise<ConfirmationProof>;
}
