Module: NanoRpc::AccountHelper

Includes:
ApplicationHelper
Included in:
Account
Defined in:
lib/nano_rpc/helpers/account_helper.rb

Instance Method Summary collapse

Instance Method Details

#balanceObject



5
6
7
# File 'lib/nano_rpc/helpers/account_helper.rb', line 5

def balance
  .balance
end

#block_countObject



9
10
11
# File 'lib/nano_rpc/helpers/account_helper.rb', line 9

def block_count
  .block_count
end

#history(count:) ⇒ Object



13
14
15
# File 'lib/nano_rpc/helpers/account_helper.rb', line 13

def history(count:)
  (count: count).history
end

#infoObject



17
18
19
# File 'lib/nano_rpc/helpers/account_helper.rb', line 17

def info
  
end

#keyObject



21
22
23
# File 'lib/nano_rpc/helpers/account_helper.rb', line 21

def key
  ['key']
end

#move(from:, to:) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/nano_rpc/helpers/account_helper.rb', line 25

def move(from:, to:)
  (
    source: from,
    wallet: to,
    accounts: [address]
  ).moved == 1
end

#pending_balanceObject Also known as: balance_pending



37
38
39
# File 'lib/nano_rpc/helpers/account_helper.rb', line 37

def pending_balance
  .pending
end

#pending_blocks(count: 100, threshold: nil, source: nil) ⇒ Object Also known as: blocks_pending



42
43
44
45
46
47
48
# File 'lib/nano_rpc/helpers/account_helper.rb', line 42

def pending_blocks(count: 100, threshold: nil, source: nil)
  pending(
    count: count,
    threshold: threshold,
    source: source
  ).blocks
end

#remove(wallet:) ⇒ Object



51
52
53
# File 'lib/nano_rpc/helpers/account_helper.rb', line 51

def remove(wallet:)
  (wallet: wallet).removed == 1
end

#representativeObject



55
56
57
# File 'lib/nano_rpc/helpers/account_helper.rb', line 55

def representative
  .representative
end

#representative_set(wallet:, representative:) ⇒ Object



59
60
61
62
63
64
# File 'lib/nano_rpc/helpers/account_helper.rb', line 59

def representative_set(wallet:, representative:)
  (
    wallet: wallet,
    representative: representative
  ).set == 1
end

#valid?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/nano_rpc/helpers/account_helper.rb', line 66

def valid?
  .valid == 1
end

#wallet_work_set(wallet:, work:) ⇒ Object



33
34
35
# File 'lib/nano_rpc/helpers/account_helper.rb', line 33

def wallet_work_set(wallet:, work:)
  work_set(wallet: wallet, work: work).success == ''
end

#weightObject



70
71
72
# File 'lib/nano_rpc/helpers/account_helper.rb', line 70

def weight
  .weight
end