Class: Dash
- Inherits:
-
Base
show all
- Defined in:
- lib/blocksdk_ruby/dash.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
#createHdWallet(request = {}) ⇒ Object
62
63
64
65
66
67
|
# File 'lib/blocksdk_ruby/dash.rb', line 62
def createHdWallet(request = {})
request["limit"].to_s.empty? ? request['limit'] = nil : request["limit"]
return request("POST","/dash/wallets/hd",{
"name" => request['name']
})
end
|
#createWalletAddress(request = {}) ⇒ Object
94
95
96
97
98
99
100
101
102
103
|
# File 'lib/blocksdk_ruby/dash.rb', line 94
def createWalletAddress(request = {})
request["wif"].to_s.empty? ? request['wif'] = nil : request["wif"]
request["password"].to_s.empty? ? request['password'] = nil : request["password"]
return request("POST","/dash/wallets/"+(request['wallet_id']).to_s + "/addresses",{
"wif" => request['wif'],
"password" => request['password']
})
end
|
#getAddressBalance(request = {}) ⇒ Object
44
45
46
|
# File 'lib/blocksdk_ruby/dash.rb', line 44
def getAddressBalance(request = {})
return request("GET","/dash/addresses/" + (request['address']).to_s + "/balance")
end
|
#getAddressInfo(request = {}) ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/blocksdk_ruby/dash.rb', line 31
def getAddressInfo(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","/dash/addresses/" + (request['address']).to_s,{
"reverse" => request['reverse'],
"rawtx" => request['rawtx'],
"offset" => request['offset'],
"limit" => request['limit']
})
end
|
#getBlock(request = {}) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/blocksdk_ruby/dash.rb', line 7
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","/dash/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/dash.rb', line 4
def getBlockChain(request = {})
return request("GET","/dash/info")
end
|
#getMemPool(request = {}) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/blocksdk_ruby/dash.rb', line 19
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","/dash/mempool",{
"rawtx" => request['rawtx'],
"offset" => request['offset'],
"limit" => request['limit']
})
end
|
#getTransaction(request = {}) ⇒ Object
165
166
167
|
# File 'lib/blocksdk_ruby/dash.rb', line 165
def getTransaction(request = {})
return request("GET","/dash/transactions/"+ (request['hash']).to_s + "")
end
|
#getWallet(request = {}) ⇒ Object
58
59
60
|
# File 'lib/blocksdk_ruby/dash.rb', line 58
def getWallet(request = {})
return request("GET","/dash/wallets/"+ (request['wallet_id']).to_s + "")
end
|
#getWalletAddress(request = {}) ⇒ Object
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# File 'lib/blocksdk_ruby/dash.rb', line 80
def getWalletAddress(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","/dash/wallets/"+(request['wallet_id']).to_s + "/addresses",{
"address" => request['address'],
"hdkeypath" => request['hdkeypath'],
"offset" => request['offset'],
"limit" => request['limit']
})
end
|
#getWalletBalance(request = {}) ⇒ Object
105
106
107
|
# File 'lib/blocksdk_ruby/dash.rb', line 105
def getWalletBalance(request = {})
return request("GET","/dash/wallets/"+(request['wallet_id']).to_s + "/balance")
end
|
#getWallets(request = {}) ⇒ Object
48
49
50
51
52
53
54
55
56
|
# File 'lib/blocksdk_ruby/dash.rb', line 48
def getWallets(request = {})
request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
return request("GET","/dash/wallets",{
"offset" => request['offset'],
"limit" => request['limit']
})
end
|
#getWalletTransactions(request = {}) ⇒ Object
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
# File 'lib/blocksdk_ruby/dash.rb', line 109
def getWalletTransactions(request = {})
request["order"].to_s.empty? ? request['order'] = 'desc' : request["order"]
request["type"].to_s.empty? ? request['type'] = 'all' : request["type"]
request["offset"].to_s.empty? ? request['offset'] = 0 : request["offset"]
request["limit"].to_s.empty? ? request['limit'] = 10 : request["limit"]
return request("GET","/dash/wallets/"+(request['wallet_id']).to_s + "/transaction",{
"type" => request['type'],
"order" => request['order'],
"offset" => request['offset'],
"limit" => request['limit']
})
end
|
#loadWallet(request = {}) ⇒ Object
69
70
71
72
73
74
|
# File 'lib/blocksdk_ruby/dash.rb', line 69
def loadWallet(request = {})
return request("POST","/dash/wallets/"+ (request['wallet_id']).to_s + "/load",{
"wif" => request['wif'],
"password" => request['password']
})
end
|
#sendMany(request = {}) ⇒ Object
145
146
147
148
149
150
151
152
153
154
155
156
157
|
# File 'lib/blocksdk_ruby/dash.rb', line 145
def sendMany(request = {})
request["wif"].to_s.empty? ? request['wif'] = nil : request["wif"]
request["password"].to_s.empty? ? request['password'] = nil : request["password"]
request["subtractfeefromamount"].to_s.empty? ? request['subtractfeefromamount'] = false : request['subtractfeefromamount']
return request("POST","/dash/wallets/"+ (request['wallet_id']).to_s + "/sendmany",{
"to" => request['to'],
"wif" => request['wif'],
"password" => request['password'],
"subtractfeefromamount" => request['subtractfeefromamount']
})
end
|
#sendToAddress(request = {}) ⇒ Object
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
# File 'lib/blocksdk_ruby/dash.rb', line 124
def sendToAddress(request = {})
if request["kbfee"].to_s.empty?
blockChain = getBlockChain()
request['kbfee'] = blockChain['medium_fee_per_kb']
end
request["wif"].to_s.empty? ? request['wif'] = nil : request["wif"]
request["password"].to_s.empty? ? request['password'] = nil : request["password"]
request["subtractfeefromamount"].to_s.empty? ? request['subtractfeefromamount'] = false : request['subtractfeefromamount']
return request("POST","/dash/wallets/"+ (request['wallet_id']).to_s + "/sendtoaddress",{
"address" => request['address'],
"amount" => request['amount'],
"wif" => request['wif'],
"password" => request['password'],
"kbfee" => request['kbfee'],
"subtractfeefromamount" => request['subtractfeefromamount']
})
end
|
#sendTransaction(request = {}) ⇒ Object
159
160
161
162
163
|
# File 'lib/blocksdk_ruby/dash.rb', line 159
def sendTransaction(request = {})
return request("POST","/dash/transactions/send",{
"hex" => request['hex']
})
end
|
#unloadWallet(request = {}) ⇒ Object
76
77
78
|
# File 'lib/blocksdk_ruby/dash.rb', line 76
def unloadWallet(request = {})
return request("POST","/dash/wallets/"+(request['wallet_id']).to_s + "/unload")
end
|