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.
- checksums.yaml +4 -4
- data/lib/blocksdk.rb +1 -49
- data/lib/blocksdk_ruby/base.rb +2 -26
- data/lib/blocksdk_ruby/binancesmart.rb +238 -0
- data/lib/blocksdk_ruby/bitcoin.rb +42 -38
- data/lib/blocksdk_ruby/bitcoincash.rb +66 -54
- data/lib/blocksdk_ruby/blocksdk.rb +16 -6
- data/lib/blocksdk_ruby/dash.rb +82 -50
- data/lib/blocksdk_ruby/ethereum.rb +174 -16
- data/lib/blocksdk_ruby/klaytn.rb +294 -0
- data/lib/blocksdk_ruby/litecoin.rb +67 -68
- data/lib/blocksdk_ruby/market.rb +69 -0
- data/lib/blocksdk_ruby/monero.rb +22 -14
- data/lib/blocksdk_ruby/price.rb +6 -6
- data/lib/blocksdk_ruby/solc.rb +12 -0
- data/lib/blocksdk_ruby/tool.rb +7 -0
- data/lib/blocksdk_ruby/webhook.rb +9 -9
- metadata +21 -2
@@ -2,23 +2,20 @@ require_relative 'base'
|
|
2
2
|
|
3
3
|
class Litecoin < Base
|
4
4
|
def getBlockChain(request = {})
|
5
|
-
return request("GET","/ltc/
|
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/
|
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
|
-
|
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/
|
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/
|
50
|
-
end
|
47
|
+
return request("GET","/ltc/addresses/" + (request['address']).to_s + "/balance")
|
48
|
+
end
|
51
49
|
|
52
|
-
def
|
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/
|
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
|
63
|
-
request
|
64
|
-
|
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/
|
71
|
-
"
|
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
|
77
|
-
return request("POST","/ltc/
|
78
|
+
def unloadWallet(request = {})
|
79
|
+
return request("POST","/ltc/wallets/"+(request['wallet_id']).to_s + "/unload")
|
78
80
|
end
|
79
|
-
|
80
|
-
def
|
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/
|
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["
|
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/
|
102
|
-
"
|
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/
|
109
|
-
end
|
110
|
-
|
111
|
-
def
|
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/
|
119
|
-
"
|
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["
|
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
|
-
|
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
|
-
"
|
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
|
-
|
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
|
-
"
|
164
|
-
"password" => request['password']
|
155
|
+
"wif" => request['wif'],
|
156
|
+
"password" => request['password'],
|
157
|
+
"subtractfeefromamount" => request['subtractfeefromamount']
|
165
158
|
})
|
166
159
|
end
|
167
160
|
|
168
|
-
|
161
|
+
def sendTransaction(request = {})
|
162
|
+
return request("POST","/ltc/transactions/send",{
|
163
|
+
"hex" => request['hex']
|
164
|
+
})
|
165
|
+
end
|
169
166
|
|
170
|
-
|
171
|
-
|
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
|
data/lib/blocksdk_ruby/monero.rb
CHANGED
@@ -2,7 +2,7 @@ require_relative 'base'
|
|
2
2
|
|
3
3
|
class Monero < Base
|
4
4
|
def getBlockChain(request = {})
|
5
|
-
return request("GET","/xmr/
|
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/
|
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
|
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/
|
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/
|
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/
|
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/
|
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/
|
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
|
74
|
-
return request("POST","/xmr/
|
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/
|
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/
|
105
|
+
return request("GET","/xmr/transactions/" + (request['hash']).to_s+ "")
|
98
106
|
end
|
99
|
-
end
|
107
|
+
end
|
data/lib/blocksdk_ruby/price.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require_relative 'base'
|
2
2
|
|
3
|
-
class
|
4
|
-
def
|
5
|
-
return request("GET","/
|
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
|
@@ -3,32 +3,32 @@ require_relative 'base'
|
|
3
3
|
class WebHook < Base
|
4
4
|
|
5
5
|
def create(request={})
|
6
|
-
return request("POST","/
|
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","/
|
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","/
|
16
|
+
return request("GET","/hooks/" + (request['hook_id']).to_s)
|
17
17
|
end
|
18
18
|
|
19
19
|
def delete(request={})
|
20
|
-
return request("
|
20
|
+
return request("DELETE","/hooks/" + (request['hook_id']).to_s)
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
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","/
|
26
|
+
return request("GET","/hooks/responses",{"offset"=>request['offset'],"limit"=>request['limit']})
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
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","/
|
32
|
+
return request("GET","/hooks/" + (request['hook_id']).to_s + "/responses",{"offset"=>request['offset'],"limit"=>request['limit']})
|
33
33
|
end
|
34
|
-
end
|
34
|
+
end
|