1 | import type { BigNumberish, BytesLike } from "../../utils/index.js";
|
2 |
|
3 |
|
4 |
|
5 | export declare const WordSize: number;
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | export declare class Result extends Array<any> {
|
14 | #private;
|
15 | [K: string | number]: any;
|
16 | |
17 |
|
18 |
|
19 | constructor(...args: Array<any>);
|
20 | /**
|
21 | * Returns the Result as a normal Array. If %%deep%%, any children
|
22 | * which are Result objects are also converted to a normal Array.
|
23 | *
|
24 | * This will throw if there are any outstanding deferred
|
25 | * errors.
|
26 | */
|
27 | toArray(deep?: boolean): Array<any>;
|
28 | /**
|
29 | * Returns the Result as an Object with each name-value pair. If
|
30 | * %%deep%%, any children which are Result objects are also
|
31 | * converted to an Object.
|
32 | *
|
33 | * This will throw if any value is unnamed, or if there are
|
34 | * any outstanding deferred errors.
|
35 | */
|
36 | toObject(deep?: boolean): Record<string, any>;
|
37 | /**
|
38 | * @_ignore
|
39 | */
|
40 | slice(start?: number | undefined, end?: number | undefined): Result;
|
41 | /**
|
42 | * @_ignore
|
43 | */
|
44 | filter(callback: (el: any, index: number, array: Result) => boolean, thisArg?: any): Result;
|
45 | /**
|
46 | * @_ignore
|
47 | */
|
48 | map<T extends any = any>(callback: (el: any, index: number, array: Result) => T, thisArg?: any): Array<T>;
|
49 | /**
|
50 | * Returns the value for %%name%%.
|
51 | *
|
52 | * Since it is possible to have a key whose name conflicts with
|
53 | * a method on a [[Result]] or its superclass Array, or any
|
54 | * JavaScript keyword, this ensures all named values are still
|
55 | * accessible by name.
|
56 | */
|
57 | getValue(name: string): any;
|
58 | /**
|
59 | * Creates a new [[Result]] for %%items%% with each entry
|
60 | * also accessible by its corresponding name in %%keys%%.
|
61 | */
|
62 | static fromItems(items: Array<any>, keys?: Array<null | string>): Result;
|
63 | }
|
64 | /**
|
65 | * Returns all errors found in a [[Result]].
|
66 | *
|
67 | * Since certain errors encountered when creating a [[Result]] do
|
68 | * not impact the ability to continue parsing data, they are
|
69 | * deferred until they are actually accessed. Hence a faulty string
|
70 | * in an Event that is never used does not impact the program flow.
|
71 | *
|
72 | * However, sometimes it may be useful to access, identify or
|
73 | * validate correctness of a [[Result]].
|
74 | *
|
75 | * @_docloc api/abi
|
76 | */
|
77 | export declare function checkResultErrors(result: Result): Array<{
|
78 | path: Array<string | number>;
|
79 | error: Error;
|
80 | }>;
|
81 |
|
82 |
|
83 |
|
84 | export declare abstract class Coder {
|
85 | readonly name: string;
|
86 | readonly type: string;
|
87 | readonly localName: string;
|
88 | readonly dynamic: boolean;
|
89 | constructor(name: string, type: string, localName: string, dynamic: boolean);
|
90 | _throwError(message: string, value: any): never;
|
91 | abstract encode(writer: Writer, value: any): number;
|
92 | abstract decode(reader: Reader): any;
|
93 | abstract defaultValue(): any;
|
94 | }
|
95 | /**
|
96 | * @_ignore
|
97 | */
|
98 | export declare class Writer {
|
99 | #private;
|
100 | constructor();
|
101 | get data(): string;
|
102 | get length(): number;
|
103 | appendWriter(writer: Writer): number;
|
104 | writeBytes(value: BytesLike): number;
|
105 | writeValue(value: BigNumberish): number;
|
106 | writeUpdatableValue(): (value: BigNumberish) => void;
|
107 | }
|
108 | /**
|
109 | * @_ignore
|
110 | */
|
111 | export declare class Reader {
|
112 | #private;
|
113 | readonly allowLoose: boolean;
|
114 | constructor(data: BytesLike, allowLoose?: boolean, maxInflation?: number);
|
115 | get data(): string;
|
116 | get dataLength(): number;
|
117 | get consumed(): number;
|
118 | get bytes(): Uint8Array;
|
119 | subReader(offset: number): Reader;
|
120 | readBytes(length: number, loose?: boolean): Uint8Array;
|
121 | readValue(): bigint;
|
122 | readIndex(): number;
|
123 | }
|
124 | //# sourceMappingURL=abstract-coder.d.ts.map |
\ | No newline at end of file |