forked from exantech/monero-nodejs-libwallet
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
166 lines (157 loc) · 4.44 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
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
export = monero;
export as namespace monero;
declare namespace monero {
type Language =
| 'English'
| 'Nederlands'
| 'Français'
| 'Español'
| 'Português'
| '日本語'
| 'Italiano'
| 'Deutsch'
| 'русский язык'
| '简体中文 (中国)'
| 'Esperanto'
| 'Lojban';
type WalletEvent =
| 'newBlock'
| 'refreshed'
| 'updated'
| 'unconfirmedMoneyReceived'
| 'moneyReceived'
| 'moneySpent'
| 'unconfirmedTokensReceived'
| 'tokensReceived'
| 'tokensSpent';
type Network =
| 'mainnet'
| 'stagenet'
| 'testnet';
type MultisigState = {
isMultisig: boolean,
isReady: boolean,
threshold: number,
total: number,
};
type Transaction = {
commit(): Promise<void>;
amount(): string;
tokenAmount(): string;
fee(): string;
transactionsCount(): number;
transactionsIds(): string[];
multisigSignData(): string;
signMultisigTransaction(): void;
signersKeys(): string[];
};
type Transfer = {
amount: string;
token_amount: string;
address: string;
};
type TransactionInfo = {
id: string;
direction: 'in' | 'out';
pending: boolean;
failed: boolean;
amount: string;
fee: string;
blockHeight: number;
subAddresses: string;
subAddrAccount: string;
label: string;
confirmations: number;
unlockTime: number;
timestamp: number;
paymentId: number;
transfers: Transfer[];
transactionType: number;
};
interface Wallet {
address(): string;
seed(): string;
on(event: 'newBlock', callback: (height: number) => void): Wallet;
on(
event: 'unconfirmedMoneyReceived' | 'moneyReceived' | 'moneySpent',
callback: (tx: string, amount: string) => void,
): Wallet;
on(
event: 'unconfirmedTokensReceived' | 'tokensReceived' | 'tokensSpent',
callback: (tx: string, token_amount: string) => void,
): Wallet;
on(event: 'refreshed' | 'updated', callback: () => void): Wallet;
off(event?: WalletEvent): Wallet;
store(): Promise<void>;
createTransaction(options: {
address: string,
amount: string,
paymentId?: string,
mixin?: number,
priority?:number,
tx_type?: number
}): Promise<Transaction>;
history(): TransactionInfo[];
path(): string;
network(): Network;
secretViewKey(): string;
publicViewKey(): string;
secretSpendKey(): string;
publicSpendKey(): string;
publicMultisigSignerKey(): string;
setPassword(password: string): Wallet;
setRefreshFromBlockHeight(height: number): Wallet;
getRefreshFromBlockHeight(): string;
connected(): boolean;
setTrustedDaemon(value: boolean): Wallet;
trustedDaemon(): boolean;
balance(): string;
unlockedBalance(): string;
blockchainHeight(): number;
daemonBlockchainHeight(): number;
synchronized(): boolean;
pauseRefresh(): void;
startRefresh(): void;
multisigState(): MultisigState;
verifyMessageWithPublicKey(message: string, key: string, signature: string): boolean;
getMultisigInfo(): string;
makeMultisig(multisigInfos: string[], walletsNumber: number): string;
finalizeMultisig(multisigInfos: string[]): string;
exportMultisigImages(): string;
importMultisigImages(keys: string[]): void;
restoreMultisigTransaction(sign: string): Promise<Transaction>;
close(storeWallet?: boolean): Promise<void>;
// Personal wallet methods
signMessage(message: string): string;
verifySignedMessage(message: string, address: string, signature: string): boolean;
// Multisig wallet methods
signMultisigParticipant(message: string): string;
}
function setupLog(level: 0 | 1 | 2 | 3 | 4, output?: string): void;
function createWallet(options: {
path: string,
password: string,
network?: Network,
daemonAddress: string,
language?: Language,
}): Promise<Wallet>;
function openWallet(options: {
path: string,
password: string,
network?: Network,
daemonAddress: string,
language?: Language,
}): Promise<Wallet>;
function recoveryWallet(options: {
path: string,
password: string,
network?: Network,
daemonAddress: string,
mnemonic: string,
restoreHeight?: number,
}): Promise<Wallet>;
function walletExists(path: string): boolean;
function genPaymentId(): string;
function paymentIdValid(paymentId: string): boolean;
function addressValid(address: string): boolean;
}