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/TWAnySigner.h>
8

9
#include "Coin.h"
10

11
using namespace TW;
12

13 1
TWData* _Nonnull TWAnySignerSign(TWData* _Nonnull data, enum TWCoinType coin) {
14 1
    const Data& dataIn = *(reinterpret_cast<const Data*>(data));
15 1
    Data dataOut;
16 1
    TW::anyCoinSign(coin, dataIn, dataOut);
17 1
    return TWDataCreateWithBytes(dataOut.data(), dataOut.size());
18
}
19

20 1
TWString *_Nonnull TWAnySignerSignJSON(TWString *_Nonnull json, TWData *_Nonnull key, enum TWCoinType coin) {
21 1
    const Data& keyData = *(reinterpret_cast<const Data*>(key));
22 1
    const std::string& jsonString = *(reinterpret_cast<const std::string*>(json));
23 1
    auto result = TW::anySignJSON(coin, jsonString, keyData);
24 1
    return TWStringCreateWithUTF8Bytes(result.c_str());
25
}
26 1
extern bool TWAnySignerSupportsJSON(enum TWCoinType coin) {
27 1
    return TW::supportsJSONSigning(coin);
28
}
29

30 1
TWData* _Nonnull TWAnySignerEncode(TWData* _Nonnull data, enum TWCoinType coin) {
31 1
    const Data& dataIn = *(reinterpret_cast<const Data*>(data));
32 1
    Data dataOut;
33 1
    TW::anyCoinEncode(coin, dataIn, dataOut);
34 1
    return TWDataCreateWithBytes(dataOut.data(), dataOut.size());
35
}
36

37 1
TWData* _Nonnull TWAnySignerDecode(TWData* _Nonnull data, enum TWCoinType coin) {
38 1
    const Data& dataIn = *(reinterpret_cast<const Data*>(data));
39 1
    Data dataOut;
40 1
    TW::anyCoinDecode(coin, dataIn, dataOut);
41 1
    return TWDataCreateWithBytes(dataOut.data(), dataOut.size());
42
}
43

44 1
TWData* _Nonnull TWAnySignerPlan(TWData* _Nonnull data, enum TWCoinType coin) {
45 1
    const Data& dataIn = *(reinterpret_cast<const Data*>(data));
46 1
    Data dataOut;
47 1
    TW::anyCoinPlan(coin, dataIn, dataOut);
48 1
    return TWDataCreateWithBytes(dataOut.data(), dataOut.size());
49
}

Read our documentation on viewing source code .

Loading