Skip to content

Commit

Permalink
wallet: Add CoinTypeKey and CoinType functions
Browse files Browse the repository at this point in the history
  • Loading branch information
githubsands committed Sep 30, 2018
1 parent 1eee706 commit 01ad4d5
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -1915,6 +1915,36 @@ func (w *Wallet) GetTransactionsByHashes(txHashes []*chainhash.Hash) (txs []*wir
err = errors.E(errors.NotExist, "transaction(s) not found")
}
return
=======
// CoinTypeKey returns the BIP0044 coin type private key for the passed account.
func (w *Wallet) CoinTypeKey() (*hdkeychain.ExtendedKey, error) {
const op errors.Op = "wallet.CoinTypeKey"
var coinTypePrivateKey *hdkeychain.ExtendedKey
err := walletdb.View(w.db, func(tx walletdb.ReadTx) error {
var err error
coinTypePrivateKey, err = w.Manager.CoinTypePrivKey(tx)
return err
})
if err != nil {
return nil, errors.E(op, err)
}
return coinTypePrivateKey, nil
}

// CoinType returns the SLIP0044 or legacy coin type for the passed account.
func (w *Wallet) CoinType() (uint32, error) {
const op errors.Op = "wallet.CoinType"
var coinType uint32
err := walletdb.View(w.db, func(tx walletdb.ReadTx) error {
var err error
coinType, err = w.Manager.CoinType(tx)
return err
})
if err != nil {
return 0, errors.E(op, err)
}
return coinType, nil
>>>>>>> wallet: Add CoinTypeKey and CoinType functions
}

// CreditCategory describes the type of wallet transaction output. The category
Expand Down

0 comments on commit 01ad4d5

Please sign in to comment.