Class: Monero
- Inherits:
-
Base
show all
- Defined in:
- lib/blocksdk_ruby/monero.rb
Instance Attribute Summary
Attributes inherited from Base
#api_token
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #request
Constructor Details
This class inherits a constructor from Base
Instance Method Details
#createAddress(request = {}) ⇒ Object
42
43
44
45
46
47
|
# File 'lib/blocksdk_ruby/monero.rb', line 42
def createAddress(request = {})
request["name"].to_s.empty? ? request['name'] = nil : request["name"]
return request("POST","/xmr/addresses",{
"name" => request['name']
})
end
|
#getAddressBalance(request = {}) ⇒ Object
60
61
62
63
64
|
# File 'lib/blocksdk_ruby/monero.rb', line 60
def getAddressBalance(request = {})
return request("GET","/xmr/addresses/" + (request['address_id']).to_s+ "/balance",{
"private_spend_key" => request['private_spend_key'],
})
end
|
#getAddresses(request = {}) ⇒ Object
32
33
34
35
36
37
38
39
40
|
# File 'lib/blocksdk_ruby/monero.rb', line 32
def getAddresses(request = {})
request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
return request("GET","/xmr/addresses",{
"offset" => request['offset'],
"limit" => request['limit']
})
end
|
#getAddressInfo(request = {}) ⇒ Object
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/blocksdk_ruby/monero.rb', line 49
def getAddressInfo(request = {})
request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
return request("GET","/xmr/addresses/" + (request['address_id']).to_s+ "",{
"offset" => request['offset'],
"limit" => request['limit'],
"private_spend_key" => request['private_spend_key'],
})
end
|
#getBlock(request = {}) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/blocksdk_ruby/monero.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","/xmr/blocks/" + (request['block']).to_s+ "",{
"rawtx" => request['rawtx'],
"offset" => request['offset'],
"limit" => request['limit']
})
end
|
#getBlockChain(request = {}) ⇒ Object
4
5
6
|
# File 'lib/blocksdk_ruby/monero.rb', line 4
def getBlockChain(request = {})
return request("GET","/xmr/info")
end
|
#getMemPool(request = {}) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/blocksdk_ruby/monero.rb', line 20
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","/xmr/mempool",{
"rawtx" => request['rawtx'],
"offset" => request['offset'],
"limit" => request['limit']
})
end
|
#getTransaction(request = {}) ⇒ Object
104
105
106
|
# File 'lib/blocksdk_ruby/monero.rb', line 104
def getTransaction(request = {})
return request("GET","/xmr/transactions/" + (request['hash']).to_s+ "")
end
|
#loadAddress(request = {}) ⇒ Object
66
67
68
69
70
71
|
# File 'lib/blocksdk_ruby/monero.rb', line 66
def loadAddress(request = {})
return request("POST","/xmr/addresses/" + (request['address_id']).to_s+ "/load",{
"private_spend_key" => request['private_spend_key'],
"password" => request['password']
})
end
|
#sendToAddress(request = {}) ⇒ Object
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
# File 'lib/blocksdk_ruby/monero.rb', line 77
def sendToAddress(request = {})
if request["kbfee"].to_s.empty?
blockChain = getBlockChain()
request['kbfee'] = blockChain['medium_fee_per_kb']
end
request["private_spend_key"].to_s.empty? ? request['private_spend_key'] = nil : request["private_spend_key"]
request["password"].to_s.empty? ? request['password'] = nil : request["password"]
request["subtractfeefromamount"].to_s.empty? ? request['subtractfeefromamount'] = false : request['subtractfeefromamount']
return request("POST","/xmr/addresses/" + (request['address_id']).to_s+ "/sendtoaddress",{
"address" => request['address'],
"amount" => request['amount'],
"private_spend_key" => request['private_spend_key'],
"password" => request['password'],
"kbfee" => request['kbfee'],
"subtractfeefromamount" => request['subtractfeefromamount']
})
end
|
#sendTransaction(request = {}) ⇒ Object
98
99
100
101
102
|
# File 'lib/blocksdk_ruby/monero.rb', line 98
def sendTransaction(request = {})
return request("POST","/xmr/transactions/send",{
"hex" => request['hex']
})
end
|
#unloadAddress(request = {}) ⇒ Object
73
74
75
|
# File 'lib/blocksdk_ruby/monero.rb', line 73
def unloadAddress(request = {})
return request("POST","/xmr/addresses/" + (request['address_id']).to_s+ "/unload")
end
|