Class: Ethereum
- Inherits:
-
Base
show all
- Defined in:
- lib/blocksdk_ruby/ethereum.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
#createAddress(request = {}) ⇒ Object
42
43
44
45
|
# File 'lib/blocksdk_ruby/ethereum.rb', line 42
def createAddress(request = {})
request["name"].to_s.empty? ? request['name'] = 0 : request["name"]
return request("POST","/eth/address",{"name" => request['name']})
end
|
#getAddressBalance(request = {}) ⇒ Object
57
58
59
|
# File 'lib/blocksdk_ruby/ethereum.rb', line 57
def getAddressBalance(request = {})
return request("GET","/eth/address/" + (request['address']).to_s + "/balance")
end
|
#getAddressInfo(request = {}) ⇒ Object
47
48
49
50
51
52
53
54
55
|
# File 'lib/blocksdk_ruby/ethereum.rb', line 47
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","/eth/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
|
# File 'lib/blocksdk_ruby/ethereum.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","/eth/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/ethereum.rb', line 4
def getBlockChain(request = {})
return request("GET","/eth/block")
end
|
#getMemPool(request = {}) ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/blocksdk_ruby/ethereum.rb', line 16
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","/eth/mempool",{"rawtx" => request['rawtx'],"offset" => request['offset'],"limit" => request['limit']})
end
|
#getTransaction(request = {}) ⇒ Object
76
77
78
|
# File 'lib/blocksdk_ruby/ethereum.rb', line 76
def getTransaction(request = {})
return request("GET","/eth/transaction/" + (request['hash']).to_s)
end
|
#listAddress(request = {}) ⇒ Object
24
25
26
27
28
29
30
31
32
|
# File 'lib/blocksdk_ruby/ethereum.rb', line 24
def listAddress(request = {})
request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
return request("GET","/eth/address",{
"offset" => request['offset'],
"limit" => request['limit']
})
end
|
#loadAddress(request = {}) ⇒ Object
34
35
36
|
# File 'lib/blocksdk_ruby/ethereum.rb', line 34
def loadAddress(request = {})
return request("POST","/eth/address/" + (request['address']).to_s + "/load",{"seed_wif" => request['seed_wif'],"password" => request['password']})
end
|
#sendToAddress(request = {}) ⇒ Object
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/blocksdk_ruby/ethereum.rb', line 61
def sendToAddress(request = {})
if request["gwei"].to_s.empty?
blockChain = getBlockChain()
request['gwei'] = blockChain['medium_gwei']
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"]
return request("POST","/eth/address/" + (request['from']).to_s + "/sendtoaddress",{"address" => request['to'],"amount" => request['amount'],"private_key" => request['private_key'],"password" => request['password'],"gwei" => request['gwei']})
end
|
#sendTransaction(request = {}) ⇒ Object
72
73
74
|
# File 'lib/blocksdk_ruby/ethereum.rb', line 72
def sendTransaction(request = {})
return request("POST","/eth/transaction",{"sign_hex" => request['sign_hex']})
end
|
#unLoadAddress(request = {}) ⇒ Object
38
39
40
|
# File 'lib/blocksdk_ruby/ethereum.rb', line 38
def unLoadAddress(request = {})
return request("POST","/eth/address/" + (request['address']).to_s + "/unload")
end
|