diff --git a/wallet/wallet.go b/wallet/wallet.go index 3c863db8f..58eeab753 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -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