1 |
|
2 | import { ObjectMap } from '@0x/types';
|
3 | import { DataItem, RevertErrorAbi } from 'ethereum-types';
|
4 | import { BigNumber } from './configured_bignumber';
|
5 | declare type ArgTypes = string | BigNumber | number | boolean | RevertError | BigNumber[] | string[] | number[] | boolean[] | Array<BigNumber | number | string>;
|
6 | declare type ValueMap = ObjectMap<ArgTypes | undefined>;
|
7 | interface RevertErrorType {
|
8 | new (): RevertError;
|
9 | }
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | export declare function registerRevertErrorType(revertClass: RevertErrorType, force?: boolean): void;
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | export declare function decodeBytesAsRevertError(bytes: string | Buffer, coerce?: boolean): RevertError;
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 | export declare function decodeThrownErrorAsRevertError(error: Error, coerce?: boolean): RevertError;
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 | export declare function coerceThrownErrorAsRevertError(error: Error): RevertError;
|
39 |
|
40 |
|
41 |
|
42 | export declare abstract class RevertError extends Error {
|
43 | private static readonly _typeRegistry;
|
44 | readonly abi?: RevertErrorAbi;
|
45 | readonly values: ValueMap;
|
46 | protected readonly _raw?: string;
|
47 | |
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 | static decode(bytes: string | Buffer | RevertError, coerce?: boolean): RevertError;
|
55 | |
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 | static registerType(revertClass: RevertErrorType, force?: boolean): void;
|
62 | |
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 | protected constructor(name: string, declaration?: string, values?: ValueMap, raw?: string);
|
72 | /**
|
73 | * Get the ABI name for this revert.
|
74 | */
|
75 | get name(): string;
|
76 | /**
|
77 | * Get the class name of this type.
|
78 | */
|
79 | get typeName(): string;
|
80 | /**
|
81 | * Get the hex selector for this revert (without leading '0x').
|
82 | */
|
83 | get selector(): string;
|
84 | /**
|
85 | * Get the signature for this revert: e.g., 'Error(string)'.
|
86 | */
|
87 | get signature(): string;
|
88 | /**
|
89 | * Get the ABI arguments for this revert.
|
90 | */
|
91 | get arguments(): DataItem[];
|
92 | get [Symbol.toStringTag](): string;
|
93 | /**
|
94 | * Compares this instance with another.
|
95 | * Fails if instances are not of the same type.
|
96 | * Only fields/values defined in both instances are compared.
|
97 | * @param other Either another RevertError instance, hex-encoded bytes, or a Buffer of the ABI encoded revert.
|
98 | * @return True if both instances match.
|
99 | */
|
100 | equals(other: RevertError | Buffer | string): boolean;
|
101 | encode(): string;
|
102 | toString(): string;
|
103 | private _getArgumentByName;
|
104 | private get _isAnyType();
|
105 | private get _isRawType();
|
106 | private get _hasAllArgumentValues();
|
107 | }
|
108 | interface GanacheTransactionRevertResult {
|
109 | error: 'revert';
|
110 | program_counter: number;
|
111 | return?: string;
|
112 | reason?: string;
|
113 | }
|
114 | interface GanacheTransactionRevertError extends Error {
|
115 | results: {
|
116 | [hash: string]: GanacheTransactionRevertResult;
|
117 | };
|
118 | hashes: string[];
|
119 | }
|
120 | interface ParityTransactionRevertError extends Error {
|
121 | code: number;
|
122 | data: string;
|
123 | message: string;
|
124 | }
|
125 |
|
126 |
|
127 |
|
128 | export declare function getThrownErrorRevertErrorBytes(error: Error | GanacheTransactionRevertError | ParityTransactionRevertError): string;
|
129 |
|
130 |
|
131 |
|
132 | export declare class StringRevertError extends RevertError {
|
133 | constructor(message?: string);
|
134 | }
|
135 | /**
|
136 | * Special RevertError type that matches with any other RevertError instance.
|
137 | */
|
138 | export declare class AnyRevertError extends RevertError {
|
139 | constructor();
|
140 | }
|
141 | /**
|
142 | * Special RevertError type that is not decoded.
|
143 | */
|
144 | export declare class RawRevertError extends RevertError {
|
145 | constructor(encoded: string | Buffer);
|
146 | }
|
147 | export {};
|
148 |
|
\ | No newline at end of file |