blocksdk 0.1.0 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,386 @@
1
+ require_relative 'base'
2
+
3
+ class Klaytn < Base
4
+ def getBlockChain(request = {})
5
+ return request("GET","/klay/info")
6
+ end
7
+
8
+ def getBlock(request = {})
9
+ request["rawtx"].to_s.empty? ? request['rawtx'] = false : request['rawtx']
10
+ request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
11
+ request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
12
+
13
+ return request("GET","/klay/blocks/" + (request['block']).to_s,{"rawtx" => request['rawtx'],"offset" => request['offset'],"limit" => request['limit']})
14
+ end
15
+
16
+ def getMemPool(request = {})
17
+ request["rawtx"].to_s.empty? ? request['rawtx'] = false : request['rawtx']
18
+ request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
19
+ request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
20
+
21
+ return request("GET","/klay/mempool",{"rawtx" => request['rawtx'],"offset" => request['offset'],"limit" => request['limit']})
22
+ end
23
+
24
+ def getAddress(request = {})
25
+ request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
26
+ request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
27
+
28
+ return request("GET","/klay/addresses",{
29
+ "offset" => request['offset'],
30
+ "limit" => request['limit']
31
+ })
32
+ end
33
+
34
+ def loadAddress(request = {})
35
+ return request("POST","/klay/addresses/" + (request['address']).to_s + "/load",{"private_key" => request['private_key'],"password" => request['password']})
36
+ end
37
+
38
+ def unloadAddress(request = {})
39
+ return request("POST","/klay/addresses/" + (request['address']).to_s + "/unload")
40
+ end
41
+
42
+ def createAddress(request = {})
43
+ request["name"].to_s.empty? ? request['name'] = 0 : request["name"]
44
+ return request("POST","/klay/addresses",{"name" => request['name']})
45
+ end
46
+
47
+ def getAddressInfo(request = {})
48
+
49
+ request["reverse"].to_s.empty? ? request['reverse'] = true : request['reverse']
50
+ request["rawtx"].to_s.empty? ? request['rawtx'] = false : request['rawtx']
51
+ request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
52
+ request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
53
+
54
+ return request("GET","/klay/addresses/" + (request['address']).to_s ,{"reverse" => request['reverse'],"rawtx" => request['rawtx'],"offset" => request['offset'],"limit" => request['limit']})
55
+ end
56
+
57
+ def getAddressBalance(request = {})
58
+ return request("GET","/klay/addresses/" + (request['address']).to_s + "/balance")
59
+ end
60
+
61
+ def sendToAddress(request = {})
62
+ request["nonce"].to_s.empty? ? request['nonce'] = nil : request["nonce"]
63
+ request["data"].to_s.empty? ? request['data'] = nil : request["data"]
64
+ request["private_key"].to_s.empty? ? request['private_key'] = nil : request["private_key"]
65
+ request["password"].to_s.empty? ? request['password'] = nil : request["password"]
66
+ request["gas_limit"].to_s.empty? ? request['gas_limit'] = nil : request["gas_limit"]
67
+
68
+ return request("POST","/klay/addresses/" + (request['from']).to_s + "/sendtoaddress",{"to" => request['to'],"amount" => request['amount'],"private_key" => request['private_key'],"password" => request['password'],"gas_limit" => request['gas_limit']})
69
+ end
70
+
71
+ def sendTransaction(request = {})
72
+ return request("POST","/klay/transactions/send",{"hex" => request['hex']})
73
+ end
74
+
75
+ def getTransactions(request = {})
76
+ return request("GET","/klay/transactions/" + (request['hash']).to_s)
77
+ end
78
+
79
+ def getKIP7(request = {})
80
+ return request("GET","/klay/kip7-tokens/" + (request['contract_address']).to_s)
81
+ end
82
+
83
+ def getKIP7Balance(request = {})
84
+ return request("GET","/klay/kip7-tokens/" + (request['contract_address']).to_s + "/" + (request['from']).to_s + "/balance")
85
+ end
86
+
87
+ def getKIP7Transfer(request = {})
88
+ request["private_key"].to_s.empty? ? request['private_key'] = nil : request["private_key"]
89
+ request["password"].to_s.empty? ? request['password'] = nil : request["password"]
90
+ request["gas_limit"].to_s.empty? ? request['gas_limit'] = nil : request["gas_limit"]
91
+
92
+ return request("POST","/klay/kip7-tokens/" + (request['contract_address']).to_s + "/" + (request['from']).to_s + "/transfer",{"to" => request['to'],"amount" => request['amount'],"private_key" => request['private_key'],"password" => request['password'],"gas_limit" => request['gas_limit']})
93
+ end
94
+
95
+ def getKIP7Sign(request = {})
96
+ request["private_key"].to_s.empty? ? request['private_key'] = nil : request["private_key"]
97
+ request["password"].to_s.empty? ? request['password'] = nil : request["password"]
98
+ request["gas_limit"].to_s.empty? ? request['gas_limit'] = nil : request["gas_limit"]
99
+
100
+ return request("POST","/klay/kip7-tokens/" + (request['contract_address']).to_s + "/" + (request['from']).to_s + "/transfer/sign",{"to" => request['to'],"amount" => request['amount'],"private_key" => request['private_key'],"password" => request['password'],"gas_limit" => request['gas_limit']})
101
+ end
102
+
103
+ def getKIP7Feedelegated(request = {})
104
+ request["private_key"].to_s.empty? ? request['private_key'] = nil : request["private_key"]
105
+ request["password"].to_s.empty? ? request['password'] = nil : request["password"]
106
+ request["gas_limit"].to_s.empty? ? request['gas_limit'] = nil : request["gas_limit"]
107
+
108
+ return request("POST","/klay/kip7-tokens/" + (request['contract_address']).to_s + "/" + (request['from']).to_s + "/transfer/sign",{"from" => request['from'], "to" => request['to'],"amount" => request['amount'],"private_key" => request['private_key'],"password" => request['password'],"gwei" => request['gwei'],"gas_limit" => request['gas_limit'],"nonce" => request["nonce"],"v" => request['v'],"r" => request['r'],"s" => request['s'],})
109
+ end
110
+
111
+ def getNfts(request = {})
112
+ request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
113
+ request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
114
+
115
+ return request("GET","/klay/kip17-tokens/" + (request['contract_address']).to_s + "/tokens",{
116
+ "offset" => request['offset'],
117
+ "limit" => request['limit']
118
+ })
119
+ end
120
+
121
+ def getOwnerNfts(request = {})
122
+ request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
123
+ request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
124
+
125
+ return request("GET","/klay/kip17-tokens/" + (request['contract_address']).to_s + "/" + (request['owner_address']).to_s + "/owner",{
126
+ "offset" => request['offset'],
127
+ "limit" => request['limit']
128
+ })
129
+ end
130
+
131
+ def getCreatorNfts(request = {})
132
+ request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
133
+ request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
134
+
135
+ return request("GET","/klay/kip17-tokens/" + (request['contract_address']).to_s + "/" + (request['creator_address']).to_s + "/creator",{
136
+ "offset" => request['offset'],
137
+ "limit" => request['limit']
138
+ })
139
+ end
140
+
141
+ def getAuctionNfts(request = {})
142
+ request["order_by"].to_s.empty? ? request['order_by'] = 'end_time' : request["order_by"]
143
+ request["order_direction"].to_s.empty? ? request['order_direction'] = 'desc' : request["order_direction"]
144
+ request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
145
+ request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
146
+
147
+ return request("GET","/klay/kip17-tokens/" + (request['contract_address']).to_s + "/auction",{
148
+ "order_by" => request['order_by'],
149
+ "order_direction" => request['order_direction'],
150
+ "offset" => request['offset'],
151
+ "limit" => request['limit']
152
+ })
153
+ end
154
+
155
+ def getSaleNfts(request = {})
156
+ request["order_direction"].to_s.empty? ? request['order_direction'] = 'desc' : request["order_direction"]
157
+ request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
158
+ request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
159
+
160
+ return request("GET","/klay/kip17-tokens/" + (request['contract_address']).to_s + "/" + (request['seller_address']).to_s + "/sale",{
161
+ "order_direction" => request['order_direction'],
162
+ "offset" => request['offset'],
163
+ "limit" => request['limit']
164
+ })
165
+ end
166
+
167
+ def getNftBids(request = {})
168
+ request["rawtx"].to_s.empty? ? request['rawtx'] = 0 : request["rawtx"]
169
+ request["order_direction"].to_s.empty? ? request['order_direction'] = 'desc' : request["order_direction"]
170
+ request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
171
+ request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
172
+
173
+ return request("GET","/klay/kip17-tokens/" + (request['contract_address']).to_s + "/" + (request['token_id']).to_s + "/bid",{
174
+ "rawtx" => request['rawtx'],
175
+ "order_direction" => request['order_direction'],
176
+ "offset" => request['offset'],
177
+ "limit" => request['limit']
178
+ })
179
+ end
180
+
181
+ def getNftInfo(request = {})
182
+ return request("GET","/klay/kip17-tokens/" + (request['contract_address']).to_s + "/" + (request['token_id']).to_s + "/info")
183
+ end
184
+
185
+ def getNftTransfers(request = {})
186
+ request["rawtx"].to_s.empty? ? request['rawtx'] = 0 : request["rawtx"]
187
+ request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
188
+ request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
189
+
190
+ return request("GET","/klay/kip17-tokens/" + (request['contract_address']).to_s + "/" + (request['token_id']).to_s + "/bid",{
191
+ "rawtx" => request['rawtx'],
192
+ "order_direction" => request['order_direction'],
193
+ "offset" => request['offset'],
194
+ "limit" => request['limit']
195
+ })
196
+ end
197
+
198
+ def getMultiNft(request = {})
199
+ request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
200
+ request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
201
+
202
+ return request("GET","/bsc/bep1155-tokens/" + (request['contract_address']).to_s + "/tokens",{
203
+ "offset" => request['offset'],
204
+ "limit" => request['limit']
205
+ })
206
+ end
207
+
208
+ def getMultiNftOwnerList(request = {})
209
+ request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
210
+ request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
211
+
212
+ return request("GET","/bsc/bep1155-tokens/" + (request['contract_address']).to_s + "/" + (request['token_id']).to_s + "/list",{
213
+ "offset" => request['offset'],
214
+ "limit" => request['limit']
215
+ })
216
+ end
217
+
218
+ def getMultiNftContractOwner(request = {})
219
+ request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
220
+ request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
221
+
222
+ return request("GET","/bsc/bep1155-tokens/" + (request['contract_address']).to_s + "/" + (request['owner_address']).to_s + "/owners",{
223
+ "offset" => request['offset'],
224
+ "limit" => request['limit']
225
+ })
226
+ end
227
+
228
+ def getMultiNftOwner(request = {})
229
+ request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
230
+ request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
231
+
232
+ return request("GET","/bsc/bep1155-tokens/" + (request['owner_address']).to_s + "/owner",{
233
+ "offset" => request['offset'],
234
+ "limit" => request['limit']
235
+ })
236
+ end
237
+
238
+ def getMultiNftContractCreator(request = {})
239
+ request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
240
+ request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
241
+
242
+ return request("GET","/bsc/bep1155-tokens/" + (request['contract_address']).to_s + "/" + (request['creator_address']).to_s + "/creators",{
243
+ "offset" => request['offset'],
244
+ "limit" => request['limit']
245
+ })
246
+ end
247
+
248
+ def getMultiNftCreator(request = {})
249
+ request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
250
+ request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
251
+
252
+ return request("GET","/bsc/bep1155-tokens/" + (request['creator_address']).to_s + "/creator",{
253
+ "offset" => request['offset'],
254
+ "limit" => request['limit']
255
+ })
256
+ end
257
+
258
+ def getMultiNftInfo(request = {})
259
+ return request("GET","/bsc/bep1155-tokens/" + (request['contract_address']).to_s + "/" + (request['token_id']).to_s + "/info",{
260
+ })
261
+ end
262
+
263
+ def getMultiNftTransfers(request = {})
264
+ request["rawtx"].to_s.empty? ? request['rawtx'] = 0 : request["rawtx"]
265
+
266
+ request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
267
+ request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
268
+
269
+ return request("GET","/bsc/bep1155-tokens/" + (request['contract_address']).to_s + "/" + (request['token_id']).to_s + "/transfers",{
270
+ "rawtx" => request['rawtx'],
271
+ "offset" => request['offset'],
272
+ "limit" => request['limit']
273
+ })
274
+ end
275
+
276
+ def getMultiSaleNfts(request = {})
277
+ request["order_direction"].to_s.empty? ? request['order_direction'] = 'desc' : request["order_direction"]
278
+
279
+ request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
280
+ request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
281
+
282
+ return request("GET","/bsc/bep1155-tokens/" + (request['contract_address']).to_s + "/" + (request['seller_address']).to_s + "/sale",{
283
+ "order_direction" => request['order_direction'],
284
+ "offset" => request['offset'],
285
+ "limit" => request['limit']
286
+ })
287
+ end
288
+
289
+ def getContractRead(request = {})
290
+ request["parameter_type"].to_s.empty? ? request['parameter_type'] = nil : request["parameter_type"]
291
+ request["parameter_data"].to_s.empty? ? request['parameter_data'] = nil : request["parameter_data"]
292
+
293
+ return request("POST","/klay/contracts/" + (request['contract_address']).to_s + "/read",{
294
+ "method" => request['method'],
295
+ "return_type" => request['return_type'],
296
+ "parameter_type" => request['parameter_type'],
297
+ "parameter_data" => request['parameter_data']
298
+ })
299
+ end
300
+
301
+ def getContractWrite(request = {})
302
+ request["private_key"].to_s.empty? ? request['private_key'] = nil : request["private_key"]
303
+ request["password"].to_s.empty? ? request['password'] = nil : request["password"]
304
+ request["gas_limit"].to_s.empty? ? request['gas_limit'] = nil : request["gas_limit"]
305
+
306
+ request["parameter_type"].to_s.empty? ? request['parameter_type'] = nil : request["parameter_type"]
307
+ request["parameter_data"].to_s.empty? ? request['parameter_data'] = nil : request["parameter_data"]
308
+
309
+ return request("POST","/klay/contracts/" + (request['contract_address']).to_s + "/write",{
310
+ "method" => request['method'],
311
+ "return_type" => request['return_type'],
312
+ "parameter_type" => request['parameter_type'],
313
+ "parameter_data" => request['parameter_data'],
314
+ "from" => request['from'],
315
+ "private_key" => request['private_key'],
316
+ "password" => request['password'],
317
+ "amount" => request['amount'],
318
+ "gas_limit" => request['gas_limit']
319
+ })
320
+ end
321
+
322
+ def getContractWriteSign(request = {})
323
+ request["private_key"].to_s.empty? ? request['private_key'] = nil : request["private_key"]
324
+ request["password"].to_s.empty? ? request['password'] = nil : request["password"]
325
+ request["gas_limit"].to_s.empty? ? request['gas_limit'] = nil : request["gas_limit"]
326
+
327
+ request["parameter_type"].to_s.empty? ? request['parameter_type'] = nil : request["parameter_type"]
328
+ request["parameter_data"].to_s.empty? ? request['parameter_data'] = nil : request["parameter_data"]
329
+
330
+ return request("POST","/klay/contracts/" + (request['contract_address']).to_s + "/write/sign",{
331
+ "method" => request['method'],
332
+ "return_type" => request['return_type'],
333
+ "parameter_type" => request['parameter_type'],
334
+ "parameter_data" => request['parameter_data'],
335
+ "from" => request['from'],
336
+ "private_key" => request['private_key'],
337
+ "password" => request['password'],
338
+ "amount" => request['amount'],
339
+ "gas_limit" => request['gas_limit']
340
+ })
341
+ end
342
+
343
+ def getContractWriteFeedelegated(request = {})
344
+ request["private_key"].to_s.empty? ? request['private_key'] = nil : request["private_key"]
345
+ request["password"].to_s.empty? ? request['password'] = nil : request["password"]
346
+ request["gas_limit"].to_s.empty? ? request['gas_limit'] = nil : request["gas_limit"]
347
+
348
+ request["parameter_type"].to_s.empty? ? request['parameter_type'] = nil : request["parameter_type"]
349
+ request["parameter_data"].to_s.empty? ? request['parameter_data'] = nil : request["parameter_data"]
350
+
351
+ return request("POST","/klay/contracts/" + (request['contract_address']).to_s + "/write/feedelegated",{
352
+ "method" => request['method'],
353
+ "return_type" => request['return_type'],
354
+ "parameter_type" => request['parameter_type'],
355
+ "parameter_data" => request['parameter_data'],
356
+ "from" => request['from'],
357
+ "fee_payer" => request['fee_payer'],
358
+ "private_key" => request['private_key'],
359
+ "password" => request['password'],
360
+ "amount" => request['amount'],
361
+ "gwei" => request['gwei'],
362
+ "gas_limit" => request['gas_limit']
363
+ })
364
+ end
365
+
366
+ def getContractWriteFees(request = {})
367
+ request["gas_limit"].to_s.empty? ? request['gas_limit'] = nil : request["gas_limit"]
368
+
369
+ request["parameter_type"].to_s.empty? ? request['parameter_type'] = nil : request["parameter_type"]
370
+ request["parameter_data"].to_s.empty? ? request['parameter_data'] = nil : request["parameter_data"]
371
+
372
+ return request("POST","/klay/kip17-tokens/" + (request['contract_address']).to_s + "/write/fees",{
373
+ "method" => request['method'],
374
+ "return_type" => request['return_type'],
375
+ "parameter_type" => request['parameter_type'],
376
+ "parameter_data" => request['parameter_data'],
377
+ "from" => request['from'],
378
+ "amount" => request['amount'],
379
+ "gas_limit" => request['gas_limit']
380
+ })
381
+ end
382
+
383
+
384
+
385
+ end
386
+
@@ -2,23 +2,20 @@ require_relative 'base'
2
2
 
3
3
  class Litecoin < Base
4
4
  def getBlockChain(request = {})
5
- return request("GET","/ltc/block")
5
+ return request("GET","/ltc/info")
6
6
  end
7
-
8
7
  def getBlock(request = {})
9
-
10
8
  request["rawtx"].to_s.empty? ? request['rawtx'] = false : request['rawtx']
11
9
  request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
12
10
  request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
13
-
14
- return request("GET","/ltc/block/" + (request['block']).to_s ,{
11
+
12
+ return request("GET","/ltc/blocks/"+ (request['block']).to_s, {
15
13
  "rawtx" => request['rawtx'],
16
14
  "offset" => request['offset'],
17
15
  "limit" => request['limit']
18
16
  })
19
17
  end
20
-
21
-
18
+
22
19
  def getMemPool(request = {})
23
20
  request["rawtx"].to_s.empty? ? request['rawtx'] = false : request['rawtx']
24
21
  request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
@@ -32,12 +29,13 @@ class Litecoin < Base
32
29
  end
33
30
 
34
31
  def getAddressInfo(request = {})
35
- request["reverse"].to_s.empty? ? request['reverse'] = true : request['reverse']
32
+
33
+ request["reverse"].to_s.empty? ? request['reverse'] = true : request["reverse"]
36
34
  request["rawtx"].to_s.empty? ? request['rawtx'] = false : request['rawtx']
37
35
  request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
38
36
  request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
39
37
 
40
- return request("GET","/ltc/address/" + (request['address']).to_s+ "",{
38
+ return request("GET","/ltc/addresses/" + (request['address']).to_s,{
41
39
  "reverse" => request['reverse'],
42
40
  "rawtx" => request['rawtx'],
43
41
  "offset" => request['offset'],
@@ -46,126 +44,127 @@ class Litecoin < Base
46
44
  end
47
45
 
48
46
  def getAddressBalance(request = {})
49
- return request("GET","/ltc/address/" + (request['address']).to_s+ "/balance")
50
- end
47
+ return request("GET","/ltc/addresses/" + (request['address']).to_s + "/balance")
48
+ end
51
49
 
52
- def listWallet(request = {})
50
+ def getWallets(request = {})
53
51
  request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
54
52
  request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
55
53
 
56
- return request("GET","/ltc/wallet",{
54
+ return request("GET","/ltc/wallets",{
57
55
  "offset" => request['offset'],
58
56
  "limit" => request['limit']
59
57
  })
60
58
  end
61
59
 
62
- def createWallet(request = {})
63
- request["name"].to_s.empty? ? request['name'] = nil : request["name"]
64
- return request("POST","/ltc/wallet",{
60
+ def getWallet(request = {})
61
+ return request("GET","/ltc/wallets/"+ (request['wallet_id']).to_s + "")
62
+ end
63
+
64
+ def createHdWallet(request = {})
65
+ request["limit"].to_s.empty? ? request['limit'] = nil : request["limit"]
66
+ return request("POST","/ltc/wallets/hd",{
65
67
  "name" => request['name']
66
68
  })
67
69
  end
68
-
70
+
69
71
  def loadWallet(request = {})
70
- return request("POST","/ltc/wallet/" + (request['wallet_id']).to_s+ "/load",{
71
- "seed_wif" => request['seed_wif'],
72
+ return request("POST","/ltc/wallets/"+ (request['wallet_id']).to_s + "/load",{
73
+ "wif" => request['wif'],
72
74
  "password" => request['password']
73
75
  })
74
76
  end
75
77
 
76
- def unLoadWallet(request = {})
77
- return request("POST","/ltc/wallet/" + (request['wallet_id']).to_s+ "/unload")
78
+ def unloadWallet(request = {})
79
+ return request("POST","/ltc/wallets/"+(request['wallet_id']).to_s + "/unload")
78
80
  end
79
-
80
- def listWalletAddress(request = {})
81
-
81
+
82
+ def getWalletAddress(request = {})
82
83
  request["address"].to_s.empty? ? request['address'] = nil : request["address"]
83
84
  request["hdkeypath"].to_s.empty? ? request['hdkeypath'] = nil : request["hdkeypath"]
84
-
85
85
  request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
86
86
  request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
87
87
 
88
- return request("GET","/ltc/wallet/" + (request['wallet_id']).to_s+ "/address",{
88
+ return request("GET","/ltc/wallets/"+(request['wallet_id']).to_s + "/addresses",{
89
89
  "address" => request['address'],
90
90
  "hdkeypath" => request['hdkeypath'],
91
91
  "offset" => request['offset'],
92
92
  "limit" => request['limit']
93
93
  })
94
94
  end
95
-
95
+
96
96
  def createWalletAddress(request = {})
97
97
 
98
- request["seed_wif"].to_s.empty? ? request['seed_wif'] = nil : request["seed_wif"]
98
+ request["wif"].to_s.empty? ? request['wif'] = nil : request["wif"]
99
99
  request["password"].to_s.empty? ? request['password'] = nil : request["password"]
100
100
 
101
- return request("POST","/ltc/wallet/" + (request['wallet_id']).to_s+ "/address",{
102
- "seed_wif" => request['seed_wif'],
101
+ return request("POST","/ltc/wallets/"+(request['wallet_id']).to_s + "/addresses",{
102
+ "wif" => request['wif'],
103
103
  "password" => request['password']
104
104
  })
105
105
  end
106
-
106
+
107
107
  def getWalletBalance(request = {})
108
- return request("GET","/ltc/wallet/" + (request['wallet_id']).to_s+ "/balance")
109
- end
110
-
111
- def getWalletTransaction(request = {})
112
-
113
- request["category"].to_s.empty? ? request['category'] = 'all' : request["category"]
108
+ return request("GET","/ltc/wallets/"+(request['wallet_id']).to_s + "/balance")
109
+ end
110
+
111
+ def getWalletTransactions(request = {})
112
+
114
113
  request["order"].to_s.empty? ? request['order'] = 'desc' : request["order"]
114
+ request["type"].to_s.empty? ? request['type'] = 'all' : request["type"]
115
115
  request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
116
116
  request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
117
-
118
- return request("GET","/ltc/wallet/" + (request['wallet_id']).to_s+ "/transaction",{
119
- "category" => request['category'],
117
+
118
+ return request("GET","/ltc/wallets/"+(request['wallet_id']).to_s + "/transaction",{
119
+ "type" => request['type'],
120
120
  "order" => request['order'],
121
121
  "offset" => request['offset'],
122
122
  "limit" => request['limit']
123
123
  })
124
124
  end
125
-
125
+
126
126
  def sendToAddress(request = {})
127
-
127
+
128
128
  if request["kbfee"].to_s.empty?
129
129
  blockChain = getBlockChain()
130
130
  request['kbfee'] = blockChain['medium_fee_per_kb']
131
131
  end
132
-
133
- request["seed_wif"].to_s.empty? ? request['seed_wif'] = nil : request["seed_wif"]
132
+
133
+ request["wif"].to_s.empty? ? request['wif'] = nil : request["wif"]
134
134
  request["password"].to_s.empty? ? request['password'] = nil : request["password"]
135
-
136
- return request("POST","/ltc/wallet/" + (request['wallet_id']).to_s+ "/sendtoaddress",{
135
+ request["subtractfeefromamount"].to_s.empty? ? request['subtractfeefromamount'] = false : request['subtractfeefromamount']
136
+
137
+ return request("POST","/ltc/wallets/"+ (request['wallet_id']).to_s + "/sendtoaddress",{
137
138
  "address" => request['address'],
138
139
  "amount" => request['amount'],
139
- "seed_wif" => request['seed_wif'],
140
+ "wif" => request['wif'],
140
141
  "password" => request['password'],
141
- "kbfee" => request['kbfee']
142
- })
143
- end
144
-
145
- def sendTransaction(request = {})
146
- return request("POST","/ltc/transaction",{
147
- "sign_hex" => request['sign_hex']
142
+ "kbfee" => request['kbfee'],
143
+ "subtractfeefromamount" => request['subtractfeefromamount']
148
144
  })
149
145
  end
150
-
151
- def getTransaction(request = {})
152
- return request("GET","/ltc/transaction/" + (request['hash']).to_s+ "")
153
- end
154
146
 
155
147
  def sendMany(request = {})
156
-
157
- request["rawtx"].to_s.empty? ? request['rawtx'] = false : nil
158
- request["seed_wif"].to_s.empty? ? request['seed_wif'] = nil : nil
159
- request["password"].to_s.empty? ? request['password'] = nil : nil
160
148
 
161
- return request("POST","/ltc/wallet/" + (request['wallet_id']).to_s+ "/sendmany",{
149
+ request["wif"].to_s.empty? ? request['wif'] = nil : request["wif"]
150
+ request["password"].to_s.empty? ? request['password'] = nil : request["password"]
151
+ request["subtractfeefromamount"].to_s.empty? ? request['subtractfeefromamount'] = false : request['subtractfeefromamount']
152
+
153
+ return request("POST","/ltc/wallets/"+ (request['wallet_id']).to_s + "/sendmany",{
162
154
  "to" => request['to'],
163
- "seed_wif" => request['seed_wif'],
164
- "password" => request['password']
155
+ "wif" => request['wif'],
156
+ "password" => request['password'],
157
+ "subtractfeefromamount" => request['subtractfeefromamount']
165
158
  })
166
159
  end
167
160
 
168
- end
161
+ def sendTransaction(request = {})
162
+ return request("POST","/ltc/transactions/send",{
163
+ "hex" => request['hex']
164
+ })
165
+ end
169
166
 
170
- #baseInstance = Litecoin.new("ad38QFTevz8fEEAG4fKsf4T5L8pwqgcy6LXMHpqU")
171
- #puts baseInstance.getTransaction({"hash" => "892235a5aa0f52c2240603e9ca55012f0c76fee688623961003eae1f0ede4506"})
167
+ def getTransaction(request = {})
168
+ return request("GET","/ltc/transactions/"+ (request['hash']).to_s + "")
169
+ end
170
+ end