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.
- checksums.yaml +4 -4
- data/lib/blocksdk_ruby/base.rb +2 -26
- data/lib/blocksdk_ruby/binancesmart.rb +330 -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 +330 -80
- data/lib/blocksdk_ruby/klaytn.rb +386 -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
@@ -1,17 +1,15 @@
|
|
1
1
|
require_relative 'base'
|
2
2
|
|
3
3
|
class BitcoinCash < Base
|
4
|
-
|
5
|
-
|
6
|
-
return request("GET","/bch/block")
|
4
|
+
def getBlockChain(request = {})
|
5
|
+
return request("GET","/bch/info")
|
7
6
|
end
|
8
|
-
|
9
7
|
def getBlock(request = {})
|
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
11
|
|
14
|
-
return request("GET","/bch/
|
12
|
+
return request("GET","/bch/blocks/"+ (request['block']).to_s, {
|
15
13
|
"rawtx" => request['rawtx'],
|
16
14
|
"offset" => request['offset'],
|
17
15
|
"limit" => request['limit']
|
@@ -29,15 +27,15 @@ class BitcoinCash < Base
|
|
29
27
|
"limit" => request['limit']
|
30
28
|
})
|
31
29
|
end
|
32
|
-
|
30
|
+
|
33
31
|
def getAddressInfo(request = {})
|
34
32
|
|
35
|
-
request["reverse"].to_s.empty? ? request['reverse'] = true : request[
|
36
|
-
request["rawtx"].to_s.empty? ? request['rawtx'] =
|
33
|
+
request["reverse"].to_s.empty? ? request['reverse'] = true : request["reverse"]
|
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","/bch/
|
38
|
+
return request("GET","/bch/addresses/" + (request['address']).to_s,{
|
41
39
|
"reverse" => request['reverse'],
|
42
40
|
"rawtx" => request['rawtx'],
|
43
41
|
"offset" => request['offset'],
|
@@ -46,113 +44,127 @@ class BitcoinCash < Base
|
|
46
44
|
end
|
47
45
|
|
48
46
|
def getAddressBalance(request = {})
|
49
|
-
return request("GET","/bch/
|
47
|
+
return request("GET","/bch/addresses/" + (request['address']).to_s + "/balance")
|
50
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
|
+
|
54
|
+
return request("GET","/bch/wallets",{
|
56
55
|
"offset" => request['offset'],
|
57
56
|
"limit" => request['limit']
|
58
57
|
})
|
59
58
|
end
|
60
59
|
|
61
|
-
def
|
62
|
-
request
|
63
|
-
|
60
|
+
def getWallet(request = {})
|
61
|
+
return request("GET","/bch/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","/bch/wallets/hd",{
|
64
67
|
"name" => request['name']
|
65
68
|
})
|
66
69
|
end
|
67
|
-
|
70
|
+
|
68
71
|
def loadWallet(request = {})
|
69
|
-
return request("POST","/bch/
|
70
|
-
"
|
72
|
+
return request("POST","/bch/wallets/"+ (request['wallet_id']).to_s + "/load",{
|
73
|
+
"wif" => request['wif'],
|
71
74
|
"password" => request['password']
|
72
75
|
})
|
73
76
|
end
|
74
|
-
|
75
|
-
def
|
76
|
-
return request("POST","/bch/
|
77
|
+
|
78
|
+
def unloadWallet(request = {})
|
79
|
+
return request("POST","/bch/wallets/"+(request['wallet_id']).to_s + "/unload")
|
77
80
|
end
|
78
|
-
|
79
|
-
def listWalletAddress(request = {})
|
80
81
|
|
81
|
-
|
82
|
+
def getWalletAddress(request = {})
|
82
83
|
request["address"].to_s.empty? ? request['address'] = nil : request["address"]
|
84
|
+
request["hdkeypath"].to_s.empty? ? request['hdkeypath'] = nil : request["hdkeypath"]
|
83
85
|
request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
|
84
86
|
request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
|
85
87
|
|
86
|
-
return request("GET","/bch/
|
88
|
+
return request("GET","/bch/wallets/"+(request['wallet_id']).to_s + "/addresses",{
|
87
89
|
"address" => request['address'],
|
88
90
|
"hdkeypath" => request['hdkeypath'],
|
89
91
|
"offset" => request['offset'],
|
90
92
|
"limit" => request['limit']
|
91
93
|
})
|
92
94
|
end
|
93
|
-
|
95
|
+
|
94
96
|
def createWalletAddress(request = {})
|
95
|
-
|
97
|
+
|
98
|
+
request["wif"].to_s.empty? ? request['wif'] = nil : request["wif"]
|
96
99
|
request["password"].to_s.empty? ? request['password'] = nil : request["password"]
|
97
100
|
|
98
|
-
return request("POST","/bch/
|
99
|
-
"
|
101
|
+
return request("POST","/bch/wallets/"+(request['wallet_id']).to_s + "/addresses",{
|
102
|
+
"wif" => request['wif'],
|
100
103
|
"password" => request['password']
|
101
104
|
})
|
102
|
-
end
|
103
|
-
|
104
|
-
def getWalletBalance(request = {})
|
105
|
-
return request("GET","/bch/wallet/" + (request['wallet_id']).to_s + "/balance")
|
106
105
|
end
|
107
106
|
|
108
|
-
def
|
107
|
+
def getWalletBalance(request = {})
|
108
|
+
return request("GET","/bch/wallets/"+(request['wallet_id']).to_s + "/balance")
|
109
|
+
end
|
110
|
+
|
111
|
+
def getWalletTransactions(request = {})
|
109
112
|
|
110
|
-
request["category"].to_s.empty? ? request['category'] = 'all' : request["category"]
|
111
113
|
request["order"].to_s.empty? ? request['order'] = 'desc' : request["order"]
|
114
|
+
request["type"].to_s.empty? ? request['type'] = 'all' : request["type"]
|
112
115
|
request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
|
113
116
|
request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
|
114
|
-
|
115
|
-
return request("GET","/bch/
|
116
|
-
"
|
117
|
+
|
118
|
+
return request("GET","/bch/wallets/"+(request['wallet_id']).to_s + "/transaction",{
|
119
|
+
"type" => request['type'],
|
117
120
|
"order" => request['order'],
|
118
121
|
"offset" => request['offset'],
|
119
122
|
"limit" => request['limit']
|
120
123
|
})
|
121
124
|
end
|
122
|
-
|
125
|
+
|
123
126
|
def sendToAddress(request = {})
|
124
|
-
|
127
|
+
|
125
128
|
if request["kbfee"].to_s.empty?
|
126
129
|
blockChain = getBlockChain()
|
127
130
|
request['kbfee'] = blockChain['medium_fee_per_kb']
|
128
131
|
end
|
129
|
-
|
130
|
-
request["
|
132
|
+
|
133
|
+
request["wif"].to_s.empty? ? request['wif'] = nil : request["wif"]
|
131
134
|
request["password"].to_s.empty? ? request['password'] = nil : request["password"]
|
135
|
+
request["subtractfeefromamount"].to_s.empty? ? request['subtractfeefromamount'] = false : request['subtractfeefromamount']
|
132
136
|
|
133
|
-
return request("POST","/bch/
|
137
|
+
return request("POST","/bch/wallets/"+ (request['wallet_id']).to_s + "/sendtoaddress",{
|
134
138
|
"address" => request['address'],
|
135
139
|
"amount" => request['amount'],
|
136
|
-
"
|
140
|
+
"wif" => request['wif'],
|
137
141
|
"password" => request['password'],
|
138
|
-
"kbfee" => request['kbfee']
|
142
|
+
"kbfee" => request['kbfee'],
|
143
|
+
"subtractfeefromamount" => request['subtractfeefromamount']
|
139
144
|
})
|
140
145
|
end
|
141
|
-
|
146
|
+
|
142
147
|
def sendMany(request = {})
|
143
148
|
|
144
|
-
request["
|
149
|
+
request["wif"].to_s.empty? ? request['wif'] = nil : request["wif"]
|
145
150
|
request["password"].to_s.empty? ? request['password'] = nil : request["password"]
|
146
|
-
|
147
|
-
|
151
|
+
request["subtractfeefromamount"].to_s.empty? ? request['subtractfeefromamount'] = false : request['subtractfeefromamount']
|
152
|
+
|
153
|
+
return request("POST","/bch/wallets/"+ (request['wallet_id']).to_s + "/sendmany",{
|
148
154
|
"to" => request['to'],
|
149
|
-
"
|
150
|
-
"password" => request['password']
|
155
|
+
"wif" => request['wif'],
|
156
|
+
"password" => request['password'],
|
157
|
+
"subtractfeefromamount" => request['subtractfeefromamount']
|
151
158
|
})
|
152
159
|
end
|
153
160
|
|
154
|
-
def
|
155
|
-
return request("
|
161
|
+
def sendTransaction(request = {})
|
162
|
+
return request("POST","/bch/transactions/send",{
|
163
|
+
"hex" => request['hex']
|
164
|
+
})
|
156
165
|
end
|
157
166
|
|
158
|
-
|
167
|
+
def getTransaction(request = {})
|
168
|
+
return request("GET","/bch/transactions/"+ (request['hash']).to_s + "")
|
169
|
+
end
|
170
|
+
end
|
@@ -6,7 +6,9 @@ require_relative 'bitcoincash'
|
|
6
6
|
require_relative 'monero'
|
7
7
|
require_relative 'webhook'
|
8
8
|
require_relative 'litecoin'
|
9
|
-
require_relative '
|
9
|
+
require_relative 'market'
|
10
|
+
require_relative 'token'
|
11
|
+
require_relative 'tool'
|
10
12
|
|
11
13
|
class BlockSDK < Base
|
12
14
|
attr_accessor :api_token
|
@@ -31,10 +33,6 @@ class BlockSDK < Base
|
|
31
33
|
return Monero.new(@api_token)
|
32
34
|
end
|
33
35
|
|
34
|
-
def createPrice()
|
35
|
-
return Price.new(@api_token)
|
36
|
-
end
|
37
|
-
|
38
36
|
def createWebHook()
|
39
37
|
return WebHook.new(@api_token)
|
40
38
|
end
|
@@ -46,4 +44,16 @@ class BlockSDK < Base
|
|
46
44
|
def createBitcoinCash()
|
47
45
|
return BitcoinCash.new(@api_token)
|
48
46
|
end
|
49
|
-
|
47
|
+
|
48
|
+
def createMarket()
|
49
|
+
return Market.new(@api_token)
|
50
|
+
end
|
51
|
+
|
52
|
+
def createToken()
|
53
|
+
return Token.new(@api_token)
|
54
|
+
end
|
55
|
+
|
56
|
+
def createTool()
|
57
|
+
return Tool.new(@api_token)
|
58
|
+
end
|
59
|
+
end
|
data/lib/blocksdk_ruby/dash.rb
CHANGED
@@ -1,75 +1,89 @@
|
|
1
1
|
require_relative 'base'
|
2
2
|
|
3
3
|
class Dash < Base
|
4
|
-
|
5
4
|
def getBlockChain(request = {})
|
6
|
-
return request("GET","/dash/
|
5
|
+
return request("GET","/dash/info")
|
7
6
|
end
|
8
|
-
|
9
7
|
def getBlock(request = {})
|
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","/dash/
|
11
|
+
|
12
|
+
return request("GET","/dash/blocks/"+ (request['block']).to_s, {
|
13
|
+
"rawtx" => request['rawtx'],
|
14
|
+
"offset" => request['offset'],
|
15
|
+
"limit" => request['limit']
|
16
|
+
})
|
15
17
|
end
|
16
|
-
|
18
|
+
|
17
19
|
def getMemPool(request = {})
|
18
20
|
request["rawtx"].to_s.empty? ? request['rawtx'] = false : request['rawtx']
|
19
21
|
request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
|
20
22
|
request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
|
21
|
-
|
23
|
+
|
24
|
+
return request("GET","/dash/mempool",{
|
25
|
+
"rawtx" => request['rawtx'],
|
26
|
+
"offset" => request['offset'],
|
27
|
+
"limit" => request['limit']
|
28
|
+
})
|
22
29
|
end
|
23
30
|
|
24
31
|
def getAddressInfo(request = {})
|
25
|
-
|
26
|
-
request["rawtx"].to_s.empty? ? request['rawtx'] = nil : request['rawtx']
|
32
|
+
request["rawtx"].to_s.empty? ? request['rawtx'] = false : request['rawtx']
|
27
33
|
request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
|
28
34
|
request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
|
29
35
|
|
30
|
-
return request("GET","/dash/
|
36
|
+
return request("GET","/dash/addresses/" + (request['address']).to_s,{
|
37
|
+
"reverse" => request['reverse'],
|
38
|
+
"rawtx" => request['rawtx'],
|
39
|
+
"offset" => request['offset'],
|
40
|
+
"limit" => request['limit']
|
41
|
+
})
|
31
42
|
end
|
32
|
-
|
33
43
|
|
34
44
|
def getAddressBalance(request = {})
|
35
|
-
return request("GET","/dash/
|
45
|
+
return request("GET","/dash/addresses/" + (request['address']).to_s + "/balance")
|
36
46
|
end
|
37
47
|
|
38
|
-
|
39
|
-
def listWallet(request = {})
|
48
|
+
def getWallets(request = {})
|
40
49
|
request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
|
41
50
|
request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
|
42
51
|
|
43
|
-
return request("GET","/dash/
|
52
|
+
return request("GET","/dash/wallets",{
|
44
53
|
"offset" => request['offset'],
|
45
54
|
"limit" => request['limit']
|
46
55
|
})
|
47
56
|
end
|
48
|
-
|
49
|
-
def
|
50
|
-
|
57
|
+
|
58
|
+
def getWallet(request = {})
|
59
|
+
return request("GET","/dash/wallets/"+ (request['wallet_id']).to_s + "")
|
60
|
+
end
|
61
|
+
|
62
|
+
def createHdWallet(request = {})
|
51
63
|
request["limit"].to_s.empty? ? request['limit'] = nil : request["limit"]
|
52
|
-
|
53
|
-
return request("POST","/dash/wallet",{
|
64
|
+
return request("POST","/dash/wallets/hd",{
|
54
65
|
"name" => request['name']
|
55
66
|
})
|
56
67
|
end
|
57
68
|
|
58
69
|
def loadWallet(request = {})
|
59
|
-
return request("POST","/dash/
|
70
|
+
return request("POST","/dash/wallets/"+ (request['wallet_id']).to_s + "/load",{
|
71
|
+
"wif" => request['wif'],
|
72
|
+
"password" => request['password']
|
73
|
+
})
|
60
74
|
end
|
61
75
|
|
62
|
-
def
|
63
|
-
return request("POST","/dash/
|
76
|
+
def unloadWallet(request = {})
|
77
|
+
return request("POST","/dash/wallets/"+(request['wallet_id']).to_s + "/unload")
|
64
78
|
end
|
65
79
|
|
66
|
-
def
|
67
|
-
request["address"].to_s.empty? ? request['address'] = nil : request[
|
80
|
+
def getWalletAddress(request = {})
|
81
|
+
request["address"].to_s.empty? ? request['address'] = nil : request["address"]
|
82
|
+
request["hdkeypath"].to_s.empty? ? request['hdkeypath'] = nil : request["hdkeypath"]
|
68
83
|
request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
|
69
84
|
request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
|
70
|
-
request["hdkeypath"].to_s.empty? ? request['hdkeypath'] = nil : request["hdkeypath"]
|
71
85
|
|
72
|
-
return request("GET","/dash/
|
86
|
+
return request("GET","/dash/wallets/"+(request['wallet_id']).to_s + "/addresses",{
|
73
87
|
"address" => request['address'],
|
74
88
|
"hdkeypath" => request['hdkeypath'],
|
75
89
|
"offset" => request['offset'],
|
@@ -79,27 +93,28 @@ class Dash < Base
|
|
79
93
|
|
80
94
|
def createWalletAddress(request = {})
|
81
95
|
|
82
|
-
request["
|
96
|
+
request["wif"].to_s.empty? ? request['wif'] = nil : request["wif"]
|
83
97
|
request["password"].to_s.empty? ? request['password'] = nil : request["password"]
|
84
98
|
|
85
|
-
return request("POST","/dash/
|
86
|
-
"
|
99
|
+
return request("POST","/dash/wallets/"+(request['wallet_id']).to_s + "/addresses",{
|
100
|
+
"wif" => request['wif'],
|
87
101
|
"password" => request['password']
|
88
|
-
})
|
102
|
+
})
|
89
103
|
end
|
90
104
|
|
91
|
-
def getWalletBalance(request = {})
|
92
|
-
return request("GET","/dash/
|
93
|
-
end
|
94
|
-
|
95
|
-
def
|
96
|
-
|
105
|
+
def getWalletBalance(request = {})
|
106
|
+
return request("GET","/dash/wallets/"+(request['wallet_id']).to_s + "/balance")
|
107
|
+
end
|
108
|
+
|
109
|
+
def getWalletTransactions(request = {})
|
110
|
+
|
97
111
|
request["order"].to_s.empty? ? request['order'] = 'desc' : request["order"]
|
112
|
+
request["type"].to_s.empty? ? request['type'] = 'all' : request["type"]
|
98
113
|
request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
|
99
114
|
request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
|
100
|
-
|
101
|
-
return request("GET","/dash/
|
102
|
-
"
|
115
|
+
|
116
|
+
return request("GET","/dash/wallets/"+(request['wallet_id']).to_s + "/transaction",{
|
117
|
+
"type" => request['type'],
|
103
118
|
"order" => request['order'],
|
104
119
|
"offset" => request['offset'],
|
105
120
|
"limit" => request['limit']
|
@@ -107,30 +122,47 @@ class Dash < Base
|
|
107
122
|
end
|
108
123
|
|
109
124
|
def sendToAddress(request = {})
|
125
|
+
|
110
126
|
if request["kbfee"].to_s.empty?
|
111
127
|
blockChain = getBlockChain()
|
112
128
|
request['kbfee'] = blockChain['medium_fee_per_kb']
|
113
129
|
end
|
114
|
-
|
115
|
-
request["
|
130
|
+
|
131
|
+
request["wif"].to_s.empty? ? request['wif'] = nil : request["wif"]
|
116
132
|
request["password"].to_s.empty? ? request['password'] = nil : request["password"]
|
133
|
+
request["subtractfeefromamount"].to_s.empty? ? request['subtractfeefromamount'] = false : request['subtractfeefromamount']
|
117
134
|
|
118
|
-
return request("POST","/dash/
|
135
|
+
return request("POST","/dash/wallets/"+ (request['wallet_id']).to_s + "/sendtoaddress",{
|
136
|
+
"address" => request['address'],
|
137
|
+
"amount" => request['amount'],
|
138
|
+
"wif" => request['wif'],
|
139
|
+
"password" => request['password'],
|
140
|
+
"kbfee" => request['kbfee'],
|
141
|
+
"subtractfeefromamount" => request['subtractfeefromamount']
|
142
|
+
})
|
119
143
|
end
|
120
144
|
|
121
145
|
def sendMany(request = {})
|
122
146
|
|
123
|
-
request["
|
147
|
+
request["wif"].to_s.empty? ? request['wif'] = nil : request["wif"]
|
124
148
|
request["password"].to_s.empty? ? request['password'] = nil : request["password"]
|
149
|
+
request["subtractfeefromamount"].to_s.empty? ? request['subtractfeefromamount'] = false : request['subtractfeefromamount']
|
125
150
|
|
126
|
-
return request("POST","/dash/
|
151
|
+
return request("POST","/dash/wallets/"+ (request['wallet_id']).to_s + "/sendmany",{
|
152
|
+
"to" => request['to'],
|
153
|
+
"wif" => request['wif'],
|
154
|
+
"password" => request['password'],
|
155
|
+
"subtractfeefromamount" => request['subtractfeefromamount']
|
156
|
+
})
|
127
157
|
end
|
128
|
-
|
158
|
+
|
129
159
|
def sendTransaction(request = {})
|
130
|
-
return request("POST","/dash/
|
160
|
+
return request("POST","/dash/transactions/send",{
|
161
|
+
"hex" => request['hex']
|
162
|
+
})
|
131
163
|
end
|
132
164
|
|
133
165
|
def getTransaction(request = {})
|
134
|
-
return request("GET","/dash/
|
135
|
-
end
|
136
|
-
end
|
166
|
+
return request("GET","/dash/transactions/"+ (request['hash']).to_s + "")
|
167
|
+
end
|
168
|
+
end
|