Fabcoin Core  0.16.2
P2P Digital Currency
Interface.cpp
Go to the documentation of this file.
1 /*
2  This file is part of cpp-ethereum.
3 
4  cpp-ethereum is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  cpp-ethereum is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
16 */
22 #include "Interface.h"
23 using namespace std;
24 using namespace dev;
25 using namespace eth;
26 
27 void Interface::submitTransaction(Secret const& _secret, u256 const& _value, Address const& _dest, bytes const& _data, u256 const& _gas, u256 const& _gasPrice, u256 const& _nonce)
28 {
30  ts.creation = false;
31  ts.value = _value;
32  ts.to = _dest;
33  ts.data = _data;
34  ts.gas = _gas;
35  ts.gasPrice = _gasPrice;
36  ts.nonce = _nonce;
37  submitTransaction(ts, _secret);
38 }
39 
40 Address Interface::submitTransaction(Secret const& _secret, u256 const& _endowment, bytes const& _init, u256 const& _gas, u256 const& _gasPrice, u256 const& _nonce)
41 {
43  ts.creation = true;
44  ts.value = _endowment;
45  ts.data = _init;
46  ts.gas = _gas;
47  ts.gasPrice = _gasPrice;
48  ts.nonce = _nonce;
49  return submitTransaction(ts, _secret).second;
50 }
51 
52 BlockHeader Interface::blockInfo(BlockNumber _block) const
53 {
54  if (_block == PendingBlock)
55  return pendingInfo();
56  return blockInfo(hashFromNumber(_block));
57 }
58 
59 BlockDetails Interface::blockDetails(BlockNumber _block) const
60 {
61  if (_block == PendingBlock)
62  return pendingDetails();
63  return blockDetails(hashFromNumber(_block));
64 }
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Definition: Arith256.cpp:15
Encapsulation of a block header.
Definition: BlockHeader.h:95
std::hash for asio::adress
Definition: Common.h:323
unsigned BlockNumber
Definition: Common.h:72
std::vector< byte > bytes
Definition: Common.h:75
Fixed-size raw-byte array container type, with an API optimised for storing hashes.
Definition: FixedHash.h:47
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
Definition: Common.h:125