UNPKG

2.79 kBTypeScriptView Raw
1/// <reference types="node" />
2import { EIP712Message, EIP712MessageTypesEntry, MessageFilters } from "./EIP712.types";
3/**
4 * @ignore for the README
5 *
6 * A Map of helpers to get the id and size to return for each
7 * type that can be used in EIP712
8 */
9export declare const EIP712_TYPE_PROPERTIES: Record<string, {
10 key: (size?: number) => number;
11 sizeInBits: (size?: number) => number | null;
12}>;
13/**
14 * @ignore for the README
15 *
16 * A Map of encoders to transform a value to formatted buffer
17 */
18export declare const EIP712_TYPE_ENCODERS: {
19 INT(value: string | null, sizeInBits?: number): Buffer;
20 UINT(value: string): Buffer;
21 BOOL(value: number | string | boolean | null): Buffer;
22 ADDRESS(value: string | null): Buffer;
23 STRING(value: string | null): Buffer;
24 BYTES(value: string | null, sizeInBits?: number | undefined): Buffer;
25};
26/**
27 * @ignore for the README
28 *
29 * Helper parsing an EIP712 Type name to return its type and size(s)
30 * if it's an array or nested arrays
31 *
32 * @see EIP712MessageTypes
33 *
34 * @example "uint8[2][][4]" => [{name: "uint", bits: 8}, [2, null, 4]]
35 * @example "bool" => [{name: "bool", bits: null}, []]
36 *
37 * @param {String} typeName
38 * @returns {[{ name: string; bits: Number | null }, Array<Number | null | undefined>]}
39 */
40export declare const destructTypeFromString: (typeName?: string | undefined) => [{
41 name: string;
42 bits: number | undefined;
43} | null, (number | null)[]];
44/**
45 * @ignore for the README
46 *
47 * Helper to construct the hexadecimal ByteString for the description
48 * of a field in an EIP712 Message
49 *
50 * @param isArray
51 * @param typeSize
52 * @param typeValue
53 * @returns {String} HexByteString
54 */
55export declare const constructTypeDescByteString: (isArray: boolean, typeSize: number | null | undefined, typeValue: number) => string;
56/**
57 * @ignore for the README
58 *
59 * Helper to create the buffer to describe an EIP712 types' entry structure
60 *
61 * @param {EIP712MessageTypesEntry} entry
62 * @returns {Buffer}
63 */
64export declare const makeTypeEntryStructBuffer: ({ name, type, }: EIP712MessageTypesEntry) => Buffer;
65export declare function isEIP712Message(message: Record<string, unknown> | string): message is EIP712Message;
66export declare const sortObjectAlphabetically: (obj: Record<string, any>) => Record<string, any>;
67export declare const getSchemaHashForMessage: (message: EIP712Message) => string;
68/**
69 * @ignore for the README
70 *
71 * Tries to find the proper filters for a given EIP712 message
72 * in the CAL
73 *
74 * @param {EIP712Message} message
75 * @returns {MessageFilters | undefined}
76 */
77export declare const getFiltersForMessage: (message: EIP712Message, remoteCryptoAssetsListURI?: string | null | undefined) => Promise<MessageFilters | undefined>;
78//# sourceMappingURL=EIP712.utils.d.ts.map
\No newline at end of file