2019-08-25 02:39:20 -04:00
|
|
|
import { BytesLike } from "@ethersproject/bytes";
|
|
|
|
import { BigNumber, BigNumberish } from "@ethersproject/bignumber";
|
2020-03-30 17:24:33 -04:00
|
|
|
export interface Result extends ReadonlyArray<any> {
|
|
|
|
readonly [key: string]: any;
|
2020-01-07 19:58:04 -05:00
|
|
|
}
|
2020-04-25 03:54:54 -04:00
|
|
|
export declare function checkResultErrors(result: Result): Array<{
|
|
|
|
path: Array<string | number>;
|
|
|
|
error: Error;
|
|
|
|
}>;
|
2019-08-25 02:39:20 -04: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;
|
2020-11-23 03:43:28 -05:00
|
|
|
abstract defaultValue(): any;
|
2019-08-25 02:39:20 -04:00
|
|
|
}
|
|
|
|
export declare class Writer {
|
|
|
|
readonly wordSize: number;
|
2020-10-05 15:46:12 -04:00
|
|
|
_data: Array<Uint8Array>;
|
|
|
|
_dataLength: number;
|
2019-08-25 02:39:20 -04:00
|
|
|
_padding: Uint8Array;
|
|
|
|
constructor(wordSize?: number);
|
2020-03-22 14:57:17 -04:00
|
|
|
get data(): string;
|
|
|
|
get length(): number;
|
2019-08-25 02:39:20 -04:00
|
|
|
_writeData(data: Uint8Array): number;
|
2020-10-05 15:46:12 -04:00
|
|
|
appendWriter(writer: Writer): number;
|
2019-08-25 02:39:20 -04:00
|
|
|
writeBytes(value: BytesLike): number;
|
|
|
|
_getValue(value: BigNumberish): Uint8Array;
|
|
|
|
writeValue(value: BigNumberish): number;
|
|
|
|
writeUpdatableValue(): (value: BigNumberish) => void;
|
|
|
|
}
|
|
|
|
export declare class Reader {
|
|
|
|
readonly wordSize: number;
|
2020-09-07 19:55:52 -04:00
|
|
|
readonly allowLoose: boolean;
|
2019-08-25 02:39:20 -04:00
|
|
|
readonly _data: Uint8Array;
|
|
|
|
readonly _coerceFunc: CoerceFunc;
|
|
|
|
_offset: number;
|
2020-09-07 19:55:52 -04:00
|
|
|
constructor(data: BytesLike, wordSize?: number, coerceFunc?: CoerceFunc, allowLoose?: boolean);
|
2020-03-22 14:57:17 -04:00
|
|
|
get data(): string;
|
|
|
|
get consumed(): number;
|
2019-08-25 02:39:20 -04:00
|
|
|
static coerce(name: string, value: any): any;
|
|
|
|
coerce(name: string, value: any): any;
|
2020-09-07 19:55:52 -04:00
|
|
|
_peekBytes(offset: number, length: number, loose?: boolean): Uint8Array;
|
2019-08-25 02:39:20 -04:00
|
|
|
subReader(offset: number): Reader;
|
2020-09-07 19:55:52 -04:00
|
|
|
readBytes(length: number, loose?: boolean): Uint8Array;
|
2019-08-25 02:39:20 -04:00
|
|
|
readValue(): BigNumber;
|
|
|
|
}
|
2021-01-19 05:22:54 -05:00
|
|
|
//# sourceMappingURL=abstract-coder.d.ts.map
|