blocksdk 0.0.5 → 0.1.3

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.
@@ -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
@@ -0,0 +1,69 @@
1
+ require_relative 'base'
2
+
3
+ class Market < Base
4
+ def getExchanges(request = {})
5
+ return request("GET","/market/exchanges")
6
+ end
7
+
8
+ def getAssets(request = {})
9
+ return request("GET","/market/assets")
10
+ end
11
+
12
+ def getAsset(request = {})
13
+ return request("GET","/market/assets/" + (request['asset_id']).to_s)
14
+ end
15
+
16
+ def getOhlcvLast(request = {})
17
+ return request("GET","/market/ohlcv/latest",request)
18
+ end
19
+
20
+ def getOhlcvHistory(request = {})
21
+ return request("GET","/market/ohlcv/history/" + (request['symbol']).to_s,request)
22
+ end
23
+
24
+ def getExchangeOhlcvLast(request = {})
25
+ return request("GET","/market/ohlcv/" + (request['exchage_id']).to_s + "/latest",request)
26
+ end
27
+
28
+ def getExchangeOhlcvHistory(request = {})
29
+ return request("GET","/market/ohlcv/" + (request['exchage_id']).to_s + "/history/" + (request['symbol']).to_s,request)
30
+ end
31
+
32
+ def getTrades(request = {})
33
+ request["from"].to_s.empty? ? request['from'] = nil : request['from']
34
+ request["to"].to_s.empty? ? request['to'] = "USD" : request["to"]
35
+
36
+ return request("GET","/market/trades",{
37
+ "from" => request['from'],
38
+ "to" => request['to']
39
+ })
40
+ end
41
+
42
+ def getRates(request = {})
43
+
44
+ return request("GET","/market/rates/" + (request['from']).to_s+ "",{
45
+ "to" => request['to'],
46
+ "from_amount" => request['from_amount']
47
+ })
48
+ end
49
+
50
+ def getExchangeTrades(request = {})
51
+ request["from"].to_s.empty? ? request['from'] = nil : request['from']
52
+ request["to"].to_s.empty? ? request['to'] = "USD" : request["to"]
53
+
54
+ return request("GET","/market/trades/" + (request['exchage_id']).to_s+ "",{
55
+ "from" => request['from'],
56
+ "to" => request['to']
57
+ })
58
+ end
59
+
60
+ def getExchangeRates(request = {})
61
+ request["to"].to_s.empty? ? request['to'] = "USD" : request["to"]
62
+
63
+ return request("GET","/market/rates/" + (request['exchage_id']).to_s + "/" + (request['from']).to_s,{
64
+ "to" => request['to'],
65
+ "from_amount" => request['from_amount']
66
+ })
67
+ end
68
+
69
+ end
@@ -2,7 +2,7 @@ require_relative 'base'
2
2
 
3
3
  class Monero < Base
4
4
  def getBlockChain(request = {})
5
- return request("GET","/xmr/block")
5
+ return request("GET","/xmr/info")
6
6
  end
7
7
 
8
8
  def getBlock(request = {})
@@ -10,7 +10,7 @@ class Monero < Base
10
10
  request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
11
11
  request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
12
12
 
13
- return request("GET","/xmr/block/" + (request['block']).to_s+ "",{
13
+ return request("GET","/xmr/blocks/" + (request['block']).to_s+ "",{
14
14
  "rawtx" => request['rawtx'],
15
15
  "offset" => request['offset'],
16
16
  "limit" => request['limit']
@@ -29,11 +29,11 @@ class Monero < Base
29
29
  })
30
30
  end
31
31
 
32
- def listAddress(request = {})
32
+ def getAddresses(request = {})
33
33
  request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
34
34
  request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
35
35
 
36
- return request("GET","/xmr/address",{
36
+ return request("GET","/xmr/addresses",{
37
37
  "offset" => request['offset'],
38
38
  "limit" => request['limit']
39
39
  })
@@ -41,7 +41,7 @@ class Monero < Base
41
41
 
42
42
  def createAddress(request = {})
43
43
  request["name"].to_s.empty? ? request['name'] = nil : request["name"]
44
- return request("POST","/xmr/address",{
44
+ return request("POST","/xmr/addresses",{
45
45
  "name" => request['name']
46
46
  })
47
47
  end
@@ -50,7 +50,7 @@ class Monero < Base
50
50
  request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
51
51
  request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
52
52
 
53
- return request("GET","/xmr/address/" + (request['address_id']).to_s+ "",{
53
+ return request("GET","/xmr/addresses/" + (request['address_id']).to_s+ "",{
54
54
  "offset" => request['offset'],
55
55
  "limit" => request['limit'],
56
56
  "private_spend_key" => request['private_spend_key'],
@@ -58,20 +58,20 @@ class Monero < Base
58
58
  end
59
59
 
60
60
  def getAddressBalance(request = {})
61
- return request("GET","/xmr/address/" + (request['address_id']).to_s+ "/balance",{
61
+ return request("GET","/xmr/addresses/" + (request['address_id']).to_s+ "/balance",{
62
62
  "private_spend_key" => request['private_spend_key'],
63
63
  })
64
64
  end
65
65
 
66
66
  def loadAddress(request = {})
67
- return request("POST","/xmr/address/" + (request['address_id']).to_s+ "/load",{
67
+ return request("POST","/xmr/addresses/" + (request['address_id']).to_s+ "/load",{
68
68
  "private_spend_key" => request['private_spend_key'],
69
69
  "password" => request['password']
70
70
  })
71
71
  end
72
72
 
73
- def unLoadAddress(request = {})
74
- return request("POST","/xmr/address/" + (request['address_id']).to_s+ "/unload")
73
+ def unloadAddress(request = {})
74
+ return request("POST","/xmr/addresses/" + (request['address_id']).to_s+ "/unload")
75
75
  end
76
76
 
77
77
  def sendToAddress(request = {})
@@ -83,17 +83,25 @@ class Monero < Base
83
83
 
84
84
  request["private_spend_key"].to_s.empty? ? request['private_spend_key'] = nil : request["private_spend_key"]
85
85
  request["password"].to_s.empty? ? request['password'] = nil : request["password"]
86
+ request["subtractfeefromamount"].to_s.empty? ? request['subtractfeefromamount'] = false : request['subtractfeefromamount']
86
87
 
87
- return request("POST","/xmr/address/" + (request['address_id']).to_s+ "/sendtoaddress",{
88
+ return request("POST","/xmr/addresses/" + (request['address_id']).to_s+ "/sendtoaddress",{
88
89
  "address" => request['address'],
89
90
  "amount" => request['amount'],
90
91
  "private_spend_key" => request['private_spend_key'],
91
92
  "password" => request['password'],
92
- "kbfee" => request['kbfee']
93
+ "kbfee" => request['kbfee'],
94
+ "subtractfeefromamount" => request['subtractfeefromamount']
95
+ })
96
+ end
97
+
98
+ def sendTransaction(request = {})
99
+ return request("POST","/xmr/transactions/send",{
100
+ "hex" => request['hex']
93
101
  })
94
102
  end
95
103
 
96
104
  def getTransaction(request = {})
97
- return request("GET","/xmr/transaction/" + (request['hash']).to_s+ "")
105
+ return request("GET","/xmr/transactions/" + (request['hash']).to_s+ "")
98
106
  end
99
- end
107
+ end
@@ -1,10 +1,10 @@
1
1
  require_relative 'base'
2
2
 
3
- class Price < Base
4
- def listPrice(request = {})
5
- return request("GET","/price")
3
+ class Token < Base
4
+ def getUsages(request = {})
5
+ return request("GET","/token/usage",{
6
+ "stat_date" => request['stat_date'],
7
+ "end_date" => request['end_date']
8
+ })
6
9
  end
7
10
  end
8
-
9
- # priceInstance = Price.new("ad38QFTevz8fEEAG4fKsf4T5L8pwqgcy6LXMHpqU")
10
- # puts priceInstance.listPrice()
@@ -0,0 +1,12 @@
1
+ require_relative 'base'
2
+
3
+ class Solc < Base
4
+ def genContract(request = {})
5
+ return request("GET","/solc/" + (request['net']).to_s + "/" + (request['type']).to_s,request)
6
+ end
7
+
8
+ def getAssets(request = {})
9
+ return request("GET","/solc/encodefunction",request)
10
+ end
11
+
12
+ end
@@ -0,0 +1,7 @@
1
+ require_relative 'base'
2
+
3
+ class Tool < Base
4
+ def getTransaction(request = {})
5
+ return getHashType("GET","/tools/hash-type/" + (request['hash']).to_s+ "")
6
+ end
7
+ end
@@ -3,32 +3,32 @@ require_relative 'base'
3
3
  class WebHook < Base
4
4
 
5
5
  def create(request={})
6
- return request("POST","/hook",{"callback"=>request['callback'],"category"=>request['category'],"address"=>request['address']})
6
+ return request("POST","/hooks",{"callback_url"=>request['callback_url'],"symbol"=>request['symbol'],"address"=>request['address']})
7
7
  end
8
8
 
9
9
  def list(request = {})
10
10
  request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
11
11
  request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
12
- return request("GET","/hook",{"offset"=>request['offset'],"limit"=>request['limit']})
12
+ return request("GET","/hooks",{"offset"=>request['offset'],"limit"=>request['limit']})
13
13
  end
14
14
 
15
15
  def get(request={})
16
- return request("GET","/hook/" + (request['hook_id']).to_s)
16
+ return request("GET","/hooks/" + (request['hook_id']).to_s)
17
17
  end
18
18
 
19
19
  def delete(request={})
20
- return request("POST","/hook/" + (request['hook_id']).to_s + "/delete")
20
+ return request("DELETE","/hooks/" + (request['hook_id']).to_s)
21
21
  end
22
22
 
23
- def listResponse(request = {})
23
+ def getResponses(request = {})
24
24
  request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
25
25
  request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
26
- return request("GET","/hook/response",{"offset"=>request['offset'],"limit"=>request['limit']})
26
+ return request("GET","/hooks/responses",{"offset"=>request['offset'],"limit"=>request['limit']})
27
27
  end
28
28
 
29
- def getResponse(request={})
29
+ def getHookResponses(request={})
30
30
  request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
31
31
  request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
32
- return request("GET","/hook/" + (request['hook_id']).to_s + "/response",{"offset"=>request['offset'],"limit"=>request['limit']})
32
+ return request("GET","/hooks/" + (request['hook_id']).to_s + "/responses",{"offset"=>request['offset'],"limit"=>request['limit']})
33
33
  end
34
- end
34
+ end