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 "../Base58Address.h"
10
#include "../PublicKey.h"
11

12
#include <array>
13
#include <cstdint>
14
#include <vector>
15

16
namespace TW::Solana {
17

18 1
const std::string STAKE_ADDRESS = "Stake11111111111111111111111111111111111111";
19

20
class Address : public Base58Address<32> {
21
  public:
22
    /// Determines whether a collection of bytes makes a valid Solana address.
23 1
    static bool isValid(const Data& data) { return data.size() == size; }
24

25
    /// Determines whether a string makes a valid address.
26
    static bool isValid(const std::string& string);
27

28
    /// Initializes an address with a string representation.
29
    explicit Address(const std::string& string);
30

31
    /// Initializes an address with a public key.
32
    explicit Address(const PublicKey& publicKey);
33

34
    /// Returns a string representation of the address.
35
    std::string string() const;
36

37
    /// Returns a vector of the address.
38
    Data vector() const;
39
};
40

41
} // namespace TW::Solana
42

43
TW::Solana::Address addressFromValidatorSeed(const TW::Solana::Address& fromAddress,
44
                                             const TW::Solana::Address& validatorAddress,
45
                                             const TW::Solana::Address& programId);

Read our documentation on viewing source code .

Loading