-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathshim.d.ts
190 lines (172 loc) · 5.05 KB
/
shim.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
import type { ProtocolWithReturn } from "@arconnect/webext-bridge";
import type { DisplayTheme } from "@arconnect/components-rebrand";
import type { Chunk } from "~api/modules/sign/chunks";
import type { InjectedEvents } from "~utils/events";
import "styled-components";
import type {
AuthRequestMessageData,
AuthResult
} from "~utils/auth/auth.types";
declare module "@arconnect/webext-bridge" {
export interface ProtocolMap {
/**
* `api/foreground/foreground-setup-wallet-sdk.ts` use `postMessage()` to send `arweaveWallet.*` calls that are
* received in `contents/api.ts`, which then sends them to the background using `sendMessage()`.
*/
api_call: ProtocolWithReturn<ApiCall, ApiResponse>;
/**
* `dispatch.foreground.ts` and `sign.foreground.ts` use `sendChunk()` to send chunks to the background.
*/
chunk: ProtocolWithReturn<ApiCall<Chunk>, ApiResponse<number>>;
/**
* `createAuthPopup()` in `auth.utils.ts` sends `auth_request` messages from the background to the auth popup, which
* are received in `auth.provider.ts`.
*/
auth_request: AuthRequestMessageData;
/**
* `auth.hook.ts` uses `auth_result` messages (calling `replyToAuthRequest()`) to reply to the `AuthRequest`s.
*/
auth_result: AuthResult<any>;
/**
* `signAuth()` in `sign_auth.ts` uses `auth_chunk` to send chunked transactions or binary data from the background
* to the auth popup.
*/
auth_chunk: Chunk;
/**
* The background sends `auth_tab_closed` messages to notify the auth popup of closed tabs.
*/
auth_tab_closed: number;
/**
* The background sends `auth_tab_reloaded` messages to notify the auth popup of reloaded tabs.
*/
auth_tab_reloaded: number;
/**
* The background sends `auth_active_wallet_change` messages to notify the auth popup of active wallet changes.
*/
auth_active_wallet_change: number;
/**
* The background sends `auth_app_disconnected` messages to notify the auth popup of disconnected apps.
*/
auth_app_disconnected: number;
// EMBEDDED:
embedded_open: any;
embedded_close: any;
embedded_resize: any;
// TODO: Maybe yes, maybe not (we should not drift too far away from the BE wallet API)
// embedded_auth: any;
// embedded_balance: any;
// embedded_info: any;
// OTHER:
switch_wallet_event: string | null;
copy_address: string;
event: Event;
ar_protocol: ProtocolWithReturn<{ url: string }, { url: sting }>;
}
}
interface ApiCall<DataType = any> extends JsonValue {
type: string;
data?: DataType;
callID: number | string;
}
interface ApiResponse<DataType = any> extends ApiCall<DataType> {
error?: boolean;
}
interface Event {
name: keyof InjectedEvents;
value: unknown;
}
declare module "styled-components" {
export interface DefaultTheme {
displayTheme: DisplayTheme;
theme: string;
primaryText: string;
secondaryText: string;
tertiaryText: string;
background: string;
cardBorder: string;
cardBackground: string;
backgroundv2: string;
primary: string;
primaryBtnHover: string;
secondaryBtnHover: string;
secondaryItemHover: string;
buttonDisabled: string;
primaryTextv2: string;
secondaryTextv2: string;
buttonDisabledText: string;
inputField: string;
success: string;
fail: string;
backgroundSecondary: string;
delete: string;
secondaryDelete: string;
button: {
background: {
primary: {
default: string;
hover: string;
active: string;
disabled: string;
};
secondary: {
default: string;
hover: string;
active: string;
disabled: string;
};
secondaryAlt: {
default: string;
hover: string;
active: string;
disabled: string;
};
};
text: {
primary: string;
secondary: string;
secondaryAlt: string;
disabled: string;
};
hoverBorder: {
primary: string;
secondary: string;
secondaryAlt: string;
};
};
surfaceSecondary: string;
surfaceTertiary: string;
borderDefault: string;
borderSecondary: string;
input: {
background: {
search: { default: string; disabled: string; special: string };
default: { default: string; disabled: string };
dropdown: { default: string; disabled: string };
};
border: {
default: { disabled: string; focused: string };
search: { disabled: string; focused: string; special: string };
dropdown: { default: string; disabled: string; focused: string };
};
placeholder: {
default: string;
search: string;
dropdown: string;
};
icons: {
searchActive: string;
searchInactive: string;
};
};
listItem: {
hover: string;
active: string;
icon: string;
};
}
}
declare namespace NodeJS {
interface ProcessEnv {
BETA_VERSION?: string;
}
}