Module: Raiblocks::WalletProxyHelper

Included in:
Wallet
Defined in:
lib/raiblocks/helpers/wallet_proxy_helper.rb

Instance Method Summary collapse

Instance Method Details

#account_work(account:) ⇒ Object



3
4
5
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 3

def (account:)
  work_get.work(account: ).work
end

#account_work_set(account:, work:) ⇒ Object Also known as: set_account_work



87
88
89
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 87

def (account:, work:)
  work_set(account: , work: work).work[:success] == ''
end

#add(key:, work: nil) ⇒ Object



7
8
9
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 7

def add(key:, work: nil)
  wallet_add(key: key, work: work).
end

#balanceObject



11
12
13
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 11

def balance
  wallet_balance_total.balance
end

#balances(threshold: nil) ⇒ Object



15
16
17
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 15

def balances(threshold: nil)
  wallet_balances(threshold: threshold).balances
end

#begin_paymentObject



19
20
21
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 19

def begin_payment
  payment_begin.
end

#change_password(new_password:) ⇒ Object



23
24
25
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 23

def change_password(new_password:)
  password_change(password: new_password).changed == 1
end

#change_seed(new_seed:) ⇒ Object



27
28
29
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 27

def change_seed(new_seed:)
  wallet_change_seed(seed: new_seed)[:success] == ''
end

#contains?(account:) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 31

def contains?(account:)
  wallet_contains(account: ).exists == 1
end

#createObject



35
36
37
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 35

def create
  wallet_create.wallet
end

#destroyObject



39
40
41
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 39

def destroy
  wallet_destroy
end

#enter_password(password) ⇒ Object



43
44
45
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 43

def enter_password(password)
  password_enter(password: password).valid == 1
end

#exportObject



47
48
49
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 47

def export
  JSON[wallet_export.json]
end

#frontiersObject



51
52
53
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 51

def frontiers
  wallet_frontiers.frontiers
end

#init_paymentObject



55
56
57
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 55

def init_payment
  payment_init.status == 'Ready'
end

#locked?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 59

def locked?
  wallet_locked.locked == 1
end

#password_valid?(password:) ⇒ Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 63

def password_valid?(password:)
  password_valid(password: password).valid == 1
end

#pending_balanceObject



67
68
69
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 67

def pending_balance
  wallet_balance_total.pending
end

#pending_blocks(count:, threshold: nil, source: nil) ⇒ Object



71
72
73
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 71

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

#receive_block(account:, block:) ⇒ Object



75
76
77
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 75

def receive_block(account:, block:)
  receive.block(account: , block: block).block
end

#representativeObject



79
80
81
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 79

def representative
  wallet_representative.representative
end

#representative_set(representative:) ⇒ Object Also known as: set_representative



92
93
94
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 92

def representative_set(representative:)
  wallet_representative_set(representative: representative).set == 1
end

#republish(count:) ⇒ Object



83
84
85
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 83

def republish(count:)
  wallet_republish(count: count).blocks
end

#send_tx(source:, destination:, amount:) ⇒ Object Also known as: send_transaction



97
98
99
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 97

def send_tx(source:, destination:, amount:)
  rai_send(source: source, destination: destination, amount: amount).block
end

#workObject



102
103
104
# File 'lib/raiblocks/helpers/wallet_proxy_helper.rb', line 102

def work
  wallet_work_get.works
end