blocksdk 0.1.0 → 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_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 +4 -2
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
|
@@ -2,7 +2,7 @@ require_relative 'base'
|
|
2
2
|
|
3
3
|
class Ethereum < Base
|
4
4
|
def getBlockChain(request = {})
|
5
|
-
return request("GET","/eth/
|
5
|
+
return request("GET","/eth/info")
|
6
6
|
end
|
7
7
|
|
8
8
|
def getBlock(request = {})
|
@@ -10,7 +10,7 @@ class Ethereum < 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","/eth/
|
13
|
+
return request("GET","/eth/blocks/" + (request['block']).to_s,{"rawtx" => request['rawtx'],"offset" => request['offset'],"limit" => request['limit']})
|
14
14
|
end
|
15
15
|
|
16
16
|
def getMemPool(request = {})
|
@@ -21,27 +21,27 @@ class Ethereum < Base
|
|
21
21
|
return request("GET","/eth/mempool",{"rawtx" => request['rawtx'],"offset" => request['offset'],"limit" => request['limit']})
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
24
|
+
def getAddress(request = {})
|
25
25
|
request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
|
26
26
|
request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
|
27
27
|
|
28
|
-
return request("GET","/eth/
|
28
|
+
return request("GET","/eth/addresses",{
|
29
29
|
"offset" => request['offset'],
|
30
30
|
"limit" => request['limit']
|
31
31
|
})
|
32
32
|
end
|
33
33
|
|
34
34
|
def loadAddress(request = {})
|
35
|
-
return request("POST","/eth/
|
35
|
+
return request("POST","/eth/addresses/" + (request['address']).to_s + "/load",{"private_key" => request['private_key'],"password" => request['password']})
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
39
|
-
return request("POST","/eth/
|
38
|
+
def unloadAddress(request = {})
|
39
|
+
return request("POST","/eth/addresses/" + (request['address']).to_s + "/unload")
|
40
40
|
end
|
41
41
|
|
42
42
|
def createAddress(request = {})
|
43
43
|
request["name"].to_s.empty? ? request['name'] = 0 : request["name"]
|
44
|
-
return request("POST","/eth/
|
44
|
+
return request("POST","/eth/addresses",{"name" => request['name']})
|
45
45
|
end
|
46
46
|
|
47
47
|
def getAddressInfo(request = {})
|
@@ -51,11 +51,11 @@ class Ethereum < Base
|
|
51
51
|
request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
|
52
52
|
request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
|
53
53
|
|
54
|
-
return request("GET","/eth/
|
54
|
+
return request("GET","/eth/addresses/" + (request['address']).to_s ,{"reverse" => request['reverse'],"rawtx" => request['rawtx'],"offset" => request['offset'],"limit" => request['limit']})
|
55
55
|
end
|
56
56
|
|
57
57
|
def getAddressBalance(request = {})
|
58
|
-
return request("GET","/eth/
|
58
|
+
return request("GET","/eth/addresses/" + (request['address']).to_s + "/balance")
|
59
59
|
end
|
60
60
|
|
61
61
|
def sendToAddress(request = {})
|
@@ -63,18 +63,39 @@ class Ethereum < Base
|
|
63
63
|
blockChain = getBlockChain()
|
64
64
|
request['gwei'] = blockChain['medium_gwei']
|
65
65
|
end
|
66
|
-
request["
|
66
|
+
request["private_key"].to_s.empty? ? request['private_key'] = nil : request["private_key"]
|
67
67
|
request["password"].to_s.empty? ? request['password'] = nil : request["password"]
|
68
|
+
request["gas_limit"].to_s.empty? ? request['gas_limit'] = nil : request["gas_limit"]
|
68
69
|
|
69
|
-
return request("POST","/eth/
|
70
|
+
return request("POST","/eth/addresses/" + (request['from']).to_s + "/sendtoaddress",{"to" => request['to'],"amount" => request['amount'],"private_key" => request['private_key'],"password" => request['password'],"gwei" => request['gwei'],"gas_limit" => request['gas_limit']})
|
70
71
|
end
|
71
72
|
|
72
73
|
def sendTransaction(request = {})
|
73
|
-
return request("POST","/eth/
|
74
|
+
return request("POST","/eth/transactions/send",{"hex" => request['hex']})
|
74
75
|
end
|
75
76
|
|
76
|
-
def
|
77
|
-
return request("GET","/eth/
|
77
|
+
def getTransactions(request = {})
|
78
|
+
return request("GET","/eth/transactions/" + (request['hash']).to_s)
|
79
|
+
end
|
80
|
+
|
81
|
+
def getErc20(request = {})
|
82
|
+
return request("GET","/eth/erc20-tokens/" + (request['contract_address']).to_s)
|
83
|
+
end
|
84
|
+
|
85
|
+
def getErc20Balance(request = {})
|
86
|
+
return request("GET","/eth/erc20-tokens/" + (request['contract_address']).to_s + "/" + (request['from']).to_s + "/balance")
|
87
|
+
end
|
88
|
+
|
89
|
+
def sendToAddress(request = {})
|
90
|
+
if request["gwei"].to_s.empty?
|
91
|
+
blockChain = getBlockChain()
|
92
|
+
request['gwei'] = blockChain['high_gwei']
|
93
|
+
end
|
94
|
+
request["private_key"].to_s.empty? ? request['private_key'] = nil : request["private_key"]
|
95
|
+
request["password"].to_s.empty? ? request['password'] = nil : request["password"]
|
96
|
+
request["gas_limit"].to_s.empty? ? request['gas_limit'] = nil : request["gas_limit"]
|
97
|
+
|
98
|
+
return request("POST","/eth/erc20-tokens/" + (request['contract_address']).to_s + "/" + (request['from']).to_s + "/transfer",{"to" => request['to'],"amount" => request['amount'],"private_key" => request['private_key'],"password" => request['password'],"gwei" => request['gwei'],"gas_limit" => request['gas_limit']})
|
78
99
|
end
|
79
100
|
|
80
|
-
end
|
101
|
+
end
|
@@ -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
|