forked from trustwallet/wallet-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTransactionCompiler.h
32 lines (23 loc) · 1.27 KB
/
TransactionCompiler.h
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
// SPDX-License-Identifier: Apache-2.0
//
// Copyright © 2017 Trust Wallet.
#pragma once
#include <TrustWalletCore/TWCoinType.h>
#include "Data.h"
#include "CoinEntry.h"
#include <string>
#include <vector>
namespace TW {
/// Non-core transaction utility methods, like building a transaction using an external signature
class TransactionCompiler {
public:
/// Obtain pre-signing hash of a transaction.
/// It will return a proto object named `PreSigningOutput` which will include hash.
/// We provide a default `PreSigningOutput` in TransactionCompiler.proto.
/// For some special coins, such as bitcoin, we will create a custom `PreSigningOutput` object in its proto file.
static Data preImageHashes(TWCoinType coinType, const Data& txInputData);
/// Compile a complete transation with an external signature, put together from transaction input and provided public key and signature
static Data compileWithSignatures(TWCoinType coinType, const Data& txInputData, const std::vector<Data>& signatures, const std::vector<Data>& publicKeys);
static Data compileWithSignaturesAndPubKeyType(TWCoinType coinType, const Data& txInputData, const std::vector<Data>& signatures, const std::vector<Data>& publicKeys, TWPublicKeyType pubKeyType);
};
} // namespace TW