blocksdk 0.0.2 → 0.1.1
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 -0
- data/lib/blocksdk_ruby/base.rb +2 -26
- 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 +37 -16
- data/lib/blocksdk_ruby/litecoin.rb +67 -68
- data/lib/blocksdk_ruby/market.rb +45 -0
- data/lib/blocksdk_ruby/monero.rb +22 -14
- data/lib/blocksdk_ruby/price.rb +6 -6
- data/lib/blocksdk_ruby/tool.rb +7 -0
- data/lib/blocksdk_ruby/webhook.rb +9 -9
- metadata +5 -3
- data/lib/main.rb +0 -28
@@ -0,0 +1,45 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
class Market < Base
|
4
|
+
def getBlockChain(request = {})
|
5
|
+
return request("GET","/market/exchanges")
|
6
|
+
end
|
7
|
+
|
8
|
+
def getTrades(request = {})
|
9
|
+
request["from"].to_s.empty? ? request['from'] = nil : request['from']
|
10
|
+
request["to"].to_s.empty? ? request['to'] = "USD" : request["to"]
|
11
|
+
|
12
|
+
return request("GET","/market/trades",{
|
13
|
+
"from" => request['from'],
|
14
|
+
"to" => request['to']
|
15
|
+
})
|
16
|
+
end
|
17
|
+
|
18
|
+
def getRates(request = {})
|
19
|
+
|
20
|
+
return request("GET","/market/rates/" + (request['from']).to_s+ "",{
|
21
|
+
"to" => request['to'],
|
22
|
+
"from_amount" => request['from_amount']
|
23
|
+
})
|
24
|
+
end
|
25
|
+
|
26
|
+
def getExchangeTrades(request = {})
|
27
|
+
request["from"].to_s.empty? ? request['from'] = nil : request['from']
|
28
|
+
request["to"].to_s.empty? ? request['to'] = "USD" : request["to"]
|
29
|
+
|
30
|
+
return request("GET","/market/trades/" + (request['exchage_id']).to_s+ "",{
|
31
|
+
"from" => request['from'],
|
32
|
+
"to" => request['to']
|
33
|
+
})
|
34
|
+
end
|
35
|
+
|
36
|
+
def getExchangeRates(request = {})
|
37
|
+
request["to"].to_s.empty? ? request['to'] = "USD" : request["to"]
|
38
|
+
|
39
|
+
return request("GET","/market/rates/" + (request['exchage_id']).to_s + "/" + (request['from']).to_s,{
|
40
|
+
"to" => request['to'],
|
41
|
+
"from_amount" => request['from_amount']
|
42
|
+
})
|
43
|
+
end
|
44
|
+
|
45
|
+
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()
|
@@ -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
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blocksdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BlockSDK
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -30,6 +30,7 @@ executables: []
|
|
30
30
|
extensions: []
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
|
+
- lib/blocksdk.rb
|
33
34
|
- lib/blocksdk_ruby/base.rb
|
34
35
|
- lib/blocksdk_ruby/bitcoin.rb
|
35
36
|
- lib/blocksdk_ruby/bitcoincash.rb
|
@@ -37,10 +38,11 @@ files:
|
|
37
38
|
- lib/blocksdk_ruby/dash.rb
|
38
39
|
- lib/blocksdk_ruby/ethereum.rb
|
39
40
|
- lib/blocksdk_ruby/litecoin.rb
|
41
|
+
- lib/blocksdk_ruby/market.rb
|
40
42
|
- lib/blocksdk_ruby/monero.rb
|
41
43
|
- lib/blocksdk_ruby/price.rb
|
44
|
+
- lib/blocksdk_ruby/tool.rb
|
42
45
|
- lib/blocksdk_ruby/webhook.rb
|
43
|
-
- lib/main.rb
|
44
46
|
homepage: http://www.blocksdk.com
|
45
47
|
licenses:
|
46
48
|
- MIT
|
data/lib/main.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'blocksdk'
|
2
|
-
|
3
|
-
blockSDK = BlockSDK.new('YOU TOKEN')
|
4
|
-
|
5
|
-
# btcClient = blockSDK.createBitcoin()
|
6
|
-
# output = btcClient.getBlockChain()
|
7
|
-
|
8
|
-
#dashClient = blockSDK.createDash()
|
9
|
-
# output = dashClient.getTransaction({ "hash" => "fa6c191a429d65552b9f0a572e24d8edbfb5e08ab4c41afc1914e60d14be14fc"})
|
10
|
-
|
11
|
-
# ethereumClient = blockSDK.createEthereum()
|
12
|
-
# output = ethereumClient.getBlockChain()
|
13
|
-
|
14
|
-
# xmrClient = blockSDK.createMonero()
|
15
|
-
# output = xmrClient.getBlockChain()
|
16
|
-
|
17
|
-
# webhookClient = blockSDK.createWebHook()
|
18
|
-
# output = webhookClient.list()
|
19
|
-
|
20
|
-
# output = blockSDK.listPrice()
|
21
|
-
|
22
|
-
# bchClient = blockSDK.createBitcoinCash()
|
23
|
-
# output = bchClient.getBlockChain()
|
24
|
-
|
25
|
-
ltcClient = blockSDK.createLitecoin()
|
26
|
-
output = ltcClient.getBlockChain()
|
27
|
-
|
28
|
-
puts output
|