forked from trustwallet/wallet-core
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTransaction.h
More file actions
72 lines (54 loc) · 1.72 KB
/
Copy pathTransaction.h
File metadata and controls
72 lines (54 loc) · 1.72 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// 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 "../Data.h"
#include "Action.h"
#include "Prefixes.h"
#include <nlohmann/json.hpp>
#include <set>
#include <array>
namespace TW::EOS {
class Signature {
public:
Data data;
Type type;
static const size_t DataSize = 65;
static const size_t ChecksumSize = 4;
Signature(Data sig, Type type);
virtual ~Signature() { }
void serialize(Data& os) const noexcept;
std::string string() const noexcept;
};
class Extension {
public:
uint16_t type;
Data buffer;
Extension(uint16_t type, Data buffer) : type(type), buffer(buffer) { }
virtual ~Extension() { }
void serialize(Data& os) const noexcept;
nlohmann::json serialize() const noexcept;
};
class Transaction {
public:
Transaction(const Data& referenceBlockId, int32_t referenceBlockTime);
void serialize(Data& os) const noexcept;
nlohmann::json serialize() const;
inline bool isValid() { return maxNetUsageWords < UINT32_MAX / 8UL; }
uint16_t refBlockNumber = 0;
uint32_t refBlockPrefix = 0;
int32_t expiration = 0;
uint32_t maxNetUsageWords = 0;
uint8_t maxCPUUsageInMS = 0;
uint32_t delaySeconds = 0;
std::vector<Action> actions;
std::vector<Action> contextFreeActions;
std::vector<Extension> transactionExtensions;
std::vector<Signature> signatures;
Data contextFreeData;
void setReferenceBlock(const Data& referenceBlockId);
static const int32_t ExpirySeconds = 30;
};
} // namespace TW::EOS