Repository navigation
Expand file tree
/
Copy pathTransaction.h
More file actions
56 lines (45 loc) · 1.45 KB
/
Copy pathTransaction.h
File metadata and controls
56 lines (45 loc) · 1.45 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
// 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 "Address.h"
#include "../uint256.h"
#include "../proto/Nebulas.pb.h"
namespace TW::Nebulas {
class Transaction {
public:
static const char* TxPayloadBinaryType;
static const char* TxPayloadDeployType;
static const char* TxPayloadCallType;
Address from;
uint256_t nonce;
uint256_t gasPrice;
uint256_t gasLimit;
Address to;
uint256_t amount;
uint256_t timestamp;
std::string payload;
// Signature values
uint256_t chainID;
Data hash;
Data signature;
uint32_t algorithm;
// serialize data
Data raw;
Transaction(Address from, uint256_t nonce, uint256_t gasPrice, uint256_t gasLimit, Address to, uint256_t amount, uint256_t timestamp, const std::string& payload)
: from(std::move(from))
, nonce(std::move(nonce))
, gasPrice(std::move(gasPrice))
, gasLimit(std::move(gasLimit))
, to(std::move(to))
, amount(std::move(amount))
, timestamp(std::move(timestamp))
, payload(payload){}
public:
static Proto::Data* newPayloadData(const std::string& payload);
///serialize the signed transaction.
void serializeToRaw();
};
} // namespace TW::Nebulas