Class: Litecoin
- Inherits:
-
Base
show all
- Defined in:
- lib/blocksdk_ruby/litecoin.rb
Instance Attribute Summary
Attributes inherited from Base
#api_token
Instance Method Summary
collapse
Methods inherited from Base
#getHashType, #getUsage, #initialize, #listPrice, #request
Constructor Details
This class inherits a constructor from Base
Instance Method Details
#createWallet(request = {}) ⇒ Object
62
63
64
65
66
67
|
# File 'lib/blocksdk_ruby/litecoin.rb', line 62
def createWallet(request = {})
request["name"].to_s.empty? ? request['name'] = nil : request["name"]
return request("POST","/ltc/wallet",{
"name" => request['name']
})
end
|
#createWalletAddress(request = {}) ⇒ Object
96
97
98
99
100
101
102
103
104
105
|
# File 'lib/blocksdk_ruby/litecoin.rb', line 96
def createWalletAddress(request = {})
request["seed_wif"].to_s.empty? ? request['seed_wif'] = nil : request["seed_wif"]
request["password"].to_s.empty? ? request['password'] = nil : request["password"]
return request("POST","/ltc/wallet/" + (request['wallet_id']).to_s+ "/address",{
"seed_wif" => request['seed_wif'],
"password" => request['password']
})
end
|
#getAddressBalance(request = {}) ⇒ Object
48
49
50
|
# File 'lib/blocksdk_ruby/litecoin.rb', line 48
def getAddressBalance(request = {})
return request("GET","/ltc/address/" + (request['address']).to_s+ "/balance")
end
|
#getAddressInfo(request = {}) ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/blocksdk_ruby/litecoin.rb', line 34
def getAddressInfo(request = {})
request["reverse"].to_s.empty? ? request['reverse'] = true : request['reverse']
request["rawtx"].to_s.empty? ? request['rawtx'] = false : request['rawtx']
request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
return request("GET","/ltc/address/" + (request['address']).to_s+ "",{
"reverse" => request['reverse'],
"rawtx" => request['rawtx'],
"offset" => request['offset'],
"limit" => request['limit']
})
end
|
#getBlock(request = {}) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/blocksdk_ruby/litecoin.rb', line 8
def getBlock(request = {})
request["rawtx"].to_s.empty? ? request['rawtx'] = false : request['rawtx']
request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
return request("GET","/ltc/block/" + (request['block']).to_s ,{
"rawtx" => request['rawtx'],
"offset" => request['offset'],
"limit" => request['limit']
})
end
|
#getBlockChain(request = {}) ⇒ Object
4
5
6
|
# File 'lib/blocksdk_ruby/litecoin.rb', line 4
def getBlockChain(request = {})
return request("GET","/ltc/block")
end
|
#getMemPool(request = {}) ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/blocksdk_ruby/litecoin.rb', line 22
def getMemPool(request = {})
request["rawtx"].to_s.empty? ? request['rawtx'] = false : request['rawtx']
request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
return request("GET","/ltc/mempool",{
"rawtx" => request['rawtx'],
"offset" => request['offset'],
"limit" => request['limit']
})
end
|
#getTransaction(request = {}) ⇒ Object
151
152
153
|
# File 'lib/blocksdk_ruby/litecoin.rb', line 151
def getTransaction(request = {})
return request("GET","/ltc/transaction/" + (request['hash']).to_s+ "")
end
|
#getWalletBalance(request = {}) ⇒ Object
107
108
109
|
# File 'lib/blocksdk_ruby/litecoin.rb', line 107
def getWalletBalance(request = {})
return request("GET","/ltc/wallet/" + (request['wallet_id']).to_s+ "/balance")
end
|
#getWalletTransaction(request = {}) ⇒ Object
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
# File 'lib/blocksdk_ruby/litecoin.rb', line 111
def getWalletTransaction(request = {})
request["category"].to_s.empty? ? request['category'] = 'all' : request["category"]
request["order"].to_s.empty? ? request['order'] = 'desc' : request["order"]
request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
return request("GET","/ltc/wallet/" + (request['wallet_id']).to_s+ "/transaction",{
"category" => request['category'],
"order" => request['order'],
"offset" => request['offset'],
"limit" => request['limit']
})
end
|
#listWallet(request = {}) ⇒ Object
52
53
54
55
56
57
58
59
60
|
# File 'lib/blocksdk_ruby/litecoin.rb', line 52
def listWallet(request = {})
request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
return request("GET","/ltc/wallet",{
"offset" => request['offset'],
"limit" => request['limit']
})
end
|
#listWalletAddress(request = {}) ⇒ Object
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/blocksdk_ruby/litecoin.rb', line 80
def listWalletAddress(request = {})
request["address"].to_s.empty? ? request['address'] = nil : request["address"]
request["hdkeypath"].to_s.empty? ? request['hdkeypath'] = nil : request["hdkeypath"]
request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
return request("GET","/ltc/wallet/" + (request['wallet_id']).to_s+ "/address",{
"address" => request['address'],
"hdkeypath" => request['hdkeypath'],
"offset" => request['offset'],
"limit" => request['limit']
})
end
|
#loadWallet(request = {}) ⇒ Object
69
70
71
72
73
74
|
# File 'lib/blocksdk_ruby/litecoin.rb', line 69
def loadWallet(request = {})
return request("POST","/ltc/wallet/" + (request['wallet_id']).to_s+ "/load",{
"seed_wif" => request['seed_wif'],
"password" => request['password']
})
end
|
#sendMany(request = {}) ⇒ Object
155
156
157
158
159
160
161
162
163
164
165
166
|
# File 'lib/blocksdk_ruby/litecoin.rb', line 155
def sendMany(request = {})
request["rawtx"].to_s.empty? ? request['rawtx'] = false : nil
request["seed_wif"].to_s.empty? ? request['seed_wif'] = nil : nil
request["password"].to_s.empty? ? request['password'] = nil : nil
return request("POST","/ltc/wallet/" + (request['wallet_id']).to_s+ "/sendmany",{
"to" => request['to'],
"seed_wif" => request['seed_wif'],
"password" => request['password']
})
end
|
#sendToAddress(request = {}) ⇒ Object
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
# File 'lib/blocksdk_ruby/litecoin.rb', line 126
def sendToAddress(request = {})
if request["kbfee"].to_s.empty?
blockChain = getBlockChain()
request['kbfee'] = blockChain['medium_fee_per_kb']
end
request["seed_wif"].to_s.empty? ? request['seed_wif'] = nil : request["seed_wif"]
request["password"].to_s.empty? ? request['password'] = nil : request["password"]
return request("POST","/ltc/wallet/" + (request['wallet_id']).to_s+ "/sendtoaddress",{
"address" => request['address'],
"amount" => request['amount'],
"seed_wif" => request['seed_wif'],
"password" => request['password'],
"kbfee" => request['kbfee']
})
end
|
#sendTransaction(request = {}) ⇒ Object
145
146
147
148
149
|
# File 'lib/blocksdk_ruby/litecoin.rb', line 145
def sendTransaction(request = {})
return request("POST","/ltc/transaction",{
"sign_hex" => request['sign_hex']
})
end
|
#unLoadWallet(request = {}) ⇒ Object
76
77
78
|
# File 'lib/blocksdk_ruby/litecoin.rb', line 76
def unLoadWallet(request = {})
return request("POST","/ltc/wallet/" + (request['wallet_id']).to_s+ "/unload")
end
|