/// <reference types="node" />
import { ec } from "elliptic";
import Long from "long";
import { Instance, InstanceID } from "../byzcoin";
import ByzCoinRPC from "../byzcoin/byzcoin-rpc";
import Signer from "../darc/signer";
import { Transaction } from "ethereumjs-tx";
import { Result } from "@ethersproject/abi";
/**
 * Ethereum account
 */
export declare class EvmAccount {
    readonly name: string;
    static EC: ec;
    static deserialize(obj: any): EvmAccount;
    private static computeAddress;
    readonly address: Buffer;
    protected key: ec.KeyPair;
    private _nonce;
    readonly nonce: number;
    /**
     * Create a new EVM account
     *
     * @param name      Account name
     * @param privKey   Private key for the account (32 bytes); if not
     *                  specified, a new one is generated randomly
     * @param nonce     Initial nonce for the account; should normally not be specified
     */
    constructor(name: string, privKey?: Buffer, nonce?: number);
    sign(tx: Transaction): void;
    incNonce(): void;
    serialize(): object;
}
/**
 * Ethereum smart contract
 */
export declare class EvmContract {
    readonly name: string;
    private bytecode;
    private abiJson;
    readonly addresses: Buffer[];
    static deserialize(obj: any): EvmContract;
    private static computeAddress;
    readonly transactions: string[];
    readonly viewMethods: string[];
    private methodAbi;
    /**
     * Create a new EVM contract
     *
     * @param name      Contract name
     * @param bytecode  Contract bytecode; pass `undefined` if the contract
     *                  does not need deploying
     * @param abiJson   Contract ABI (JSON-encoded)
     * @param addresses Array of existing (already deployed) contract
     *                  instances; if not provided, the contract will need to
     *                  deploy instances before exeuting transactions or
     *                  view method calls
     */
    constructor(name: string, bytecode: Buffer, abiJson: string, addresses?: Buffer[]);
    getMethodAbi(method: string): any;
    encodeDeployData(...args: any[]): Buffer;
    encodeCallData(method: string, ...args: any[]): Buffer;
    decodeCallResult(method: string, result: Buffer): Result;
    /**
     * Add a new instance to this conctract, with the address determine by the
     * provided account.
     *
     * @param account Account that spawned the instance
     */
    addNewInstance(account: EvmAccount): void;
    serialize(): object;
    private getMethodFragment;
}
export declare const WEI_PER_ETHER: Long;
/**
 * BEvm client
 */
export declare class BEvmInstance extends Instance {
    private byzcoinRPC;
    static readonly contractID = "bevm";
    static readonly commandTransaction = "transaction";
    static readonly argumentTx = "txRlp";
    static readonly commandCredit = "credit";
    static readonly argumentAddress = "address";
    static readonly argumentAmount = "amount";
    /**
     * Spawn a new BEvm instance
     *
     * @param bc        ByzCoin RPC to use
     * @param darcID    DARC instance ID
     * @param signers   List of signers for the ByzCoin transaction
     *
     * @return New BEvm instance
     */
    static spawn(bc: ByzCoinRPC, darcID: InstanceID, signers: Signer[]): Promise<BEvmInstance>;
    /**
     * Retrieve an existing BEvm instance
     *
     * @param bc    ByzCoin RPC to use
     * @param iid   BEvm instance ID
     *
     * @returns BEvm instance
     */
    static fromByzcoin(bc: ByzCoinRPC, iid: InstanceID, waitMatch?: number, interval?: number): Promise<BEvmInstance>;
    private bevmRPC;
    private currentBlockIndex;
    constructor(byzcoinRPC: ByzCoinRPC, inst: Instance);
    /**
     * Deploy an EVM smart contract
     *
     * @param signers   ByzCoin identities signing the ByzCoin transaction
     * @param gasLimit  Gas limit for the transaction
     * @param gasPrice  Gas price for the transaction
     * @param amount    Amount transferred during the transaction
     * @param account   EVM account
     * @param contract  EVM contract to deploy
     * @param args      Arguments for the smart contract constructor
     * @param wait      Number of blocks to wait for the ByzCoin transaction to be included
     *
     * The `args` are passed as an array of values, one per argument. The types
     * of the arguments must match the types in the constructor ABI. In
     * particular, for large number types (e.g. uint256), the argument can be
     * passed as a number, string or BN value.
     */
    deploy(signers: Signer[], gasLimit: number, gasPrice: number, amount: number, account: EvmAccount, contract: EvmContract, args?: any[], wait?: number): Promise<void>;
    /**
     * Execute an EVM transaction on a deployed smart contract (R/W method)
     *
     * @param signers       ByzCoin identities signing the ByzCoin transaction
     * @param gasLimit      Gas limit for the transaction
     * @param gasPrice      Gas price for the transaction
     * @param amount        Amount transferred during the transaction
     * @param account       EVM account
     * @param contract      EVM contract
     * @param instanceIndex Index of the deployed smart contract instance
     * @param method        Name of the method to execute
     * @param args          Arguments for the smart contract method
     * @param wait          Number of blocks to wait for the ByzCoin transaction to be included
     *
     * See `deploy()` for a description of `args`.
     */
    transaction(signers: Signer[], gasLimit: number, gasPrice: number, amount: number, account: EvmAccount, contract: EvmContract, instanceIndex: number, method: string, args?: any[], wait?: number): Promise<void>;
    /**
     * Execute a view method on a deployed smart contract (read-only method)
     *
     * A view method is executed on a conode on behalf of the client. This
     * conode does not necessarily belong to the ByzCoin cothority. Therefore,
     * the actual cothority configuration, the BEvm ID as well as the ByzCoin
     * ID that contains it must be provided.
     *
     * @param account           EVM account
     * @param contract          EVM contract
     * @param instanceIndex     Index of the deployed smart contract instance
     * @param method            Name of the view method to execute
     * @param args              Arguments for the smart contract method
     *
     * @return Result of the view method execution, as an array of values. The
     * types of the values will match the return values in the view method ABI.
     * In particular, values for large number types (e.g. uint256) will be BNs.
     *
     * See `deploy()` for a description of `args`.
     */
    call(account: EvmAccount, contract: EvmContract, instanceIndex: number, method: string, args?: any[]): Promise<Result>;
    /**
     * Credit an EVM account by the specified amount
     *
     * @param signers   ByzCoin identities signing the ByzCoin transaction
     * @param account   EVM account
     * @param amount    Amount to credit on the account
     * @param wait      Number of blocks to wait for the ByzCoin transaction to be included
     */
    creditAccount(signers: Signer[], account: EvmAccount, amount: Long, wait?: number): Promise<void>;
    private invoke;
}
