1
// Copyright © 2017-2020 Trust Wallet.
2
//
3
// This file is part of Trust. The full Trust copyright notice, including
4
// terms governing use, modification, and redistribution, is contained in the
5
// file LICENSE at the root of the source code distribution tree.
6

7
#pragma once
8

9
#include "../DerivationPath.h"
10

11
#include <nlohmann/json.hpp>
12
#include <string>
13

14
namespace TW::Keystore {
15

16
/// Account for a particular coin within a wallet.
17 1
class Account {
18
  public:
19
    /// Account public address
20
    std::string address;
21

22
    /// Account derivation path, only relevant for HD wallets.
23
    DerivationPath derivationPath;
24

25
    /// Extended public key.
26
    std::string extendedPublicKey;
27

28
    /// Coin this account is for.
29
    TWCoinType coin;
30

31
    Account() = default;
32 1
    Account(std::string address, TWCoinType coin, DerivationPath derivationPath, std::string extendedPublicKey = "")
33 1
        : address(std::move(address))
34 1
        , derivationPath(std::move(derivationPath))
35 1
        , extendedPublicKey(std::move(extendedPublicKey))
36 1
        , coin(coin) {}
37

38
    /// Initializes `Account` with a JSON object.
39
    Account(const nlohmann::json& json);
40

41
    /// Saves `this` as a JSON object.
42
    nlohmann::json json() const;
43
};
44

45
} // namespace TW::Keystore
46

47
/// Wrapper for C interface.
48 1
struct TWAccount {
49
    TW::Keystore::Account impl;
50
};

Read our documentation on viewing source code .

Loading