forked from trustwallet/wallet-core
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAddress.h
More file actions
50 lines (36 loc) · 1.5 KB
/
Copy pathAddress.h
File metadata and controls
50 lines (36 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright © 2017-2020 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.
#pragma once
#include "../Base58Address.h"
#include "../PublicKey.h"
#include <array>
#include <cstdint>
#include <vector>
namespace TW::Solana {
const std::string STAKE_ADDRESS = "Stake11111111111111111111111111111111111111";
class Address : public Base58Address<32> {
public:
/// Determines whether a collection of bytes makes a valid Solana address.
static bool isValid(const Data& data) { return data.size() == size; }
/// Determines whether a string makes a valid address.
static bool isValid(const std::string& string);
/// Initializes an address with a string representation.
explicit Address(const std::string& string);
/// Initializes an address with a public key.
explicit Address(const PublicKey& publicKey);
/// Returns a string representation of the address.
std::string string() const;
/// Returns a vector of the address.
Data vector() const;
};
} // namespace TW::Solana
TW::Solana::Address addressFromValidatorSeed(TW::Solana::Address& fromAddress,
TW::Solana::Address& validatorAddress,
TW::Solana::Address& programId);
/// Wrapper for C interface.
struct TWSolanaAddress {
TW::Solana::Address impl;
};