import fetch from 'isomorphic-fetch';

declare const ROOCH_ADDRESS_LENGTH = 64;

declare const DEFAULT_MAX_GAS_AMOUNT = 1000000;

interface ChainInfo {
    chainId: string;
    blockExplorerUrls?: string[];
    chainName?: string;
    iconUrls?: string[];
    nativeCurrency?: {
        name: string;
        symbol: string;
        decimals: number;
    };
    rpcUrls?: string[];
}
interface ConnectionOptions {
    url: string;
    websocket?: string;
}
declare class Chain {
    id: number;
    name: string;
    options: ConnectionOptions;
    constructor(id: number, name: string, options: ConnectionOptions);
    get url(): string;
    get websocket(): string;
    get info(): ChainInfo;
}
declare const LocalChain: Chain;
declare const DevChain: Chain;
declare const TestChain: Chain;
declare const AllChain: Chain[];

/**
 * TODO:
 *
 * All bytes (Vec<u8>) data is represented as hex-encoded string prefixed with `0x` and fulfilled with
 * two hex digits per byte.
 *
 * Unlike the `Address` type, HexEncodedBytes will not trim any zeros.
 *
 */
type HexEncodedBytes = string;
type MaybeHexString = HexString | string;
/**
 * A util class for working with hex strings.
 * Hex strings are strings that are prefixed with `0x`
 */
declare class HexString {
    private readonly hexString;
    /**
     * Creates new hex string from Buffer
     * @param buffer A buffer to convert
     * @returns New HexString
     */
    static fromBuffer(buffer: Uint8Array): HexString;
    /**
     * Creates new hex string from Uint8Array
     * @param arr Uint8Array to convert
     * @returns New HexString
     */
    static fromUint8Array(arr: Uint8Array): HexString;
    /**
     * Ensures `hexString` is instance of `HexString` class
     * @param hexString String to check
     * @returns New HexString if `hexString` is regular string or `hexString` if it is HexString instance
     * @example
     * ```
     *  const regularString = "string";
     *  const hexString = new HexString("string"); // "0xstring"
     *  HexString.ensure(regularString); // "0xstring"
     *  HexString.ensure(hexString); // "0xstring"
     * ```
     */
    static ensure(hexString: MaybeHexString): HexString;
    /**
     * Creates new HexString instance from regular string. If specified string already starts with "0x" prefix,
     * it will not add another one
     * @param hexString String to convert
     * @example
     * ```
     *  const string = "string";
     *  new HexString(string); // "0xstring"
     * ```
     */
    constructor(hexString: string | HexEncodedBytes);
    /**
     * Getter for inner hexString
     * @returns Inner hex string
     */
    hex(): string;
    /**
     * Getter for inner hexString without prefix
     * @returns Inner hex string without prefix
     * @example
     * ```
     *  const hexString = new HexString("string"); // "0xstring"
     *  hexString.noPrefix(); // "string"
     * ```
     */
    noPrefix(): string;
    /**
     * Overrides default `toString` method
     * @returns Inner hex string
     */
    toString(): string;
    /**
     * Trimmes extra zeroes in the begining of a string
     * @returns Inner hexString without leading zeroes
     * @example
     * ```
     *  new HexString("0x000000string").toShortString(); // result = "0xstring"
     * ```
     */
    toShortString(): string;
    /**
     * Converts hex string to a Uint8Array
     * @returns Uint8Array from inner hexString without prefix
     */
    toUint8Array(): Uint8Array;
}

type Identifier$1 = string;
type AccountAddress$1 = string;
type HashValue = string;
type Bool = boolean;
type U8 = number;
type U16 = number;
type U32 = number;
type U64 = bigint;
type U128 = bigint;
type U256 = bigint;
type BlockNumber = number;
type AuthenticationKey = string;
type MultiEd25519PublicKey = string;
type MultiEd25519Signature = string;
type EventKey = string;
type ModuleId$1 = string | {
    address: AccountAddress$1;
    name: Identifier$1;
};
type FunctionId$1 = string | {
    address: AccountAddress$1;
    module: Identifier$1;
    functionName: Identifier$1;
};
interface StructTag$1 {
    address: string;
    module: string;
    name: string;
    type_params?: TypeTag$1[];
}
type TypeTag$1 = 'Bool' | 'U8' | 'U64' | 'U128' | 'Address' | 'Signer' | 'Ascii' | 'String' | {
    Vector: TypeTag$1;
} | {
    Struct: StructTag$1;
} | 'U16' | 'U32' | 'U256';
type ArgType = Bool | U8 | U16 | U32 | U64 | U128 | U256 | string | AccountAddress$1 | ArgType[];
type Arg = {
    type: TypeTag$1;
    value: ArgType;
};

type Bytes = Uint8Array;

type AnnotatedEventView = {
    event: EventView;
    parsed_event_data: AnnotatedMoveStructView;
    sender: RoochAccountAddress;
    timestamp_ms?: number | null;
    tx_hash?: Hex | null;
};
type AnnotatedFunctionResultView = {
    return_values?: AnnotatedFunctionReturnValueView[] | null;
    vm_status: VMStatusView;
};
type AnnotatedFunctionReturnValueView = {
    move_value: AnnotatedMoveValueView;
    value: FunctionReturnValueView;
};
type AnnotatedMoveStructView = {
    abilities: number;
    type: RoochStructTag;
    value: {
        [key: string]: AnnotatedMoveValueView;
    };
};
type AnnotatedMoveValueView = number | unknown | u128 | boolean | RoochAccountAddress | AnnotatedMoveValueView[] | Uint8Array | AnnotatedMoveStructView | SpecificStructView | number | number | RoochU256;
type AnnotatedStateView = {
    move_value: AnnotatedMoveValueView;
    state: StateView;
};
type AuthenticatorView = {
    auth_validator_id: u64;
    payload: Uint8Array;
};
type BalanceInfoView = {
    balance: RoochU256;
    coin_type: RoochStructTag;
    decimals: number;
    symbol: string;
};
type EventID = {
    event_handle_id: unknown;
    event_seq: number;
};
type EventView = {
    event_data: Uint8Array;
    event_id: EventID;
    event_index: number;
    type_tag: RoochTypeTag;
};
type ExecuteTransactionResponseView = {
    execution_info: TransactionExecutionInfoView;
    output: TransactionOutputView;
    sequence_info: TransactionSequenceInfoView;
};
type FunctionCallView = {
    args: Uint8Array[];
    function_id: RoochFunctionId;
    ty_args: RoochTypeTag[];
};
type FunctionReturnValueView = {
    type_tag: RoochTypeTag;
    value: Uint8Array;
};
type Hex = string;
type KeptVMStatusView0 = {
    type: string;
};
type KeptVMStatusView1 = {
    type: string;
};
type KeptVMStatusView2 = {
    abort_code: u64;
    location: AbortLocation;
    type: string;
};
type KeptVMStatusView3 = {
    code_offset: number;
    function: number;
    location: AbortLocation;
    type: string;
};
type KeptVMStatusView4 = {
    type: string;
};
type KeptVMStatusView = KeptVMStatusView0 | KeptVMStatusView1 | KeptVMStatusView2 | KeptVMStatusView3 | KeptVMStatusView4;
type MoveActionTypeView = string;
type MoveActionView = {
    function_call?: FunctionCallView | null;
    module_bundle?: Uint8Array[] | null;
    script_call?: ScriptCallView | null;
};
type MoveAsciiString$1 = {
    bytes: number[];
};
type MoveString$1 = {
    bytes: number[];
};
type OpView_for_StateView0 = {
    type: string;
    value: Uint8Array;
    value_type: RoochTypeTag;
};
type OpView_for_StateView1 = {
    type: string;
    value: Uint8Array;
    value_type: RoochTypeTag;
};
type OpView_for_StateView2 = {
    type: string;
};
type OpView_for_StateView = OpView_for_StateView0 | OpView_for_StateView1 | OpView_for_StateView2;
type AnnotatedEventResultPageView = {
    data: AnnotatedEventView | null[];
    has_next_page: boolean;
    next_cursor?: number | null;
};
type PageView_for_Nullable_AnnotatedStateView_and_alloc_vec_Vec_U8Array = {
    data: AnnotatedStateView | null[];
    has_next_page: boolean;
    next_cursor?: Uint8Array | null;
};
type PageView_for_Nullable_BalanceInfoView_and_alloc_vec_Vec_U8Array = {
    data: BalanceInfoView | null[];
    has_next_page: boolean;
    next_cursor?: Uint8Array | null;
};
type StateResultPageView = {
    data: StateView | null[];
    has_next_page: boolean;
    next_cursor?: Uint8Array | null;
};
type TransactionResultPageView = {
    data: TransactionResultView[];
    has_next_page: boolean;
    next_cursor?: number | null;
};
type ScriptCallView = {
    args: Uint8Array[];
    code: Uint8Array;
    ty_args: RoochTypeTag[];
};
type SpecificStructView = MoveString$1 | MoveAsciiString$1 | Hex;
type StateChangeSetView = {
    changes: {
        [key: string]: TableChangeView;
    };
    new_tables: {
        [key: string]: TableTypeInfoView;
    };
    removed_tables: Hex[];
};
type StateView = {
    value: Uint8Array;
    value_type: RoochTypeTag;
};
type TableChangeView = {
    entries: {
        [key: string]: OpView_for_StateView;
    };
};
type TableTypeInfoView = {
    key_type: RoochTypeTag;
};
type TransactionExecutionInfoView = {
    event_root: Hex;
    gas_used: number;
    state_root: Hex;
    status: KeptVMStatusView;
    tx_hash: Hex;
};
type TransactionOutputView = {
    events: EventView[];
    gas_used: number;
    status: KeptVMStatusView;
    table_changeset: StateChangeSetView;
};
type TransactionResultView = {
    execution_info: TransactionExecutionInfoView;
    sequence_info: TransactionSequenceInfoView;
    transaction: TransactionView;
};
type TransactionSequenceInfoView = {
    tx_accumulator_root: Hex;
    tx_order: u128;
    tx_order_signature: AuthenticatorView;
};
type TransactionTypeView = string;
type TransactionView = {
    action: MoveActionView;
    action_type: MoveActionTypeView;
    raw: Uint8Array;
    sender: string;
    sequence_number: number;
    transaction_type: TransactionTypeView;
};
type VMStatusView0 = string;
type VMStatusView1 = {
    MoveAbort: {
        abort_code: u64;
        location: AbortLocation;
    };
};
type VMStatusView2 = {
    ExecutionFailure: {
        code_offset: number;
        function: number;
        location: AbortLocation;
        status_code: u64;
    };
};
type VMStatusView3 = {
    Error: u64;
};
type VMStatusView = VMStatusView0 | VMStatusView1 | VMStatusView2 | VMStatusView3;
type RoochAccountAddress = string;
type RoochStructTag = string;
type RoochTypeTag = string;
type RoochU256 = string;
type AbortLocation = string;
type AccessPath = string;
type RoochFunctionId = string;
type u128 = string;
type u64 = string;

declare function fromB64(sBase64: string, nBlocksSize?: number): Uint8Array;
declare function toB64(aBytes: Uint8Array): string;

/**
 * Copyright (c) Facebook, Inc. and its affiliates
 * SPDX-License-Identifier: MIT OR Apache-2.0
 */
interface Serializer {
    serializeStr(value: string): void;
    serializeBytes(value: Uint8Array): void;
    serializeBool(value: boolean): void;
    serializeUnit(value: null): void;
    serializeChar(value: string): void;
    serializeF32(value: number): void;
    serializeF64(value: number): void;
    serializeU8(value: number): void;
    serializeU16(value: number): void;
    serializeU32(value: number): void;
    serializeU64(value: bigint | number): void;
    serializeU128(value: bigint | number): void;
    serializeI8(value: number): void;
    serializeI16(value: number): void;
    serializeI32(value: number): void;
    serializeI64(value: bigint | number): void;
    serializeI128(value: bigint | number): void;
    serializeLen(value: number): void;
    serializeVariantIndex(value: number): void;
    serializeOptionTag(value: boolean): void;
    getBufferOffset(): number;
    getBytes(): Uint8Array;
    sortMapEntries(offsets: number[]): void;
}

/**
 * Copyright (c) Facebook, Inc. and its affiliates
 * SPDX-License-Identifier: MIT OR Apache-2.0
 */

declare abstract class BinarySerializer implements Serializer {
    private static readonly BIG_32;
    private static readonly BIG_64;
    private static readonly BIG_32Fs;
    private static readonly BIG_64Fs;
    private static readonly textEncoder;
    private buffer;
    private offset;
    constructor();
    private ensureBufferWillHandleSize;
    protected serialize(values: Uint8Array): void;
    abstract serializeLen(value: number): void;
    abstract serializeVariantIndex(value: number): void;
    abstract sortMapEntries(offsets: number[]): void;
    serializeStr(value: string): void;
    serializeBytes(value: Uint8Array): void;
    serializeBool(value: boolean): void;
    serializeUnit(_value: null): void;
    private serializeWithFunction;
    serializeU8(value: number): void;
    serializeU16(value: number): void;
    serializeU32(value: number): void;
    serializeU64(value: BigInt | number): void;
    serializeU128(value: BigInt | number): void;
    serializeI8(value: number): void;
    serializeI16(value: number): void;
    serializeI32(value: number): void;
    serializeI64(value: bigint | number): void;
    serializeI128(value: bigint | number): void;
    serializeOptionTag(value: boolean): void;
    getBufferOffset(): number;
    getBytes(): Uint8Array;
    serializeChar(_value: string): void;
    serializeF32(value: number): void;
    serializeF64(value: number): void;
}

/**
 * Copyright (c) Facebook, Inc. and its affiliates
 * SPDX-License-Identifier: MIT OR Apache-2.0
 */

declare class BcsSerializer extends BinarySerializer {
    serializeU32AsUleb128(value: number): void;
    serializeLen(value: number): void;
    serializeVariantIndex(value: number): void;
    sortMapEntries(_offsets: number[]): void;
}

/**
 * Copyright (c) Facebook, Inc. and its affiliates
 * SPDX-License-Identifier: MIT OR Apache-2.0
 */
interface Deserializer {
    deserializeStr(): string;
    deserializeBytes(): Uint8Array;
    deserializeBool(): boolean;
    deserializeUnit(): null;
    deserializeChar(): string;
    deserializeF32(): number;
    deserializeF64(): number;
    deserializeU8(): number;
    deserializeU16(): number;
    deserializeU32(): number;
    deserializeU64(): bigint;
    deserializeU128(): bigint;
    deserializeI8(): number;
    deserializeI16(): number;
    deserializeI32(): number;
    deserializeI64(): bigint;
    deserializeI128(): bigint;
    deserializeLen(): number;
    deserializeVariantIndex(): number;
    deserializeOptionTag(): boolean;
    getBufferOffset(): number;
    checkThatKeySlicesAreIncreasing(key1: [number, number], key2: [number, number]): void;
}

/**
 * Copyright (c) Facebook, Inc. and its affiliates
 * SPDX-License-Identifier: MIT OR Apache-2.0
 */

declare abstract class BinaryDeserializer implements Deserializer {
    private static readonly BIG_32;
    private static readonly BIG_64;
    private static readonly textDecoder;
    buffer: ArrayBuffer;
    offset: number;
    constructor(data: Uint8Array);
    private read;
    abstract deserializeLen(): number;
    abstract deserializeVariantIndex(): number;
    abstract checkThatKeySlicesAreIncreasing(key1: [number, number], key2: [number, number]): void;
    deserializeStr(): string;
    deserializeBytes(): Uint8Array;
    deserializeBool(): boolean;
    deserializeUnit(): null;
    deserializeU8(): number;
    deserializeU16(): number;
    deserializeU32(): number;
    deserializeU64(): bigint;
    deserializeU128(): bigint;
    deserializeI8(): number;
    deserializeI16(): number;
    deserializeI32(): number;
    deserializeI64(): bigint;
    deserializeI128(): bigint;
    deserializeOptionTag(): boolean;
    getBufferOffset(): number;
    deserializeChar(): string;
    deserializeF32(): number;
    deserializeF64(): number;
}

/**
 * Copyright (c) Facebook, Inc. and its affiliates
 * SPDX-License-Identifier: MIT OR Apache-2.0
 */

declare class BcsDeserializer extends BinaryDeserializer {
    private static readonly MAX_UINT_32;
    deserializeUleb128AsU32(): number;
    deserializeLen(): number;
    deserializeVariantIndex(): number;
    checkThatKeySlicesAreIncreasing(_key1: [number, number], _key2: [number, number]): void;
}

/**
 * Copyright (c) Facebook, Inc. and its affiliates
 * SPDX-License-Identifier: MIT OR Apache-2.0
 */
type Optional<T> = T | null;
type Seq<T> = T[];
type Tuple<T extends any[]> = T;
type ListTuple<T extends any[]> = Tuple<T>[];
type unit = null;
type bool = boolean;
type int8 = number;
type int16 = number;
type int32 = number;
type int64 = bigint;
type int128 = bigint;
type uint8 = number;
type uint16 = number;
type uint32 = number;
type uint64 = bigint;
type uint128 = bigint;
type float32 = number;
type float64 = number;
type char = string;
type str = string;
type bytes = Uint8Array;

declare class AccountAddress {
    value: ListTuple<[uint8]>;
    constructor(value: ListTuple<[uint8]>);
    serialize(serializer: Serializer): void;
    static deserialize(deserializer: Deserializer): AccountAddress;
}
declare class Authenticator {
    auth_validator_id: uint64;
    payload: Seq<uint8>;
    constructor(auth_validator_id: uint64, payload: Seq<uint8>);
    serialize(serializer: Serializer): void;
    static deserialize(deserializer: Deserializer): Authenticator;
}
declare class FunctionCall {
    function_id: FunctionId;
    ty_args: Seq<TypeTag>;
    args: Seq<Seq<uint8>>;
    constructor(function_id: FunctionId, ty_args: Seq<TypeTag>, args: Seq<Seq<uint8>>);
    serialize(serializer: Serializer): void;
    static deserialize(deserializer: Deserializer): FunctionCall;
}
declare class FunctionId {
    module_id: ModuleId;
    function_name: Identifier;
    constructor(module_id: ModuleId, function_name: Identifier);
    serialize(serializer: Serializer): void;
    static deserialize(deserializer: Deserializer): FunctionId;
}
declare class Identifier {
    value: str;
    constructor(value: str);
    serialize(serializer: Serializer): void;
    static deserialize(deserializer: Deserializer): Identifier;
}
declare class ModuleId {
    address: AccountAddress;
    name: Identifier;
    constructor(address: AccountAddress, name: Identifier);
    serialize(serializer: Serializer): void;
    static deserialize(deserializer: Deserializer): ModuleId;
}
declare abstract class MoveAction {
    abstract serialize(serializer: Serializer): void;
    static deserialize(deserializer: Deserializer): MoveAction;
}
declare class MoveActionVariantScript extends MoveAction {
    value: ScriptCall;
    constructor(value: ScriptCall);
    serialize(serializer: Serializer): void;
    static load(deserializer: Deserializer): MoveActionVariantScript;
}
declare class MoveActionVariantFunction extends MoveAction {
    value: FunctionCall;
    constructor(value: FunctionCall);
    serialize(serializer: Serializer): void;
    static load(deserializer: Deserializer): MoveActionVariantFunction;
}
declare class MoveActionVariantModuleBundle extends MoveAction {
    value: Seq<Seq<uint8>>;
    constructor(value: Seq<Seq<uint8>>);
    serialize(serializer: Serializer): void;
    static load(deserializer: Deserializer): MoveActionVariantModuleBundle;
}
declare class RoochTransaction {
    data: RoochTransactionData;
    authenticator: Authenticator;
    constructor(data: RoochTransactionData, authenticator: Authenticator);
    serialize(serializer: Serializer): void;
    static deserialize(deserializer: Deserializer): RoochTransaction;
}
declare class RoochTransactionData {
    sender: AccountAddress;
    sequence_number: uint64;
    chain_id: uint64;
    max_gas_amount: uint64;
    action: MoveAction;
    constructor(sender: AccountAddress, sequence_number: uint64, chain_id: uint64, max_gas_amount: uint64, action: MoveAction);
    serialize(serializer: Serializer): void;
    static deserialize(deserializer: Deserializer): RoochTransactionData;
}
declare class ScriptCall {
    code: bytes;
    ty_args: Seq<TypeTag>;
    args: Seq<Seq<uint8>>;
    constructor(code: bytes, ty_args: Seq<TypeTag>, args: Seq<Seq<uint8>>);
    serialize(serializer: Serializer): void;
    static deserialize(deserializer: Deserializer): ScriptCall;
}
declare class StructTag {
    address: AccountAddress;
    module: Identifier;
    name: Identifier;
    type_args: Seq<TypeTag>;
    constructor(address: AccountAddress, module: Identifier, name: Identifier, type_args: Seq<TypeTag>);
    serialize(serializer: Serializer): void;
    static deserialize(deserializer: Deserializer): StructTag;
}
declare abstract class TypeTag {
    abstract serialize(serializer: Serializer): void;
    static deserialize(deserializer: Deserializer): TypeTag;
}
declare class TypeTagVariantbool extends TypeTag {
    constructor();
    serialize(serializer: Serializer): void;
    static load(deserializer: Deserializer): TypeTagVariantbool;
}
declare class TypeTagVariantu8 extends TypeTag {
    constructor();
    serialize(serializer: Serializer): void;
    static load(deserializer: Deserializer): TypeTagVariantu8;
}
declare class TypeTagVariantu64 extends TypeTag {
    constructor();
    serialize(serializer: Serializer): void;
    static load(deserializer: Deserializer): TypeTagVariantu64;
}
declare class TypeTagVariantu128 extends TypeTag {
    constructor();
    serialize(serializer: Serializer): void;
    static load(deserializer: Deserializer): TypeTagVariantu128;
}
declare class TypeTagVariantaddress extends TypeTag {
    constructor();
    serialize(serializer: Serializer): void;
    static load(deserializer: Deserializer): TypeTagVariantaddress;
}
declare class TypeTagVariantsigner extends TypeTag {
    constructor();
    serialize(serializer: Serializer): void;
    static load(deserializer: Deserializer): TypeTagVariantsigner;
}
declare class TypeTagVariantvector extends TypeTag {
    value: TypeTag;
    constructor(value: TypeTag);
    serialize(serializer: Serializer): void;
    static load(deserializer: Deserializer): TypeTagVariantvector;
}
declare class TypeTagVariantstruct extends TypeTag {
    value: StructTag;
    constructor(value: StructTag);
    serialize(serializer: Serializer): void;
    static load(deserializer: Deserializer): TypeTagVariantstruct;
}
declare class TypeTagVariantu16 extends TypeTag {
    constructor();
    serialize(serializer: Serializer): void;
    static load(deserializer: Deserializer): TypeTagVariantu16;
}
declare class TypeTagVariantu32 extends TypeTag {
    constructor();
    serialize(serializer: Serializer): void;
    static load(deserializer: Deserializer): TypeTagVariantu32;
}
declare class TypeTagVariantu256 extends TypeTag {
    constructor();
    serialize(serializer: Serializer): void;
    static load(deserializer: Deserializer): TypeTagVariantu256;
}
declare class Helpers {
    static serializeArray32U8Array(value: ListTuple<[uint8]>, serializer: Serializer): void;
    static deserializeArray32U8Array(deserializer: Deserializer): ListTuple<[uint8]>;
    static serializeVectorTypeTag(value: Seq<TypeTag>, serializer: Serializer): void;
    static deserializeVectorTypeTag(deserializer: Deserializer): Seq<TypeTag>;
    static serializeVectorU8(value: Seq<uint8>, serializer: Serializer): void;
    static deserializeVectorU8(deserializer: Deserializer): Seq<uint8>;
    static serializeVectorVectorU8(value: Seq<Seq<uint8>>, serializer: Serializer): void;
    static deserializeVectorVectorU8(deserializer: Deserializer): Seq<Seq<uint8>>;
}

declare class MoveString {
    private bytes;
    constructor(bytes: Seq<uint8>);
    serialize(serializer: Serializer): void;
    static deserialize(deserializer: Deserializer): MoveString;
}

declare class MoveAsciiString {
    private bytes;
    constructor(bytes: Seq<uint8>);
    serialize(serializer: Serializer): void;
    static deserialize(deserializer: Deserializer): MoveAsciiString;
}

declare function serializeU256(se: BcsSerializer, value: bigint | number): void;

type index_AccountAddress = AccountAddress;
declare const index_AccountAddress: typeof AccountAddress;
type index_Authenticator = Authenticator;
declare const index_Authenticator: typeof Authenticator;
type index_BcsDeserializer = BcsDeserializer;
declare const index_BcsDeserializer: typeof BcsDeserializer;
type index_BcsSerializer = BcsSerializer;
declare const index_BcsSerializer: typeof BcsSerializer;
type index_BinaryDeserializer = BinaryDeserializer;
declare const index_BinaryDeserializer: typeof BinaryDeserializer;
type index_BinarySerializer = BinarySerializer;
declare const index_BinarySerializer: typeof BinarySerializer;
type index_Deserializer = Deserializer;
type index_FunctionCall = FunctionCall;
declare const index_FunctionCall: typeof FunctionCall;
type index_FunctionId = FunctionId;
declare const index_FunctionId: typeof FunctionId;
type index_Helpers = Helpers;
declare const index_Helpers: typeof Helpers;
type index_Identifier = Identifier;
declare const index_Identifier: typeof Identifier;
type index_ListTuple<T extends any[]> = ListTuple<T>;
type index_ModuleId = ModuleId;
declare const index_ModuleId: typeof ModuleId;
type index_MoveAction = MoveAction;
declare const index_MoveAction: typeof MoveAction;
type index_MoveActionVariantFunction = MoveActionVariantFunction;
declare const index_MoveActionVariantFunction: typeof MoveActionVariantFunction;
type index_MoveActionVariantModuleBundle = MoveActionVariantModuleBundle;
declare const index_MoveActionVariantModuleBundle: typeof MoveActionVariantModuleBundle;
type index_MoveActionVariantScript = MoveActionVariantScript;
declare const index_MoveActionVariantScript: typeof MoveActionVariantScript;
type index_MoveAsciiString = MoveAsciiString;
declare const index_MoveAsciiString: typeof MoveAsciiString;
type index_MoveString = MoveString;
declare const index_MoveString: typeof MoveString;
type index_Optional<T> = Optional<T>;
type index_RoochTransaction = RoochTransaction;
declare const index_RoochTransaction: typeof RoochTransaction;
type index_RoochTransactionData = RoochTransactionData;
declare const index_RoochTransactionData: typeof RoochTransactionData;
type index_ScriptCall = ScriptCall;
declare const index_ScriptCall: typeof ScriptCall;
type index_Seq<T> = Seq<T>;
type index_Serializer = Serializer;
type index_StructTag = StructTag;
declare const index_StructTag: typeof StructTag;
type index_Tuple<T extends any[]> = Tuple<T>;
type index_TypeTag = TypeTag;
declare const index_TypeTag: typeof TypeTag;
type index_TypeTagVariantaddress = TypeTagVariantaddress;
declare const index_TypeTagVariantaddress: typeof TypeTagVariantaddress;
type index_TypeTagVariantbool = TypeTagVariantbool;
declare const index_TypeTagVariantbool: typeof TypeTagVariantbool;
type index_TypeTagVariantsigner = TypeTagVariantsigner;
declare const index_TypeTagVariantsigner: typeof TypeTagVariantsigner;
type index_TypeTagVariantstruct = TypeTagVariantstruct;
declare const index_TypeTagVariantstruct: typeof TypeTagVariantstruct;
type index_TypeTagVariantu128 = TypeTagVariantu128;
declare const index_TypeTagVariantu128: typeof TypeTagVariantu128;
type index_TypeTagVariantu16 = TypeTagVariantu16;
declare const index_TypeTagVariantu16: typeof TypeTagVariantu16;
type index_TypeTagVariantu256 = TypeTagVariantu256;
declare const index_TypeTagVariantu256: typeof TypeTagVariantu256;
type index_TypeTagVariantu32 = TypeTagVariantu32;
declare const index_TypeTagVariantu32: typeof TypeTagVariantu32;
type index_TypeTagVariantu64 = TypeTagVariantu64;
declare const index_TypeTagVariantu64: typeof TypeTagVariantu64;
type index_TypeTagVariantu8 = TypeTagVariantu8;
declare const index_TypeTagVariantu8: typeof TypeTagVariantu8;
type index_TypeTagVariantvector = TypeTagVariantvector;
declare const index_TypeTagVariantvector: typeof TypeTagVariantvector;
type index_bool = bool;
type index_bytes = bytes;
type index_char = char;
type index_float32 = float32;
type index_float64 = float64;
declare const index_fromB64: typeof fromB64;
type index_int128 = int128;
type index_int16 = int16;
type index_int32 = int32;
type index_int64 = int64;
type index_int8 = int8;
declare const index_serializeU256: typeof serializeU256;
type index_str = str;
declare const index_toB64: typeof toB64;
type index_uint128 = uint128;
type index_uint16 = uint16;
type index_uint32 = uint32;
type index_uint64 = uint64;
type index_uint8 = uint8;
type index_unit = unit;
declare namespace index {
  export {
    index_AccountAddress as AccountAddress,
    index_Authenticator as Authenticator,
    index_BcsDeserializer as BcsDeserializer,
    index_BcsSerializer as BcsSerializer,
    index_BinaryDeserializer as BinaryDeserializer,
    index_BinarySerializer as BinarySerializer,
    index_Deserializer as Deserializer,
    index_FunctionCall as FunctionCall,
    index_FunctionId as FunctionId,
    index_Helpers as Helpers,
    index_Identifier as Identifier,
    index_ListTuple as ListTuple,
    index_ModuleId as ModuleId,
    index_MoveAction as MoveAction,
    index_MoveActionVariantFunction as MoveActionVariantFunction,
    index_MoveActionVariantModuleBundle as MoveActionVariantModuleBundle,
    index_MoveActionVariantScript as MoveActionVariantScript,
    index_MoveAsciiString as MoveAsciiString,
    index_MoveString as MoveString,
    index_Optional as Optional,
    index_RoochTransaction as RoochTransaction,
    index_RoochTransactionData as RoochTransactionData,
    index_ScriptCall as ScriptCall,
    index_Seq as Seq,
    index_Serializer as Serializer,
    index_StructTag as StructTag,
    index_Tuple as Tuple,
    index_TypeTag as TypeTag,
    index_TypeTagVariantaddress as TypeTagVariantaddress,
    index_TypeTagVariantbool as TypeTagVariantbool,
    index_TypeTagVariantsigner as TypeTagVariantsigner,
    index_TypeTagVariantstruct as TypeTagVariantstruct,
    index_TypeTagVariantu128 as TypeTagVariantu128,
    index_TypeTagVariantu16 as TypeTagVariantu16,
    index_TypeTagVariantu256 as TypeTagVariantu256,
    index_TypeTagVariantu32 as TypeTagVariantu32,
    index_TypeTagVariantu64 as TypeTagVariantu64,
    index_TypeTagVariantu8 as TypeTagVariantu8,
    index_TypeTagVariantvector as TypeTagVariantvector,
    index_bool as bool,
    index_bytes as bytes,
    index_char as char,
    index_float32 as float32,
    index_float64 as float64,
    index_fromB64 as fromB64,
    index_int128 as int128,
    index_int16 as int16,
    index_int32 as int32,
    index_int64 as int64,
    index_int8 as int8,
    index_serializeU256 as serializeU256,
    index_str as str,
    index_toB64 as toB64,
    index_uint128 as uint128,
    index_uint16 as uint16,
    index_uint32 as uint32,
    index_uint64 as uint64,
    index_uint8 as uint8,
    index_unit as unit,
  };
}

/**
In TypeScript, we can’t inherit or extend from more than one class,
Mixins helps us to get around that by creating a partial classes
that we can combine to form a single class that contains all the methods and properties from the partial classes.
{@link https://www.typescriptlang.org/docs/handbook/mixins.html#alternative-pattern}
*/
declare function applyMixin(targetClass: any, baseClass: any, baseClassProp: string): void;

declare function toHexString(byteArray: Iterable<number>): string;
declare function fromHexString(hex: string, padding?: number): Uint8Array;
/**
 * @public
 * Should be called to pad string to expected length
 */
declare function padLeft(str: string, chars: number, sign?: string): string;
/**
 * @public
 * Should be called to pad string to expected length
 */
declare function padRight(str: string, chars: number, sign?: string): string;

declare function encodeFunctionCall(functionId: FunctionId$1, tyArgs: TypeTag$1[], args: bytes[]): MoveActionVariantFunction;
declare function typeTagToSCS(ty: TypeTag$1): TypeTag;
declare function structTagToSCS(data: StructTag$1): StructTag;
declare function addressToSCS(addr: AccountAddress$1): AccountAddress;
declare function encodeStructTypeTags(typeArgsString: string[]): TypeTag$1[];
declare function addressToListTuple(ethAddress: string): ListTuple<[uint8]>;
declare function addressToSeqNumber(ethAddress: string): Seq<number>;
declare function encodeArg(arg: Arg): bytes;
declare const encodeMoveCallData: (funcId: FunctionId$1, tyArgs: TypeTag$1[], args: Arg[]) => Uint8Array;

declare function functionIdToStirng(functionId: FunctionId$1): string;
declare function parseFunctionId(functionId: FunctionId$1): {
    address: AccountAddress$1;
    module: Identifier$1;
    functionName: Identifier$1;
};
/**
 * Perform the following operations:
 * 1. Make the address lower case
 * 2. Prepend `0x` if the string does not start with `0x`.
 * 3. Add more zeros if the length of the address(excluding `0x`) is less than `Rooch_ADDRESS_LENGTH`
 *
 * WARNING: if the address value itself starts with `0x`, e.g., `0x0x`, the default behavior
 * is to treat the first `0x` not as part of the address. The default behavior can be overridden by
 * setting `forceAdd0x` to true
 *
 */
declare function normalizeRoochAddress(value: string, forceAdd0x?: boolean): string;
declare function typeTagToString(type_tag: TypeTag$1): string;

declare function uint8Array2SeqNumber(bytes: Uint8Array): Seq<number>;

/**
 * Value to be converted into public key.
 */
type PublicKeyInitData = string | Uint8Array | Iterable<number>;
/**
 * A public key
 */
declare abstract class PublicKey {
    /**
     * Checks if two public keys are equal
     */
    equals(publicKey: PublicKey): boolean;
    /**
     * Return the base-64 representation of the public key
     */
    toBase64(): string;
    /**
     * Return the Rooch representation of the public key encoded in
     * base-64. A Rooch public key is formed by the concatenation
     * of the scheme flag with the raw bytes of the public key
     */
    toRoochPublicKey(): string;
    /**
     * Return the byte array representation of the public key
     */
    abstract toBytes(): Uint8Array;
    /**
     * Return the Rooch address associated with this public key
     */
    abstract toRoochAddress(): string;
    /**
     * Return signature scheme flag of the public key
     */
    abstract flag(): number;
}

type SignatureScheme = 'ED25519';
/**
 * Pair of signature and corresponding public key
 */
type SignaturePubkeyPair = {
    signatureScheme: SignatureScheme;
    /** Base64-encoded signature */
    signature: Uint8Array;
    /** Base64-encoded public key */
    pubKey: PublicKey;
};
/**
 * (`flag || signature || pubkey` bytes, as base-64 encoded string).
 * Signature is committed to the intent message of the transaction data, as base-64 encoded string.
 */
type SerializedSignature = Uint8Array;
declare const SIGNATURE_SCHEME_TO_FLAG: {
    ED25519: number;
};
declare const SIGNATURE_FLAG_TO_SCHEME: {
    readonly 0: "ED25519";
};
type SignatureFlag = keyof typeof SIGNATURE_FLAG_TO_SCHEME;
declare function toSerializedSignature({ signature, signatureScheme, pubKey, }: SignaturePubkeyPair): SerializedSignature;

/**
 * Parse and validate a path that is compliant to SLIP-0010 in form
 * m/44'/784'/{account_index}'/{change_index}'/{address_index}'.
 *
 * @param path path string (e.g. `m/44'/784'/0'/0'/0'`).
 */
declare function isValidHardenedPath(path: string): boolean;
/**
 * Parse and validate a path that is compliant to BIP-32 in form
 * m/54'/784'/{account_index}'/{change_index}/{address_index}
 * for Secp256k1 and m/74'/784'/{account_index}'/{change_index}/{address_index} for Secp256r1.
 *
 * Note that the purpose for Secp256k1 is registered as 54, to differentiate from Ed25519 with purpose 44.
 *
 * @param path path string (e.g. `m/54'/784'/0'/0/0`).
 */
declare function isValidBIP32Path(path: string): boolean;
/**
 * Uses KDF to derive 64 bytes of key data from mnemonic with empty password.
 *
 * @param mnemonics 12 words string split by spaces.
 */
declare function mnemonicToSeed(mnemonics: string): Uint8Array;
/**
 * Derive the seed in hex format from a 12-word mnemonic string.
 *
 * @param mnemonics 12 words string split by spaces.
 */
declare function mnemonicToSeedHex(mnemonics: string): string;

type ExportedKeypair = {
    schema: SignatureScheme;
    privateKey: string;
};
declare abstract class BaseSigner {
    abstract sign(bytes: Uint8Array): Promise<Uint8Array>;
    signMessage(bytes: Uint8Array): Promise<{
        signature: Uint8Array;
        bytes: Uint8Array;
    }>;
    signMessageWithHashed(bytes: Uint8Array): Promise<{
        signature: Uint8Array;
        bytes: Uint8Array;
    }>;
    toRoochAddress(): string;
    /**
     * Return the signature for the data.
     * Prefer the async verion {@link sign}, as this method will be deprecated in a future release.
     */
    abstract signData(data: Uint8Array): Uint8Array;
    /**
     * Get the key scheme of the keypair: Secp256k1 or ED25519
     */
    abstract getKeyScheme(): SignatureScheme;
    /**
     * The public key for this keypair
     */
    abstract getPublicKey(): PublicKey;
}
/**
 * TODO: Document
 */
declare abstract class Keypair extends BaseSigner {
    abstract export(): ExportedKeypair;
}

/**
 * An Ed25519 public key
 */
declare class Ed25519PublicKey extends PublicKey {
    static SIZE: number;
    private data;
    /**
     * Create a new Ed25519PublicKey object
     * @param value ed25519 public key as buffer or base-64 encoded string
     */
    constructor(value: PublicKeyInitData);
    /**
     * Checks if two Ed25519 public keys are equal
     */
    equals(publicKey: Ed25519PublicKey): boolean;
    /**
     * Return the byte array representation of the Ed25519 public key
     */
    toBytes(): Uint8Array;
    /**
     * Return the Rooch address associated with this Ed25519 public key
     */
    toRoochAddress(): string;
    /**
     * Return the Rooch address associated with this Ed25519 public key
     */
    flag(): number;
}

declare const DEFAULT_ED25519_DERIVATION_PATH = "m/44'/784'/0'/0'/0'";
declare const DEFAULT_ED25519_SCHEMAS = "ED25519";
/**
 * Ed25519 Keypair data. The publickey is the 32-byte public key and
 * the secretkey is 64-byte, where the first 32 bytes is the secret
 * key and the last 32 bytes is the public key.
 */
interface Ed25519KeypairData {
    publicKey: Uint8Array;
    secretKey: Uint8Array;
}
/**
 * An Ed25519 Keypair used for signing transactions.
 */
declare class Ed25519Keypair extends Keypair {
    private keypair;
    private scheme;
    /**
     * Create a new Ed25519 keypair instance.
     * Generate random keypair if no {@link Ed25519Keypair} is provided.
     *
     * @param keypair Ed25519 keypair
     */
    constructor(keypair?: Ed25519KeypairData);
    /**
     * Get the key scheme of the keypair ED25519
     */
    getKeyScheme(): SignatureScheme;
    /**
     * Generate a new random Ed25519 keypair
     */
    static generate(): Ed25519Keypair;
    /**
     * Create a Ed25519 keypair from a raw secret key byte array, also known as seed.
     * This is NOT the private scalar which is result of hashing and bit clamping of
     * the raw secret key.
     *
     * The rooch.keystore key is a list of Base64 encoded `flag || privkey`. To import
     * a key from rooch.keystore to typescript, decode from base64 and remove the first
     * flag byte after checking it is indeed the Ed25519 scheme flag 0x00 (See more
     * on flag for signature scheme: https://github.com/rooch-network/rooch/blob/main/crates/rooch-types/src/crypto.rs):
     * ```
     * import { Ed25519Keypair, fromB64 } from 'rooch'
     * const raw = fromB64(t[1])
     * if (raw[0] !== 0 || raw.length !== PRIVATE_KEY_SIZE + 1) {
     *   throw new Error('invalid key')
     * }
     * const imported = Ed25519Keypair.fromSecretKey(raw.slice(1))
     * ```
     * @throws error if the provided secret key is invalid and validation is not skipped.
     *
     * @param secretKey secret key byte array
     * @param options: skip secret key validation
     */
    static fromSecretKey(secretKey: Uint8Array, options?: {
        skipValidation?: boolean;
    }): Ed25519Keypair;
    /**
     * The public key for this Ed25519 keypair
     */
    getPublicKey(): Ed25519PublicKey;
    sign(data: Uint8Array): Promise<Uint8Array>;
    /**
     * Return the signature for the provided data using Ed25519.
     */
    signData(data: Uint8Array): Uint8Array;
    /**
     * Derive Ed25519 keypair from mnemonics and path. The mnemonics must be normalized
     * and validated against the english wordlist.
     *
     * If path is none, it will default to m/44'/784'/0'/0'/0', otherwise the path must
     * be compliant to SLIP-0010 in form m/44'/784'/{account_index}'/{change_index}'/{address_index}'.
     */
    static deriveKeypair(mnemonics: string, path?: string): Ed25519Keypair;
    /**
     * Derive Ed25519 keypair from mnemonicSeed and path.
     *
     * If path is none, it will default to m/44'/784'/0'/0'/0', otherwise the path must
     * be compliant to SLIP-0010 in form m/44'/784'/{account_index}'/{change_index}'/{address_index}'.
     */
    static deriveKeypairFromSeed(seedHex: string, path?: string): Ed25519Keypair;
    /**
     * This returns an exported keypair object, the private key field is the pure 32-byte seed.
     */
    export(): ExportedKeypair;
}

interface IProvider {
    getRpcApiVersion(): Promise<string | undefined>;
    getChainId(): number;
    executeViewFunction(funcId: FunctionId$1, tyArgs?: TypeTag$1[], args?: Arg[]): Promise<AnnotatedFunctionResultView>;
    sendRawTransaction(playload: Bytes): Promise<string>;
}

/**
 * Configuration options for the JsonRpcProvider. If the value of a field is not provided,
 * value in `DEFAULT_OPTIONS` for that field will be used
 */
type RpcProviderOptions = {
    /**
     * Cache timeout in seconds for the RPC API Version
     */
    versionCacheTimeoutInSeconds?: number;
    /** Allow defining a custom RPC client to use */
    fetcher?: typeof fetch;
};
declare class JsonRpcProvider {
    options: RpcProviderOptions;
    chain: Chain;
    private client;
    private rpcApiVersion;
    private cacheExpiry;
    constructor(chain?: Chain, options?: RpcProviderOptions);
    switchChain(chain: Chain): void;
    ChainInfo(): ChainInfo;
    getChainId(): number;
    getRpcApiVersion(): Promise<string | undefined>;
    executeViewFunction(funcId: FunctionId$1, tyArgs?: TypeTag$1[], args?: Arg[]): Promise<AnnotatedFunctionResultView>;
    sendRawTransaction(playload: Bytes): Promise<string>;
    getTransactionsByHash(tx_hashes: string[]): Promise<TransactionView | null[]>;
    getAnnotatedStates(accessPath: string): Promise<AnnotatedStateView | null[]>;
    getTransactionsByOrder(cursor: number, limit: number): Promise<TransactionResultPageView>;
    getEventsByEventHandle(event_handle_type: string, cursor: number, limit: number): Promise<AnnotatedEventResultPageView>;
    getStates(access_path: string): Promise<StateView | null[]>;
    listStates(access_path: string, cursor: Uint8Array, limit: number): Promise<StateResultPageView>;
}

interface IAuthorization {
    scheme: number;
    payload: Bytes;
}
interface IAuthorizer {
    auth(callData: Bytes): Promise<IAuthorization>;
}

declare class PrivateKeyAuth implements IAuthorizer {
    private pk;
    constructor(pk: Keypair);
    auth(data: Bytes): Promise<IAuthorization>;
}

interface CallOption {
    maxGasAmount?: number;
}
interface IAccount {
    /**
     * Get account address
     */
    getAddress(): string;
    /**
     * Run move function by current account
     *
     * @param funcId FunctionId the function like '0x3::empty::empty'
     * @param tyArgs Generic parameter list
     * @param args parameter list
     * @param opts Call option
     */
    runFunction(funcId: FunctionId$1, tyArgs?: TypeTag$1[], args?: Arg[], opts?: CallOption): Promise<string>;
    /**
     * Create session account with scope
     *
     * @param scope string the scope of created account
     * @param maxInactiveInterval  number The max inactive interval
     * @param opts CallOption
     */
    createSessionAccount(scope: Array<string>, maxInactiveInterval: number, opts?: CallOption): Promise<IAccount>;
    /**
     * Create session key
     *
     * @param authKey
     * @param scopes
     * @param maxInactiveInterval
     * @param opts
     */
    registerSessionKey(authKey: AccountAddress$1, scopes: Array<string>, maxInactiveInterval: number, opts?: CallOption): Promise<void>;
}

declare class Account implements IAccount {
    private provider;
    private address;
    private authorizer;
    constructor(provider: IProvider, address: AccountAddress$1, authorizer: IAuthorizer);
    getAddress(): string;
    runFunction(funcId: FunctionId$1, tyArgs: TypeTag$1[], args: Arg[], opts: CallOption): Promise<string>;
    private makeAuth;
    sequenceNumber(): Promise<number>;
    createSessionAccount(scope: Array<string>, maxInactiveInterval: number, opts?: CallOption): Promise<IAccount>;
    registerSessionKey(authKey: AccountAddress$1, scopes: Array<string>, maxInactiveInterval: number, opts?: CallOption): Promise<void>;
}

export { AbortLocation, AccessPath, Account, AccountAddress$1 as AccountAddress, AllChain, AnnotatedEventResultPageView, AnnotatedEventView, AnnotatedFunctionResultView, AnnotatedFunctionReturnValueView, AnnotatedMoveStructView, AnnotatedMoveValueView, AnnotatedStateView, Arg, ArgType, AuthenticationKey, AuthenticatorView, BalanceInfoView, BlockNumber, Bool, Bytes, CallOption, Chain, ChainInfo, DEFAULT_ED25519_DERIVATION_PATH, DEFAULT_ED25519_SCHEMAS, DEFAULT_MAX_GAS_AMOUNT, DevChain, Ed25519Keypair, Ed25519KeypairData, Ed25519PublicKey, EventID, EventKey, EventView, ExecuteTransactionResponseView, ExportedKeypair, FunctionCallView, FunctionId$1 as FunctionId, FunctionReturnValueView, HashValue, Hex, HexEncodedBytes, HexString, IAccount, IAuthorization, IAuthorizer, IProvider, Identifier$1 as Identifier, JsonRpcProvider, KeptVMStatusView, KeptVMStatusView0, KeptVMStatusView1, KeptVMStatusView2, KeptVMStatusView3, KeptVMStatusView4, Keypair, LocalChain, MaybeHexString, ModuleId$1 as ModuleId, MoveActionTypeView, MoveActionView, MoveAsciiString$1 as MoveAsciiString, MoveString$1 as MoveString, MultiEd25519PublicKey, MultiEd25519Signature, OpView_for_StateView, OpView_for_StateView0, OpView_for_StateView1, OpView_for_StateView2, PageView_for_Nullable_AnnotatedStateView_and_alloc_vec_Vec_U8Array, PageView_for_Nullable_BalanceInfoView_and_alloc_vec_Vec_U8Array, PrivateKeyAuth, PublicKey, ROOCH_ADDRESS_LENGTH, RoochAccountAddress, RoochFunctionId, RoochStructTag, RoochTypeTag, RoochU256, RpcProviderOptions, SIGNATURE_FLAG_TO_SCHEME, SIGNATURE_SCHEME_TO_FLAG, ScriptCallView, SerializedSignature, SignatureFlag, SignaturePubkeyPair, SignatureScheme, BaseSigner as Signer, SpecificStructView, StateChangeSetView, StateResultPageView, StateView, StructTag$1 as StructTag, TableChangeView, TableTypeInfoView, TestChain, TransactionExecutionInfoView, TransactionOutputView, TransactionResultPageView, TransactionResultView, TransactionSequenceInfoView, TransactionTypeView, TransactionView, TypeTag$1 as TypeTag, U128, U16, U256, U32, U64, U8, VMStatusView, VMStatusView0, VMStatusView1, VMStatusView2, VMStatusView3, addressToListTuple, addressToSCS, addressToSeqNumber, applyMixin, index as bcsTypes, encodeArg, encodeFunctionCall, encodeMoveCallData, encodeStructTypeTags, fromHexString, functionIdToStirng, isValidBIP32Path, isValidHardenedPath, mnemonicToSeed, mnemonicToSeedHex, normalizeRoochAddress, padLeft, padRight, parseFunctionId, structTagToSCS, toHexString, toSerializedSignature, typeTagToSCS, typeTagToString, u128, u64, uint8Array2SeqNumber };
