Wire Sysio
Wire Sysion 1.0.0
Loading...
Searching...
No Matches
cf_transaction.cpp
Go to the documentation of this file.
1
#include <
sysio/chain/webassembly/interface.hpp
>
2
#include <
sysio/chain/transaction_context.hpp
>
3
#include <
sysio/chain/apply_context.hpp
>
4
5
namespace
sysio
{
namespace
chain {
namespace
webassembly {
6
int32_t
interface::read_transaction
(
legacy_span<char>
data )
const
{
7
if
( data.size() == 0 )
return
transaction_size
();
8
9
// always pack the transaction here as exact pack format is part of consensus
10
// and an alternative packed format could be stored in get_packed_transaction()
11
const
packed_transaction
& packed_trx =
context
.trx_context.packed_trx;
12
bytes
trx =
fc::raw::pack
(
static_cast<
const
transaction
&
>
( packed_trx.
get_transaction
() ) );
13
size_t
copy_size = std::min(
static_cast<
size_t
>
(data.size()), trx.size() );
14
std::memcpy( data.data(), trx.data(), copy_size );
15
16
return
copy_size;
17
}
18
19
int32_t
interface::transaction_size
()
const
{
20
const
packed_transaction
& packed_trx =
context
.trx_context.packed_trx;
21
return
fc::raw::pack_size
(
static_cast<
const
transaction
&
>
( packed_trx.
get_transaction
() ) );
22
}
23
24
int32_t
interface::expiration
()
const
{
25
return
context
.trx_context.packed_trx.get_transaction().expiration.sec_since_epoch();
26
}
27
28
int32_t
interface::tapos_block_num
()
const
{
29
return
context
.trx_context.packed_trx.get_transaction().ref_block_num;
30
}
31
32
int32_t
interface::tapos_block_prefix
()
const
{
33
return
context
.trx_context.packed_trx.get_transaction().ref_block_prefix;
34
}
35
36
int32_t
interface::get_action
(
uint32_t
type,
uint32_t
index,
legacy_span<char>
buffer )
const
{
37
return
context
.get_action( type, index, buffer.data(), buffer.size() );
38
}
39
}}}
// ns sysio::chain::webassembly
apply_context.hpp
fc::vector< char >
sysio::chain::webassembly::interface::expiration
int32_t expiration() const
Definition
cf_transaction.cpp:24
sysio::chain::webassembly::interface::get_action
int32_t get_action(uint32_t type, uint32_t index, legacy_span< char > buffer) const
Definition
cf_transaction.cpp:36
sysio::chain::webassembly::interface::tapos_block_prefix
int32_t tapos_block_prefix() const
Definition
cf_transaction.cpp:32
sysio::chain::webassembly::interface::tapos_block_num
int32_t tapos_block_num() const
Definition
cf_transaction.cpp:28
sysio::chain::webassembly::interface::read_transaction
int32_t read_transaction(legacy_span< char > data) const
Definition
cf_transaction.cpp:6
sysio::chain::webassembly::interface::transaction_size
int32_t transaction_size() const
Definition
cf_transaction.cpp:19
interface.hpp
fc::raw::pack
void pack(Stream &s, const std::deque< T > &value)
Definition
raw.hpp:531
fc::raw::pack_size
size_t pack_size(const T &v)
Definition
raw.hpp:671
sysio
Definition
abi_serializer.cpp:8
uint32_t
unsigned int uint32_t
Definition
stdint.h:126
int32_t
signed int int32_t
Definition
stdint.h:123
context
Definition
yubihsm_winhttp.c:52
sysio::chain::packed_transaction
Definition
transaction.hpp:136
sysio::chain::packed_transaction::get_transaction
const transaction & get_transaction() const
Definition
transaction.hpp:184
sysio::chain::transaction
Definition
transaction.hpp:83
sysio::vm::argument_proxy
Definition
argument_proxy.hpp:16
transaction_context.hpp
libraries
chain
webassembly
cf_transaction.cpp
Generated by
1.12.0