Module: Coinable
- Defined in:
- lib/coinable.rb,
lib/coinable/error.rb,
lib/coinable/version.rb
Constant Summary collapse
- HEADERS =
{ 'Content-Type' => 'application/json', 'Accept' => 'application/json' }.freeze
- Error =
Class.new(StandardError)
- VERSION =
'0.0.2'.freeze
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#account ⇒ Object
getaccount.
-
#account=(_) ⇒ Object
setaccount.
-
#account_address ⇒ Object
getaccountaddress.
-
#add_multisig_address ⇒ Object
addmultisigaddress.
-
#add_node ⇒ Object
addnode.
-
#added_node_info ⇒ Object
getaddednodeinfo.
-
#addresses_by_account ⇒ Object
getaddressesbyaccount.
-
#backup_wallet ⇒ Object
backupwallet.
-
#balance ⇒ Object
getbalance.
-
#best_block_hash ⇒ Object
getbestblockhash.
-
#block ⇒ Object
getblock.
-
#block_count ⇒ Object
getblockcount.
-
#block_hash ⇒ Object
getblockhash.
-
#block_number ⇒ Object
getblocknumber.
-
#block_template ⇒ Object
getblocktemplate.
- #configure {|_self| ... } ⇒ Object
-
#connection_count ⇒ Object
getconnectioncount.
-
#create_multisig ⇒ Object
createmultisig.
-
#create_raw_transaction ⇒ Object
createrawtransaction.
-
#decode_raw_transaction ⇒ Object
decoderawtransaction.
-
#difficulty ⇒ Object
getdifficulty.
-
#dump_priv_key ⇒ Object
dumpprivkey.
-
#encrypt_wallet ⇒ Object
encryptwallet.
-
#generate ⇒ Object
getgenerate.
-
#generate=(_) ⇒ Object
setgenerate.
-
#hashes_per_sec ⇒ Object
gethashespersec.
-
#help ⇒ Object
help.
-
#import_priv_key ⇒ Object
importprivkey.
-
#info ⇒ Object
getinfo.
-
#keypool_refill ⇒ Object
keypoolrefill.
-
#list_accounts(minconf = nil) ⇒ Object
listaccounts.
-
#list_address_groupings ⇒ Object
listaddressgroupings.
-
#list_lock_unspent ⇒ Object
listlockunspent.
-
#list_received_by_account ⇒ Object
listreceivedbyaccount.
-
#list_received_by_address ⇒ Object
listreceivedbyaddress.
-
#list_since_block ⇒ Object
listsinceblock.
-
#list_transactions(account = nil, count = nil, from = nil) ⇒ Object
listtransactions.
-
#list_unspent ⇒ Object
listunspent.
-
#lock_unspent ⇒ Object
lockunspent.
-
#memory_pool ⇒ Object
getmemorypool.
-
#mining_info ⇒ Object
getmininginfo.
-
#move ⇒ Object
move.
-
#new_address(account = nil) ⇒ Object
getnewaddress.
-
#peer_info ⇒ Object
getpeerinfo.
-
#raw_change_address ⇒ Object
getrawchangeaddress.
-
#raw_mem_pool ⇒ Object
getrawmempool.
-
#raw_transaction ⇒ Object
getrawtransaction.
-
#received_by_account ⇒ Object
getreceivedbyaccount.
-
#received_by_address ⇒ Object
getreceivedbyaddress.
-
#send_from ⇒ Object
sendfrom.
-
#send_many ⇒ Object
sendmany.
-
#send_raw_transaction ⇒ Object
sendrawtransaction.
-
#send_to_address(address, amount, comment = nil, comment_to = nil) ⇒ Object
sendtoaddress.
-
#sign_message ⇒ Object
signmessage.
-
#sign_raw_transaction ⇒ Object
signrawtransaction.
-
#stop ⇒ Object
stop.
-
#submit_block ⇒ Object
submitblock.
-
#transaction(txid) ⇒ Object
gettransaction.
-
#tx_fee=(_) ⇒ Object
settxfee.
-
#tx_out ⇒ Object
gettxout.
-
#tx_out_set_info ⇒ Object
gettxoutsetinfo.
- #valid_address?(address) ⇒ Boolean
-
#validate_address(address) ⇒ Object
validateaddress.
-
#verify_message ⇒ Object
verifymessage.
-
#wallet_lock ⇒ Object
walletlock.
-
#wallet_passphrase ⇒ Object
walletpassphrase.
-
#wallet_passphrase_change ⇒ Object
walletpassphrasechange.
-
#work ⇒ Object
getwork.
Instance Attribute Details
#host ⇒ Object
14 15 16 |
# File 'lib/coinable.rb', line 14 def host @host || 'localhost' end |
#password ⇒ Object
26 27 28 |
# File 'lib/coinable.rb', line 26 def password @password || 'rpcpassword' end |
#port ⇒ Object
18 19 20 |
# File 'lib/coinable.rb', line 18 def port @port || 8543 end |
#user ⇒ Object
22 23 24 |
# File 'lib/coinable.rb', line 22 def user @user || 'rpcuser' end |
Instance Method Details
#account ⇒ Object
getaccount
75 76 77 |
# File 'lib/coinable.rb', line 75 def account raise NotImplementedError end |
#account=(_) ⇒ Object
setaccount
344 345 346 |
# File 'lib/coinable.rb', line 344 def account=(_) raise NotImplementedError end |
#account_address ⇒ Object
getaccountaddress
80 81 82 |
# File 'lib/coinable.rb', line 80 def account_address raise NotImplementedError end |
#add_multisig_address ⇒ Object
addmultisigaddress
35 36 37 |
# File 'lib/coinable.rb', line 35 def add_multisig_address raise NotImplementedError end |
#add_node ⇒ Object
addnode
40 41 42 |
# File 'lib/coinable.rb', line 40 def add_node raise NotImplementedError end |
#added_node_info ⇒ Object
getaddednodeinfo
85 86 87 |
# File 'lib/coinable.rb', line 85 def added_node_info raise NotImplementedError end |
#addresses_by_account ⇒ Object
getaddressesbyaccount
90 91 92 |
# File 'lib/coinable.rb', line 90 def addresses_by_account raise NotImplementedError end |
#backup_wallet ⇒ Object
backupwallet
45 46 47 |
# File 'lib/coinable.rb', line 45 def backup_wallet raise NotImplementedError end |
#balance ⇒ Object
getbalance
95 96 97 |
# File 'lib/coinable.rb', line 95 def balance raise NotImplementedError end |
#best_block_hash ⇒ Object
getbestblockhash
100 101 102 |
# File 'lib/coinable.rb', line 100 def best_block_hash raise NotImplementedError end |
#block ⇒ Object
getblock
105 106 107 |
# File 'lib/coinable.rb', line 105 def block raise NotImplementedError end |
#block_count ⇒ Object
getblockcount
110 111 112 |
# File 'lib/coinable.rb', line 110 def block_count raise NotImplementedError end |
#block_hash ⇒ Object
getblockhash
115 116 117 |
# File 'lib/coinable.rb', line 115 def block_hash raise NotImplementedError end |
#block_number ⇒ Object
getblocknumber
120 121 122 |
# File 'lib/coinable.rb', line 120 def block_number raise NotImplementedError end |
#block_template ⇒ Object
getblocktemplate
125 126 127 |
# File 'lib/coinable.rb', line 125 def block_template raise NotImplementedError end |
#configure {|_self| ... } ⇒ Object
30 31 32 |
# File 'lib/coinable.rb', line 30 def configure yield self end |
#connection_count ⇒ Object
getconnectioncount
130 131 132 |
# File 'lib/coinable.rb', line 130 def connection_count raise NotImplementedError end |
#create_multisig ⇒ Object
createmultisig
50 51 52 |
# File 'lib/coinable.rb', line 50 def create_multisig raise NotImplementedError end |
#create_raw_transaction ⇒ Object
createrawtransaction
55 56 57 |
# File 'lib/coinable.rb', line 55 def create_raw_transaction raise NotImplementedError end |
#decode_raw_transaction ⇒ Object
decoderawtransaction
60 61 62 |
# File 'lib/coinable.rb', line 60 def decode_raw_transaction raise NotImplementedError end |
#difficulty ⇒ Object
getdifficulty
135 136 137 |
# File 'lib/coinable.rb', line 135 def difficulty raise NotImplementedError end |
#dump_priv_key ⇒ Object
dumpprivkey
65 66 67 |
# File 'lib/coinable.rb', line 65 def dump_priv_key raise NotImplementedError end |
#encrypt_wallet ⇒ Object
encryptwallet
70 71 72 |
# File 'lib/coinable.rb', line 70 def encrypt_wallet raise NotImplementedError end |
#generate ⇒ Object
getgenerate
140 141 142 |
# File 'lib/coinable.rb', line 140 def generate raise NotImplementedError end |
#generate=(_) ⇒ Object
setgenerate
349 350 351 |
# File 'lib/coinable.rb', line 349 def generate=(_) raise NotImplementedError end |
#hashes_per_sec ⇒ Object
gethashespersec
145 146 147 |
# File 'lib/coinable.rb', line 145 def hashes_per_sec raise NotImplementedError end |
#help ⇒ Object
help
235 236 237 |
# File 'lib/coinable.rb', line 235 def help raise NotImplementedError end |
#import_priv_key ⇒ Object
importprivkey
240 241 242 |
# File 'lib/coinable.rb', line 240 def import_priv_key raise NotImplementedError end |
#info ⇒ Object
getinfo
150 151 152 153 154 155 156 |
# File 'lib/coinable.rb', line 150 def info payload = { method: 'getinfo' } request(payload) end |
#keypool_refill ⇒ Object
keypoolrefill
245 246 247 |
# File 'lib/coinable.rb', line 245 def keypool_refill raise NotImplementedError end |
#list_accounts(minconf = nil) ⇒ Object
listaccounts
250 251 252 253 254 255 256 257 258 |
# File 'lib/coinable.rb', line 250 def list_accounts(minconf = nil) payload = { method: 'listaccounts' } payload[:params] = [minconf] unless minconf.nil? request(payload) end |
#list_address_groupings ⇒ Object
listaddressgroupings
261 262 263 |
# File 'lib/coinable.rb', line 261 def list_address_groupings raise NotImplementedError end |
#list_lock_unspent ⇒ Object
listlockunspent
301 302 303 |
# File 'lib/coinable.rb', line 301 def list_lock_unspent raise NotImplementedError end |
#list_received_by_account ⇒ Object
listreceivedbyaccount
266 267 268 |
# File 'lib/coinable.rb', line 266 def list_received_by_account raise NotImplementedError end |
#list_received_by_address ⇒ Object
listreceivedbyaddress
271 272 273 |
# File 'lib/coinable.rb', line 271 def list_received_by_address raise NotImplementedError end |
#list_since_block ⇒ Object
listsinceblock
276 277 278 |
# File 'lib/coinable.rb', line 276 def list_since_block raise NotImplementedError end |
#list_transactions(account = nil, count = nil, from = nil) ⇒ Object
listtransactions
281 282 283 284 285 286 287 288 289 290 291 292 293 |
# File 'lib/coinable.rb', line 281 def list_transactions(account = nil, count = nil, from = nil) payload = { method: 'listtransactions' } unless account.nil? payload[:params] = [account] payload[:params] << count unless count.nil? payload[:params] << from unless from.nil? end request(payload) end |
#list_unspent ⇒ Object
listunspent
296 297 298 |
# File 'lib/coinable.rb', line 296 def list_unspent raise NotImplementedError end |
#lock_unspent ⇒ Object
lockunspent
306 307 308 |
# File 'lib/coinable.rb', line 306 def lock_unspent raise NotImplementedError end |
#memory_pool ⇒ Object
getmemorypool
159 160 161 |
# File 'lib/coinable.rb', line 159 def memory_pool raise NotImplementedError end |
#mining_info ⇒ Object
getmininginfo
164 165 166 |
# File 'lib/coinable.rb', line 164 def mining_info raise NotImplementedError end |
#move ⇒ Object
move
311 312 313 |
# File 'lib/coinable.rb', line 311 def move raise NotImplementedError end |
#new_address(account = nil) ⇒ Object
getnewaddress
169 170 171 172 173 174 175 176 177 |
# File 'lib/coinable.rb', line 169 def new_address(account = nil) payload = { method: 'getnewaddress' } payload[:params] = [account] unless account.nil? request(payload) end |
#peer_info ⇒ Object
getpeerinfo
180 181 182 |
# File 'lib/coinable.rb', line 180 def peer_info raise NotImplementedError end |
#raw_change_address ⇒ Object
getrawchangeaddress
185 186 187 |
# File 'lib/coinable.rb', line 185 def raw_change_address raise NotImplementedError end |
#raw_mem_pool ⇒ Object
getrawmempool
190 191 192 |
# File 'lib/coinable.rb', line 190 def raw_mem_pool raise NotImplementedError end |
#raw_transaction ⇒ Object
getrawtransaction
195 196 197 |
# File 'lib/coinable.rb', line 195 def raw_transaction raise NotImplementedError end |
#received_by_account ⇒ Object
getreceivedbyaccount
200 201 202 |
# File 'lib/coinable.rb', line 200 def received_by_account raise NotImplementedError end |
#received_by_address ⇒ Object
getreceivedbyaddress
205 206 207 |
# File 'lib/coinable.rb', line 205 def received_by_address raise NotImplementedError end |
#send_from ⇒ Object
sendfrom
316 317 318 |
# File 'lib/coinable.rb', line 316 def send_from raise NotImplementedError end |
#send_many ⇒ Object
sendmany
321 322 323 |
# File 'lib/coinable.rb', line 321 def send_many raise NotImplementedError end |
#send_raw_transaction ⇒ Object
sendrawtransaction
326 327 328 |
# File 'lib/coinable.rb', line 326 def send_raw_transaction raise NotImplementedError end |
#send_to_address(address, amount, comment = nil, comment_to = nil) ⇒ Object
sendtoaddress
331 332 333 334 335 336 337 338 339 340 341 |
# File 'lib/coinable.rb', line 331 def send_to_address(address, amount, comment = nil, comment_to = nil) payload = { method: 'sendtoaddress', params: [address, amount] } payload[:params] << comment unless comment.nil? payload[:params] << comment_to unless comment_to.nil? request(payload) end |
#sign_message ⇒ Object
signmessage
359 360 361 |
# File 'lib/coinable.rb', line 359 def raise NotImplementedError end |
#sign_raw_transaction ⇒ Object
signrawtransaction
364 365 366 |
# File 'lib/coinable.rb', line 364 def sign_raw_transaction raise NotImplementedError end |
#stop ⇒ Object
stop
369 370 371 |
# File 'lib/coinable.rb', line 369 def stop raise NotImplementedError end |
#submit_block ⇒ Object
submitblock
374 375 376 |
# File 'lib/coinable.rb', line 374 def submit_block raise NotImplementedError end |
#transaction(txid) ⇒ Object
gettransaction
210 211 212 213 214 215 216 217 |
# File 'lib/coinable.rb', line 210 def transaction(txid) payload = { method: 'gettransaction', params: [txid] } request(payload) end |
#tx_fee=(_) ⇒ Object
settxfee
354 355 356 |
# File 'lib/coinable.rb', line 354 def tx_fee=(_) raise NotImplementedError end |
#tx_out ⇒ Object
gettxout
220 221 222 |
# File 'lib/coinable.rb', line 220 def tx_out raise NotImplementedError end |
#tx_out_set_info ⇒ Object
gettxoutsetinfo
225 226 227 |
# File 'lib/coinable.rb', line 225 def tx_out_set_info raise NotImplementedError end |
#valid_address?(address) ⇒ Boolean
408 409 410 |
# File 'lib/coinable.rb', line 408 def valid_address?(address) validate_address(address)['isvalid'] end |
#validate_address(address) ⇒ Object
validateaddress
379 380 381 382 383 384 385 386 |
# File 'lib/coinable.rb', line 379 def validate_address(address) payload = { method: 'validateaddress', params: [address] } request(payload) end |
#verify_message ⇒ Object
verifymessage
389 390 391 |
# File 'lib/coinable.rb', line 389 def raise NotImplementedError end |
#wallet_lock ⇒ Object
walletlock
394 395 396 |
# File 'lib/coinable.rb', line 394 def wallet_lock raise NotImplementedError end |
#wallet_passphrase ⇒ Object
walletpassphrase
399 400 401 |
# File 'lib/coinable.rb', line 399 def wallet_passphrase raise NotImplementedError end |
#wallet_passphrase_change ⇒ Object
walletpassphrasechange
404 405 406 |
# File 'lib/coinable.rb', line 404 def wallet_passphrase_change raise NotImplementedError end |
#work ⇒ Object
getwork
230 231 232 |
# File 'lib/coinable.rb', line 230 def work raise NotImplementedError end |