-
Notifications
You must be signed in to change notification settings - Fork 29
/
global.d.ts
84 lines (73 loc) · 1.92 KB
/
global.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
import Vue from 'vue';
import 'vite/client';
declare global {
interface Window {
VITE_NODE_API: string;
touchID: any;
}
}
declare type bnStr = string
declare type tokenId = string
declare type tokenSymbol = string
declare interface HDAccount {
id: string;
lang: string;
name: string;
address: string;
status: number;
addrList: Array<{
address: string,
id: string,
idx: number
}>
addrNum: number
activeAccount
constructor({ id, lang, name, activeAddr, keystore, addrNum, activeIdx }: {
id: string,
keystore: string,
lang?: string,
name?: string,
activeAddr: string,
addrNum?: number,
activeIdx?: number
})
save();
saveAcc();
activate();
freeze();
saveOnAcc(key: string, info: any)
getAccInfo()
lock()
setActiveAcc(index?: number, address?: string)
unlock(params: any)
}
declare module '*.vue' {
export default Vue;
}
declare module '*.png'
declare module '*.svg'
type Network = {
name: string;
rpcUrl: string;
explorerUrl?: string;
};
type injectedScriptEvents = 'accountChange' | 'networkChange';
type VitePassport = {
// These methods are relayed from contentScript.ts => injectedScript.ts
getConnectedAddress: () => Promise<undefined | string>;
disconnectWallet: () => Promise<undefined>;
getNetwork: () => Promise<Network>;
// These methods are relayed from contentScript.ts => background.ts => popup => contentScript.ts => injectedScript.ts
connectWallet: () => Promise<{ domain: string }>;
writeAccountBlock: (type: string, params: object) => Promise<{ block: AccountBlockBlock }>;
// `on` subscribes to `event` and returns an unsubscribe function
on: (
event: injectedScriptEvents,
callback: (payload: { activeAddress?: string; activeNetwork: Network }) => void
) => () => void;
};
declare global {
interface Window {
vitePassport?: VitePassport;
}
}