/// <reference types="node" />
import { ec } from "elliptic";
import Long from "long";
import ByzCoinRPC from "../byzcoin/byzcoin-rpc";
import Instance, { InstanceID } from "../byzcoin/instance";
import Signer from "../darc/signer";
import { BEvmService } from "./service";
/**
 * 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(hash: Buffer): Buffer;
    incNonce(): void;
    serialize(): object;
}
/**
 * Ethereum smart contract
 */
export declare class EvmContract {
    readonly name: string;
    readonly bytecode: Buffer;
    readonly abi: string;
    readonly addresses: Buffer[];
    static deserialize(obj: any): EvmContract;
    private static computeAddress;
    private static erlEncode;
    readonly transactions: string[];
    readonly viewMethods: string[];
    /**
     * Create a new EVM contract
     *
     * @param name      Contract name
     * @param bytecode  Contract bytecode
     * @param abi       Contract ABI (JSON-encoded)
     * @param addresses Array of deployed contract instances; should normally not be specified
     */
    constructor(name: string, bytecode: Buffer, abi: string, addresses?: Buffer[]);
    createNewAddress(account: EvmAccount): void;
    serialize(): object;
}
export declare const WEI_PER_ETHER: Long;
/**
 * BEvm client
 */
export declare class BEvmClient extends Instance {
    private byzcoinRPC;
    static readonly contractID = "bevm";
    static readonly commandTransaction = "transaction";
    static readonly argumentTx = "tx";
    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<BEvmClient>;
    /**
     * 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<BEvmClient>;
    private bevmService;
    constructor(byzcoinRPC: ByzCoinRPC, inst: Instance);
    /**
     * Set the BEvm service to use
     */
    setBEvmService(bevmService: BEvmService): void;
    /**
     * 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 strings, one per argument, each of
     * them JSON-encoded.
     * The following argument types are currently supported:
     *
     *   Solidity type          | JSON type | Example
     *   --------------------------------------------
     *   uint, uint256, uint128 | string    | "12345"
     *   int, int256, int128    | string    | "-12345"
     *   uint32, uint16, uint8  | number    | 12345
     *   int32, int16, int8     | number    | -12345
     *   address                | string    | "112233445566778899aabbccddeeff0011223344"
     *   string                 | string    | "look at me I am a string"
     *   array, e.g. uint[2]    | array     | ["123", "456"]
     */
    deploy(signers: Signer[], gasLimit: number, gasPrice: number, amount: number, account: EvmAccount, contract: EvmContract, args?: string[], 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?: string[], 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 byzcoinId         ByzCoin ID
     * @param serverConfig      Cothority server config in TOML
     * @param bevmInstanceId    BEvm instance ID
     * @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
     *
     * See `deploy()` for a description of `args`.
     */
    call(byzcoinId: Buffer, serverConfig: string, bevmInstanceId: Buffer, account: EvmAccount, contract: EvmContract, instanceIndex: number, method: string, args?: string[]): Promise<any>;
    /**
     * 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;
}
