1 | import type { SignatureLike } from "../crypto/index.js";
|
2 | import type { BigNumberish, BytesLike } from "../utils/index.js";
|
3 |
|
4 |
|
5 |
|
6 | export interface TypedDataDomain {
|
7 | |
8 |
|
9 |
|
10 | name?: null | string;
|
11 | |
12 |
|
13 |
|
14 | version?: null | string;
|
15 | |
16 |
|
17 |
|
18 | chainId?: null | BigNumberish;
|
19 | |
20 |
|
21 |
|
22 | verifyingContract?: null | string;
|
23 | |
24 |
|
25 |
|
26 | salt?: null | BytesLike;
|
27 | }
|
28 |
|
29 |
|
30 |
|
31 | export interface TypedDataField {
|
32 | |
33 |
|
34 |
|
35 | name: string;
|
36 | |
37 |
|
38 |
|
39 | type: string;
|
40 | }
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | export declare class TypedDataEncoder {
|
50 | #private;
|
51 | |
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 | readonly primaryType: string;
|
60 | |
61 |
|
62 |
|
63 | get types(): Record<string, Array<TypedDataField>>;
|
64 | |
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 | constructor(_types: Record<string, Array<TypedDataField>>);
|
72 | /**
|
73 | * Returnthe encoder for the specific %%type%%.
|
74 | */
|
75 | getEncoder(type: string): (value: any) => string;
|
76 | /**
|
77 | * Return the full type for %%name%%.
|
78 | */
|
79 | encodeType(name: string): string;
|
80 | /**
|
81 | * Return the encoded %%value%% for the %%type%%.
|
82 | */
|
83 | encodeData(type: string, value: any): string;
|
84 | /**
|
85 | * Returns the hash of %%value%% for the type of %%name%%.
|
86 | */
|
87 | hashStruct(name: string, value: Record<string, any>): string;
|
88 | /**
|
89 | * Return the fulled encoded %%value%% for the [[types]].
|
90 | */
|
91 | encode(value: Record<string, any>): string;
|
92 | /**
|
93 | * Return the hash of the fully encoded %%value%% for the [[types]].
|
94 | */
|
95 | hash(value: Record<string, any>): string;
|
96 | /**
|
97 | * @_ignore:
|
98 | */
|
99 | _visit(type: string, value: any, callback: (type: string, data: any) => any): any;
|
100 | /**
|
101 | * Call %%calback%% for each value in %%value%%, passing the type and
|
102 | * component within %%value%%.
|
103 | *
|
104 | * This is useful for replacing addresses or other transformation that
|
105 | * may be desired on each component, based on its type.
|
106 | */
|
107 | visit(value: Record<string, any>, callback: (type: string, data: any) => any): any;
|
108 | /**
|
109 | * Create a new **TypedDataEncoder** for %%types%%.
|
110 | */
|
111 | static from(types: Record<string, Array<TypedDataField>>): TypedDataEncoder;
|
112 | /**
|
113 | * Return the primary type for %%types%%.
|
114 | */
|
115 | static getPrimaryType(types: Record<string, Array<TypedDataField>>): string;
|
116 | /**
|
117 | * Return the hashed struct for %%value%% using %%types%% and %%name%%.
|
118 | */
|
119 | static hashStruct(name: string, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): string;
|
120 | /**
|
121 | * Return the domain hash for %%domain%%.
|
122 | */
|
123 | static hashDomain(domain: TypedDataDomain): string;
|
124 | /**
|
125 | * Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%.
|
126 | */
|
127 | static encode(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): string;
|
128 | /**
|
129 | * Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%.
|
130 | */
|
131 | static hash(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): string;
|
132 | /**
|
133 | * Resolves to the value from resolving all addresses in %%value%% for
|
134 | * %%types%% and the %%domain%%.
|
135 | */
|
136 | static resolveNames(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>, resolveName: (name: string) => Promise<string>): Promise<{
|
137 | domain: TypedDataDomain;
|
138 | value: any;
|
139 | }>;
|
140 | |
141 |
|
142 |
|
143 |
|
144 | static getPayload(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): any;
|
145 | }
|
146 |
|
147 |
|
148 |
|
149 | export declare function verifyTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>, signature: SignatureLike): string;
|
150 |
|
\ | No newline at end of file |