/**
 * Antelope/SYSIO ABI Encoder
 */
import { ABI, ABIDef } from "../chain/Abi.js";
import { Bytes } from "../chain/Bytes.js";
import { ABISerializable, ABISerializableConstructor, ABISerializableType } from "./Serializable.js";
import { buildTypeLookup } from "./Builtins.js";
interface EncodeArgsBase {
    /**
     * ABI definition to use when encoding.
     */
    abi?: ABIDef;
    /**
     * Additional types to use when encoding, can be used to pass type constructors
     * that should be used when encountering a custom type.
     */
    customTypes?: ABISerializableConstructor[];
    /**
     * Can be passed to use a custom ABIEncoder instance.
     */
    encoder?: ABIEncoder;
    /**
     * Optional metadata to pass to the encoder.
     */
    metadata?: Record<string, any>;
}
interface EncodeArgsUntyped extends EncodeArgsBase {
    /**
     * Object to encode, either a object conforming to `ABISerializable`
     * or a JavaScript object, when the latter is used an the `type`
     * argument must also be set.
     */
    object: any;
    /**
     * Type to use when encoding the given object, either a type constructor
     * or a string name of a builtin type or a custom type in the given `abi`.
     */
    type: ABISerializableType;
}
interface EncodeArgsSerializable extends EncodeArgsBase {
    /**
     * Object conforming to `ABISerializable` to be encoded.
     */
    object: ABISerializable;
    /**
     * Optional type-override for given serializable object.
     */
    type?: ABISerializableType;
}
export type EncodeArgs = EncodeArgsSerializable | EncodeArgsUntyped;
export declare function abiEncode(args: EncodeArgs): Bytes;
export declare function encodeAny(value: any, type: ABI.ResolvedType, ctx: EncodingContext): void;
interface EncodingContext {
    encoder: ABIEncoder;
    types: ReturnType<typeof buildTypeLookup>;
    codingPath: {
        field: string | number;
        type: ABI.ResolvedType;
    }[];
}
export declare class ABIEncoder {
    private pageSize;
    static __className: string;
    private pos;
    private data;
    private array;
    private textEncoder;
    /** User declared metadata, can be used to pass info to instances when encoding.  */
    metadata: Record<string, any>;
    constructor(pageSize?: number);
    private ensure;
    /** Write a single byte. */
    writeByte(byte: number): void;
    /** Write an array of bytes. */
    writeArray(bytes: ArrayLike<number>): void;
    writeFloat(value: number, byteWidth: number): void;
    writeVaruint32(v: number): void;
    writeVarint32(v: number): void;
    writeString(v: string): void;
    getData(): Uint8Array;
    getBytes(): Bytes;
}
export {};
//# sourceMappingURL=Encoder.d.ts.map