Repository navigation
Expand file tree
/
Copy pathSignerTests.cpp
More file actions
36 lines (28 loc) · 1.5 KB
/
Copy pathSignerTests.cpp
File metadata and controls
36 lines (28 loc) · 1.5 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
// 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.
#include "HexCoding.h"
#include "Theta/Signer.h"
#include <gtest/gtest.h>
namespace TW::Theta {
using boost::multiprecision::uint256_t;
TEST(Signer, Sign) {
const auto pkFrom =
PrivateKey(parse_hex("0x93a90ea508331dfdf27fb79757d4250b4e84954927ba0073cd67454ac432c737"));
const auto from = Ethereum::Address("0x2E833968E5bB786Ae419c4d13189fB081Cc43bab");
const auto to = Ethereum::Address("0x9F1233798E905E173560071255140b4A8aBd3Ec6");
auto transaction = Transaction(from, to, 10, 20, 1);
auto signer = Signer("privatenet");
auto signature = signer.sign(pkFrom, transaction);
transaction.setSignature(from, signature);
ASSERT_EQ(hex(signature), "5190868498d587d074d57298f41853d0109d997f15ddf617f471eb8cbb7fff267cb8"
"fe9134ccdef053ec7cabd18070325c9c436efe1abbacd14eb7561d3fc10501");
ASSERT_EQ(hex(transaction.encode()),
"02f887c78085e8d4a51000f863f861942e833968e5bb786ae419c4d13189fb081cc43babc70a85e8d4a5"
"101401b8415190868498d587d074d57298f41853d0109d997f15ddf617f471eb8cbb7fff267cb8fe9134"
"ccdef053ec7cabd18070325c9c436efe1abbacd14eb7561d3fc10501d9d8949f1233798e905e17356007"
"1255140b4a8abd3ec6c20a14");
}
} // namespace TW::Theta