/// <reference types="node" />
import { KeyPair } from "./types";
import { RawGtv } from "../gtv/types";
import { Web3PromiEvent } from "../promiEvent/promiEvents";
import { StatusObject } from "../restclient/types";
import { ClientConfig, Operation, QueryArguments, QueryCallback, QueryObject, SignatureProvider, SignedTransaction, Transaction, TransactionReceipt } from "./types";
import { GTX } from "../gtx/types";
import { ResponseObjectProof } from "../blockchainClient/types";
export interface Queryable {
    query<TArgs extends QueryArguments | undefined = QueryArguments, TReturn extends RawGtv = RawGtv>(nameOrQueryObject: string | QueryObject<TArgs>, args?: TArgs, callback?: QueryCallback<TReturn>): Promise<TReturn>;
}
export interface IClient extends Queryable {
    config: ClientConfig;
    /**
     * 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 TArgs - The type of the query arguments. Defaults to `QueryArguments`.
     * @template TReturn - The type of the query return value. Defaults to `RawGtv`.
     * @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<TArgs extends QueryArguments | undefined = QueryArguments, TReturn extends RawGtv = RawGtv>(nameOrQueryObject: string | QueryObject<TArgs>, args?: TArgs, callback?: QueryCallback<TReturn>): Promise<TReturn>;
    /**
     * 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;
    /**
     * 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: ResponseObjectProof) => void): Promise<ResponseObjectProof>;
}
