-
Notifications
You must be signed in to change notification settings - Fork 393
/
env.d.ts
87 lines (78 loc) · 2.5 KB
/
env.d.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/// <reference types="styled-jsx" />
declare module "webext-redux/lib/strategies/deepDiff/diff" {
// This should be : DiffStrategy, but importing webext-redux to reuse
// DiffStrategy results in an error augmenting the diff module.
export default function (): (oldObj: unknown, newObj: unknown) => unknown
}
declare module "webext-redux/lib/strategies/deepDiff/patch" {
// This should be : DiffStrategy, but importing webext-redux to reuse
// DiffStrategy results in an error augmenting the patch module.
export default function (): (oldObj: unknown, newObj: unknown) => unknown
}
// Although you would expect this file to be unnecessary, removing it will
// result in a handful of type errors. See PR #196.
declare module "styled-jsx/style"
type BaseWalletProvider = {
providerInfo?: {
label: string
injectedNamespace: string
iconURL: string
identityFlag?: string
checkIdentity?: (provider: WalletProvider) => boolean
}
emit: (eventName: string | symbol, ...args: unknown[]) => boolean
on: (
eventName: string | symbol,
listener: (...args: unknown[]) => void,
) => unknown
removeListener: (
eventName: string | symbol,
listener: (...args: unknown[]) => void,
) => unknown
}
type WalletProvider = BaseWalletProvider & {
[optionalProps: string]: unknown
}
type TahoProvider = BaseWalletProvider & {
isTally: true
isTaho: true
tahoSetAsDefault: boolean
send: (method: string, params: unknown[]) => void | Promise<unknown>
}
type WindowEthereum = WalletProvider & {
isMetaMask?: boolean
tallySetAsDefault?: boolean
tahoSetAsDefault?: boolean
isTally?: boolean
isTaho?: boolean
autoRefreshOnNetworkChange?: boolean
}
interface Window {
walletRouter?: {
currentProvider: WalletProvider
providers: WalletProvider[]
shouldSetTallyForCurrentProvider: (
shouldSetTaho: boolean,
shouldReload?: boolean,
) => void
shouldSetTahoForCurrentProvider: (
shouldSetTaho: boolean,
shouldReload?: boolean,
) => void
routeToNewNonTahoDefault: (request: unknown) => Promise<unknown>
reemitTahoEvent: (event: string | symbol, ...args: unknown[]) => boolean
getProviderInfo: (
provider: WalletProvider,
) => WalletProvider["providerInfo"]
addProvider: (newProvider: WalletProvider) => void
}
tally?: TahoProvider
taho?: TahoProvider
ethereum?: WindowEthereum
oldEthereum?: WindowEthereum
}
declare namespace NodeJS {
interface ProcessEnv {
NODE_ENV: "production" | "development" | "test"
}
}