32 #ifndef LEDGER_CORE_BITCOINLIKECOMMONKEYCHAINFACTORY_H 33 #define LEDGER_CORE_BITCOINLIKECOMMONKEYCHAINFACTORY_H 36 template <
class Keychain>
39 std::shared_ptr<ledger::core::BitcoinLikeKeychain>
42 const std::shared_ptr<DynamicObject> &configuration,
44 const std::shared_ptr<Preferences> &accountPreferences,
const api::Currency ¤cy)
override {
45 if (!info.extendedKeys.empty()) {
46 auto xpub = make_try<std::shared_ptr<BitcoinLikeExtendedPublicKey>>([&] () -> std::shared_ptr<BitcoinLikeExtendedPublicKey> {
47 return BitcoinLikeExtendedPublicKey::fromBase58(
54 if (xpub.isFailure()) {
55 throw xpub.getFailure();
57 auto keychain = std::make_shared<Keychain>(
58 configuration, currency, index, xpub.getValue(), accountPreferences
63 throw make_exception(api::ErrorCode::MISSING_DERIVATION,
"Cannot find derivation {}", path.toString());
67 std::shared_ptr<ledger::core::BitcoinLikeKeychain>
68 restore(int32_t index,
70 const std::shared_ptr<DynamicObject> &configuration,
const std::string &databaseXpubEntry,
71 const std::shared_ptr<Preferences> &accountPreferences,
const api::Currency ¤cy)
override {
72 auto keychain = std::make_shared<Keychain>(configuration,
75 BitcoinLikeExtendedPublicKey::fromBase58(currency,
85 #endif //LEDGER_CORE_BITCOINLIKECOMMONKEYCHAINFACTORY_H
Definition: ExtendedKeyAccountCreationInfo.hpp:16
Definition: BitcoinLikeKeychainFactory.h:42
Definition: DerivationPath.hpp:40
Definition: BitcoinLikeCommonKeychainFactory.h:37
Definition: Currency.hpp:23
Definition: Account.cpp:8