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

11
namespace TW::FIO {
12

13 1
void Transaction::set(uint32_t expiryTime, const ChainParams& chainParams) {
14 1
    expiration = expiryTime;
15 1
    refBlockNumber = static_cast<uint16_t>(chainParams.headBlockNumber & 0xffff);
16 1
    refBlockPrefix = static_cast<uint32_t>(chainParams.refBlockPrefix & 0xffffffff);
17
}
18

19 1
void Transaction::serialize(Data& out) const {
20 1
    encode32LE(expiration, out);
21 1
    encode16LE(refBlockNumber, out);
22 1
    encode32LE(refBlockPrefix, out);
23 1
    encode32LE(0, out); // 00000000
24 1
    encodeVarInt(actions.size(), out);
25 1
    for (const auto& item : actions) {
26 1
        item.serialize(out);
27
    }
28
}
29

30
} // namespace TW::FIO

Read our documentation on viewing source code .

Loading