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
#include <TrustWalletCore/TWGroestlcoinAddress.h>
8
#include <TrustWalletCore/TWPublicKey.h>
9

10
#include "../Groestlcoin/Address.h"
11

12
#include <cstring>
13

14
using namespace TW::Groestlcoin;
15

16 1
bool TWGroestlcoinAddressEqual(struct TWGroestlcoinAddress *_Nonnull lhs, struct TWGroestlcoinAddress *_Nonnull rhs) {
17 1
    return lhs->impl.bytes == rhs->impl.bytes;
18
}
19

20 0
bool TWGroestlcoinAddressIsValidString(TWString *_Nonnull string) {
21 0
    auto& s = *reinterpret_cast<const std::string*>(string);
22 0
    return Address::isValid(s);
23
}
24

25 1
struct TWGroestlcoinAddress *_Nullable TWGroestlcoinAddressCreateWithString(TWString *_Nonnull string) {
26 1
    auto& s = *reinterpret_cast<const std::string*>(string);
27 1
    if (!Address::isValid(s)) {
28 0
        return nullptr;
29
    }
30 1
    return new TWGroestlcoinAddress{ Address(s) };
31
}
32

33 1
struct TWGroestlcoinAddress *_Nonnull TWGroestlcoinAddressCreateWithPublicKey(struct TWPublicKey *_Nonnull publicKey, uint8_t prefix) {
34 1
    return new TWGroestlcoinAddress{ Address(publicKey->impl, prefix) };
35
}
36

37 1
void TWGroestlcoinAddressDelete(struct TWGroestlcoinAddress *_Nonnull address) {
38 1
    delete address;
39
}
40

41 1
TWString *_Nonnull TWGroestlcoinAddressDescription(struct TWGroestlcoinAddress *_Nonnull address) {
42 1
    const auto str = address->impl.string();
43 1
    return TWStringCreateWithUTF8Bytes(str.c_str());
44
}

Read our documentation on viewing source code .

Loading