lib/nanook/wallet.rb in nanook-0.6.3 vs lib/nanook/wallet.rb in nanook-0.7.0
- old
+ new
@@ -10,34 +10,36 @@
Nanook::WalletAccount.new(@wallet, account, @rpc)
end
def accounts
wallet_required!
- rpc(:account_list)
+ response = rpc(:account_list)[:accounts]
+ Nanook::Util.coerce_empty_string_to_type(response, Array)
end
def balance(account_break_down: false)
wallet_required!
if account_break_down
- rpc(:wallet_balances)
+ rpc(:wallet_balances)[:balances]
else
rpc(:wallet_balance_total)
end
end
def create
- rpc(:wallet_create)
+ rpc(:wallet_create)[:wallet]
end
def destroy
wallet_required!
rpc(:wallet_destroy)
+ true
end
def export
wallet_required!
- rpc(:wallet_export)
+ rpc(:wallet_export)[:json]
end
def contains?(account)
wallet_required!
response = rpc(:wallet_contains, account: account)
@@ -60,20 +62,20 @@
!response.empty? && response[:locked] != 0
end
def unlock(password)
wallet_required!
- rpc(:password_enter, password: password)
+ rpc(:password_enter, password: password)[:valid] == 1
end
def change_password(password)
wallet_required!
- rpc(:password_change, password: password)
+ rpc(:password_change, password: password)[:changed] == 1
end
def all
wallet_required!
- rpc(:account_list)
+ rpc(:account_list)[:accounts]
end
private
def rpc(action, params={})