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

Instance Attribute Details

#hostObject



14
15
16
# File 'lib/coinable.rb', line 14

def host
  @host || 'localhost'
end

#passwordObject



26
27
28
# File 'lib/coinable.rb', line 26

def password
  @password || 'rpcpassword'
end

#portObject



18
19
20
# File 'lib/coinable.rb', line 18

def port
  @port || 8543
end

#userObject



22
23
24
# File 'lib/coinable.rb', line 22

def user
  @user || 'rpcuser'
end

Instance Method Details

#accountObject

getaccount

Raises:

  • (NotImplementedError)


75
76
77
# File 'lib/coinable.rb', line 75

def 
  raise NotImplementedError
end

#account=(_) ⇒ Object

setaccount

Raises:

  • (NotImplementedError)


344
345
346
# File 'lib/coinable.rb', line 344

def account=(_)
  raise NotImplementedError
end

#account_addressObject

getaccountaddress

Raises:

  • (NotImplementedError)


80
81
82
# File 'lib/coinable.rb', line 80

def 
  raise NotImplementedError
end

#add_multisig_addressObject

addmultisigaddress

Raises:

  • (NotImplementedError)


35
36
37
# File 'lib/coinable.rb', line 35

def add_multisig_address
  raise NotImplementedError
end

#add_nodeObject

addnode

Raises:

  • (NotImplementedError)


40
41
42
# File 'lib/coinable.rb', line 40

def add_node
  raise NotImplementedError
end

#added_node_infoObject

getaddednodeinfo

Raises:

  • (NotImplementedError)


85
86
87
# File 'lib/coinable.rb', line 85

def added_node_info
  raise NotImplementedError
end

#addresses_by_accountObject

getaddressesbyaccount

Raises:

  • (NotImplementedError)


90
91
92
# File 'lib/coinable.rb', line 90

def 
  raise NotImplementedError
end

#backup_walletObject

backupwallet

Raises:

  • (NotImplementedError)


45
46
47
# File 'lib/coinable.rb', line 45

def backup_wallet
  raise NotImplementedError
end

#balanceObject

getbalance

Raises:

  • (NotImplementedError)


95
96
97
# File 'lib/coinable.rb', line 95

def balance
  raise NotImplementedError
end

#best_block_hashObject

getbestblockhash

Raises:

  • (NotImplementedError)


100
101
102
# File 'lib/coinable.rb', line 100

def best_block_hash
  raise NotImplementedError
end

#blockObject

getblock

Raises:

  • (NotImplementedError)


105
106
107
# File 'lib/coinable.rb', line 105

def block
  raise NotImplementedError
end

#block_countObject

getblockcount

Raises:

  • (NotImplementedError)


110
111
112
# File 'lib/coinable.rb', line 110

def block_count
  raise NotImplementedError
end

#block_hashObject

getblockhash

Raises:

  • (NotImplementedError)


115
116
117
# File 'lib/coinable.rb', line 115

def block_hash
  raise NotImplementedError
end

#block_numberObject

getblocknumber

Raises:

  • (NotImplementedError)


120
121
122
# File 'lib/coinable.rb', line 120

def block_number
  raise NotImplementedError
end

#block_templateObject

getblocktemplate

Raises:

  • (NotImplementedError)


125
126
127
# File 'lib/coinable.rb', line 125

def block_template
  raise NotImplementedError
end

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Coinable)

    the object that the method was called on



30
31
32
# File 'lib/coinable.rb', line 30

def configure
  yield self
end

#connection_countObject

getconnectioncount

Raises:

  • (NotImplementedError)


130
131
132
# File 'lib/coinable.rb', line 130

def connection_count
  raise NotImplementedError
end

#create_multisigObject

createmultisig

Raises:

  • (NotImplementedError)


50
51
52
# File 'lib/coinable.rb', line 50

def create_multisig
  raise NotImplementedError
end

#create_raw_transactionObject

createrawtransaction

Raises:

  • (NotImplementedError)


55
56
57
# File 'lib/coinable.rb', line 55

def create_raw_transaction
  raise NotImplementedError
end

#decode_raw_transactionObject

decoderawtransaction

Raises:

  • (NotImplementedError)


60
61
62
# File 'lib/coinable.rb', line 60

def decode_raw_transaction
  raise NotImplementedError
end

#difficultyObject

getdifficulty

Raises:

  • (NotImplementedError)


135
136
137
# File 'lib/coinable.rb', line 135

def difficulty
  raise NotImplementedError
end

#dump_priv_keyObject

dumpprivkey

Raises:

  • (NotImplementedError)


65
66
67
# File 'lib/coinable.rb', line 65

def dump_priv_key
  raise NotImplementedError
end

#encrypt_walletObject

encryptwallet

Raises:

  • (NotImplementedError)


70
71
72
# File 'lib/coinable.rb', line 70

def encrypt_wallet
  raise NotImplementedError
end

#generateObject

getgenerate

Raises:

  • (NotImplementedError)


140
141
142
# File 'lib/coinable.rb', line 140

def generate
  raise NotImplementedError
end

#generate=(_) ⇒ Object

setgenerate

Raises:

  • (NotImplementedError)


349
350
351
# File 'lib/coinable.rb', line 349

def generate=(_)
  raise NotImplementedError
end

#hashes_per_secObject

gethashespersec

Raises:

  • (NotImplementedError)


145
146
147
# File 'lib/coinable.rb', line 145

def hashes_per_sec
  raise NotImplementedError
end

#helpObject

help

Raises:

  • (NotImplementedError)


235
236
237
# File 'lib/coinable.rb', line 235

def help
  raise NotImplementedError
end

#import_priv_keyObject

importprivkey

Raises:

  • (NotImplementedError)


240
241
242
# File 'lib/coinable.rb', line 240

def import_priv_key
  raise NotImplementedError
end

#infoObject

getinfo



150
151
152
153
154
155
156
# File 'lib/coinable.rb', line 150

def info
  payload = {
    method: 'getinfo'
  }

  request(payload)
end

#keypool_refillObject

keypoolrefill

Raises:

  • (NotImplementedError)


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_groupingsObject

listaddressgroupings

Raises:

  • (NotImplementedError)


261
262
263
# File 'lib/coinable.rb', line 261

def list_address_groupings
  raise NotImplementedError
end

#list_lock_unspentObject

listlockunspent

Raises:

  • (NotImplementedError)


301
302
303
# File 'lib/coinable.rb', line 301

def list_lock_unspent
  raise NotImplementedError
end

#list_received_by_accountObject

listreceivedbyaccount

Raises:

  • (NotImplementedError)


266
267
268
# File 'lib/coinable.rb', line 266

def 
  raise NotImplementedError
end

#list_received_by_addressObject

listreceivedbyaddress

Raises:

  • (NotImplementedError)


271
272
273
# File 'lib/coinable.rb', line 271

def list_received_by_address
  raise NotImplementedError
end

#list_since_blockObject

listsinceblock

Raises:

  • (NotImplementedError)


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( = nil, count = nil, from = nil)
  payload = {
    method: 'listtransactions'
  }

  unless .nil?
    payload[:params] = []
    payload[:params] << count unless count.nil?
    payload[:params] << from unless from.nil?
  end

  request(payload)
end

#list_unspentObject

listunspent

Raises:

  • (NotImplementedError)


296
297
298
# File 'lib/coinable.rb', line 296

def list_unspent
  raise NotImplementedError
end

#lock_unspentObject

lockunspent

Raises:

  • (NotImplementedError)


306
307
308
# File 'lib/coinable.rb', line 306

def lock_unspent
  raise NotImplementedError
end

#memory_poolObject

getmemorypool

Raises:

  • (NotImplementedError)


159
160
161
# File 'lib/coinable.rb', line 159

def memory_pool
  raise NotImplementedError
end

#mining_infoObject

getmininginfo

Raises:

  • (NotImplementedError)


164
165
166
# File 'lib/coinable.rb', line 164

def mining_info
  raise NotImplementedError
end

#moveObject

move

Raises:

  • (NotImplementedError)


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( = nil)
  payload = {
    method: 'getnewaddress'
  }

  payload[:params] = [] unless .nil?

  request(payload)
end

#peer_infoObject

getpeerinfo

Raises:

  • (NotImplementedError)


180
181
182
# File 'lib/coinable.rb', line 180

def peer_info
  raise NotImplementedError
end

#raw_change_addressObject

getrawchangeaddress

Raises:

  • (NotImplementedError)


185
186
187
# File 'lib/coinable.rb', line 185

def raw_change_address
  raise NotImplementedError
end

#raw_mem_poolObject

getrawmempool

Raises:

  • (NotImplementedError)


190
191
192
# File 'lib/coinable.rb', line 190

def raw_mem_pool
  raise NotImplementedError
end

#raw_transactionObject

getrawtransaction

Raises:

  • (NotImplementedError)


195
196
197
# File 'lib/coinable.rb', line 195

def raw_transaction
  raise NotImplementedError
end

#received_by_accountObject

getreceivedbyaccount

Raises:

  • (NotImplementedError)


200
201
202
# File 'lib/coinable.rb', line 200

def 
  raise NotImplementedError
end

#received_by_addressObject

getreceivedbyaddress

Raises:

  • (NotImplementedError)


205
206
207
# File 'lib/coinable.rb', line 205

def received_by_address
  raise NotImplementedError
end

#send_fromObject

sendfrom

Raises:

  • (NotImplementedError)


316
317
318
# File 'lib/coinable.rb', line 316

def send_from
  raise NotImplementedError
end

#send_manyObject

sendmany

Raises:

  • (NotImplementedError)


321
322
323
# File 'lib/coinable.rb', line 321

def send_many
  raise NotImplementedError
end

#send_raw_transactionObject

sendrawtransaction

Raises:

  • (NotImplementedError)


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_messageObject

signmessage

Raises:

  • (NotImplementedError)


359
360
361
# File 'lib/coinable.rb', line 359

def sign_message
  raise NotImplementedError
end

#sign_raw_transactionObject

signrawtransaction

Raises:

  • (NotImplementedError)


364
365
366
# File 'lib/coinable.rb', line 364

def sign_raw_transaction
  raise NotImplementedError
end

#stopObject

stop

Raises:

  • (NotImplementedError)


369
370
371
# File 'lib/coinable.rb', line 369

def stop
  raise NotImplementedError
end

#submit_blockObject

submitblock

Raises:

  • (NotImplementedError)


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

Raises:

  • (NotImplementedError)


354
355
356
# File 'lib/coinable.rb', line 354

def tx_fee=(_)
  raise NotImplementedError
end

#tx_outObject

gettxout

Raises:

  • (NotImplementedError)


220
221
222
# File 'lib/coinable.rb', line 220

def tx_out
  raise NotImplementedError
end

#tx_out_set_infoObject

gettxoutsetinfo

Raises:

  • (NotImplementedError)


225
226
227
# File 'lib/coinable.rb', line 225

def tx_out_set_info
  raise NotImplementedError
end

#valid_address?(address) ⇒ Boolean

Returns:

  • (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_messageObject

verifymessage

Raises:

  • (NotImplementedError)


389
390
391
# File 'lib/coinable.rb', line 389

def verify_message
  raise NotImplementedError
end

#wallet_lockObject

walletlock

Raises:

  • (NotImplementedError)


394
395
396
# File 'lib/coinable.rb', line 394

def wallet_lock
  raise NotImplementedError
end

#wallet_passphraseObject

walletpassphrase

Raises:

  • (NotImplementedError)


399
400
401
# File 'lib/coinable.rb', line 399

def wallet_passphrase
  raise NotImplementedError
end

#wallet_passphrase_changeObject

walletpassphrasechange

Raises:

  • (NotImplementedError)


404
405
406
# File 'lib/coinable.rb', line 404

def wallet_passphrase_change
  raise NotImplementedError
end

#workObject

getwork

Raises:

  • (NotImplementedError)


230
231
232
# File 'lib/coinable.rb', line 230

def work
  raise NotImplementedError
end