stellar-base 0.19.0 → 0.23.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{LICENSE.txt → LICENSE} +0 -0
- data/README.md +2 -3
- data/generated/stellar-base-generated.rb +45 -8
- data/generated/stellar/allow_trust_op.rb +5 -4
- data/generated/stellar/allow_trust_op/asset.rb +4 -4
- data/generated/stellar/asset.rb +2 -2
- data/generated/stellar/asset/alpha_num12.rb +2 -2
- data/generated/stellar/asset/alpha_num4.rb +2 -2
- data/generated/stellar/authenticated_message.rb +4 -4
- data/generated/stellar/authenticated_message/v0.rb +4 -4
- data/generated/stellar/bucket_entry.rb +6 -0
- data/generated/stellar/bucket_entry_type.rb +8 -2
- data/generated/stellar/bucket_metadata.rb +32 -0
- data/generated/stellar/bucket_metadata/ext.rb +24 -0
- data/generated/stellar/claim_offer_atom.rb +2 -2
- data/generated/stellar/{create_passive_offer_op.rb → create_passive_sell_offer_op.rb} +2 -2
- data/generated/stellar/crypto_key_type.rb +8 -4
- data/generated/stellar/curve25519_public.rb +1 -1
- data/generated/stellar/curve25519_secret.rb +1 -1
- data/generated/stellar/envelope_type.rb +10 -4
- data/generated/stellar/fee_bump_transaction.rb +39 -0
- data/generated/stellar/fee_bump_transaction/ext.rb +24 -0
- data/generated/stellar/fee_bump_transaction/inner_tx.rb +25 -0
- data/generated/stellar/fee_bump_transaction_envelope.rb +22 -0
- data/generated/stellar/hmac_sha256_key.rb +1 -1
- data/generated/stellar/hmac_sha256_mac.rb +1 -1
- data/generated/stellar/inner_transaction_result.rb +56 -0
- data/generated/stellar/inner_transaction_result/ext.rb +24 -0
- data/generated/stellar/inner_transaction_result/result.rb +52 -0
- data/generated/stellar/inner_transaction_result_pair.rb +20 -0
- data/generated/stellar/ledger_close_meta.rb +23 -0
- data/generated/stellar/ledger_close_meta_v0.rb +35 -0
- data/generated/stellar/ledger_close_value_signature.rb +20 -0
- data/generated/stellar/ledger_key.rb +1 -1
- data/generated/stellar/ledger_key/offer.rb +2 -2
- data/generated/stellar/manage_buy_offer_op.rb +29 -0
- data/generated/stellar/{manage_offer_result.rb → manage_buy_offer_result.rb} +5 -5
- data/generated/stellar/manage_buy_offer_result_code.rb +51 -0
- data/generated/stellar/{manage_offer_op.rb → manage_sell_offer_op.rb} +4 -4
- data/generated/stellar/manage_sell_offer_result.rb +26 -0
- data/generated/stellar/manage_sell_offer_result_code.rb +54 -0
- data/generated/stellar/message_type.rb +6 -1
- data/generated/stellar/muxed_account.rb +35 -0
- data/generated/stellar/muxed_account/med25519.rb +22 -0
- data/generated/stellar/offer_entry.rb +2 -2
- data/generated/stellar/operation.rb +13 -9
- data/generated/stellar/operation/body.rb +37 -29
- data/generated/stellar/operation_result.rb +10 -6
- data/generated/stellar/operation_result/tr.rb +38 -30
- data/generated/stellar/operation_result_code.rb +11 -7
- data/generated/stellar/operation_type.rb +20 -16
- data/generated/stellar/{path_payment_op.rb → path_payment_strict_receive_op.rb} +6 -6
- data/generated/stellar/path_payment_strict_receive_result.rb +38 -0
- data/generated/stellar/path_payment_strict_receive_result/success.rb +22 -0
- data/generated/stellar/path_payment_strict_receive_result_code.rb +56 -0
- data/generated/stellar/path_payment_strict_send_op.rb +32 -0
- data/generated/stellar/{path_payment_result.rb → path_payment_strict_send_result.rb} +7 -7
- data/generated/stellar/{path_payment_result → path_payment_strict_send_result}/success.rb +1 -1
- data/generated/stellar/path_payment_strict_send_result_code.rb +55 -0
- data/generated/stellar/payment_op.rb +4 -4
- data/generated/stellar/peer_stats.rb +48 -0
- data/generated/stellar/signed_survey_request_message.rb +20 -0
- data/generated/stellar/signed_survey_response_message.rb +20 -0
- data/generated/stellar/signer.rb +1 -1
- data/generated/stellar/stellar_message.rb +22 -12
- data/generated/stellar/stellar_value.rb +7 -5
- data/generated/stellar/stellar_value/ext.rb +8 -4
- data/generated/stellar/stellar_value_type.rb +22 -0
- data/generated/stellar/survey_message_command_type.rb +20 -0
- data/generated/stellar/survey_request_message.rb +26 -0
- data/generated/stellar/survey_response_body.rb +23 -0
- data/generated/stellar/survey_response_message.rb +26 -0
- data/generated/stellar/time_bounds.rb +4 -4
- data/generated/stellar/topology_response_body.rb +25 -0
- data/generated/stellar/transaction.rb +4 -4
- data/generated/stellar/transaction_envelope.rb +17 -8
- data/generated/stellar/transaction_meta.rb +4 -0
- data/generated/stellar/transaction_meta_v1.rb +1 -1
- data/generated/stellar/transaction_meta_v2.rb +24 -0
- data/generated/stellar/transaction_result.rb +3 -0
- data/generated/stellar/transaction_result/result.rb +9 -3
- data/generated/stellar/transaction_result_code.rb +21 -14
- data/generated/stellar/transaction_result_meta.rb +22 -0
- data/generated/stellar/transaction_signature_payload.rb +3 -1
- data/generated/stellar/transaction_signature_payload/tagged_transaction.rb +7 -3
- data/generated/stellar/transaction_v0.rb +39 -0
- data/generated/stellar/transaction_v0/ext.rb +24 -0
- data/generated/stellar/transaction_v0_envelope.rb +22 -0
- data/generated/stellar/transaction_v1_envelope.rb +22 -0
- data/generated/stellar/trust_line_flags.rb +6 -2
- data/generated/stellar/upgrade_entry_meta.rb +20 -0
- data/lib/stellar-base.rb +28 -23
- data/lib/stellar/account_flags.rb +2 -4
- data/lib/stellar/asset.rb +6 -6
- data/lib/stellar/base.rb +1 -1
- data/lib/stellar/compat.rb +21 -0
- data/lib/stellar/concerns/transaction.rb +49 -0
- data/lib/stellar/convert.rb +2 -2
- data/lib/stellar/factories.rb +1 -3
- data/lib/stellar/fee_bump_transaction.rb +21 -0
- data/lib/stellar/key_pair.rb +9 -6
- data/lib/stellar/networks.rb +5 -7
- data/lib/stellar/operation.rb +428 -317
- data/lib/stellar/{path_payment_result.rb → path_payment_strict_receive_result.rb} +2 -3
- data/lib/stellar/price.rb +2 -4
- data/lib/stellar/signer_key.rb +4 -8
- data/lib/stellar/thresholds.rb +5 -7
- data/lib/stellar/transaction.rb +154 -169
- data/lib/stellar/transaction_builder.rb +149 -0
- data/lib/stellar/transaction_envelope.rb +40 -8
- data/lib/stellar/transaction_v0.rb +39 -0
- data/lib/stellar/util/continued_fraction.rb +19 -19
- data/lib/stellar/util/strkey.rb +39 -14
- data/lib/stellar/{base/version.rb → version.rb} +1 -1
- metadata +68 -210
- data/.gitignore +0 -17
- data/.travis.yml +0 -13
- data/.yardopts +0 -8
- data/CHANGELOG.md +0 -120
- data/CONTRIBUTING.md +0 -48
- data/Gemfile +0 -15
- data/Guardfile +0 -5
- data/Rakefile +0 -4
- data/examples/create_account.rb +0 -26
- data/examples/low_level_transaction_post.rb +0 -46
- data/examples/mid_level_transaction_post.rb +0 -33
- data/examples/non_native_payment.rb +0 -60
- data/examples/offer.rb +0 -75
- data/examples/transaction_merge.rb +0 -23
- data/generated/stellar/manage_offer_result_code.rb +0 -50
- data/generated/stellar/path_payment_result_code.rb +0 -47
- data/ruby-stellar-base.gemspec +0 -34
- data/spec/lib/stellar/account_flags_spec.rb +0 -19
- data/spec/lib/stellar/asset_spec.rb +0 -45
- data/spec/lib/stellar/convert_spec.rb +0 -61
- data/spec/lib/stellar/key_pair_spec.rb +0 -251
- data/spec/lib/stellar/networks_spec.rb +0 -77
- data/spec/lib/stellar/operation_spec.rb +0 -71
- data/spec/lib/stellar/path_payment_result_spec.rb +0 -95
- data/spec/lib/stellar/price_spec.rb +0 -34
- data/spec/lib/stellar/signer_key_spec.rb +0 -26
- data/spec/lib/stellar/thresholds_spec.rb +0 -62
- data/spec/lib/stellar/transaction_envelope_spec.rb +0 -93
- data/spec/lib/stellar/transaction_spec.rb +0 -100
- data/spec/lib/stellar/util/strkey_spec.rb +0 -54
- data/spec/spec_helper.rb +0 -16
- data/spec/support/matchers/be_strkey.rb +0 -9
- data/spec/support/matchers/eq_bytes.rb +0 -5
- data/spec/support/matchers/have_length.rb +0 -5
- data/tasks/rspec.rake +0 -6
- data/tasks/travis.rake +0 -1
- data/tasks/xdr.rake +0 -50
- data/xdr/Stellar-SCP.x +0 -86
- data/xdr/Stellar-ledger-entries.x +0 -288
- data/xdr/Stellar-ledger.x +0 -283
- data/xdr/Stellar-overlay.x +0 -146
- data/xdr/Stellar-transaction.x +0 -777
- data/xdr/Stellar-types.x +0 -81
data/xdr/Stellar-ledger.x
DELETED
@@ -1,283 +0,0 @@
|
|
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-SCP.h"
|
6
|
-
%#include "xdr/Stellar-transaction.h"
|
7
|
-
|
8
|
-
namespace stellar
|
9
|
-
{
|
10
|
-
|
11
|
-
typedef opaque UpgradeType<128>;
|
12
|
-
|
13
|
-
/* StellarValue is the value used by SCP to reach consensus on a given ledger
|
14
|
-
*/
|
15
|
-
struct StellarValue
|
16
|
-
{
|
17
|
-
Hash txSetHash; // transaction set to apply to previous ledger
|
18
|
-
uint64 closeTime; // network close time
|
19
|
-
|
20
|
-
// upgrades to apply to the previous ledger (usually empty)
|
21
|
-
// this is a vector of encoded 'LedgerUpgrade' so that nodes can drop
|
22
|
-
// unknown steps during consensus if needed.
|
23
|
-
// see notes below on 'LedgerUpgrade' for more detail
|
24
|
-
// max size is dictated by number of upgrade types (+ room for future)
|
25
|
-
UpgradeType upgrades<6>;
|
26
|
-
|
27
|
-
// reserved for future use
|
28
|
-
union switch (int v)
|
29
|
-
{
|
30
|
-
case 0:
|
31
|
-
void;
|
32
|
-
}
|
33
|
-
ext;
|
34
|
-
};
|
35
|
-
|
36
|
-
/* The LedgerHeader is the highest level structure representing the
|
37
|
-
* state of a ledger, cryptographically linked to previous ledgers.
|
38
|
-
*/
|
39
|
-
struct LedgerHeader
|
40
|
-
{
|
41
|
-
uint32 ledgerVersion; // the protocol version of the ledger
|
42
|
-
Hash previousLedgerHash; // hash of the previous ledger header
|
43
|
-
StellarValue scpValue; // what consensus agreed to
|
44
|
-
Hash txSetResultHash; // the TransactionResultSet that led to this ledger
|
45
|
-
Hash bucketListHash; // hash of the ledger state
|
46
|
-
|
47
|
-
uint32 ledgerSeq; // sequence number of this ledger
|
48
|
-
|
49
|
-
int64 totalCoins; // total number of stroops in existence.
|
50
|
-
// 10,000,000 stroops in 1 XLM
|
51
|
-
|
52
|
-
int64 feePool; // fees burned since last inflation run
|
53
|
-
uint32 inflationSeq; // inflation sequence number
|
54
|
-
|
55
|
-
uint64 idPool; // last used global ID, used for generating objects
|
56
|
-
|
57
|
-
uint32 baseFee; // base fee per operation in stroops
|
58
|
-
uint32 baseReserve; // account base reserve in stroops
|
59
|
-
|
60
|
-
uint32 maxTxSetSize; // maximum size a transaction set can be
|
61
|
-
|
62
|
-
Hash skipList[4]; // hashes of ledgers in the past. allows you to jump back
|
63
|
-
// in time without walking the chain back ledger by ledger
|
64
|
-
// each slot contains the oldest ledger that is mod of
|
65
|
-
// either 50 5000 50000 or 500000 depending on index
|
66
|
-
// skipList[0] mod(50), skipList[1] mod(5000), etc
|
67
|
-
|
68
|
-
// reserved for future use
|
69
|
-
union switch (int v)
|
70
|
-
{
|
71
|
-
case 0:
|
72
|
-
void;
|
73
|
-
}
|
74
|
-
ext;
|
75
|
-
};
|
76
|
-
|
77
|
-
/* Ledger upgrades
|
78
|
-
note that the `upgrades` field from StellarValue is normalized such that
|
79
|
-
it only contains one entry per LedgerUpgradeType, and entries are sorted
|
80
|
-
in ascending order
|
81
|
-
*/
|
82
|
-
enum LedgerUpgradeType
|
83
|
-
{
|
84
|
-
LEDGER_UPGRADE_VERSION = 1,
|
85
|
-
LEDGER_UPGRADE_BASE_FEE = 2,
|
86
|
-
LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3,
|
87
|
-
LEDGER_UPGRADE_BASE_RESERVE = 4
|
88
|
-
};
|
89
|
-
|
90
|
-
union LedgerUpgrade switch (LedgerUpgradeType type)
|
91
|
-
{
|
92
|
-
case LEDGER_UPGRADE_VERSION:
|
93
|
-
uint32 newLedgerVersion; // update ledgerVersion
|
94
|
-
case LEDGER_UPGRADE_BASE_FEE:
|
95
|
-
uint32 newBaseFee; // update baseFee
|
96
|
-
case LEDGER_UPGRADE_MAX_TX_SET_SIZE:
|
97
|
-
uint32 newMaxTxSetSize; // update maxTxSetSize
|
98
|
-
case LEDGER_UPGRADE_BASE_RESERVE:
|
99
|
-
uint32 newBaseReserve; // update baseReserve
|
100
|
-
};
|
101
|
-
|
102
|
-
/* Entries used to define the bucket list */
|
103
|
-
|
104
|
-
union LedgerKey switch (LedgerEntryType type)
|
105
|
-
{
|
106
|
-
case ACCOUNT:
|
107
|
-
struct
|
108
|
-
{
|
109
|
-
AccountID accountID;
|
110
|
-
} account;
|
111
|
-
|
112
|
-
case TRUSTLINE:
|
113
|
-
struct
|
114
|
-
{
|
115
|
-
AccountID accountID;
|
116
|
-
Asset asset;
|
117
|
-
} trustLine;
|
118
|
-
|
119
|
-
case OFFER:
|
120
|
-
struct
|
121
|
-
{
|
122
|
-
AccountID sellerID;
|
123
|
-
uint64 offerID;
|
124
|
-
} offer;
|
125
|
-
|
126
|
-
case DATA:
|
127
|
-
struct
|
128
|
-
{
|
129
|
-
AccountID accountID;
|
130
|
-
string64 dataName;
|
131
|
-
} data;
|
132
|
-
};
|
133
|
-
|
134
|
-
enum BucketEntryType
|
135
|
-
{
|
136
|
-
LIVEENTRY = 0,
|
137
|
-
DEADENTRY = 1
|
138
|
-
};
|
139
|
-
|
140
|
-
union BucketEntry switch (BucketEntryType type)
|
141
|
-
{
|
142
|
-
case LIVEENTRY:
|
143
|
-
LedgerEntry liveEntry;
|
144
|
-
|
145
|
-
case DEADENTRY:
|
146
|
-
LedgerKey deadEntry;
|
147
|
-
};
|
148
|
-
|
149
|
-
// Transaction sets are the unit used by SCP to decide on transitions
|
150
|
-
// between ledgers
|
151
|
-
struct TransactionSet
|
152
|
-
{
|
153
|
-
Hash previousLedgerHash;
|
154
|
-
TransactionEnvelope txs<>;
|
155
|
-
};
|
156
|
-
|
157
|
-
struct TransactionResultPair
|
158
|
-
{
|
159
|
-
Hash transactionHash;
|
160
|
-
TransactionResult result; // result for the transaction
|
161
|
-
};
|
162
|
-
|
163
|
-
// TransactionResultSet is used to recover results between ledgers
|
164
|
-
struct TransactionResultSet
|
165
|
-
{
|
166
|
-
TransactionResultPair results<>;
|
167
|
-
};
|
168
|
-
|
169
|
-
// Entries below are used in the historical subsystem
|
170
|
-
|
171
|
-
struct TransactionHistoryEntry
|
172
|
-
{
|
173
|
-
uint32 ledgerSeq;
|
174
|
-
TransactionSet txSet;
|
175
|
-
|
176
|
-
// reserved for future use
|
177
|
-
union switch (int v)
|
178
|
-
{
|
179
|
-
case 0:
|
180
|
-
void;
|
181
|
-
}
|
182
|
-
ext;
|
183
|
-
};
|
184
|
-
|
185
|
-
struct TransactionHistoryResultEntry
|
186
|
-
{
|
187
|
-
uint32 ledgerSeq;
|
188
|
-
TransactionResultSet txResultSet;
|
189
|
-
|
190
|
-
// reserved for future use
|
191
|
-
union switch (int v)
|
192
|
-
{
|
193
|
-
case 0:
|
194
|
-
void;
|
195
|
-
}
|
196
|
-
ext;
|
197
|
-
};
|
198
|
-
|
199
|
-
struct LedgerHeaderHistoryEntry
|
200
|
-
{
|
201
|
-
Hash hash;
|
202
|
-
LedgerHeader header;
|
203
|
-
|
204
|
-
// reserved for future use
|
205
|
-
union switch (int v)
|
206
|
-
{
|
207
|
-
case 0:
|
208
|
-
void;
|
209
|
-
}
|
210
|
-
ext;
|
211
|
-
};
|
212
|
-
|
213
|
-
// historical SCP messages
|
214
|
-
|
215
|
-
struct LedgerSCPMessages
|
216
|
-
{
|
217
|
-
uint32 ledgerSeq;
|
218
|
-
SCPEnvelope messages<>;
|
219
|
-
};
|
220
|
-
|
221
|
-
// note: ledgerMessages may refer to any quorumSets encountered
|
222
|
-
// in the file so far, not just the one from this entry
|
223
|
-
struct SCPHistoryEntryV0
|
224
|
-
{
|
225
|
-
SCPQuorumSet quorumSets<>; // additional quorum sets used by ledgerMessages
|
226
|
-
LedgerSCPMessages ledgerMessages;
|
227
|
-
};
|
228
|
-
|
229
|
-
// SCP history file is an array of these
|
230
|
-
union SCPHistoryEntry switch (int v)
|
231
|
-
{
|
232
|
-
case 0:
|
233
|
-
SCPHistoryEntryV0 v0;
|
234
|
-
};
|
235
|
-
|
236
|
-
// represents the meta in the transaction table history
|
237
|
-
|
238
|
-
// STATE is emitted every time a ledger entry is modified/deleted
|
239
|
-
// and the entry was not already modified in the current ledger
|
240
|
-
|
241
|
-
enum LedgerEntryChangeType
|
242
|
-
{
|
243
|
-
LEDGER_ENTRY_CREATED = 0, // entry was added to the ledger
|
244
|
-
LEDGER_ENTRY_UPDATED = 1, // entry was modified in the ledger
|
245
|
-
LEDGER_ENTRY_REMOVED = 2, // entry was removed from the ledger
|
246
|
-
LEDGER_ENTRY_STATE = 3 // value of the entry
|
247
|
-
};
|
248
|
-
|
249
|
-
union LedgerEntryChange switch (LedgerEntryChangeType type)
|
250
|
-
{
|
251
|
-
case LEDGER_ENTRY_CREATED:
|
252
|
-
LedgerEntry created;
|
253
|
-
case LEDGER_ENTRY_UPDATED:
|
254
|
-
LedgerEntry updated;
|
255
|
-
case LEDGER_ENTRY_REMOVED:
|
256
|
-
LedgerKey removed;
|
257
|
-
case LEDGER_ENTRY_STATE:
|
258
|
-
LedgerEntry state;
|
259
|
-
};
|
260
|
-
|
261
|
-
typedef LedgerEntryChange LedgerEntryChanges<>;
|
262
|
-
|
263
|
-
struct OperationMeta
|
264
|
-
{
|
265
|
-
LedgerEntryChanges changes;
|
266
|
-
};
|
267
|
-
|
268
|
-
struct TransactionMetaV1
|
269
|
-
{
|
270
|
-
LedgerEntryChanges txChanges; // tx level changes if any
|
271
|
-
OperationMeta operations<>; // meta for each operation
|
272
|
-
};
|
273
|
-
|
274
|
-
// this is the meta produced when applying transactions
|
275
|
-
// it does not include pre-apply updates such as fees
|
276
|
-
union TransactionMeta switch (int v)
|
277
|
-
{
|
278
|
-
case 0:
|
279
|
-
OperationMeta operations<>;
|
280
|
-
case 1:
|
281
|
-
TransactionMetaV1 v1;
|
282
|
-
};
|
283
|
-
}
|
data/xdr/Stellar-overlay.x
DELETED
@@ -1,146 +0,0 @@
|
|
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<100>;
|
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
|
-
}
|
data/xdr/Stellar-transaction.x
DELETED
@@ -1,777 +0,0 @@
|
|
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
|
-
MANAGE_DATA = 10,
|
29
|
-
BUMP_SEQUENCE = 11
|
30
|
-
};
|
31
|
-
|
32
|
-
/* CreateAccount
|
33
|
-
Creates and funds a new account with the specified starting balance.
|
34
|
-
|
35
|
-
Threshold: med
|
36
|
-
|
37
|
-
Result: CreateAccountResult
|
38
|
-
|
39
|
-
*/
|
40
|
-
|
41
|
-
struct CreateAccountOp
|
42
|
-
{
|
43
|
-
AccountID destination; // account to create
|
44
|
-
int64 startingBalance; // amount they end up with
|
45
|
-
};
|
46
|
-
|
47
|
-
/* Payment
|
48
|
-
|
49
|
-
Send an amount in specified asset to a destination account.
|
50
|
-
|
51
|
-
Threshold: med
|
52
|
-
|
53
|
-
Result: PaymentResult
|
54
|
-
*/
|
55
|
-
struct PaymentOp
|
56
|
-
{
|
57
|
-
AccountID destination; // recipient of the payment
|
58
|
-
Asset asset; // what they end up with
|
59
|
-
int64 amount; // amount they end up with
|
60
|
-
};
|
61
|
-
|
62
|
-
/* PathPayment
|
63
|
-
|
64
|
-
send an amount to a destination account through a path.
|
65
|
-
(up to sendMax, sendAsset)
|
66
|
-
(X0, Path[0]) .. (Xn, Path[n])
|
67
|
-
(destAmount, destAsset)
|
68
|
-
|
69
|
-
Threshold: med
|
70
|
-
|
71
|
-
Result: PathPaymentResult
|
72
|
-
*/
|
73
|
-
struct PathPaymentOp
|
74
|
-
{
|
75
|
-
Asset sendAsset; // asset we pay with
|
76
|
-
int64 sendMax; // the maximum amount of sendAsset to
|
77
|
-
// send (excluding fees).
|
78
|
-
// The operation will fail if can't be met
|
79
|
-
|
80
|
-
AccountID destination; // recipient of the payment
|
81
|
-
Asset destAsset; // what they end up with
|
82
|
-
int64 destAmount; // amount they end up with
|
83
|
-
|
84
|
-
Asset path<5>; // additional hops it must go through to get there
|
85
|
-
};
|
86
|
-
|
87
|
-
/* Creates, updates or deletes an offer
|
88
|
-
|
89
|
-
Threshold: med
|
90
|
-
|
91
|
-
Result: ManageOfferResult
|
92
|
-
|
93
|
-
*/
|
94
|
-
struct ManageOfferOp
|
95
|
-
{
|
96
|
-
Asset selling;
|
97
|
-
Asset buying;
|
98
|
-
int64 amount; // amount being sold. if set to 0, delete the offer
|
99
|
-
Price price; // price of thing being sold in terms of what you are buying
|
100
|
-
|
101
|
-
// 0=create a new offer, otherwise edit an existing offer
|
102
|
-
uint64 offerID;
|
103
|
-
};
|
104
|
-
|
105
|
-
/* Creates an offer that doesn't take offers of the same price
|
106
|
-
|
107
|
-
Threshold: med
|
108
|
-
|
109
|
-
Result: CreatePassiveOfferResult
|
110
|
-
|
111
|
-
*/
|
112
|
-
struct CreatePassiveOfferOp
|
113
|
-
{
|
114
|
-
Asset selling; // A
|
115
|
-
Asset buying; // B
|
116
|
-
int64 amount; // amount taker gets. if set to 0, delete the offer
|
117
|
-
Price price; // cost of A in terms of B
|
118
|
-
};
|
119
|
-
|
120
|
-
/* Set Account Options
|
121
|
-
|
122
|
-
updates "AccountEntry" fields.
|
123
|
-
note: updating thresholds or signers requires high threshold
|
124
|
-
|
125
|
-
Threshold: med or high
|
126
|
-
|
127
|
-
Result: SetOptionsResult
|
128
|
-
*/
|
129
|
-
|
130
|
-
struct SetOptionsOp
|
131
|
-
{
|
132
|
-
AccountID* inflationDest; // sets the inflation destination
|
133
|
-
|
134
|
-
uint32* clearFlags; // which flags to clear
|
135
|
-
uint32* setFlags; // which flags to set
|
136
|
-
|
137
|
-
// account threshold manipulation
|
138
|
-
uint32* masterWeight; // weight of the master account
|
139
|
-
uint32* lowThreshold;
|
140
|
-
uint32* medThreshold;
|
141
|
-
uint32* highThreshold;
|
142
|
-
|
143
|
-
string32* homeDomain; // sets the home domain
|
144
|
-
|
145
|
-
// Add, update or remove a signer for the account
|
146
|
-
// signer is deleted if the weight is 0
|
147
|
-
Signer* signer;
|
148
|
-
};
|
149
|
-
|
150
|
-
/* Creates, updates or deletes a trust line
|
151
|
-
|
152
|
-
Threshold: med
|
153
|
-
|
154
|
-
Result: ChangeTrustResult
|
155
|
-
|
156
|
-
*/
|
157
|
-
struct ChangeTrustOp
|
158
|
-
{
|
159
|
-
Asset line;
|
160
|
-
|
161
|
-
// if limit is set to 0, deletes the trust line
|
162
|
-
int64 limit;
|
163
|
-
};
|
164
|
-
|
165
|
-
/* Updates the "authorized" flag of an existing trust line
|
166
|
-
this is called by the issuer of the related asset.
|
167
|
-
|
168
|
-
note that authorize can only be set (and not cleared) if
|
169
|
-
the issuer account does not have the AUTH_REVOCABLE_FLAG set
|
170
|
-
Threshold: low
|
171
|
-
|
172
|
-
Result: AllowTrustResult
|
173
|
-
*/
|
174
|
-
struct AllowTrustOp
|
175
|
-
{
|
176
|
-
AccountID trustor;
|
177
|
-
union switch (AssetType type)
|
178
|
-
{
|
179
|
-
// ASSET_TYPE_NATIVE is not allowed
|
180
|
-
case ASSET_TYPE_CREDIT_ALPHANUM4:
|
181
|
-
opaque assetCode4[4];
|
182
|
-
|
183
|
-
case ASSET_TYPE_CREDIT_ALPHANUM12:
|
184
|
-
opaque assetCode12[12];
|
185
|
-
|
186
|
-
// add other asset types here in the future
|
187
|
-
}
|
188
|
-
asset;
|
189
|
-
|
190
|
-
bool authorize;
|
191
|
-
};
|
192
|
-
|
193
|
-
/* Inflation
|
194
|
-
Runs inflation
|
195
|
-
|
196
|
-
Threshold: low
|
197
|
-
|
198
|
-
Result: InflationResult
|
199
|
-
|
200
|
-
*/
|
201
|
-
|
202
|
-
/* AccountMerge
|
203
|
-
Transfers native balance to destination account.
|
204
|
-
|
205
|
-
Threshold: high
|
206
|
-
|
207
|
-
Result : AccountMergeResult
|
208
|
-
*/
|
209
|
-
|
210
|
-
/* ManageData
|
211
|
-
Adds, Updates, or Deletes a key value pair associated with a particular
|
212
|
-
account.
|
213
|
-
|
214
|
-
Threshold: med
|
215
|
-
|
216
|
-
Result: ManageDataResult
|
217
|
-
*/
|
218
|
-
|
219
|
-
struct ManageDataOp
|
220
|
-
{
|
221
|
-
string64 dataName;
|
222
|
-
DataValue* dataValue; // set to null to clear
|
223
|
-
};
|
224
|
-
|
225
|
-
/* Bump Sequence
|
226
|
-
|
227
|
-
increases the sequence to a given level
|
228
|
-
|
229
|
-
Threshold: low
|
230
|
-
|
231
|
-
Result: BumpSequenceResult
|
232
|
-
*/
|
233
|
-
|
234
|
-
struct BumpSequenceOp
|
235
|
-
{
|
236
|
-
SequenceNumber bumpTo;
|
237
|
-
};
|
238
|
-
|
239
|
-
/* An operation is the lowest unit of work that a transaction does */
|
240
|
-
struct Operation
|
241
|
-
{
|
242
|
-
// sourceAccount is the account used to run the operation
|
243
|
-
// if not set, the runtime defaults to "sourceAccount" specified at
|
244
|
-
// the transaction level
|
245
|
-
AccountID* sourceAccount;
|
246
|
-
|
247
|
-
union switch (OperationType type)
|
248
|
-
{
|
249
|
-
case CREATE_ACCOUNT:
|
250
|
-
CreateAccountOp createAccountOp;
|
251
|
-
case PAYMENT:
|
252
|
-
PaymentOp paymentOp;
|
253
|
-
case PATH_PAYMENT:
|
254
|
-
PathPaymentOp pathPaymentOp;
|
255
|
-
case MANAGE_OFFER:
|
256
|
-
ManageOfferOp manageOfferOp;
|
257
|
-
case CREATE_PASSIVE_OFFER:
|
258
|
-
CreatePassiveOfferOp createPassiveOfferOp;
|
259
|
-
case SET_OPTIONS:
|
260
|
-
SetOptionsOp setOptionsOp;
|
261
|
-
case CHANGE_TRUST:
|
262
|
-
ChangeTrustOp changeTrustOp;
|
263
|
-
case ALLOW_TRUST:
|
264
|
-
AllowTrustOp allowTrustOp;
|
265
|
-
case ACCOUNT_MERGE:
|
266
|
-
AccountID destination;
|
267
|
-
case INFLATION:
|
268
|
-
void;
|
269
|
-
case MANAGE_DATA:
|
270
|
-
ManageDataOp manageDataOp;
|
271
|
-
case BUMP_SEQUENCE:
|
272
|
-
BumpSequenceOp bumpSequenceOp;
|
273
|
-
}
|
274
|
-
body;
|
275
|
-
};
|
276
|
-
|
277
|
-
enum MemoType
|
278
|
-
{
|
279
|
-
MEMO_NONE = 0,
|
280
|
-
MEMO_TEXT = 1,
|
281
|
-
MEMO_ID = 2,
|
282
|
-
MEMO_HASH = 3,
|
283
|
-
MEMO_RETURN = 4
|
284
|
-
};
|
285
|
-
|
286
|
-
union Memo switch (MemoType type)
|
287
|
-
{
|
288
|
-
case MEMO_NONE:
|
289
|
-
void;
|
290
|
-
case MEMO_TEXT:
|
291
|
-
string text<28>;
|
292
|
-
case MEMO_ID:
|
293
|
-
uint64 id;
|
294
|
-
case MEMO_HASH:
|
295
|
-
Hash hash; // the hash of what to pull from the content server
|
296
|
-
case MEMO_RETURN:
|
297
|
-
Hash retHash; // the hash of the tx you are rejecting
|
298
|
-
};
|
299
|
-
|
300
|
-
struct TimeBounds
|
301
|
-
{
|
302
|
-
uint64 minTime;
|
303
|
-
uint64 maxTime; // 0 here means no maxTime
|
304
|
-
};
|
305
|
-
|
306
|
-
/* a transaction is a container for a set of operations
|
307
|
-
- is executed by an account
|
308
|
-
- fees are collected from the account
|
309
|
-
- operations are executed in order as one ACID transaction
|
310
|
-
either all operations are applied or none are
|
311
|
-
if any returns a failing code
|
312
|
-
*/
|
313
|
-
|
314
|
-
struct Transaction
|
315
|
-
{
|
316
|
-
// account used to run the transaction
|
317
|
-
AccountID sourceAccount;
|
318
|
-
|
319
|
-
// the fee the sourceAccount will pay
|
320
|
-
uint32 fee;
|
321
|
-
|
322
|
-
// sequence number to consume in the account
|
323
|
-
SequenceNumber seqNum;
|
324
|
-
|
325
|
-
// validity range (inclusive) for the last ledger close time
|
326
|
-
TimeBounds* timeBounds;
|
327
|
-
|
328
|
-
Memo memo;
|
329
|
-
|
330
|
-
Operation operations<100>;
|
331
|
-
|
332
|
-
// reserved for future use
|
333
|
-
union switch (int v)
|
334
|
-
{
|
335
|
-
case 0:
|
336
|
-
void;
|
337
|
-
}
|
338
|
-
ext;
|
339
|
-
};
|
340
|
-
|
341
|
-
struct TransactionSignaturePayload
|
342
|
-
{
|
343
|
-
Hash networkId;
|
344
|
-
union switch (EnvelopeType type)
|
345
|
-
{
|
346
|
-
case ENVELOPE_TYPE_TX:
|
347
|
-
Transaction tx;
|
348
|
-
/* All other values of type are invalid */
|
349
|
-
}
|
350
|
-
taggedTransaction;
|
351
|
-
};
|
352
|
-
|
353
|
-
/* A TransactionEnvelope wraps a transaction with signatures. */
|
354
|
-
struct TransactionEnvelope
|
355
|
-
{
|
356
|
-
Transaction tx;
|
357
|
-
/* Each decorated signature is a signature over the SHA256 hash of
|
358
|
-
* a TransactionSignaturePayload */
|
359
|
-
DecoratedSignature signatures<20>;
|
360
|
-
};
|
361
|
-
|
362
|
-
/* Operation Results section */
|
363
|
-
|
364
|
-
/* This result is used when offers are taken during an operation */
|
365
|
-
struct ClaimOfferAtom
|
366
|
-
{
|
367
|
-
// emitted to identify the offer
|
368
|
-
AccountID sellerID; // Account that owns the offer
|
369
|
-
uint64 offerID;
|
370
|
-
|
371
|
-
// amount and asset taken from the owner
|
372
|
-
Asset assetSold;
|
373
|
-
int64 amountSold;
|
374
|
-
|
375
|
-
// amount and asset sent to the owner
|
376
|
-
Asset assetBought;
|
377
|
-
int64 amountBought;
|
378
|
-
};
|
379
|
-
|
380
|
-
/******* CreateAccount Result ********/
|
381
|
-
|
382
|
-
enum CreateAccountResultCode
|
383
|
-
{
|
384
|
-
// codes considered as "success" for the operation
|
385
|
-
CREATE_ACCOUNT_SUCCESS = 0, // account was created
|
386
|
-
|
387
|
-
// codes considered as "failure" for the operation
|
388
|
-
CREATE_ACCOUNT_MALFORMED = -1, // invalid destination
|
389
|
-
CREATE_ACCOUNT_UNDERFUNDED = -2, // not enough funds in source account
|
390
|
-
CREATE_ACCOUNT_LOW_RESERVE =
|
391
|
-
-3, // would create an account below the min reserve
|
392
|
-
CREATE_ACCOUNT_ALREADY_EXIST = -4 // account already exists
|
393
|
-
};
|
394
|
-
|
395
|
-
union CreateAccountResult switch (CreateAccountResultCode code)
|
396
|
-
{
|
397
|
-
case CREATE_ACCOUNT_SUCCESS:
|
398
|
-
void;
|
399
|
-
default:
|
400
|
-
void;
|
401
|
-
};
|
402
|
-
|
403
|
-
/******* Payment Result ********/
|
404
|
-
|
405
|
-
enum PaymentResultCode
|
406
|
-
{
|
407
|
-
// codes considered as "success" for the operation
|
408
|
-
PAYMENT_SUCCESS = 0, // payment successfuly completed
|
409
|
-
|
410
|
-
// codes considered as "failure" for the operation
|
411
|
-
PAYMENT_MALFORMED = -1, // bad input
|
412
|
-
PAYMENT_UNDERFUNDED = -2, // not enough funds in source account
|
413
|
-
PAYMENT_SRC_NO_TRUST = -3, // no trust line on source account
|
414
|
-
PAYMENT_SRC_NOT_AUTHORIZED = -4, // source not authorized to transfer
|
415
|
-
PAYMENT_NO_DESTINATION = -5, // destination account does not exist
|
416
|
-
PAYMENT_NO_TRUST = -6, // destination missing a trust line for asset
|
417
|
-
PAYMENT_NOT_AUTHORIZED = -7, // destination not authorized to hold asset
|
418
|
-
PAYMENT_LINE_FULL = -8, // destination would go above their limit
|
419
|
-
PAYMENT_NO_ISSUER = -9 // missing issuer on asset
|
420
|
-
};
|
421
|
-
|
422
|
-
union PaymentResult switch (PaymentResultCode code)
|
423
|
-
{
|
424
|
-
case PAYMENT_SUCCESS:
|
425
|
-
void;
|
426
|
-
default:
|
427
|
-
void;
|
428
|
-
};
|
429
|
-
|
430
|
-
/******* Payment Result ********/
|
431
|
-
|
432
|
-
enum PathPaymentResultCode
|
433
|
-
{
|
434
|
-
// codes considered as "success" for the operation
|
435
|
-
PATH_PAYMENT_SUCCESS = 0, // success
|
436
|
-
|
437
|
-
// codes considered as "failure" for the operation
|
438
|
-
PATH_PAYMENT_MALFORMED = -1, // bad input
|
439
|
-
PATH_PAYMENT_UNDERFUNDED = -2, // not enough funds in source account
|
440
|
-
PATH_PAYMENT_SRC_NO_TRUST = -3, // no trust line on source account
|
441
|
-
PATH_PAYMENT_SRC_NOT_AUTHORIZED = -4, // source not authorized to transfer
|
442
|
-
PATH_PAYMENT_NO_DESTINATION = -5, // destination account does not exist
|
443
|
-
PATH_PAYMENT_NO_TRUST = -6, // dest missing a trust line for asset
|
444
|
-
PATH_PAYMENT_NOT_AUTHORIZED = -7, // dest not authorized to hold asset
|
445
|
-
PATH_PAYMENT_LINE_FULL = -8, // dest would go above their limit
|
446
|
-
PATH_PAYMENT_NO_ISSUER = -9, // missing issuer on one asset
|
447
|
-
PATH_PAYMENT_TOO_FEW_OFFERS = -10, // not enough offers to satisfy path
|
448
|
-
PATH_PAYMENT_OFFER_CROSS_SELF = -11, // would cross one of its own offers
|
449
|
-
PATH_PAYMENT_OVER_SENDMAX = -12 // could not satisfy sendmax
|
450
|
-
};
|
451
|
-
|
452
|
-
struct SimplePaymentResult
|
453
|
-
{
|
454
|
-
AccountID destination;
|
455
|
-
Asset asset;
|
456
|
-
int64 amount;
|
457
|
-
};
|
458
|
-
|
459
|
-
union PathPaymentResult switch (PathPaymentResultCode code)
|
460
|
-
{
|
461
|
-
case PATH_PAYMENT_SUCCESS:
|
462
|
-
struct
|
463
|
-
{
|
464
|
-
ClaimOfferAtom offers<>;
|
465
|
-
SimplePaymentResult last;
|
466
|
-
} success;
|
467
|
-
case PATH_PAYMENT_NO_ISSUER:
|
468
|
-
Asset noIssuer; // the asset that caused the error
|
469
|
-
default:
|
470
|
-
void;
|
471
|
-
};
|
472
|
-
|
473
|
-
/******* ManageOffer Result ********/
|
474
|
-
|
475
|
-
enum ManageOfferResultCode
|
476
|
-
{
|
477
|
-
// codes considered as "success" for the operation
|
478
|
-
MANAGE_OFFER_SUCCESS = 0,
|
479
|
-
|
480
|
-
// codes considered as "failure" for the operation
|
481
|
-
MANAGE_OFFER_MALFORMED = -1, // generated offer would be invalid
|
482
|
-
MANAGE_OFFER_SELL_NO_TRUST = -2, // no trust line for what we're selling
|
483
|
-
MANAGE_OFFER_BUY_NO_TRUST = -3, // no trust line for what we're buying
|
484
|
-
MANAGE_OFFER_SELL_NOT_AUTHORIZED = -4, // not authorized to sell
|
485
|
-
MANAGE_OFFER_BUY_NOT_AUTHORIZED = -5, // not authorized to buy
|
486
|
-
MANAGE_OFFER_LINE_FULL = -6, // can't receive more of what it's buying
|
487
|
-
MANAGE_OFFER_UNDERFUNDED = -7, // doesn't hold what it's trying to sell
|
488
|
-
MANAGE_OFFER_CROSS_SELF = -8, // would cross an offer from the same user
|
489
|
-
MANAGE_OFFER_SELL_NO_ISSUER = -9, // no issuer for what we're selling
|
490
|
-
MANAGE_OFFER_BUY_NO_ISSUER = -10, // no issuer for what we're buying
|
491
|
-
|
492
|
-
// update errors
|
493
|
-
MANAGE_OFFER_NOT_FOUND = -11, // offerID does not match an existing offer
|
494
|
-
|
495
|
-
MANAGE_OFFER_LOW_RESERVE = -12 // not enough funds to create a new Offer
|
496
|
-
};
|
497
|
-
|
498
|
-
enum ManageOfferEffect
|
499
|
-
{
|
500
|
-
MANAGE_OFFER_CREATED = 0,
|
501
|
-
MANAGE_OFFER_UPDATED = 1,
|
502
|
-
MANAGE_OFFER_DELETED = 2
|
503
|
-
};
|
504
|
-
|
505
|
-
struct ManageOfferSuccessResult
|
506
|
-
{
|
507
|
-
// offers that got claimed while creating this offer
|
508
|
-
ClaimOfferAtom offersClaimed<>;
|
509
|
-
|
510
|
-
union switch (ManageOfferEffect effect)
|
511
|
-
{
|
512
|
-
case MANAGE_OFFER_CREATED:
|
513
|
-
case MANAGE_OFFER_UPDATED:
|
514
|
-
OfferEntry offer;
|
515
|
-
default:
|
516
|
-
void;
|
517
|
-
}
|
518
|
-
offer;
|
519
|
-
};
|
520
|
-
|
521
|
-
union ManageOfferResult switch (ManageOfferResultCode code)
|
522
|
-
{
|
523
|
-
case MANAGE_OFFER_SUCCESS:
|
524
|
-
ManageOfferSuccessResult success;
|
525
|
-
default:
|
526
|
-
void;
|
527
|
-
};
|
528
|
-
|
529
|
-
/******* SetOptions Result ********/
|
530
|
-
|
531
|
-
enum SetOptionsResultCode
|
532
|
-
{
|
533
|
-
// codes considered as "success" for the operation
|
534
|
-
SET_OPTIONS_SUCCESS = 0,
|
535
|
-
// codes considered as "failure" for the operation
|
536
|
-
SET_OPTIONS_LOW_RESERVE = -1, // not enough funds to add a signer
|
537
|
-
SET_OPTIONS_TOO_MANY_SIGNERS = -2, // max number of signers already reached
|
538
|
-
SET_OPTIONS_BAD_FLAGS = -3, // invalid combination of clear/set flags
|
539
|
-
SET_OPTIONS_INVALID_INFLATION = -4, // inflation account does not exist
|
540
|
-
SET_OPTIONS_CANT_CHANGE = -5, // can no longer change this option
|
541
|
-
SET_OPTIONS_UNKNOWN_FLAG = -6, // can't set an unknown flag
|
542
|
-
SET_OPTIONS_THRESHOLD_OUT_OF_RANGE = -7, // bad value for weight/threshold
|
543
|
-
SET_OPTIONS_BAD_SIGNER = -8, // signer cannot be masterkey
|
544
|
-
SET_OPTIONS_INVALID_HOME_DOMAIN = -9 // malformed home domain
|
545
|
-
};
|
546
|
-
|
547
|
-
union SetOptionsResult switch (SetOptionsResultCode code)
|
548
|
-
{
|
549
|
-
case SET_OPTIONS_SUCCESS:
|
550
|
-
void;
|
551
|
-
default:
|
552
|
-
void;
|
553
|
-
};
|
554
|
-
|
555
|
-
/******* ChangeTrust Result ********/
|
556
|
-
|
557
|
-
enum ChangeTrustResultCode
|
558
|
-
{
|
559
|
-
// codes considered as "success" for the operation
|
560
|
-
CHANGE_TRUST_SUCCESS = 0,
|
561
|
-
// codes considered as "failure" for the operation
|
562
|
-
CHANGE_TRUST_MALFORMED = -1, // bad input
|
563
|
-
CHANGE_TRUST_NO_ISSUER = -2, // could not find issuer
|
564
|
-
CHANGE_TRUST_INVALID_LIMIT = -3, // cannot drop limit below balance
|
565
|
-
// cannot create with a limit of 0
|
566
|
-
CHANGE_TRUST_LOW_RESERVE =
|
567
|
-
-4, // not enough funds to create a new trust line,
|
568
|
-
CHANGE_TRUST_SELF_NOT_ALLOWED = -5 // trusting self is not allowed
|
569
|
-
};
|
570
|
-
|
571
|
-
union ChangeTrustResult switch (ChangeTrustResultCode code)
|
572
|
-
{
|
573
|
-
case CHANGE_TRUST_SUCCESS:
|
574
|
-
void;
|
575
|
-
default:
|
576
|
-
void;
|
577
|
-
};
|
578
|
-
|
579
|
-
/******* AllowTrust Result ********/
|
580
|
-
|
581
|
-
enum AllowTrustResultCode
|
582
|
-
{
|
583
|
-
// codes considered as "success" for the operation
|
584
|
-
ALLOW_TRUST_SUCCESS = 0,
|
585
|
-
// codes considered as "failure" for the operation
|
586
|
-
ALLOW_TRUST_MALFORMED = -1, // asset is not ASSET_TYPE_ALPHANUM
|
587
|
-
ALLOW_TRUST_NO_TRUST_LINE = -2, // trustor does not have a trustline
|
588
|
-
// source account does not require trust
|
589
|
-
ALLOW_TRUST_TRUST_NOT_REQUIRED = -3,
|
590
|
-
ALLOW_TRUST_CANT_REVOKE = -4, // source account can't revoke trust,
|
591
|
-
ALLOW_TRUST_SELF_NOT_ALLOWED = -5 // trusting self is not allowed
|
592
|
-
};
|
593
|
-
|
594
|
-
union AllowTrustResult switch (AllowTrustResultCode code)
|
595
|
-
{
|
596
|
-
case ALLOW_TRUST_SUCCESS:
|
597
|
-
void;
|
598
|
-
default:
|
599
|
-
void;
|
600
|
-
};
|
601
|
-
|
602
|
-
/******* AccountMerge Result ********/
|
603
|
-
|
604
|
-
enum AccountMergeResultCode
|
605
|
-
{
|
606
|
-
// codes considered as "success" for the operation
|
607
|
-
ACCOUNT_MERGE_SUCCESS = 0,
|
608
|
-
// codes considered as "failure" for the operation
|
609
|
-
ACCOUNT_MERGE_MALFORMED = -1, // can't merge onto itself
|
610
|
-
ACCOUNT_MERGE_NO_ACCOUNT = -2, // destination does not exist
|
611
|
-
ACCOUNT_MERGE_IMMUTABLE_SET = -3, // source account has AUTH_IMMUTABLE set
|
612
|
-
ACCOUNT_MERGE_HAS_SUB_ENTRIES = -4, // account has trust lines/offers
|
613
|
-
ACCOUNT_MERGE_SEQNUM_TOO_FAR = -5, // sequence number is over max allowed
|
614
|
-
ACCOUNT_MERGE_DEST_FULL = -6 // can't add source balance to
|
615
|
-
// destination balance
|
616
|
-
};
|
617
|
-
|
618
|
-
union AccountMergeResult switch (AccountMergeResultCode code)
|
619
|
-
{
|
620
|
-
case ACCOUNT_MERGE_SUCCESS:
|
621
|
-
int64 sourceAccountBalance; // how much got transfered from source account
|
622
|
-
default:
|
623
|
-
void;
|
624
|
-
};
|
625
|
-
|
626
|
-
/******* Inflation Result ********/
|
627
|
-
|
628
|
-
enum InflationResultCode
|
629
|
-
{
|
630
|
-
// codes considered as "success" for the operation
|
631
|
-
INFLATION_SUCCESS = 0,
|
632
|
-
// codes considered as "failure" for the operation
|
633
|
-
INFLATION_NOT_TIME = -1
|
634
|
-
};
|
635
|
-
|
636
|
-
struct InflationPayout // or use PaymentResultAtom to limit types?
|
637
|
-
{
|
638
|
-
AccountID destination;
|
639
|
-
int64 amount;
|
640
|
-
};
|
641
|
-
|
642
|
-
union InflationResult switch (InflationResultCode code)
|
643
|
-
{
|
644
|
-
case INFLATION_SUCCESS:
|
645
|
-
InflationPayout payouts<>;
|
646
|
-
default:
|
647
|
-
void;
|
648
|
-
};
|
649
|
-
|
650
|
-
/******* ManageData Result ********/
|
651
|
-
|
652
|
-
enum ManageDataResultCode
|
653
|
-
{
|
654
|
-
// codes considered as "success" for the operation
|
655
|
-
MANAGE_DATA_SUCCESS = 0,
|
656
|
-
// codes considered as "failure" for the operation
|
657
|
-
MANAGE_DATA_NOT_SUPPORTED_YET =
|
658
|
-
-1, // The network hasn't moved to this protocol change yet
|
659
|
-
MANAGE_DATA_NAME_NOT_FOUND =
|
660
|
-
-2, // Trying to remove a Data Entry that isn't there
|
661
|
-
MANAGE_DATA_LOW_RESERVE = -3, // not enough funds to create a new Data Entry
|
662
|
-
MANAGE_DATA_INVALID_NAME = -4 // Name not a valid string
|
663
|
-
};
|
664
|
-
|
665
|
-
union ManageDataResult switch (ManageDataResultCode code)
|
666
|
-
{
|
667
|
-
case MANAGE_DATA_SUCCESS:
|
668
|
-
void;
|
669
|
-
default:
|
670
|
-
void;
|
671
|
-
};
|
672
|
-
|
673
|
-
/******* BumpSequence Result ********/
|
674
|
-
|
675
|
-
enum BumpSequenceResultCode
|
676
|
-
{
|
677
|
-
// codes considered as "success" for the operation
|
678
|
-
BUMP_SEQUENCE_SUCCESS = 0,
|
679
|
-
// codes considered as "failure" for the operation
|
680
|
-
BUMP_SEQUENCE_BAD_SEQ = -1 // `bumpTo` is not within bounds
|
681
|
-
};
|
682
|
-
|
683
|
-
union BumpSequenceResult switch (BumpSequenceResultCode code)
|
684
|
-
{
|
685
|
-
case BUMP_SEQUENCE_SUCCESS:
|
686
|
-
void;
|
687
|
-
default:
|
688
|
-
void;
|
689
|
-
};
|
690
|
-
/* High level Operation Result */
|
691
|
-
|
692
|
-
enum OperationResultCode
|
693
|
-
{
|
694
|
-
opINNER = 0, // inner object result is valid
|
695
|
-
|
696
|
-
opBAD_AUTH = -1, // too few valid signatures / wrong network
|
697
|
-
opNO_ACCOUNT = -2, // source account was not found
|
698
|
-
opNOT_SUPPORTED = -3 // operation not supported at this time
|
699
|
-
};
|
700
|
-
|
701
|
-
union OperationResult switch (OperationResultCode code)
|
702
|
-
{
|
703
|
-
case opINNER:
|
704
|
-
union switch (OperationType type)
|
705
|
-
{
|
706
|
-
case CREATE_ACCOUNT:
|
707
|
-
CreateAccountResult createAccountResult;
|
708
|
-
case PAYMENT:
|
709
|
-
PaymentResult paymentResult;
|
710
|
-
case PATH_PAYMENT:
|
711
|
-
PathPaymentResult pathPaymentResult;
|
712
|
-
case MANAGE_OFFER:
|
713
|
-
ManageOfferResult manageOfferResult;
|
714
|
-
case CREATE_PASSIVE_OFFER:
|
715
|
-
ManageOfferResult createPassiveOfferResult;
|
716
|
-
case SET_OPTIONS:
|
717
|
-
SetOptionsResult setOptionsResult;
|
718
|
-
case CHANGE_TRUST:
|
719
|
-
ChangeTrustResult changeTrustResult;
|
720
|
-
case ALLOW_TRUST:
|
721
|
-
AllowTrustResult allowTrustResult;
|
722
|
-
case ACCOUNT_MERGE:
|
723
|
-
AccountMergeResult accountMergeResult;
|
724
|
-
case INFLATION:
|
725
|
-
InflationResult inflationResult;
|
726
|
-
case MANAGE_DATA:
|
727
|
-
ManageDataResult manageDataResult;
|
728
|
-
case BUMP_SEQUENCE:
|
729
|
-
BumpSequenceResult bumpSeqResult;
|
730
|
-
}
|
731
|
-
tr;
|
732
|
-
default:
|
733
|
-
void;
|
734
|
-
};
|
735
|
-
|
736
|
-
enum TransactionResultCode
|
737
|
-
{
|
738
|
-
txSUCCESS = 0, // all operations succeeded
|
739
|
-
|
740
|
-
txFAILED = -1, // one of the operations failed (none were applied)
|
741
|
-
|
742
|
-
txTOO_EARLY = -2, // ledger closeTime before minTime
|
743
|
-
txTOO_LATE = -3, // ledger closeTime after maxTime
|
744
|
-
txMISSING_OPERATION = -4, // no operation was specified
|
745
|
-
txBAD_SEQ = -5, // sequence number does not match source account
|
746
|
-
|
747
|
-
txBAD_AUTH = -6, // too few valid signatures / wrong network
|
748
|
-
txINSUFFICIENT_BALANCE = -7, // fee would bring account below reserve
|
749
|
-
txNO_ACCOUNT = -8, // source account not found
|
750
|
-
txINSUFFICIENT_FEE = -9, // fee is too small
|
751
|
-
txBAD_AUTH_EXTRA = -10, // unused signatures attached to transaction
|
752
|
-
txINTERNAL_ERROR = -11 // an unknown error occured
|
753
|
-
};
|
754
|
-
|
755
|
-
struct TransactionResult
|
756
|
-
{
|
757
|
-
int64 feeCharged; // actual fee charged for the transaction
|
758
|
-
|
759
|
-
union switch (TransactionResultCode code)
|
760
|
-
{
|
761
|
-
case txSUCCESS:
|
762
|
-
case txFAILED:
|
763
|
-
OperationResult results<>;
|
764
|
-
default:
|
765
|
-
void;
|
766
|
-
}
|
767
|
-
result;
|
768
|
-
|
769
|
-
// reserved for future use
|
770
|
-
union switch (int v)
|
771
|
-
{
|
772
|
-
case 0:
|
773
|
-
void;
|
774
|
-
}
|
775
|
-
ext;
|
776
|
-
};
|
777
|
-
}
|