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.
@@ -1,17 +1,15 @@
1
1
  require_relative 'base'
2
2
 
3
3
  class BitcoinCash < Base
4
-
5
- def getBlockChain(request = {})
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/block/" + (request['block']).to_s + "",{
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['reverse']
36
- request["rawtx"].to_s.empty? ? request['rawtx'] = nil : 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/address/" + (request['address']).to_s + "",{
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/address/" + (request['address']).to_s + "/balance")
47
+ return request("GET","/bch/addresses/" + (request['address']).to_s + "/balance")
50
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
- return request("GET","/bch/wallet",{
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 createWallet(request = {})
62
- request["name"].to_s.empty? ? request['name'] = 0 : request["name"]
63
- return request("POST","/bch/wallet",{
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/wallet/" + (request['wallet_id']).to_s + "/load",{
70
- "seed_wif" => request['seed_wif'],
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 unLoadWallet(request = {})
76
- return request("POST","/bch/wallet/" + (request['wallet_id']).to_s + "/unload")
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
- request["hdkeypath"].to_s.empty? ? request['hdkeypath'] = nil : request["hdkeypath"]
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/wallet/" + (request['wallet_id']).to_s + "/address",{
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
- request["seed_wif"].to_s.empty? ? request['seed_wif'] = nil : request["seed_wif"]
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/wallet/" + (request['wallet_id']).to_s + "/address",{
99
- "seed_wif" => request['seed_wif'],
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 getWalletTransaction(request = {})
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/wallet/" + (request['wallet_id']).to_s + "/transaction",{
116
- "category" => request['category'],
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["seed_wif"].to_s.empty? ? request['seed_wif'] = nil : request["seed_wif"]
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/wallet/" + (request['wallet_id']).to_s + "/sendtoaddress",{
137
+ return request("POST","/bch/wallets/"+ (request['wallet_id']).to_s + "/sendtoaddress",{
134
138
  "address" => request['address'],
135
139
  "amount" => request['amount'],
136
- "seed_wif" => request['seed_wif'],
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["seed_wif"].to_s.empty? ? request['seed_wif'] = nil : request["seed_wif"]
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
- return request("POST","/bch/wallet/" + (request['wallet_id']).to_s + "/sendmany",{
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
- "seed_wif" => request['seed_wif'],
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 getTransaction(request = {})
155
- return request("GET","/bch/transaction/" + (request['hash']).to_s + "")
161
+ def sendTransaction(request = {})
162
+ return request("POST","/bch/transactions/send",{
163
+ "hex" => request['hex']
164
+ })
156
165
  end
157
166
 
158
- end
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 'price'
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
- end
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
@@ -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/block")
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/block/" + (request['block']).to_s, {"rawtx" => request['rawtx'],"offset" => request['offset'],"limit" => request['limit']})
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
- return request("GET","/dash/mempool",{"rawtx" => request['rawtx'],"offset" => request['offset'],"limit" => request['limit']})
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/address/" + (request['address']).to_s, {"rawtx" => request['rawtx'],"offset" => request['offset'],"limit" => request['limit']})
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/address/" + (request['address']).to_s + "/balance")
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/wallet",{
52
+ return request("GET","/dash/wallets",{
44
53
  "offset" => request['offset'],
45
54
  "limit" => request['limit']
46
55
  })
47
56
  end
48
-
49
- def createWallet(request = {})
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/wallet/" + (request['wallet_id']).to_s + "/load",{"seed_wif" => request['seed_wif'],"password" => request['password']})
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 unLoadWallet(request = {})
63
- return request("POST","/dash/wallet/" + (request['wallet_id']).to_s + "/unload")
76
+ def unloadWallet(request = {})
77
+ return request("POST","/dash/wallets/"+(request['wallet_id']).to_s + "/unload")
64
78
  end
65
79
 
66
- def listWalletAddress(request = {})
67
- request["address"].to_s.empty? ? request['address'] = nil : request['address']
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/wallet/" + (request['wallet_id']).to_s + "/address",{
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["seed_wif"].to_s.empty? ? request['seed_wif'] = nil : request["seed_wif"]
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/wallet/" + (request['wallet_id']).to_s + "/address",{
86
- "seed_wif" => request['seed_wif'],
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/wallet/" + (request['wallet_id']).to_s + "/balance")
93
- end
94
-
95
- def getWalletTransaction(request = {})
96
- request["category"].to_s.empty? ? request['category'] = 'all' : request["category"]
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/wallet/" + (request['wallet_id']).to_s + "/transaction",{
102
- "category" => request['category'],
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["seed_wif"].to_s.empty? ? request['seed_wif'] = nil : request["seed_wif"]
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/wallet/" + (request['wallet_id']).to_s + "/sendtoaddress",{"address" => request['address'],"amount" => request['amount'],"seed_wif" => request['seed_wif'],"password" => request['password'],"kbfee" => request['kbfee']})
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["seed_wif"].to_s.empty? ? request['seed_wif'] = nil : request["seed_wif"]
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/wallet/" + (request['wallet_id']).to_s + "/sendmany",{"to" => request['to'],"seed_wif" => request['seed_wif'],"password" => request['password']})
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/transaction",{"sign_hex" => request['sign_hex']})
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/transaction/" + (request['hash']).to_s)
135
- end
136
- end
166
+ return request("GET","/dash/transactions/"+ (request['hash']).to_s + "")
167
+ end
168
+ end