auction-ruby-base 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.travis.yml +15 -0
- data/.yardopts +8 -0
- data/CHANGELOG.md +58 -0
- data/CONTRIBUTING.md +48 -0
- data/Gemfile +15 -0
- data/Guardfile +5 -0
- data/LICENSE.txt +202 -0
- data/README.md +83 -0
- data/Rakefile +4 -0
- data/auction-ruby-base.gemspec +35 -0
- data/examples/create_account.rb +26 -0
- data/examples/low_level_transaction_post.rb +46 -0
- data/examples/mid_level_transaction_post.rb +33 -0
- data/examples/non_native_payment.rb +60 -0
- data/examples/offer.rb +75 -0
- data/examples/transaction_merge.rb +23 -0
- data/generated/stellar-base-generated.rb +174 -0
- data/generated/stellar/account_entry.rb +55 -0
- data/generated/stellar/account_entry/ext.rb +24 -0
- data/generated/stellar/account_flags.rb +31 -0
- data/generated/stellar/account_merge_result.rb +26 -0
- data/generated/stellar/account_merge_result_code.rb +30 -0
- data/generated/stellar/affirm_fail_op.rb +22 -0
- data/generated/stellar/affirm_fail_result.rb +25 -0
- data/generated/stellar/affirm_fail_result_code.rb +22 -0
- data/generated/stellar/affirm_pass_op.rb +24 -0
- data/generated/stellar/affirm_pass_result.rb +25 -0
- data/generated/stellar/affirm_pass_result_code.rb +22 -0
- data/generated/stellar/allow_trust_op.rb +38 -0
- data/generated/stellar/allow_trust_op/asset.rb +33 -0
- data/generated/stellar/allow_trust_result.rb +25 -0
- data/generated/stellar/allow_trust_result_code.rb +31 -0
- data/generated/stellar/asset.rb +47 -0
- data/generated/stellar/asset/alpha_num12.rb +22 -0
- data/generated/stellar/asset/alpha_num4.rb +22 -0
- data/generated/stellar/asset_type.rb +24 -0
- data/generated/stellar/auth.rb +20 -0
- data/generated/stellar/auth_cert.rb +22 -0
- data/generated/stellar/authenticated_message.rb +32 -0
- data/generated/stellar/authenticated_message/v0.rb +24 -0
- data/generated/stellar/bucket_entry.rb +28 -0
- data/generated/stellar/bucket_entry_type.rb +22 -0
- data/generated/stellar/change_trust_op.rb +22 -0
- data/generated/stellar/change_trust_result.rb +25 -0
- data/generated/stellar/change_trust_result_code.rb +31 -0
- data/generated/stellar/claim_offer_atom.rb +33 -0
- data/generated/stellar/create_account_op.rb +20 -0
- data/generated/stellar/create_account_result.rb +25 -0
- data/generated/stellar/create_account_result_code.rb +32 -0
- data/generated/stellar/create_bid_op.rb +20 -0
- data/generated/stellar/create_bid_result.rb +25 -0
- data/generated/stellar/create_bid_result_code.rb +22 -0
- data/generated/stellar/create_lot_op.rb +46 -0
- data/generated/stellar/create_lot_result.rb +25 -0
- data/generated/stellar/create_lot_result_code.rb +22 -0
- data/generated/stellar/create_passive_offer_op.rb +24 -0
- data/generated/stellar/crypto_key_type.rb +20 -0
- data/generated/stellar/curve25519_public.rb +18 -0
- data/generated/stellar/curve25519_secret.rb +18 -0
- data/generated/stellar/decorated_signature.rb +20 -0
- data/generated/stellar/dont_have.rb +20 -0
- data/generated/stellar/envelope_type.rb +24 -0
- data/generated/stellar/error.rb +20 -0
- data/generated/stellar/error_code.rb +28 -0
- data/generated/stellar/hello.rb +34 -0
- data/generated/stellar/hmac_sha256_key.rb +18 -0
- data/generated/stellar/hmac_sha256_mac.rb +18 -0
- data/generated/stellar/inflation_payout.rb +20 -0
- data/generated/stellar/inflation_result.rb +26 -0
- data/generated/stellar/inflation_result_code.rb +24 -0
- data/generated/stellar/ip_addr_type.rb +22 -0
- data/generated/stellar/ledger_entry.rb +52 -0
- data/generated/stellar/ledger_entry/data.rb +49 -0
- data/generated/stellar/ledger_entry/ext.rb +24 -0
- data/generated/stellar/ledger_entry_change.rb +35 -0
- data/generated/stellar/ledger_entry_change_type.rb +26 -0
- data/generated/stellar/ledger_entry_type.rb +32 -0
- data/generated/stellar/ledger_header.rb +69 -0
- data/generated/stellar/ledger_header/ext.rb +24 -0
- data/generated/stellar/ledger_header_history_entry.rb +33 -0
- data/generated/stellar/ledger_header_history_entry/ext.rb +24 -0
- data/generated/stellar/ledger_key.rb +87 -0
- data/generated/stellar/ledger_key/account.rb +20 -0
- data/generated/stellar/ledger_key/lot.rb +22 -0
- data/generated/stellar/ledger_key/message.rb +22 -0
- data/generated/stellar/ledger_key/offer.rb +22 -0
- data/generated/stellar/ledger_key/participant.rb +22 -0
- data/generated/stellar/ledger_key/proof.rb +22 -0
- data/generated/stellar/ledger_key/trust_line.rb +22 -0
- data/generated/stellar/ledger_scp_messages.rb +20 -0
- data/generated/stellar/ledger_upgrade.rb +31 -0
- data/generated/stellar/ledger_upgrade_type.rb +24 -0
- data/generated/stellar/lot_branch.rb +21 -0
- data/generated/stellar/lot_entry.rb +64 -0
- data/generated/stellar/lot_entry/ext.rb +24 -0
- data/generated/stellar/lot_type.rb +21 -0
- data/generated/stellar/manage_offer_effect.rb +24 -0
- data/generated/stellar/manage_offer_op.rb +28 -0
- data/generated/stellar/manage_offer_result.rb +26 -0
- data/generated/stellar/manage_offer_result_code.rb +50 -0
- data/generated/stellar/manage_offer_success_result.rb +34 -0
- data/generated/stellar/manage_offer_success_result/offer.rb +30 -0
- data/generated/stellar/memo.rb +38 -0
- data/generated/stellar/memo_type.rb +28 -0
- data/generated/stellar/message_entry.rb +38 -0
- data/generated/stellar/message_entry/ext.rb +24 -0
- data/generated/stellar/message_type.rb +51 -0
- data/generated/stellar/offer_entry.rb +49 -0
- data/generated/stellar/offer_entry/ext.rb +24 -0
- data/generated/stellar/offer_entry_flags.rb +21 -0
- data/generated/stellar/operation.rb +65 -0
- data/generated/stellar/operation/body.rb +88 -0
- data/generated/stellar/operation_meta.rb +18 -0
- data/generated/stellar/operation_result.rb +67 -0
- data/generated/stellar/operation_result/tr.rb +89 -0
- data/generated/stellar/operation_result_code.rb +25 -0
- data/generated/stellar/operation_type.rb +52 -0
- data/generated/stellar/participant_entry.rb +39 -0
- data/generated/stellar/participant_entry/ext.rb +24 -0
- data/generated/stellar/participant_state.rb +25 -0
- data/generated/stellar/path_payment_op.rb +32 -0
- data/generated/stellar/path_payment_result.rb +38 -0
- data/generated/stellar/path_payment_result/success.rb +22 -0
- data/generated/stellar/path_payment_result_code.rb +47 -0
- data/generated/stellar/payment_op.rb +22 -0
- data/generated/stellar/payment_result.rb +25 -0
- data/generated/stellar/payment_result_code.rb +41 -0
- data/generated/stellar/peer_address.rb +33 -0
- data/generated/stellar/peer_address/ip.rb +29 -0
- data/generated/stellar/price.rb +20 -0
- data/generated/stellar/proof_entry.rb +42 -0
- data/generated/stellar/proof_entry/ext.rb +24 -0
- data/generated/stellar/provide_proof_op.rb +24 -0
- data/generated/stellar/provide_proof_result.rb +25 -0
- data/generated/stellar/provide_proof_result_code.rb +22 -0
- data/generated/stellar/public_key.rb +23 -0
- data/generated/stellar/register_participant_op.rb +22 -0
- data/generated/stellar/register_participant_result.rb +25 -0
- data/generated/stellar/register_participant_result_code.rb +22 -0
- data/generated/stellar/scp_ballot.rb +20 -0
- data/generated/stellar/scp_envelope.rb +20 -0
- data/generated/stellar/scp_history_entry.rb +23 -0
- data/generated/stellar/scp_history_entry_v0.rb +20 -0
- data/generated/stellar/scp_nomination.rb +22 -0
- data/generated/stellar/scp_quorum_set.rb +22 -0
- data/generated/stellar/scp_statement.rb +58 -0
- data/generated/stellar/scp_statement/pledges.rb +63 -0
- data/generated/stellar/scp_statement/pledges/confirm.rb +30 -0
- data/generated/stellar/scp_statement/pledges/externalize.rb +26 -0
- data/generated/stellar/scp_statement/pledges/prepare.rb +32 -0
- data/generated/stellar/scp_statement_type.rb +26 -0
- data/generated/stellar/send_message_op.rb +22 -0
- data/generated/stellar/send_message_result.rb +25 -0
- data/generated/stellar/send_message_result_code.rb +22 -0
- data/generated/stellar/set_options_op.rb +41 -0
- data/generated/stellar/set_options_result.rb +25 -0
- data/generated/stellar/set_options_result_code.rb +40 -0
- data/generated/stellar/signer.rb +20 -0
- data/generated/stellar/simple_payment_result.rb +22 -0
- data/generated/stellar/stellar_message.rb +74 -0
- data/generated/stellar/stellar_value.rb +41 -0
- data/generated/stellar/stellar_value/ext.rb +24 -0
- data/generated/stellar/threshold_indexes.rb +26 -0
- data/generated/stellar/time_bounds.rb +20 -0
- data/generated/stellar/transaction.rb +50 -0
- data/generated/stellar/transaction/ext.rb +24 -0
- data/generated/stellar/transaction_envelope.rb +20 -0
- data/generated/stellar/transaction_history_entry.rb +33 -0
- data/generated/stellar/transaction_history_entry/ext.rb +24 -0
- data/generated/stellar/transaction_history_result_entry.rb +33 -0
- data/generated/stellar/transaction_history_result_entry/ext.rb +24 -0
- data/generated/stellar/transaction_meta.rb +23 -0
- data/generated/stellar/transaction_result.rb +43 -0
- data/generated/stellar/transaction_result/ext.rb +24 -0
- data/generated/stellar/transaction_result/result.rb +30 -0
- data/generated/stellar/transaction_result_code.rb +45 -0
- data/generated/stellar/transaction_result_pair.rb +20 -0
- data/generated/stellar/transaction_result_set.rb +18 -0
- data/generated/stellar/transaction_set.rb +20 -0
- data/generated/stellar/trust_line_entry.rb +41 -0
- data/generated/stellar/trust_line_entry/ext.rb +24 -0
- data/generated/stellar/trust_line_flags.rb +21 -0
- data/lib/stellar-base.rb +33 -0
- data/lib/stellar/account_flags.rb +28 -0
- data/lib/stellar/asset.rb +69 -0
- data/lib/stellar/base.rb +1 -0
- data/lib/stellar/base/version.rb +5 -0
- data/lib/stellar/convert.rb +32 -0
- data/lib/stellar/key_pair.rb +112 -0
- data/lib/stellar/networks.rb +45 -0
- data/lib/stellar/operation.rb +384 -0
- data/lib/stellar/path_payment_result.rb +17 -0
- data/lib/stellar/price.rb +32 -0
- data/lib/stellar/thresholds.rb +39 -0
- data/lib/stellar/transaction.rb +205 -0
- data/lib/stellar/transaction_envelope.rb +32 -0
- data/lib/stellar/util/continued_fraction.rb +96 -0
- data/lib/stellar/util/strkey.rb +43 -0
- data/spec/lib/stellar/account_flags_spec.rb +19 -0
- data/spec/lib/stellar/asset_spec.rb +45 -0
- data/spec/lib/stellar/convert_spec.rb +61 -0
- data/spec/lib/stellar/key_pair_spec.rb +238 -0
- data/spec/lib/stellar/networks_spec.rb +77 -0
- data/spec/lib/stellar/operation_spec.rb +13 -0
- data/spec/lib/stellar/path_payment_result_spec.rb +95 -0
- data/spec/lib/stellar/price_spec.rb +34 -0
- data/spec/lib/stellar/thresholds_spec.rb +62 -0
- data/spec/lib/stellar/transaction_envelope_spec.rb +93 -0
- data/spec/lib/stellar/transaction_spec.rb +83 -0
- data/spec/lib/stellar/util/strkey_spec.rb +46 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/support/matchers/be_strkey.rb +9 -0
- data/spec/support/matchers/eq_bytes.rb +5 -0
- data/spec/support/matchers/have_length.rb +5 -0
- data/tasks/rspec.rake +6 -0
- data/tasks/travis.rake +1 -0
- data/tasks/xdr.rake +50 -0
- data/xdr/Stellar-SCP.x +86 -0
- data/xdr/Stellar-ledger-entries.x +351 -0
- data/xdr/Stellar-ledger.x +288 -0
- data/xdr/Stellar-overlay.x +146 -0
- data/xdr/Stellar-transaction.x +936 -0
- data/xdr/Stellar-types.x +55 -0
- metadata +495 -0
@@ -0,0 +1,146 @@
|
|
1
|
+
// Copyright 2015 Stellar Development Foundation and contributors. Licensed
|
2
|
+
// under the Apache License, Version 2.0. See the COPYING file at the root
|
3
|
+
// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
|
5
|
+
%#include "xdr/Stellar-ledger.h"
|
6
|
+
|
7
|
+
namespace stellar
|
8
|
+
{
|
9
|
+
|
10
|
+
enum ErrorCode
|
11
|
+
{
|
12
|
+
ERR_MISC = 0, // Unspecific error
|
13
|
+
ERR_DATA = 1, // Malformed data
|
14
|
+
ERR_CONF = 2, // Misconfiguration error
|
15
|
+
ERR_AUTH = 3, // Authentication failure
|
16
|
+
ERR_LOAD = 4 // System overloaded
|
17
|
+
};
|
18
|
+
|
19
|
+
struct Error
|
20
|
+
{
|
21
|
+
ErrorCode code;
|
22
|
+
string msg<100>;
|
23
|
+
};
|
24
|
+
|
25
|
+
struct AuthCert
|
26
|
+
{
|
27
|
+
Curve25519Public pubkey;
|
28
|
+
uint64 expiration;
|
29
|
+
Signature sig;
|
30
|
+
};
|
31
|
+
|
32
|
+
struct Hello
|
33
|
+
{
|
34
|
+
uint32 ledgerVersion;
|
35
|
+
uint32 overlayVersion;
|
36
|
+
uint32 overlayMinVersion;
|
37
|
+
Hash networkID;
|
38
|
+
string versionStr<100>;
|
39
|
+
int listeningPort;
|
40
|
+
NodeID peerID;
|
41
|
+
AuthCert cert;
|
42
|
+
uint256 nonce;
|
43
|
+
};
|
44
|
+
|
45
|
+
struct Auth
|
46
|
+
{
|
47
|
+
// Empty message, just to confirm
|
48
|
+
// establishment of MAC keys.
|
49
|
+
int unused;
|
50
|
+
};
|
51
|
+
|
52
|
+
enum IPAddrType
|
53
|
+
{
|
54
|
+
IPv4 = 0,
|
55
|
+
IPv6 = 1
|
56
|
+
};
|
57
|
+
|
58
|
+
struct PeerAddress
|
59
|
+
{
|
60
|
+
union switch (IPAddrType type)
|
61
|
+
{
|
62
|
+
case IPv4:
|
63
|
+
opaque ipv4[4];
|
64
|
+
case IPv6:
|
65
|
+
opaque ipv6[16];
|
66
|
+
}
|
67
|
+
ip;
|
68
|
+
uint32 port;
|
69
|
+
uint32 numFailures;
|
70
|
+
};
|
71
|
+
|
72
|
+
enum MessageType
|
73
|
+
{
|
74
|
+
ERROR_MSG = 0,
|
75
|
+
AUTH = 2,
|
76
|
+
DONT_HAVE = 3,
|
77
|
+
|
78
|
+
GET_PEERS = 4, // gets a list of peers this guy knows about
|
79
|
+
PEERS = 5,
|
80
|
+
|
81
|
+
GET_TX_SET = 6, // gets a particular txset by hash
|
82
|
+
TX_SET = 7,
|
83
|
+
|
84
|
+
TRANSACTION = 8, // pass on a tx you have heard about
|
85
|
+
|
86
|
+
// SCP
|
87
|
+
GET_SCP_QUORUMSET = 9,
|
88
|
+
SCP_QUORUMSET = 10,
|
89
|
+
SCP_MESSAGE = 11,
|
90
|
+
GET_SCP_STATE = 12,
|
91
|
+
|
92
|
+
// new messages
|
93
|
+
HELLO = 13
|
94
|
+
};
|
95
|
+
|
96
|
+
struct DontHave
|
97
|
+
{
|
98
|
+
MessageType type;
|
99
|
+
uint256 reqHash;
|
100
|
+
};
|
101
|
+
|
102
|
+
union StellarMessage switch (MessageType type)
|
103
|
+
{
|
104
|
+
case ERROR_MSG:
|
105
|
+
Error error;
|
106
|
+
case HELLO:
|
107
|
+
Hello hello;
|
108
|
+
case AUTH:
|
109
|
+
Auth auth;
|
110
|
+
case DONT_HAVE:
|
111
|
+
DontHave dontHave;
|
112
|
+
case GET_PEERS:
|
113
|
+
void;
|
114
|
+
case PEERS:
|
115
|
+
PeerAddress peers<>;
|
116
|
+
|
117
|
+
case GET_TX_SET:
|
118
|
+
uint256 txSetHash;
|
119
|
+
case TX_SET:
|
120
|
+
TransactionSet txSet;
|
121
|
+
|
122
|
+
case TRANSACTION:
|
123
|
+
TransactionEnvelope transaction;
|
124
|
+
|
125
|
+
// SCP
|
126
|
+
case GET_SCP_QUORUMSET:
|
127
|
+
uint256 qSetHash;
|
128
|
+
case SCP_QUORUMSET:
|
129
|
+
SCPQuorumSet qSet;
|
130
|
+
case SCP_MESSAGE:
|
131
|
+
SCPEnvelope envelope;
|
132
|
+
case GET_SCP_STATE:
|
133
|
+
uint32 getSCPLedgerSeq; // ledger seq requested ; if 0, requests the latest
|
134
|
+
};
|
135
|
+
|
136
|
+
union AuthenticatedMessage switch (uint32 v)
|
137
|
+
{
|
138
|
+
case 0:
|
139
|
+
struct
|
140
|
+
{
|
141
|
+
uint64 sequence;
|
142
|
+
StellarMessage message;
|
143
|
+
HmacSha256Mac mac;
|
144
|
+
} v0;
|
145
|
+
};
|
146
|
+
}
|
@@ -0,0 +1,936 @@
|
|
1
|
+
// Copyright 2015 Stellar Development Foundation and contributors. Licensed
|
2
|
+
// under the Apache License, Version 2.0. See the COPYING file at the root
|
3
|
+
// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0
|
4
|
+
|
5
|
+
%#include "xdr/Stellar-ledger-entries.h"
|
6
|
+
|
7
|
+
namespace stellar
|
8
|
+
{
|
9
|
+
|
10
|
+
struct DecoratedSignature
|
11
|
+
{
|
12
|
+
SignatureHint hint; // last 4 bytes of the public key, used as a hint
|
13
|
+
Signature signature; // actual signature
|
14
|
+
};
|
15
|
+
|
16
|
+
enum OperationType
|
17
|
+
{
|
18
|
+
CREATE_ACCOUNT = 0,
|
19
|
+
PAYMENT = 1,
|
20
|
+
PATH_PAYMENT = 2,
|
21
|
+
MANAGE_OFFER = 3,
|
22
|
+
CREATE_PASSIVE_OFFER = 4,
|
23
|
+
SET_OPTIONS = 5,
|
24
|
+
CHANGE_TRUST = 6,
|
25
|
+
ALLOW_TRUST = 7,
|
26
|
+
ACCOUNT_MERGE = 8,
|
27
|
+
INFLATION = 9,
|
28
|
+
CREATE_LOT = 10,
|
29
|
+
REGISTER_PARTICIPANT = 11,
|
30
|
+
PROVIDE_PROOF = 12,
|
31
|
+
SEND_MESSAGE = 13,
|
32
|
+
CREATE_BID = 14,
|
33
|
+
AFFIRM_FAIL = 15,
|
34
|
+
AFFIRM_PASS = 16
|
35
|
+
};
|
36
|
+
|
37
|
+
/* CreateAccount
|
38
|
+
Creates and funds a new account with the specified starting balance.
|
39
|
+
|
40
|
+
Threshold: med
|
41
|
+
|
42
|
+
Result: CreateAccountResult
|
43
|
+
|
44
|
+
*/
|
45
|
+
|
46
|
+
struct CreateAccountOp
|
47
|
+
{
|
48
|
+
AccountID destination; // account to create
|
49
|
+
string32 codeKYC;
|
50
|
+
};
|
51
|
+
|
52
|
+
/* CreateLot
|
53
|
+
Creates a new lot
|
54
|
+
|
55
|
+
Threshold: med
|
56
|
+
|
57
|
+
Result: CreateLotResult
|
58
|
+
*/
|
59
|
+
|
60
|
+
struct CreateLotOp
|
61
|
+
{
|
62
|
+
string lotName<1000>; // name of the lot
|
63
|
+
uint32 type;
|
64
|
+
string32 lotCode;
|
65
|
+
string lotAddress<1000>;
|
66
|
+
uint32 lotBranch;
|
67
|
+
string lotLocation<1000>;
|
68
|
+
uint64 startPrice;
|
69
|
+
uint32 minStep;
|
70
|
+
uint32 maxStep;
|
71
|
+
uint64 published;
|
72
|
+
uint64 aucStarted;
|
73
|
+
uint64 duration;
|
74
|
+
uint64 pledge;
|
75
|
+
string details<1000>;
|
76
|
+
AccountID publisherID;
|
77
|
+
};
|
78
|
+
|
79
|
+
/* CreateBid
|
80
|
+
Creates a new bid
|
81
|
+
|
82
|
+
Threshold: med
|
83
|
+
|
84
|
+
Result: CreateBidResult
|
85
|
+
*/
|
86
|
+
|
87
|
+
struct CreateBidOp
|
88
|
+
{
|
89
|
+
uint64 lotID; // name of the lot
|
90
|
+
uint64 amount;
|
91
|
+
};
|
92
|
+
|
93
|
+
/* AffirmFail
|
94
|
+
|
95
|
+
Threshold: med
|
96
|
+
|
97
|
+
Result: AffirmFailResult
|
98
|
+
*/
|
99
|
+
|
100
|
+
struct AffirmFailOp
|
101
|
+
{
|
102
|
+
uint64 lotID;
|
103
|
+
string purpose<1000>;
|
104
|
+
AccountID accountID;
|
105
|
+
};
|
106
|
+
/* AffirmPass
|
107
|
+
|
108
|
+
Threshold: med
|
109
|
+
|
110
|
+
Result: AffirmPassResult
|
111
|
+
*/
|
112
|
+
|
113
|
+
struct AffirmPassOp
|
114
|
+
{
|
115
|
+
uint64 lotID; // name of the lot
|
116
|
+
string paperHash<1000>;
|
117
|
+
string paperLink<1000>;
|
118
|
+
AccountID accountID;
|
119
|
+
};
|
120
|
+
|
121
|
+
/* Register participant
|
122
|
+
|
123
|
+
Threshold: med
|
124
|
+
|
125
|
+
Result: RegisterParticipantResult
|
126
|
+
*/
|
127
|
+
|
128
|
+
struct RegisterParticipantOp
|
129
|
+
{
|
130
|
+
uint64 lotID; // name of the lot
|
131
|
+
AccountID accountID;
|
132
|
+
uint64 bestBid;
|
133
|
+
};
|
134
|
+
|
135
|
+
/* ProvideProof
|
136
|
+
|
137
|
+
Threshold: med
|
138
|
+
|
139
|
+
Result: ProvideProofResult
|
140
|
+
*/
|
141
|
+
|
142
|
+
struct ProvideProofOp
|
143
|
+
{
|
144
|
+
uint64 lotID; // name of the lot
|
145
|
+
uint32 quantity;
|
146
|
+
string proof<1000>;
|
147
|
+
uint64 bankID;
|
148
|
+
};
|
149
|
+
|
150
|
+
/* SendMessage
|
151
|
+
|
152
|
+
Threshold: med
|
153
|
+
|
154
|
+
Result: SendMessageResult
|
155
|
+
*/
|
156
|
+
|
157
|
+
struct SendMessageOp
|
158
|
+
{
|
159
|
+
uint64 lotID; // name of the lot
|
160
|
+
string text<1000>;
|
161
|
+
uint64 refMessage;
|
162
|
+
};
|
163
|
+
|
164
|
+
/* Payment
|
165
|
+
|
166
|
+
Send an amount in specified asset to a destination account.
|
167
|
+
|
168
|
+
Threshold: med
|
169
|
+
|
170
|
+
Result: PaymentResult
|
171
|
+
*/
|
172
|
+
struct PaymentOp
|
173
|
+
{
|
174
|
+
AccountID destination; // recipient of the payment
|
175
|
+
Asset asset; // what they end up with
|
176
|
+
int64 amount; // amount they end up with
|
177
|
+
};
|
178
|
+
|
179
|
+
/* PathPayment
|
180
|
+
|
181
|
+
send an amount to a destination account through a path.
|
182
|
+
(up to sendMax, sendAsset)
|
183
|
+
(X0, Path[0]) .. (Xn, Path[n])
|
184
|
+
(destAmount, destAsset)
|
185
|
+
|
186
|
+
Threshold: med
|
187
|
+
|
188
|
+
Result: PathPaymentResult
|
189
|
+
*/
|
190
|
+
struct PathPaymentOp
|
191
|
+
{
|
192
|
+
Asset sendAsset; // asset we pay with
|
193
|
+
int64 sendMax; // the maximum amount of sendAsset to
|
194
|
+
// send (excluding fees).
|
195
|
+
// The operation will fail if can't be met
|
196
|
+
|
197
|
+
AccountID destination; // recipient of the payment
|
198
|
+
Asset destAsset; // what they end up with
|
199
|
+
int64 destAmount; // amount they end up with
|
200
|
+
|
201
|
+
Asset path<5>; // additional hops it must go through to get there
|
202
|
+
};
|
203
|
+
|
204
|
+
/* Creates, updates or deletes an offer
|
205
|
+
|
206
|
+
Threshold: med
|
207
|
+
|
208
|
+
Result: ManageOfferResult
|
209
|
+
|
210
|
+
*/
|
211
|
+
struct ManageOfferOp
|
212
|
+
{
|
213
|
+
Asset selling;
|
214
|
+
Asset buying;
|
215
|
+
int64 amount; // amount being sold. if set to 0, delete the offer
|
216
|
+
Price price; // price of thing being sold in terms of what you are buying
|
217
|
+
|
218
|
+
// 0=create a new offer, otherwise edit an existing offer
|
219
|
+
uint64 offerID;
|
220
|
+
};
|
221
|
+
|
222
|
+
/* Creates an offer that doesn't take offers of the same price
|
223
|
+
|
224
|
+
Threshold: med
|
225
|
+
|
226
|
+
Result: CreatePassiveOfferResult
|
227
|
+
|
228
|
+
*/
|
229
|
+
struct CreatePassiveOfferOp
|
230
|
+
{
|
231
|
+
Asset selling; // A
|
232
|
+
Asset buying; // B
|
233
|
+
int64 amount; // amount taker gets. if set to 0, delete the offer
|
234
|
+
Price price; // cost of A in terms of B
|
235
|
+
};
|
236
|
+
|
237
|
+
/* Set Account Options
|
238
|
+
|
239
|
+
updates "AccountEntry" fields.
|
240
|
+
note: updating thresholds or signers requires high threshold
|
241
|
+
|
242
|
+
Threshold: med or high
|
243
|
+
|
244
|
+
Result: SetOptionsResult
|
245
|
+
*/
|
246
|
+
|
247
|
+
struct SetOptionsOp
|
248
|
+
{
|
249
|
+
AccountID* inflationDest; // sets the inflation destination
|
250
|
+
|
251
|
+
uint32* clearFlags; // which flags to clear
|
252
|
+
uint32* setFlags; // which flags to set
|
253
|
+
|
254
|
+
// account threshold manipulation
|
255
|
+
uint32* masterWeight; // weight of the master account
|
256
|
+
uint32* lowThreshold;
|
257
|
+
uint32* medThreshold;
|
258
|
+
uint32* highThreshold;
|
259
|
+
|
260
|
+
string32* homeDomain; // sets the home domain
|
261
|
+
|
262
|
+
// Add, update or remove a signer for the account
|
263
|
+
// signer is deleted if the weight is 0
|
264
|
+
Signer* signer;
|
265
|
+
};
|
266
|
+
|
267
|
+
/* Creates, updates or deletes a trust line
|
268
|
+
|
269
|
+
Threshold: med
|
270
|
+
|
271
|
+
Result: ChangeTrustResult
|
272
|
+
|
273
|
+
*/
|
274
|
+
struct ChangeTrustOp
|
275
|
+
{
|
276
|
+
Asset line;
|
277
|
+
|
278
|
+
// if limit is set to 0, deletes the trust line
|
279
|
+
int64 limit;
|
280
|
+
};
|
281
|
+
|
282
|
+
/* Updates the "authorized" flag of an existing trust line
|
283
|
+
this is called by the issuer of the related asset.
|
284
|
+
|
285
|
+
note that authorize can only be set (and not cleared) if
|
286
|
+
the issuer account does not have the AUTH_REVOCABLE_FLAG set
|
287
|
+
Threshold: low
|
288
|
+
|
289
|
+
Result: AllowTrustResult
|
290
|
+
*/
|
291
|
+
struct AllowTrustOp
|
292
|
+
{
|
293
|
+
AccountID trustor;
|
294
|
+
union switch (AssetType type)
|
295
|
+
{
|
296
|
+
// ASSET_TYPE_NATIVE is not allowed
|
297
|
+
case ASSET_TYPE_CREDIT_ALPHANUM4:
|
298
|
+
opaque assetCode4[4];
|
299
|
+
|
300
|
+
case ASSET_TYPE_CREDIT_ALPHANUM12:
|
301
|
+
opaque assetCode12[12];
|
302
|
+
|
303
|
+
// add other asset types here in the future
|
304
|
+
}
|
305
|
+
asset;
|
306
|
+
|
307
|
+
bool authorize;
|
308
|
+
};
|
309
|
+
|
310
|
+
/* Inflation
|
311
|
+
Runs inflation
|
312
|
+
|
313
|
+
Threshold: low
|
314
|
+
|
315
|
+
Result: InflationResult
|
316
|
+
|
317
|
+
*/
|
318
|
+
|
319
|
+
/* AccountMerge
|
320
|
+
Transfers native balance to destination account.
|
321
|
+
|
322
|
+
Threshold: high
|
323
|
+
|
324
|
+
Result : AccountMergeResult
|
325
|
+
*/
|
326
|
+
|
327
|
+
/* An operation is the lowest unit of work that a transaction does */
|
328
|
+
struct Operation
|
329
|
+
{
|
330
|
+
// sourceAccount is the account used to run the operation
|
331
|
+
// if not set, the runtime defaults to "sourceAccount" specified at
|
332
|
+
// the transaction level
|
333
|
+
AccountID* sourceAccount;
|
334
|
+
|
335
|
+
union switch (OperationType type)
|
336
|
+
{
|
337
|
+
case CREATE_ACCOUNT:
|
338
|
+
CreateAccountOp createAccountOp;
|
339
|
+
case PAYMENT:
|
340
|
+
PaymentOp paymentOp;
|
341
|
+
case PATH_PAYMENT:
|
342
|
+
PathPaymentOp pathPaymentOp;
|
343
|
+
case MANAGE_OFFER:
|
344
|
+
ManageOfferOp manageOfferOp;
|
345
|
+
case CREATE_PASSIVE_OFFER:
|
346
|
+
CreatePassiveOfferOp createPassiveOfferOp;
|
347
|
+
case SET_OPTIONS:
|
348
|
+
SetOptionsOp setOptionsOp;
|
349
|
+
case CHANGE_TRUST:
|
350
|
+
ChangeTrustOp changeTrustOp;
|
351
|
+
case ALLOW_TRUST:
|
352
|
+
AllowTrustOp allowTrustOp;
|
353
|
+
case ACCOUNT_MERGE:
|
354
|
+
AccountID destination;
|
355
|
+
case INFLATION:
|
356
|
+
void;
|
357
|
+
case CREATE_LOT:
|
358
|
+
CreateLotOp createLotOp;
|
359
|
+
case REGISTER_PARTICIPANT:
|
360
|
+
RegisterParticipantOp registerParticipantOp;
|
361
|
+
case PROVIDE_PROOF:
|
362
|
+
ProvideProofOp provideProofOp;
|
363
|
+
case SEND_MESSAGE:
|
364
|
+
SendMessageOp sendMessageOp;
|
365
|
+
case CREATE_BID:
|
366
|
+
CreateBidOp createBidOp;
|
367
|
+
case AFFIRM_FAIL:
|
368
|
+
AffirmFailOp affirmFailOp;
|
369
|
+
case AFFIRM_PASS:
|
370
|
+
AffirmPassOp affirmPassOp;
|
371
|
+
}
|
372
|
+
body;
|
373
|
+
};
|
374
|
+
|
375
|
+
enum MemoType
|
376
|
+
{
|
377
|
+
MEMO_NONE = 0,
|
378
|
+
MEMO_TEXT = 1,
|
379
|
+
MEMO_ID = 2,
|
380
|
+
MEMO_HASH = 3,
|
381
|
+
MEMO_RETURN = 4
|
382
|
+
};
|
383
|
+
|
384
|
+
union Memo switch (MemoType type)
|
385
|
+
{
|
386
|
+
case MEMO_NONE:
|
387
|
+
void;
|
388
|
+
case MEMO_TEXT:
|
389
|
+
string text<28>;
|
390
|
+
case MEMO_ID:
|
391
|
+
uint64 id;
|
392
|
+
case MEMO_HASH:
|
393
|
+
Hash hash; // the hash of what to pull from the content server
|
394
|
+
case MEMO_RETURN:
|
395
|
+
Hash retHash; // the hash of the tx you are rejecting
|
396
|
+
};
|
397
|
+
|
398
|
+
struct TimeBounds
|
399
|
+
{
|
400
|
+
uint64 minTime;
|
401
|
+
uint64 maxTime;
|
402
|
+
};
|
403
|
+
|
404
|
+
/* a transaction is a container for a set of operations
|
405
|
+
- is executed by an account
|
406
|
+
- fees are collected from the account
|
407
|
+
- operations are executed in order as one ACID transaction
|
408
|
+
either all operations are applied or none are
|
409
|
+
if any returns a failing code
|
410
|
+
*/
|
411
|
+
|
412
|
+
struct Transaction
|
413
|
+
{
|
414
|
+
// account used to run the transaction
|
415
|
+
AccountID sourceAccount;
|
416
|
+
|
417
|
+
// the fee the sourceAccount will pay
|
418
|
+
uint32 fee;
|
419
|
+
|
420
|
+
// sequence number to consume in the account
|
421
|
+
SequenceNumber seqNum;
|
422
|
+
|
423
|
+
// validity range (inclusive) for the last ledger close time
|
424
|
+
TimeBounds* timeBounds;
|
425
|
+
|
426
|
+
Memo memo;
|
427
|
+
|
428
|
+
Operation operations<100>;
|
429
|
+
|
430
|
+
// reserved for future use
|
431
|
+
union switch (int v)
|
432
|
+
{
|
433
|
+
case 0:
|
434
|
+
void;
|
435
|
+
}
|
436
|
+
ext;
|
437
|
+
};
|
438
|
+
|
439
|
+
/* A TransactionEnvelope wraps a transaction with signatures. */
|
440
|
+
struct TransactionEnvelope
|
441
|
+
{
|
442
|
+
Transaction tx;
|
443
|
+
DecoratedSignature signatures<20>;
|
444
|
+
};
|
445
|
+
|
446
|
+
/* Operation Results section */
|
447
|
+
|
448
|
+
/* This result is used when offers are taken during an operation */
|
449
|
+
struct ClaimOfferAtom
|
450
|
+
{
|
451
|
+
// emitted to identify the offer
|
452
|
+
AccountID sellerID; // Account that owns the offer
|
453
|
+
uint64 offerID;
|
454
|
+
|
455
|
+
// amount and asset taken from the owner
|
456
|
+
Asset assetSold;
|
457
|
+
int64 amountSold;
|
458
|
+
|
459
|
+
// amount and asset sent to the owner
|
460
|
+
Asset assetBought;
|
461
|
+
int64 amountBought;
|
462
|
+
};
|
463
|
+
|
464
|
+
/******* CreateAccount Result ********/
|
465
|
+
|
466
|
+
enum CreateAccountResultCode
|
467
|
+
{
|
468
|
+
// codes considered as "success" for the operation
|
469
|
+
CREATE_ACCOUNT_SUCCESS = 0, // account was created
|
470
|
+
|
471
|
+
// codes considered as "failure" for the operation
|
472
|
+
CREATE_ACCOUNT_MALFORMED = -1, // invalid destination
|
473
|
+
CREATE_ACCOUNT_UNDERFUNDED = -2, // not enough funds in source account
|
474
|
+
CREATE_ACCOUNT_LOW_RESERVE =
|
475
|
+
-3, // would create an account below the min reserve
|
476
|
+
CREATE_ACCOUNT_ALREADY_EXIST = -4 // account already exists
|
477
|
+
};
|
478
|
+
|
479
|
+
union CreateAccountResult switch (CreateAccountResultCode code)
|
480
|
+
{
|
481
|
+
case CREATE_ACCOUNT_SUCCESS:
|
482
|
+
void;
|
483
|
+
default:
|
484
|
+
void;
|
485
|
+
};
|
486
|
+
|
487
|
+
/******* CreateLot Result ********/
|
488
|
+
|
489
|
+
enum CreateLotResultCode
|
490
|
+
{
|
491
|
+
CREATE_LOT_SUCCESS = 0, // lot was created
|
492
|
+
CREATE_LOT_ERROR = 1 // lot was created
|
493
|
+
};
|
494
|
+
|
495
|
+
union CreateLotResult switch (CreateLotResultCode code)
|
496
|
+
{
|
497
|
+
case CREATE_LOT_SUCCESS:
|
498
|
+
void;
|
499
|
+
default:
|
500
|
+
void;
|
501
|
+
};
|
502
|
+
|
503
|
+
/******* CreateBid Result ********/
|
504
|
+
|
505
|
+
enum CreateBidResultCode
|
506
|
+
{
|
507
|
+
CREATE_BID_SUCCESS = 0,
|
508
|
+
CREATE_BID_ERROR = 1
|
509
|
+
};
|
510
|
+
|
511
|
+
union CreateBidResult switch (CreateBidResultCode code)
|
512
|
+
{
|
513
|
+
case CREATE_BID_SUCCESS:
|
514
|
+
void;
|
515
|
+
default:
|
516
|
+
void;
|
517
|
+
};
|
518
|
+
|
519
|
+
/******* AffirmFail Result ********/
|
520
|
+
|
521
|
+
enum AffirmFailResultCode
|
522
|
+
{
|
523
|
+
AFFIRM_FAIL_SUCCESS = 0,
|
524
|
+
AFFIRM_FAIL_ERROR = 1
|
525
|
+
};
|
526
|
+
|
527
|
+
union AffirmFailResult switch (AffirmFailResultCode code)
|
528
|
+
{
|
529
|
+
case AFFIRM_FAIL_SUCCESS:
|
530
|
+
void;
|
531
|
+
default:
|
532
|
+
void;
|
533
|
+
};
|
534
|
+
|
535
|
+
/******* AffirmPass Result ********/
|
536
|
+
|
537
|
+
enum AffirmPassResultCode
|
538
|
+
{
|
539
|
+
AFFIRM_PASS_SUCCESS = 0,
|
540
|
+
AFFIRM_PASS_ERROR = 1
|
541
|
+
};
|
542
|
+
|
543
|
+
union AffirmPassResult switch (AffirmPassResultCode code)
|
544
|
+
{
|
545
|
+
case AFFIRM_PASS_SUCCESS:
|
546
|
+
void;
|
547
|
+
default:
|
548
|
+
void;
|
549
|
+
};
|
550
|
+
|
551
|
+
/******* RegisterParticipant Result ********/
|
552
|
+
|
553
|
+
enum RegisterParticipantResultCode
|
554
|
+
{
|
555
|
+
REGISTER_PARTICIPANT_SUCCESS = 0, // lot was created
|
556
|
+
REGISTER_PARTICIPANT_ERROR = 1 // lot was created
|
557
|
+
};
|
558
|
+
|
559
|
+
union RegisterParticipantResult switch (RegisterParticipantResultCode code)
|
560
|
+
{
|
561
|
+
case REGISTER_PARTICIPANT_SUCCESS:
|
562
|
+
void;
|
563
|
+
default:
|
564
|
+
void;
|
565
|
+
};
|
566
|
+
|
567
|
+
/******* ProvideProof Result ********/
|
568
|
+
|
569
|
+
enum ProvideProofResultCode
|
570
|
+
{
|
571
|
+
PROVIDE_PROOF_SUCCESS = 0,
|
572
|
+
PROVIDE_PROOF_ERROR = 1
|
573
|
+
};
|
574
|
+
|
575
|
+
union ProvideProofResult switch (ProvideProofResultCode code)
|
576
|
+
{
|
577
|
+
case PROVIDE_PROOF_SUCCESS:
|
578
|
+
void;
|
579
|
+
default:
|
580
|
+
void;
|
581
|
+
};
|
582
|
+
|
583
|
+
/******* SendMessage Result ********/
|
584
|
+
|
585
|
+
enum SendMessageResultCode
|
586
|
+
{
|
587
|
+
SEND_MESSAGE_SUCCESS = 0, // lot was created
|
588
|
+
SEND_MESSAGE_ERROR = 1 // lot was created
|
589
|
+
};
|
590
|
+
|
591
|
+
union SendMessageResult switch (SendMessageResultCode code)
|
592
|
+
{
|
593
|
+
case SEND_MESSAGE_SUCCESS:
|
594
|
+
void;
|
595
|
+
default:
|
596
|
+
void;
|
597
|
+
};
|
598
|
+
|
599
|
+
/******* Payment Result ********/
|
600
|
+
|
601
|
+
enum PaymentResultCode
|
602
|
+
{
|
603
|
+
// codes considered as "success" for the operation
|
604
|
+
PAYMENT_SUCCESS = 0, // payment successfuly completed
|
605
|
+
|
606
|
+
// codes considered as "failure" for the operation
|
607
|
+
PAYMENT_MALFORMED = -1, // bad input
|
608
|
+
PAYMENT_UNDERFUNDED = -2, // not enough funds in source account
|
609
|
+
PAYMENT_SRC_NO_TRUST = -3, // no trust line on source account
|
610
|
+
PAYMENT_SRC_NOT_AUTHORIZED = -4, // source not authorized to transfer
|
611
|
+
PAYMENT_NO_DESTINATION = -5, // destination account does not exist
|
612
|
+
PAYMENT_NO_TRUST = -6, // destination missing a trust line for asset
|
613
|
+
PAYMENT_NOT_AUTHORIZED = -7, // destination not authorized to hold asset
|
614
|
+
PAYMENT_LINE_FULL = -8, // destination would go above their limit
|
615
|
+
PAYMENT_NO_ISSUER = -9 // missing issuer on asset
|
616
|
+
};
|
617
|
+
|
618
|
+
union PaymentResult switch (PaymentResultCode code)
|
619
|
+
{
|
620
|
+
case PAYMENT_SUCCESS:
|
621
|
+
void;
|
622
|
+
default:
|
623
|
+
void;
|
624
|
+
};
|
625
|
+
|
626
|
+
/******* Payment Result ********/
|
627
|
+
|
628
|
+
enum PathPaymentResultCode
|
629
|
+
{
|
630
|
+
// codes considered as "success" for the operation
|
631
|
+
PATH_PAYMENT_SUCCESS = 0, // success
|
632
|
+
|
633
|
+
// codes considered as "failure" for the operation
|
634
|
+
PATH_PAYMENT_MALFORMED = -1, // bad input
|
635
|
+
PATH_PAYMENT_UNDERFUNDED = -2, // not enough funds in source account
|
636
|
+
PATH_PAYMENT_SRC_NO_TRUST = -3, // no trust line on source account
|
637
|
+
PATH_PAYMENT_SRC_NOT_AUTHORIZED = -4, // source not authorized to transfer
|
638
|
+
PATH_PAYMENT_NO_DESTINATION = -5, // destination account does not exist
|
639
|
+
PATH_PAYMENT_NO_TRUST = -6, // dest missing a trust line for asset
|
640
|
+
PATH_PAYMENT_NOT_AUTHORIZED = -7, // dest not authorized to hold asset
|
641
|
+
PATH_PAYMENT_LINE_FULL = -8, // dest would go above their limit
|
642
|
+
PATH_PAYMENT_NO_ISSUER = -9, // missing issuer on one asset
|
643
|
+
PATH_PAYMENT_TOO_FEW_OFFERS = -10, // not enough offers to satisfy path
|
644
|
+
PATH_PAYMENT_OFFER_CROSS_SELF = -11, // would cross one of its own offers
|
645
|
+
PATH_PAYMENT_OVER_SENDMAX = -12 // could not satisfy sendmax
|
646
|
+
};
|
647
|
+
|
648
|
+
struct SimplePaymentResult
|
649
|
+
{
|
650
|
+
AccountID destination;
|
651
|
+
Asset asset;
|
652
|
+
int64 amount;
|
653
|
+
};
|
654
|
+
|
655
|
+
union PathPaymentResult switch (PathPaymentResultCode code)
|
656
|
+
{
|
657
|
+
case PATH_PAYMENT_SUCCESS:
|
658
|
+
struct
|
659
|
+
{
|
660
|
+
ClaimOfferAtom offers<>;
|
661
|
+
SimplePaymentResult last;
|
662
|
+
} success;
|
663
|
+
case PATH_PAYMENT_NO_ISSUER:
|
664
|
+
Asset noIssuer; // the asset that caused the error
|
665
|
+
default:
|
666
|
+
void;
|
667
|
+
};
|
668
|
+
|
669
|
+
/******* ManageOffer Result ********/
|
670
|
+
|
671
|
+
enum ManageOfferResultCode
|
672
|
+
{
|
673
|
+
// codes considered as "success" for the operation
|
674
|
+
MANAGE_OFFER_SUCCESS = 0,
|
675
|
+
|
676
|
+
// codes considered as "failure" for the operation
|
677
|
+
MANAGE_OFFER_MALFORMED = -1, // generated offer would be invalid
|
678
|
+
MANAGE_OFFER_SELL_NO_TRUST = -2, // no trust line for what we're selling
|
679
|
+
MANAGE_OFFER_BUY_NO_TRUST = -3, // no trust line for what we're buying
|
680
|
+
MANAGE_OFFER_SELL_NOT_AUTHORIZED = -4, // not authorized to sell
|
681
|
+
MANAGE_OFFER_BUY_NOT_AUTHORIZED = -5, // not authorized to buy
|
682
|
+
MANAGE_OFFER_LINE_FULL = -6, // can't receive more of what it's buying
|
683
|
+
MANAGE_OFFER_UNDERFUNDED = -7, // doesn't hold what it's trying to sell
|
684
|
+
MANAGE_OFFER_CROSS_SELF = -8, // would cross an offer from the same user
|
685
|
+
MANAGE_OFFER_SELL_NO_ISSUER = -9, // no issuer for what we're selling
|
686
|
+
MANAGE_OFFER_BUY_NO_ISSUER = -10, // no issuer for what we're buying
|
687
|
+
|
688
|
+
// update errors
|
689
|
+
MANAGE_OFFER_NOT_FOUND = -11, // offerID does not match an existing offer
|
690
|
+
|
691
|
+
MANAGE_OFFER_LOW_RESERVE = -12 // not enough funds to create a new Offer
|
692
|
+
};
|
693
|
+
|
694
|
+
enum ManageOfferEffect
|
695
|
+
{
|
696
|
+
MANAGE_OFFER_CREATED = 0,
|
697
|
+
MANAGE_OFFER_UPDATED = 1,
|
698
|
+
MANAGE_OFFER_DELETED = 2
|
699
|
+
};
|
700
|
+
|
701
|
+
struct ManageOfferSuccessResult
|
702
|
+
{
|
703
|
+
// offers that got claimed while creating this offer
|
704
|
+
ClaimOfferAtom offersClaimed<>;
|
705
|
+
|
706
|
+
union switch (ManageOfferEffect effect)
|
707
|
+
{
|
708
|
+
case MANAGE_OFFER_CREATED:
|
709
|
+
case MANAGE_OFFER_UPDATED:
|
710
|
+
OfferEntry offer;
|
711
|
+
default:
|
712
|
+
void;
|
713
|
+
}
|
714
|
+
offer;
|
715
|
+
};
|
716
|
+
|
717
|
+
union ManageOfferResult switch (ManageOfferResultCode code)
|
718
|
+
{
|
719
|
+
case MANAGE_OFFER_SUCCESS:
|
720
|
+
ManageOfferSuccessResult success;
|
721
|
+
default:
|
722
|
+
void;
|
723
|
+
};
|
724
|
+
|
725
|
+
/******* SetOptions Result ********/
|
726
|
+
|
727
|
+
enum SetOptionsResultCode
|
728
|
+
{
|
729
|
+
// codes considered as "success" for the operation
|
730
|
+
SET_OPTIONS_SUCCESS = 0,
|
731
|
+
// codes considered as "failure" for the operation
|
732
|
+
SET_OPTIONS_LOW_RESERVE = -1, // not enough funds to add a signer
|
733
|
+
SET_OPTIONS_TOO_MANY_SIGNERS = -2, // max number of signers already reached
|
734
|
+
SET_OPTIONS_BAD_FLAGS = -3, // invalid combination of clear/set flags
|
735
|
+
SET_OPTIONS_INVALID_INFLATION = -4, // inflation account does not exist
|
736
|
+
SET_OPTIONS_CANT_CHANGE = -5, // can no longer change this option
|
737
|
+
SET_OPTIONS_UNKNOWN_FLAG = -6, // can't set an unknown flag
|
738
|
+
SET_OPTIONS_THRESHOLD_OUT_OF_RANGE = -7, // bad value for weight/threshold
|
739
|
+
SET_OPTIONS_BAD_SIGNER = -8, // signer cannot be masterkey
|
740
|
+
SET_OPTIONS_INVALID_HOME_DOMAIN = -9 // malformed home domain
|
741
|
+
};
|
742
|
+
|
743
|
+
union SetOptionsResult switch (SetOptionsResultCode code)
|
744
|
+
{
|
745
|
+
case SET_OPTIONS_SUCCESS:
|
746
|
+
void;
|
747
|
+
default:
|
748
|
+
void;
|
749
|
+
};
|
750
|
+
|
751
|
+
/******* ChangeTrust Result ********/
|
752
|
+
|
753
|
+
enum ChangeTrustResultCode
|
754
|
+
{
|
755
|
+
// codes considered as "success" for the operation
|
756
|
+
CHANGE_TRUST_SUCCESS = 0,
|
757
|
+
// codes considered as "failure" for the operation
|
758
|
+
CHANGE_TRUST_MALFORMED = -1, // bad input
|
759
|
+
CHANGE_TRUST_NO_ISSUER = -2, // could not find issuer
|
760
|
+
CHANGE_TRUST_INVALID_LIMIT = -3, // cannot drop limit below balance
|
761
|
+
// cannot create with a limit of 0
|
762
|
+
CHANGE_TRUST_LOW_RESERVE = -4 // not enough funds to create a new trust line
|
763
|
+
};
|
764
|
+
|
765
|
+
union ChangeTrustResult switch (ChangeTrustResultCode code)
|
766
|
+
{
|
767
|
+
case CHANGE_TRUST_SUCCESS:
|
768
|
+
void;
|
769
|
+
default:
|
770
|
+
void;
|
771
|
+
};
|
772
|
+
|
773
|
+
/******* AllowTrust Result ********/
|
774
|
+
|
775
|
+
enum AllowTrustResultCode
|
776
|
+
{
|
777
|
+
// codes considered as "success" for the operation
|
778
|
+
ALLOW_TRUST_SUCCESS = 0,
|
779
|
+
// codes considered as "failure" for the operation
|
780
|
+
ALLOW_TRUST_MALFORMED = -1, // asset is not ASSET_TYPE_ALPHANUM
|
781
|
+
ALLOW_TRUST_NO_TRUST_LINE = -2, // trustor does not have a trustline
|
782
|
+
// source account does not require trust
|
783
|
+
ALLOW_TRUST_TRUST_NOT_REQUIRED = -3,
|
784
|
+
ALLOW_TRUST_CANT_REVOKE = -4 // source account can't revoke trust
|
785
|
+
};
|
786
|
+
|
787
|
+
union AllowTrustResult switch (AllowTrustResultCode code)
|
788
|
+
{
|
789
|
+
case ALLOW_TRUST_SUCCESS:
|
790
|
+
void;
|
791
|
+
default:
|
792
|
+
void;
|
793
|
+
};
|
794
|
+
|
795
|
+
/******* AccountMerge Result ********/
|
796
|
+
|
797
|
+
enum AccountMergeResultCode
|
798
|
+
{
|
799
|
+
// codes considered as "success" for the operation
|
800
|
+
ACCOUNT_MERGE_SUCCESS = 0,
|
801
|
+
// codes considered as "failure" for the operation
|
802
|
+
ACCOUNT_MERGE_MALFORMED = -1, // can't merge onto itself
|
803
|
+
ACCOUNT_MERGE_NO_ACCOUNT = -2, // destination does not exist
|
804
|
+
ACCOUNT_MERGE_IMMUTABLE_SET = -3, // source account has AUTH_IMMUTABLE set
|
805
|
+
ACCOUNT_MERGE_HAS_SUB_ENTRIES = -4 // account has trust lines/offers
|
806
|
+
};
|
807
|
+
|
808
|
+
union AccountMergeResult switch (AccountMergeResultCode code)
|
809
|
+
{
|
810
|
+
case ACCOUNT_MERGE_SUCCESS:
|
811
|
+
int64 sourceAccountBalance; // how much got transfered from source account
|
812
|
+
default:
|
813
|
+
void;
|
814
|
+
};
|
815
|
+
|
816
|
+
/******* Inflation Result ********/
|
817
|
+
|
818
|
+
enum InflationResultCode
|
819
|
+
{
|
820
|
+
// codes considered as "success" for the operation
|
821
|
+
INFLATION_SUCCESS = 0,
|
822
|
+
// codes considered as "failure" for the operation
|
823
|
+
INFLATION_NOT_TIME = -1
|
824
|
+
};
|
825
|
+
|
826
|
+
struct InflationPayout // or use PaymentResultAtom to limit types?
|
827
|
+
{
|
828
|
+
AccountID destination;
|
829
|
+
int64 amount;
|
830
|
+
};
|
831
|
+
|
832
|
+
union InflationResult switch (InflationResultCode code)
|
833
|
+
{
|
834
|
+
case INFLATION_SUCCESS:
|
835
|
+
InflationPayout payouts<>;
|
836
|
+
default:
|
837
|
+
void;
|
838
|
+
};
|
839
|
+
|
840
|
+
/* High level Operation Result */
|
841
|
+
|
842
|
+
enum OperationResultCode
|
843
|
+
{
|
844
|
+
opINNER = 0, // inner object result is valid
|
845
|
+
|
846
|
+
opBAD_AUTH = -1, // too few valid signatures / wrong network
|
847
|
+
opNO_ACCOUNT = -2 // source account was not found
|
848
|
+
};
|
849
|
+
|
850
|
+
union OperationResult switch (OperationResultCode code)
|
851
|
+
{
|
852
|
+
case opINNER:
|
853
|
+
union switch (OperationType type)
|
854
|
+
{
|
855
|
+
case CREATE_ACCOUNT:
|
856
|
+
CreateAccountResult createAccountResult;
|
857
|
+
case PAYMENT:
|
858
|
+
PaymentResult paymentResult;
|
859
|
+
case PATH_PAYMENT:
|
860
|
+
PathPaymentResult pathPaymentResult;
|
861
|
+
case MANAGE_OFFER:
|
862
|
+
ManageOfferResult manageOfferResult;
|
863
|
+
case CREATE_PASSIVE_OFFER:
|
864
|
+
ManageOfferResult createPassiveOfferResult;
|
865
|
+
case SET_OPTIONS:
|
866
|
+
SetOptionsResult setOptionsResult;
|
867
|
+
case CHANGE_TRUST:
|
868
|
+
ChangeTrustResult changeTrustResult;
|
869
|
+
case ALLOW_TRUST:
|
870
|
+
AllowTrustResult allowTrustResult;
|
871
|
+
case ACCOUNT_MERGE:
|
872
|
+
AccountMergeResult accountMergeResult;
|
873
|
+
case INFLATION:
|
874
|
+
InflationResult inflationResult;
|
875
|
+
case CREATE_LOT:
|
876
|
+
CreateLotResult createLotResult;
|
877
|
+
case REGISTER_PARTICIPANT:
|
878
|
+
RegisterParticipantResult registerParticipantResult;
|
879
|
+
case PROVIDE_PROOF:
|
880
|
+
ProvideProofResult provideProofResult;
|
881
|
+
case SEND_MESSAGE:
|
882
|
+
SendMessageResult sendMessageResult;
|
883
|
+
case CREATE_BID:
|
884
|
+
CreateBidResult createBidResult;
|
885
|
+
case AFFIRM_FAIL:
|
886
|
+
AffirmFailResult affirmFailResult;
|
887
|
+
case AFFIRM_PASS:
|
888
|
+
AffirmPassResult affirmPassResult;
|
889
|
+
}
|
890
|
+
tr;
|
891
|
+
default:
|
892
|
+
void;
|
893
|
+
};
|
894
|
+
|
895
|
+
enum TransactionResultCode
|
896
|
+
{
|
897
|
+
txSUCCESS = 0, // all operations succeeded
|
898
|
+
|
899
|
+
txFAILED = -1, // one of the operations failed (none were applied)
|
900
|
+
|
901
|
+
txTOO_EARLY = -2, // ledger closeTime before minTime
|
902
|
+
txTOO_LATE = -3, // ledger closeTime after maxTime
|
903
|
+
txMISSING_OPERATION = -4, // no operation was specified
|
904
|
+
txBAD_SEQ = -5, // sequence number does not match source account
|
905
|
+
|
906
|
+
txBAD_AUTH = -6, // too few valid signatures / wrong network
|
907
|
+
txINSUFFICIENT_BALANCE = -7, // fee would bring account below reserve
|
908
|
+
txNO_ACCOUNT = -8, // source account not found
|
909
|
+
txINSUFFICIENT_FEE = -9, // fee is too small
|
910
|
+
txBAD_AUTH_EXTRA = -10, // unused signatures attached to transaction
|
911
|
+
txINTERNAL_ERROR = -11 // an unknown error occured
|
912
|
+
};
|
913
|
+
|
914
|
+
struct TransactionResult
|
915
|
+
{
|
916
|
+
int64 feeCharged; // actual fee charged for the transaction
|
917
|
+
|
918
|
+
union switch (TransactionResultCode code)
|
919
|
+
{
|
920
|
+
case txSUCCESS:
|
921
|
+
case txFAILED:
|
922
|
+
OperationResult results<>;
|
923
|
+
default:
|
924
|
+
void;
|
925
|
+
}
|
926
|
+
result;
|
927
|
+
|
928
|
+
// reserved for future use
|
929
|
+
union switch (int v)
|
930
|
+
{
|
931
|
+
case 0:
|
932
|
+
void;
|
933
|
+
}
|
934
|
+
ext;
|
935
|
+
};
|
936
|
+
}
|