-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathliskdll.cpp
335 lines (266 loc) · 9.36 KB
/
liskdll.cpp
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
// Important note about DLL memory management when your DLL uses the
// static version of the RunTime Library:
//
// If your DLL exports any functions that pass String objects (or structs/
// classes containing nested Strings) as parameter or function results,
// you will need to add the library MEMMGR.LIB to both the DLL project and
// any other projects that use the DLL. You will also need to use MEMMGR.LIB
// if any other projects which use the DLL will be performing new or delete
// operations on any non-TObject-derived classes which are exported from the
// DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling
// EXE's to use the BORLNDMM.DLL as their memory manager. In these cases,
// the file BORLNDMM.DLL should be deployed along with your DLL.
//
// To avoid using BORLNDMM.DLL, pass string information using "char *" or
// ShortString parameters.
//
// If your DLL uses the dynamic version of the RTL, you do not need to
// explicitly add MEMMGR.LIB as this will be done implicitly for you
#include <vcl.h>
#include <windows.h>
#include "LiskApi.h"
#pragma hdrstop
#pragma argsused
#define BUILD_DLL
#ifdef BUILD_DLL
#define IMPORT_EXPORT __declspec(dllexport)
#else
#define IMPORT_EXPORT __declspec(dllimport)
#endif
LiskAPI *liskapi = NULL;
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason,
void* lpReserved) {
return 1;
}
extern "C" {
IMPORT_EXPORT void __stdcall InitAPI(char *nodeurl) {
if (liskapi == NULL)
liskapi = new LiskAPI(nodeurl);
}
IMPORT_EXPORT void __stdcall SetNodeURL(char *nodeurl) {
liskapi->lisknode = AnsiString(nodeurl);
}
IMPORT_EXPORT void __stdcall FreeAPI() {
if (liskapi != NULL) {
delete liskapi;
liskapi = NULL;
}
}
IMPORT_EXPORT char * __stdcall GetAccountBySecret(char * secret) {
return liskapi->GetAccountBySecret(secret);
}
IMPORT_EXPORT char * __stdcall Balance(char * address) {
return liskapi->Balance(address);
}
IMPORT_EXPORT char * __stdcall PublicKey(char * address) {
return liskapi->PublicKey(address);
}
IMPORT_EXPORT char * __stdcall GenPublicKey(char * secret) {
return liskapi->GenPublicKey(secret);
}
IMPORT_EXPORT char * __stdcall GetAccountByAddress(char * address) {
return liskapi->GetAccountByAddress(address);
}
IMPORT_EXPORT char * __stdcall GetDelegates(char * address) {
return liskapi->GetDelegates(address);
}
IMPORT_EXPORT char * __stdcall DelegatesVote(char * secret,
char * second_secret, char * pubkey, char *delegates) {
return liskapi->DelegatesVote(secret, second_secret, pubkey, delegates);
}
IMPORT_EXPORT char * __stdcall Status() {
return liskapi->Status();
}
IMPORT_EXPORT char * __stdcall SyncStatus() {
return liskapi->SyncStatus();
}
IMPORT_EXPORT char * __stdcall Ping() {
return liskapi->Ping();
}
IMPORT_EXPORT char * __stdcall Transations(char * blockID,
char * senderId, char * recvID, __int64 limit, __int64 offset,
char * orderby) {
return liskapi->Transactions(blockID, senderId, recvID, limit, offset,
orderby);
}
IMPORT_EXPORT char * __stdcall SendTransactions(char * secret,
__int64 amount, char * recverID, char * publicKey, char * secondSecret)
{
return liskapi->SendTransactions(secret, amount, recverID, publicKey,
secondSecret);
}
IMPORT_EXPORT char * __stdcall GetTransactions(char * txid) {
return liskapi->GetTransactions(txid);
}
IMPORT_EXPORT char * __stdcall GetUnConfirmedTxByID(char * txid) {
return liskapi->GetUnConfirmedTxByID(txid);
}
IMPORT_EXPORT char * __stdcall GetUnConfirmedTx() {
return liskapi->GetUnConfirmedTx();
}
IMPORT_EXPORT char * __stdcall GetQueuedTx() {
return liskapi->GetQueuedTx();
}
IMPORT_EXPORT char * __stdcall GetQueuedTxByID(char * txid) {
return liskapi->GetQueuedTxByID(txid);
}
IMPORT_EXPORT char * __stdcall GetPeers(int state, char * os,
char * version, int limit, __int32 offset, char * orderBy) {
return liskapi->GetPeers(state, os, version, limit, offset, orderBy);
}
IMPORT_EXPORT char * __stdcall GetPeerByIPEndPoint(char * ip,
int port) {
return liskapi->GetPeerByIPEndPoint(ip, port);
}
IMPORT_EXPORT char * __stdcall LiskNodeVersion() {
return liskapi->LiskNodeVersion();
}
IMPORT_EXPORT char * __stdcall GetBlockByID(char * blockid) {
return liskapi->GetBlockByID(blockid);
}
IMPORT_EXPORT char * __stdcall GetBlocks(__int64 totalfee,
__int64 totalAmount, char * prevBlock, __int64 height,
char * generatorPubKey, int limit, __int32 offset, char * orderBy) {
return liskapi->GetBlocks(totalfee, totalAmount, prevBlock, height,
generatorPubKey, limit, offset, orderBy);
}
IMPORT_EXPORT char * __stdcall GetBlockFee() {
return liskapi->GetBlockFee();
}
IMPORT_EXPORT char * __stdcall GetFees() {
return liskapi->GetFees();
}
IMPORT_EXPORT char * __stdcall GetReward() {
return liskapi->GetReward();
}
IMPORT_EXPORT char * __stdcall GetSupply() {
return liskapi->GetSupply();
}
IMPORT_EXPORT char * __stdcall GetHeight() {
return liskapi->GetHeight();
}
IMPORT_EXPORT char * __stdcall GetStatus() {
return liskapi->GetStatus();
}
IMPORT_EXPORT char * __stdcall GetNethash() {
return liskapi->GetNethash();
}
IMPORT_EXPORT char * __stdcall GetMilestone() {
return liskapi->GetMilestone();
}
IMPORT_EXPORT char * __stdcall GetSignatureFee() {
return liskapi->GetSignatureFee();
}
IMPORT_EXPORT char * __stdcall AddSignature(char * secret,
char * secondSecret, char * publickey) {
return liskapi->AddSignature(secret, secondSecret, publickey);
}
IMPORT_EXPORT char * __stdcall CreateDelegate(char * secret,
char * second_secret, char * username) {
return liskapi->CreateDelegate(secret, second_secret, username);
}
IMPORT_EXPORT char * __stdcall DelegatesList(int limit,
__int32 offset, char * orderBy) {
return liskapi->DelegatesList(limit, offset, orderBy);
}
IMPORT_EXPORT char * __stdcall GetDelegateByPkey(char * publickey) {
return liskapi->GetDelegateByPkey(publickey);
}
IMPORT_EXPORT char * __stdcall GetDelegateByName(char * username) {
return liskapi->GetDelegateByName(username);
}
IMPORT_EXPORT char * __stdcall SearchDelegate(char * username,
char * orderby) {
return liskapi->SearchDelegate(username, orderby);
}
IMPORT_EXPORT char * __stdcall DelegatesCount() {
return liskapi->DelegatesCount();
}
IMPORT_EXPORT char * __stdcall GetVotesByAddress(char * address) {
return liskapi->GetVotesByAddress(address);
}
IMPORT_EXPORT char * __stdcall GetVotersByPubkey(char * publicKey) {
return liskapi->GetVotersByPubkey(publicKey);
}
IMPORT_EXPORT char * __stdcall EnableForge(char * secret) {
return liskapi->EnableForge(secret);
}
IMPORT_EXPORT char * __stdcall DisableForge(char * secret) {
return liskapi->DisableForge(secret);
}
IMPORT_EXPORT char * __stdcall GetForgedAmount(char * pubkey) {
return liskapi->GetForgedAmount(pubkey);
}
IMPORT_EXPORT char * __stdcall GetNextForgers(int limit) {
return liskapi->GetNextForgers(limit);
}
IMPORT_EXPORT char * __stdcall RegistDapp(char * secret,
char * secondSecret, char * pubkey, char * category, char * name,
char * description, char * tags, int type, char * link, char * icon) {
return liskapi->RegistDapp(secret, secondSecret, pubkey, category, name,
description, tags, type, link, icon);
}
IMPORT_EXPORT char * __stdcall GetDapps(char * category,
char * name, int type, char * link, int limit, __int32 offset,
char * orderBy) {
return liskapi->GetDapps(category, name, type, link, limit, offset,
orderBy);
}
IMPORT_EXPORT char * __stdcall GetDapp(char * id) {
return liskapi->GetDapp(id);
}
IMPORT_EXPORT char * __stdcall SearchDapp(char * query,
char * category, int isInstalled) {
return liskapi->SearchDapp(query, category, isInstalled);
}
IMPORT_EXPORT char * __stdcall InstallDapp(char * id) {
return liskapi->InstallDapp(id);
}
IMPORT_EXPORT char * __stdcall InstalledDapps() {
return liskapi->InstalledDapps();
}
IMPORT_EXPORT char * __stdcall InstalledDappIds() {
return liskapi->InstalledDappIds();
}
IMPORT_EXPORT char * __stdcall UninstallDapp(char * id) {
return liskapi->UninstallDapp(id);
}
IMPORT_EXPORT char * __stdcall LaunchDapp(char * id, char * params)
{
return liskapi->LaunchDapp(id, params);
}
IMPORT_EXPORT char * __stdcall InstallingDapps() {
return liskapi->InstallingDapps();
}
IMPORT_EXPORT char * __stdcall UnInstallingDapps() {
return liskapi->UnInstallingDapps();
}
IMPORT_EXPORT char * __stdcall LaunchedDapps() {
return liskapi->LaunchedDapps();
}
IMPORT_EXPORT char * __stdcall Catefories() {
return liskapi->Catefories();
}
IMPORT_EXPORT char * __stdcall StopDapp(char * id) {
return liskapi->StopDapp(id);
}
IMPORT_EXPORT char * __stdcall MultiSign(char * secret,
int lifetime, int min, char *keysgroup) {
return liskapi->MultiSign(secret, lifetime, min, keysgroup);
}
IMPORT_EXPORT char * __stdcall GetMultiSign(char * publickey) {
return liskapi->GetMultiSign(publickey);
}
IMPORT_EXPORT char * __stdcall SignMultiSignature(char * secret,
char * publickey, char * txid) {
return liskapi->SignMultiSignature(secret, publickey, txid);
}
IMPORT_EXPORT char * __stdcall GetPendingMultiSign(char * publickey)
{
return liskapi->GetPendingMultiSign(publickey);
}
IMPORT_EXPORT char * __stdcall HTTPRequest(int request_method,char * url,char *data)
{
return liskapi->HTTPRequest((REQUEST_METHOD)request_method,url,data);
}
}