-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.d.ts
103 lines (99 loc) · 3.04 KB
/
index.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
import type { Config, DonatPoolTokenData, Protocol, FetchedDonatPool } from '@/shared/types';
interface ConnectionParameters {
wallet: 'Nami' | 'Lode' | 'Flint' | 'Eternl';
isMainnet: false;
}
interface InjectedWallet<Name> {
name: Name;
apiVersion: string;
icon: string;
enable: () => Promise<Record<string, unknown>> | never;
isEnabled: () => Promise<boolean>;
}
type HandleError = (error: string) => void;
type FetchDonatPools = (
onSuccess: (donatPools: FetchedDonatPool[]) => void,
) => (onError: HandleError) => (protocol: Protocol) => (connectionParameters: ConnectionParameters) => () => void;
declare global {
namespace NodeJS {
interface ProcessEnv {
NEXT_PUBLIC_PROTOCOL: string;
}
}
interface Window {
cardano?: {
nami?: InjectedWallet<'Nami'>;
LodeWallet?: {
name: 'LodeWallet';
apiVersion: string;
icon: string;
enable: () => Promise<Record<string, unknown> | undefined>;
isEnabled: () => Promise<boolean>;
};
flint?: InjectedWallet<'Flint wallet'>;
eternl?: InjectedWallet<'eternl'>;
};
donatPool?: Promise<{
getAppInfo: (
onSuccess: (appInfo: {
protocolConfig: {
minAmountParam: {
value: number;
};
maxAmountParam: {
value: number;
};
minDurationParam: {
value: number;
};
maxDurationParam: {
value: number;
};
protocolFeeParam: {
value: number;
};
};
userInfo: {
address: string;
isManager: boolean;
};
}) => void,
) => (onError: HandleError) => (protocol: Protocol) => (connectionParameters: ConnectionParameters) => () => void;
createFundraising: (
onSuccess: (createdDonatPool: FetchedDonatPool) => void,
) => (
onError: HandleError,
) => (
protocol: Protocol,
) => (connectionParameters: ConnectionParameters) => (data: CreateDonatPoolParams) => () => void;
getAllFundraisings: FetchDonatPools;
getUserRelatedFundraisings: FetchDonatPools;
donate: (
onSuccess: () => void,
) => (
onError: HandleError,
) => (
protocol: Protocol,
) => (
connectionParameters: ConnectionParameters,
) => (donatPoolData: DonatPoolTokenData) => (amount: number) => () => void;
setProtocol: (
onSuccess: (config: {
minAmountParam: number;
maxAmountParam: number;
minDurationParam: number;
maxDurationParam: number;
protocolFeeParam: number;
}) => void,
) => (onError: HandleError) => (protocol: Protocol) => (config: Config) => () => void;
receiveFunds: (
onSuccess: () => void,
) => (
onError: HandleError,
) => (
protocol: Protocol,
) => (connectionParameters: ConnectionParameters) => (donatPoolData: DonatPoolData) => () => void;
}>;
}
}
export {};