rippled
Loading...
Searching...
No Matches
escrow.h
1#pragma once
2
3#include <test/jtx/Account.h>
4#include <test/jtx/Env.h>
5#include <test/jtx/TestHelpers.h>
6#include <test/jtx/owners.h>
7#include <test/jtx/rate.h>
8
9#include <xrpl/protocol/Indexes.h>
10
11namespace xrpl {
12namespace test {
13namespace jtx {
14
16namespace escrow {
17
19create(AccountID const& account, AccountID const& to, STAmount const& amount);
20
21inline Json::Value
22create(Account const& account, Account const& to, STAmount const& amount)
23{
24 return create(account.id(), to.id(), amount);
25}
26
28finish(AccountID const& account, AccountID const& from, std::uint32_t seq);
29
30inline Json::Value
31finish(Account const& account, Account const& from, std::uint32_t seq)
32{
33 return finish(account.id(), from.id(), seq);
34}
35
37cancel(AccountID const& account, Account const& from, std::uint32_t seq);
38
39inline Json::Value
40cancel(Account const& account, Account const& from, std::uint32_t seq)
41{
42 return cancel(account.id(), from, seq);
43}
44
45Rate
46rate(Env& env, Account const& account, std::uint32_t const& seq);
47
48// A PreimageSha256 fulfillments and its associated condition.
49std::array<std::uint8_t, 4> const fb1 = {{0xA0, 0x02, 0x80, 0x00}};
50
51std::array<std::uint8_t, 39> const cb1 = {{0xA0, 0x25, 0x80, 0x20, 0xE3, 0xB0, 0xC4, 0x42, 0x98, 0xFC,
52 0x1C, 0x14, 0x9A, 0xFB, 0xF4, 0xC8, 0x99, 0x6F, 0xB9, 0x24,
53 0x27, 0xAE, 0x41, 0xE4, 0x64, 0x9B, 0x93, 0x4C, 0xA4, 0x95,
54 0x99, 0x1B, 0x78, 0x52, 0xB8, 0x55, 0x81, 0x01, 0x00}};
55
56// Another PreimageSha256 fulfillments and its associated condition.
57std::array<std::uint8_t, 7> const fb2 = {{0xA0, 0x05, 0x80, 0x03, 0x61, 0x61, 0x61}};
58
59std::array<std::uint8_t, 39> const cb2 = {{0xA0, 0x25, 0x80, 0x20, 0x98, 0x34, 0x87, 0x6D, 0xCF, 0xB0,
60 0x5C, 0xB1, 0x67, 0xA5, 0xC2, 0x49, 0x53, 0xEB, 0xA5, 0x8C,
61 0x4A, 0xC8, 0x9B, 0x1A, 0xDF, 0x57, 0xF2, 0x8F, 0x2F, 0x9D,
62 0x09, 0xAF, 0x10, 0x7E, 0xE8, 0xF0, 0x81, 0x01, 0x03}};
63
64// Another PreimageSha256 fulfillment and its associated condition.
65std::array<std::uint8_t, 8> const fb3 = {{0xA0, 0x06, 0x80, 0x04, 0x6E, 0x69, 0x6B, 0x62}};
66
67std::array<std::uint8_t, 39> const cb3 = {{0xA0, 0x25, 0x80, 0x20, 0x6E, 0x4C, 0x71, 0x45, 0x30, 0xC0,
68 0xA4, 0x26, 0x8B, 0x3F, 0xA6, 0x3B, 0x1B, 0x60, 0x6F, 0x2D,
69 0x26, 0x4A, 0x2D, 0x85, 0x7B, 0xE8, 0xA0, 0x9C, 0x1D, 0xFD,
70 0x57, 0x0D, 0x15, 0x85, 0x8B, 0xD4, 0x81, 0x01, 0x04}};
71
73auto const finish_time = JTxFieldWrapper<timePointField>(sfFinishAfter);
74
76auto const cancel_time = JTxFieldWrapper<timePointField>(sfCancelAfter);
77
78auto const condition = JTxFieldWrapper<blobField>(sfCondition);
79
80auto const fulfillment = JTxFieldWrapper<blobField>(sfFulfillment);
81
82} // namespace escrow
83
84} // namespace jtx
85
86} // namespace test
87} // namespace xrpl
Represents a JSON value.
Definition json_value.h:130
Immutable cryptographic account descriptor.
Definition Account.h:19
AccountID id() const
Returns the Account ID.
Definition Account.h:87
A transaction testing environment.
Definition Env.h:119
auto const finish_time
Set the "FinishAfter" time tag on a JTx.
Definition escrow.h:73
Json::Value create(AccountID const &account, AccountID const &to, STAmount const &amount)
Definition escrow.cpp:14
std::array< std::uint8_t, 39 > const cb3
Definition escrow.h:67
auto const condition
Definition escrow.h:78
Rate rate(Env &env, Account const &account, std::uint32_t const &seq)
Definition escrow.cpp:50
std::array< std::uint8_t, 7 > const fb2
Definition escrow.h:57
Json::Value cancel(AccountID const &account, Account const &from, std::uint32_t seq)
Definition escrow.cpp:38
std::array< std::uint8_t, 39 > const cb2
Definition escrow.h:59
std::array< std::uint8_t, 39 > const cb1
Definition escrow.h:51
auto const cancel_time
Set the "CancelAfter" time tag on a JTx.
Definition escrow.h:76
auto const fulfillment
Definition escrow.h:80
Json::Value finish(AccountID const &account, AccountID const &from, std::uint32_t seq)
Definition escrow.cpp:26
std::array< std::uint8_t, 8 > const fb3
Definition escrow.h:65
std::array< std::uint8_t, 4 > const fb1
Definition escrow.h:49
auto const amount
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
Represents a transfer rate.
Definition Rate.h:20
Set the sequence number on a JTx.
Definition seq.h:14