Class: Round::Wallet

Inherits:
Base
  • Object
show all
Defined in:
lib/round/wallet.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#resource

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

association, #hash_identifier, #method_missing, #refresh

Constructor Details

#initialize(options = {}) ⇒ Wallet

Returns a new instance of Wallet.



6
7
8
9
10
# File 'lib/round/wallet.rb', line 6

def initialize(options = {})
  @multiwallet = options[:multiwallet]
  @application = options[:application]
  super(options)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Round::Base

Instance Attribute Details

#applicationObject (readonly)

Returns the value of attribute application.



4
5
6
# File 'lib/round/wallet.rb', line 4

def application
  @application
end

#multiwalletObject (readonly)

Returns the value of attribute multiwallet.



4
5
6
# File 'lib/round/wallet.rb', line 4

def multiwallet
  @multiwallet
end

Class Method Details

.hash_identifierObject



34
35
36
# File 'lib/round/wallet.rb', line 34

def self.hash_identifier
  'name'
end

Instance Method Details

#accountsObject



26
27
28
29
30
31
32
# File 'lib/round/wallet.rb', line 26

def accounts
  Round::AccountCollection.new(
    resource: @resource.accounts,
    wallet: self,
    client: @client
  )
end

#unlock(passphrase) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/round/wallet.rb', line 12

def unlock(passphrase)
  primary_seed = CoinOp::Crypto::PassphraseBox.decrypt(passphrase, @resource.primary_private_seed)
  primary_master = MoneyTree::Master.new(seed_hex: primary_seed)
  @multiwallet = CoinOp::Bit::MultiWallet.new(
    private: {
      primary: primary_master
    },
    public: {
      cosigner: @resource.cosigner_public_seed,
      backup: @resource.backup_public_seed
    }
  )
end