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 "RLP.h"
8
#include "Transaction.h"
9
#include "../Ethereum/RLP.h"
10

11
using namespace TW;
12
using namespace TW::Aion;
13
using boost::multiprecision::uint128_t;
14

15 1
Data Transaction::encode() const noexcept {
16 1
    auto encoded = Data();
17 1
    append(encoded, Ethereum::RLP::encode(nonce));
18 1
    append(encoded, Ethereum::RLP::encode(to.bytes));
19 1
    append(encoded, Ethereum::RLP::encode(amount));
20 1
    append(encoded, Ethereum::RLP::encode(payload));
21 1
    append(encoded, Ethereum::RLP::encode(timestamp));
22 1
    append(encoded, RLP::encodeLong(gasLimit));
23 1
    append(encoded, RLP::encodeLong(gasPrice));
24 1
    append(encoded, RLP::encodeLong(uint128_t(1))); // Aion transaction type
25 1
    if (!signature.empty()) {
26 1
        append(encoded, Ethereum::RLP::encode(signature));
27
    }
28 1
    return Ethereum::RLP::encodeList(encoded);
29
}

Read our documentation on viewing source code .

Loading