-
Notifications
You must be signed in to change notification settings - Fork 0
/
custon.d.ts
50 lines (44 loc) · 1.06 KB
/
custon.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
import { Wallets } from '@/constants/wallets'
type APIErrorCode = {
InvalidRequest: -1
InternalError: -2
Refused: -3
AccountChange: -4
}
interface DataSignErrorCode {
ProofGeneration: 1
AddressNotPK: 2
UserDeclined: 3
}
type DataSignError = {
code: DataSignErrorCode
info: string
}
type EnabledWallet = {
getBalance: () => Promise<string>
getChangeAddress: () => Promise<string>
getRewardAddresses: () => Promise<string[]>
getUnusedAddresses: () => Promise<string[]>
getUsedAddresses: () => Promise<string[]>
getUtxos: () => Promise<string[]>
signData: (addr: string, msg: string) => Promise<DataSignError>
signTx: () => void
submitTx: () => void
}
declare global {
interface Window {
cardano?: {
[k in Wallets]: {
enable: () => Promise<EnabledWallet>
}
}
}
}
// Extend the Window interface with the getNetworkId property
declare global {
interface Window {
cardano?: {
getNetworkId: () => Promise<0 | 1>
}
}
}