forked from tahowallet/extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
73 lines (62 loc) · 2.39 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { TypedDataField } from "@ethersproject/abstract-signer"
import { Opaque } from "./tag-types"
/**
* Named type for strings that should be URIs.
*
* Currently *does not offer type safety*, just documentation value; see
* https://github.com/microsoft/TypeScript/issues/202 and
* https://github.com/microsoft/TypeScript/issues/41160 for TS features that
* would give this some more teeth. Right now, any `string` can be assigned
* into a variable of type `URI` and vice versa.
*/
export type URI = string
/**
* Named type for strings that should be domain names.
*
* Currently *does not offer type safety*, just documentation value; see
* https://github.com/microsoft/TypeScript/issues/202 and
* https://github.com/microsoft/TypeScript/issues/41160 for TS features that
* would give this some more teeth. Right now, any `string` can be assigned
* into a variable of type `DomainName` and vice versa.
*/
export type DomainName = string
/**
* Named type for strings that should be hexadecimal numbers.
*
* Currently *does not offer type safety*, just documentation value; see
* https://github.com/microsoft/TypeScript/issues/202 and
* https://github.com/microsoft/TypeScript/issues/41160 for TS features that
* would give this some more teeth. Right now, any `string` can be assigned
* into a variable of type `HexString` and vice versa.
*/
export type HexString = string
declare const NormalizedEVMAddressSymbol: unique symbol
export type NormalizedEVMAddress = Opaque<
string,
typeof NormalizedEVMAddressSymbol
>
/*
* Named type for a number measuring time in seconds since the Unix Epoch,
* January 1st, 1970 UTC.
*
* Currently *does not offer type safety*, just documentation value; see
* https://github.com/microsoft/TypeScript/issues/202 and for a TS feature that
* would give this some more teeth. Right now, any `number` can be assigned
* into a variable of type `UNIXTime` and vice versa.
*/
export type UNIXTime = number
export type EIP712DomainType = {
name?: string
version?: string
chainId?: number | string
verifyingContract?: HexString
}
export type EIP712TypedData<T = Record<string, unknown>> = {
domain: EIP712DomainType
types: Record<string, TypedDataField[]>
message: T
primaryType: string
}
export type EIP191Data = string
export type Writeable<T> = { -readonly [P in keyof T]: T[P] }
export type DeepWriteable<T> = { -readonly [P in keyof T]: DeepWriteable<T[P]> }