2019-08-25 09:39:20 +03:00
|
|
|
import { BytesLike } from "@ethersproject/bytes";
|
|
|
|
import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
|
2020-03-31 00:24:33 +03:00
|
|
|
export interface Result extends ReadonlyArray<any> {
|
|
|
|
readonly [key: string]: any;
|
2020-01-08 03:58:04 +03:00
|
|
|
}
|
2020-04-25 10:54:54 +03:00
|
|
|
export declare function checkResultErrors(result: Result): Array<{
|
|
|
|
path: Array<string | number>;
|
|
|
|
error: Error;
|
|
|
|
}>;
|
2019-08-25 09:39:20 +03:00
|
|
|
export declare type CoerceFunc = (type: string, value: any) => any;
|
|
|
|
export declare abstract class Coder {
|
|
|
|
readonly name: string;
|
|
|
|
readonly type: string;
|
|
|
|
readonly localName: string;
|
|
|
|
readonly dynamic: boolean;
|
|
|
|
constructor(name: string, type: string, localName: string, dynamic: boolean);
|
|
|
|
_throwError(message: string, value: any): void;
|
|
|
|
abstract encode(writer: Writer, value: any): number;
|
|
|
|
abstract decode(reader: Reader): any;
|
|
|
|
}
|
|
|
|
export declare class Writer {
|
|
|
|
readonly wordSize: number;
|
|
|
|
_data: Uint8Array;
|
|
|
|
_padding: Uint8Array;
|
|
|
|
constructor(wordSize?: number);
|
2020-03-22 21:57:17 +03:00
|
|
|
get data(): string;
|
|
|
|
get length(): number;
|
2019-08-25 09:39:20 +03:00
|
|
|
_writeData(data: Uint8Array): number;
|
|
|
|
writeBytes(value: BytesLike): number;
|
|
|
|
_getValue(value: BigNumberish): Uint8Array;
|
|
|
|
writeValue(value: BigNumberish): number;
|
|
|
|
writeUpdatableValue(): (value: BigNumberish) => void;
|
|
|
|
}
|
|
|
|
export declare class Reader {
|
|
|
|
readonly wordSize: number;
|
|
|
|
readonly _data: Uint8Array;
|
|
|
|
readonly _coerceFunc: CoerceFunc;
|
|
|
|
_offset: number;
|
|
|
|
constructor(data: BytesLike, wordSize?: number, coerceFunc?: CoerceFunc);
|
2020-03-22 21:57:17 +03:00
|
|
|
get data(): string;
|
|
|
|
get consumed(): number;
|
2019-08-25 09:39:20 +03:00
|
|
|
static coerce(name: string, value: any): any;
|
|
|
|
coerce(name: string, value: any): any;
|
|
|
|
_peekBytes(offset: number, length: number): Uint8Array;
|
|
|
|
subReader(offset: number): Reader;
|
|
|
|
readBytes(length: number): Uint8Array;
|
|
|
|
readValue(): BigNumber;
|
|
|
|
}
|