stellar-base 0.20.0 → 0.23.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -21
  3. data/{LICENSE.txt → LICENSE} +0 -0
  4. data/README.md +2 -3
  5. data/generated/stellar-base-generated.rb +31 -4
  6. data/generated/stellar/allow_trust_op.rb +3 -2
  7. data/generated/stellar/authenticated_message.rb +4 -4
  8. data/generated/stellar/authenticated_message/v0.rb +4 -4
  9. data/generated/stellar/change_trust_result_code.rb +1 -1
  10. data/generated/stellar/crypto_key_type.rb +8 -4
  11. data/generated/stellar/curve25519_public.rb +1 -1
  12. data/generated/stellar/curve25519_secret.rb +1 -1
  13. data/generated/stellar/envelope_type.rb +9 -5
  14. data/generated/stellar/fee_bump_transaction.rb +39 -0
  15. data/generated/stellar/fee_bump_transaction/ext.rb +24 -0
  16. data/generated/stellar/fee_bump_transaction/inner_tx.rb +25 -0
  17. data/generated/stellar/fee_bump_transaction_envelope.rb +22 -0
  18. data/generated/stellar/hmac_sha256_key.rb +1 -1
  19. data/generated/stellar/hmac_sha256_mac.rb +1 -1
  20. data/generated/stellar/inner_transaction_result.rb +56 -0
  21. data/generated/stellar/inner_transaction_result/ext.rb +24 -0
  22. data/generated/stellar/inner_transaction_result/result.rb +52 -0
  23. data/generated/stellar/inner_transaction_result_pair.rb +20 -0
  24. data/generated/stellar/ledger_close_meta.rb +23 -0
  25. data/generated/stellar/ledger_close_meta_v0.rb +35 -0
  26. data/generated/stellar/manage_buy_offer_result_code.rb +5 -4
  27. data/generated/stellar/manage_sell_offer_result_code.rb +12 -8
  28. data/generated/stellar/message_type.rb +6 -1
  29. data/generated/stellar/muxed_account.rb +35 -0
  30. data/generated/stellar/muxed_account/med25519.rb +22 -0
  31. data/generated/stellar/operation.rb +7 -5
  32. data/generated/stellar/operation/body.rb +31 -27
  33. data/generated/stellar/operation_result.rb +5 -3
  34. data/generated/stellar/operation_result/tr.rb +33 -29
  35. data/generated/stellar/operation_result_code.rb +3 -3
  36. data/generated/stellar/operation_type.rb +17 -15
  37. data/generated/stellar/{path_payment_op.rb → path_payment_strict_receive_op.rb} +6 -6
  38. data/generated/stellar/path_payment_strict_receive_result.rb +38 -0
  39. data/generated/stellar/path_payment_strict_receive_result/success.rb +22 -0
  40. data/generated/stellar/path_payment_strict_receive_result_code.rb +56 -0
  41. data/generated/stellar/path_payment_strict_send_op.rb +32 -0
  42. data/generated/stellar/{path_payment_result.rb → path_payment_strict_send_result.rb} +7 -7
  43. data/generated/stellar/{path_payment_result → path_payment_strict_send_result}/success.rb +1 -1
  44. data/generated/stellar/path_payment_strict_send_result_code.rb +55 -0
  45. data/generated/stellar/payment_op.rb +4 -4
  46. data/generated/stellar/peer_stats.rb +48 -0
  47. data/generated/stellar/signed_survey_request_message.rb +20 -0
  48. data/generated/stellar/signed_survey_response_message.rb +20 -0
  49. data/generated/stellar/stellar_message.rb +22 -12
  50. data/generated/stellar/survey_message_command_type.rb +20 -0
  51. data/generated/stellar/survey_request_message.rb +26 -0
  52. data/generated/stellar/survey_response_body.rb +23 -0
  53. data/generated/stellar/survey_response_message.rb +26 -0
  54. data/generated/stellar/topology_response_body.rb +25 -0
  55. data/generated/stellar/transaction.rb +2 -2
  56. data/generated/stellar/transaction_envelope.rb +17 -8
  57. data/generated/stellar/transaction_meta.rb +4 -0
  58. data/generated/stellar/transaction_meta_v2.rb +24 -0
  59. data/generated/stellar/transaction_result.rb +3 -0
  60. data/generated/stellar/transaction_result/result.rb +9 -3
  61. data/generated/stellar/transaction_result_code.rb +21 -14
  62. data/generated/stellar/transaction_result_meta.rb +22 -0
  63. data/generated/stellar/transaction_signature_payload.rb +3 -1
  64. data/generated/stellar/transaction_signature_payload/tagged_transaction.rb +7 -3
  65. data/generated/stellar/transaction_v0.rb +39 -0
  66. data/generated/stellar/transaction_v0/ext.rb +24 -0
  67. data/generated/stellar/transaction_v0_envelope.rb +22 -0
  68. data/generated/stellar/transaction_v1_envelope.rb +22 -0
  69. data/generated/stellar/trust_line_flags.rb +6 -2
  70. data/generated/stellar/upgrade_entry_meta.rb +20 -0
  71. data/lib/stellar-base.rb +27 -24
  72. data/lib/stellar/account_flags.rb +2 -4
  73. data/lib/stellar/asset.rb +6 -6
  74. data/lib/stellar/base.rb +1 -1
  75. data/lib/stellar/{base/compat.rb → compat.rb} +6 -7
  76. data/lib/stellar/concerns/transaction.rb +49 -0
  77. data/lib/stellar/convert.rb +2 -2
  78. data/lib/stellar/factories.rb +1 -3
  79. data/lib/stellar/fee_bump_transaction.rb +21 -0
  80. data/lib/stellar/key_pair.rb +9 -6
  81. data/lib/stellar/networks.rb +5 -7
  82. data/lib/stellar/operation.rb +427 -336
  83. data/lib/stellar/{path_payment_result.rb → path_payment_strict_receive_result.rb} +2 -3
  84. data/lib/stellar/price.rb +2 -4
  85. data/lib/stellar/signer_key.rb +4 -8
  86. data/lib/stellar/thresholds.rb +5 -7
  87. data/lib/stellar/transaction.rb +154 -175
  88. data/lib/stellar/transaction_builder.rb +149 -0
  89. data/lib/stellar/transaction_envelope.rb +40 -8
  90. data/lib/stellar/transaction_v0.rb +39 -0
  91. data/lib/stellar/util/continued_fraction.rb +19 -19
  92. data/lib/stellar/util/strkey.rb +39 -14
  93. data/lib/stellar/{base/version.rb → version.rb} +1 -1
  94. metadata +61 -211
  95. data/.gitignore +0 -17
  96. data/.travis.yml +0 -16
  97. data/.yardopts +0 -8
  98. data/CONTRIBUTING.md +0 -48
  99. data/Gemfile +0 -15
  100. data/Guardfile +0 -5
  101. data/Rakefile +0 -4
  102. data/examples/allow_trust.rb +0 -51
  103. data/examples/create_account.rb +0 -26
  104. data/examples/low_level_transaction_post.rb +0 -46
  105. data/examples/mid_level_transaction_post.rb +0 -33
  106. data/examples/non_native_payment.rb +0 -60
  107. data/examples/offer.rb +0 -75
  108. data/examples/transaction_merge.rb +0 -23
  109. data/generated/stellar/path_payment_result_code.rb +0 -47
  110. data/ruby-stellar-base.gemspec +0 -34
  111. data/spec/lib/stellar/account_flags_spec.rb +0 -19
  112. data/spec/lib/stellar/asset_spec.rb +0 -45
  113. data/spec/lib/stellar/convert_spec.rb +0 -61
  114. data/spec/lib/stellar/key_pair_spec.rb +0 -251
  115. data/spec/lib/stellar/networks_spec.rb +0 -77
  116. data/spec/lib/stellar/operation_spec.rb +0 -71
  117. data/spec/lib/stellar/path_payment_result_spec.rb +0 -95
  118. data/spec/lib/stellar/price_spec.rb +0 -34
  119. data/spec/lib/stellar/signer_key_spec.rb +0 -26
  120. data/spec/lib/stellar/thresholds_spec.rb +0 -62
  121. data/spec/lib/stellar/transaction_envelope_spec.rb +0 -93
  122. data/spec/lib/stellar/transaction_spec.rb +0 -100
  123. data/spec/lib/stellar/util/strkey_spec.rb +0 -54
  124. data/spec/spec_helper.rb +0 -16
  125. data/spec/support/matchers/be_strkey.rb +0 -9
  126. data/spec/support/matchers/eq_bytes.rb +0 -5
  127. data/spec/support/matchers/have_length.rb +0 -5
  128. data/tasks/rspec.rake +0 -6
  129. data/tasks/travis.rake +0 -1
  130. data/tasks/xdr.rake +0 -45
  131. data/xdr/Stellar-SCP.x +0 -86
  132. data/xdr/Stellar-ledger-entries.x +0 -295
  133. data/xdr/Stellar-ledger.x +0 -318
  134. data/xdr/Stellar-overlay.x +0 -146
  135. data/xdr/Stellar-transaction.x +0 -834
  136. data/xdr/Stellar-types.x +0 -81
@@ -1,834 +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_SELL_OFFER = 3,
22
- CREATE_PASSIVE_SELL_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
- MANAGE_BUY_OFFER = 12
31
- };
32
-
33
- /* CreateAccount
34
- Creates and funds a new account with the specified starting balance.
35
-
36
- Threshold: med
37
-
38
- Result: CreateAccountResult
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: ManageSellOfferResult
92
-
93
- */
94
- struct ManageSellOfferOp
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
- int64 offerID;
103
- };
104
-
105
- /* Creates, updates or deletes an offer with amount in terms of buying asset
106
-
107
- Threshold: med
108
-
109
- Result: ManageBuyOfferResult
110
-
111
- */
112
- struct ManageBuyOfferOp
113
- {
114
- Asset selling;
115
- Asset buying;
116
- int64 buyAmount; // amount being bought. if set to 0, delete the offer
117
- Price price; // price of thing being bought in terms of what you are
118
- // selling
119
-
120
- // 0=create a new offer, otherwise edit an existing offer
121
- int64 offerID;
122
- };
123
-
124
- /* Creates an offer that doesn't take offers of the same price
125
-
126
- Threshold: med
127
-
128
- Result: CreatePassiveSellOfferResult
129
-
130
- */
131
- struct CreatePassiveSellOfferOp
132
- {
133
- Asset selling; // A
134
- Asset buying; // B
135
- int64 amount; // amount taker gets. if set to 0, delete the offer
136
- Price price; // cost of A in terms of B
137
- };
138
-
139
- /* Set Account Options
140
-
141
- updates "AccountEntry" fields.
142
- note: updating thresholds or signers requires high threshold
143
-
144
- Threshold: med or high
145
-
146
- Result: SetOptionsResult
147
- */
148
- struct SetOptionsOp
149
- {
150
- AccountID* inflationDest; // sets the inflation destination
151
-
152
- uint32* clearFlags; // which flags to clear
153
- uint32* setFlags; // which flags to set
154
-
155
- // account threshold manipulation
156
- uint32* masterWeight; // weight of the master account
157
- uint32* lowThreshold;
158
- uint32* medThreshold;
159
- uint32* highThreshold;
160
-
161
- string32* homeDomain; // sets the home domain
162
-
163
- // Add, update or remove a signer for the account
164
- // signer is deleted if the weight is 0
165
- Signer* signer;
166
- };
167
-
168
- /* Creates, updates or deletes a trust line
169
-
170
- Threshold: med
171
-
172
- Result: ChangeTrustResult
173
-
174
- */
175
- struct ChangeTrustOp
176
- {
177
- Asset line;
178
-
179
- // if limit is set to 0, deletes the trust line
180
- int64 limit;
181
- };
182
-
183
- /* Updates the "authorized" flag of an existing trust line
184
- this is called by the issuer of the related asset.
185
-
186
- note that authorize can only be set (and not cleared) if
187
- the issuer account does not have the AUTH_REVOCABLE_FLAG set
188
- Threshold: low
189
-
190
- Result: AllowTrustResult
191
- */
192
- struct AllowTrustOp
193
- {
194
- AccountID trustor;
195
- union switch (AssetType type)
196
- {
197
- // ASSET_TYPE_NATIVE is not allowed
198
- case ASSET_TYPE_CREDIT_ALPHANUM4:
199
- AssetCode4 assetCode4;
200
-
201
- case ASSET_TYPE_CREDIT_ALPHANUM12:
202
- AssetCode12 assetCode12;
203
-
204
- // add other asset types here in the future
205
- }
206
- asset;
207
-
208
- bool authorize;
209
- };
210
-
211
- /* Inflation
212
- Runs inflation
213
-
214
- Threshold: low
215
-
216
- Result: InflationResult
217
-
218
- */
219
-
220
- /* AccountMerge
221
- Transfers native balance to destination account.
222
-
223
- Threshold: high
224
-
225
- Result : AccountMergeResult
226
- */
227
-
228
- /* ManageData
229
- Adds, Updates, or Deletes a key value pair associated with a particular
230
- account.
231
-
232
- Threshold: med
233
-
234
- Result: ManageDataResult
235
- */
236
- struct ManageDataOp
237
- {
238
- string64 dataName;
239
- DataValue* dataValue; // set to null to clear
240
- };
241
-
242
- /* Bump Sequence
243
-
244
- increases the sequence to a given level
245
-
246
- Threshold: low
247
-
248
- Result: BumpSequenceResult
249
- */
250
- struct BumpSequenceOp
251
- {
252
- SequenceNumber bumpTo;
253
- };
254
-
255
- /* An operation is the lowest unit of work that a transaction does */
256
- struct Operation
257
- {
258
- // sourceAccount is the account used to run the operation
259
- // if not set, the runtime defaults to "sourceAccount" specified at
260
- // the transaction level
261
- AccountID* sourceAccount;
262
-
263
- union switch (OperationType type)
264
- {
265
- case CREATE_ACCOUNT:
266
- CreateAccountOp createAccountOp;
267
- case PAYMENT:
268
- PaymentOp paymentOp;
269
- case PATH_PAYMENT:
270
- PathPaymentOp pathPaymentOp;
271
- case MANAGE_SELL_OFFER:
272
- ManageSellOfferOp manageSellOfferOp;
273
- case CREATE_PASSIVE_SELL_OFFER:
274
- CreatePassiveSellOfferOp createPassiveSellOfferOp;
275
- case SET_OPTIONS:
276
- SetOptionsOp setOptionsOp;
277
- case CHANGE_TRUST:
278
- ChangeTrustOp changeTrustOp;
279
- case ALLOW_TRUST:
280
- AllowTrustOp allowTrustOp;
281
- case ACCOUNT_MERGE:
282
- AccountID destination;
283
- case INFLATION:
284
- void;
285
- case MANAGE_DATA:
286
- ManageDataOp manageDataOp;
287
- case BUMP_SEQUENCE:
288
- BumpSequenceOp bumpSequenceOp;
289
- case MANAGE_BUY_OFFER:
290
- ManageBuyOfferOp manageBuyOfferOp;
291
- }
292
- body;
293
- };
294
-
295
- enum MemoType
296
- {
297
- MEMO_NONE = 0,
298
- MEMO_TEXT = 1,
299
- MEMO_ID = 2,
300
- MEMO_HASH = 3,
301
- MEMO_RETURN = 4
302
- };
303
-
304
- union Memo switch (MemoType type)
305
- {
306
- case MEMO_NONE:
307
- void;
308
- case MEMO_TEXT:
309
- string text<28>;
310
- case MEMO_ID:
311
- uint64 id;
312
- case MEMO_HASH:
313
- Hash hash; // the hash of what to pull from the content server
314
- case MEMO_RETURN:
315
- Hash retHash; // the hash of the tx you are rejecting
316
- };
317
-
318
- struct TimeBounds
319
- {
320
- TimePoint minTime;
321
- TimePoint maxTime; // 0 here means no maxTime
322
- };
323
-
324
- // maximum number of operations per transaction
325
- const MAX_OPS_PER_TX = 100;
326
-
327
- /* a transaction is a container for a set of operations
328
- - is executed by an account
329
- - fees are collected from the account
330
- - operations are executed in order as one ACID transaction
331
- either all operations are applied or none are
332
- if any returns a failing code
333
- */
334
- struct Transaction
335
- {
336
- // account used to run the transaction
337
- AccountID sourceAccount;
338
-
339
- // the fee the sourceAccount will pay
340
- uint32 fee;
341
-
342
- // sequence number to consume in the account
343
- SequenceNumber seqNum;
344
-
345
- // validity range (inclusive) for the last ledger close time
346
- TimeBounds* timeBounds;
347
-
348
- Memo memo;
349
-
350
- Operation operations<MAX_OPS_PER_TX>;
351
-
352
- // reserved for future use
353
- union switch (int v)
354
- {
355
- case 0:
356
- void;
357
- }
358
- ext;
359
- };
360
-
361
- struct TransactionSignaturePayload
362
- {
363
- Hash networkId;
364
- union switch (EnvelopeType type)
365
- {
366
- case ENVELOPE_TYPE_TX:
367
- Transaction tx;
368
- /* All other values of type are invalid */
369
- }
370
- taggedTransaction;
371
- };
372
-
373
- /* A TransactionEnvelope wraps a transaction with signatures. */
374
- struct TransactionEnvelope
375
- {
376
- Transaction tx;
377
- /* Each decorated signature is a signature over the SHA256 hash of
378
- * a TransactionSignaturePayload */
379
- DecoratedSignature signatures<20>;
380
- };
381
-
382
- /* Operation Results section */
383
-
384
- /* This result is used when offers are taken during an operation */
385
- struct ClaimOfferAtom
386
- {
387
- // emitted to identify the offer
388
- AccountID sellerID; // Account that owns the offer
389
- int64 offerID;
390
-
391
- // amount and asset taken from the owner
392
- Asset assetSold;
393
- int64 amountSold;
394
-
395
- // amount and asset sent to the owner
396
- Asset assetBought;
397
- int64 amountBought;
398
- };
399
-
400
- /******* CreateAccount Result ********/
401
-
402
- enum CreateAccountResultCode
403
- {
404
- // codes considered as "success" for the operation
405
- CREATE_ACCOUNT_SUCCESS = 0, // account was created
406
-
407
- // codes considered as "failure" for the operation
408
- CREATE_ACCOUNT_MALFORMED = -1, // invalid destination
409
- CREATE_ACCOUNT_UNDERFUNDED = -2, // not enough funds in source account
410
- CREATE_ACCOUNT_LOW_RESERVE =
411
- -3, // would create an account below the min reserve
412
- CREATE_ACCOUNT_ALREADY_EXIST = -4 // account already exists
413
- };
414
-
415
- union CreateAccountResult switch (CreateAccountResultCode code)
416
- {
417
- case CREATE_ACCOUNT_SUCCESS:
418
- void;
419
- default:
420
- void;
421
- };
422
-
423
- /******* Payment Result ********/
424
-
425
- enum PaymentResultCode
426
- {
427
- // codes considered as "success" for the operation
428
- PAYMENT_SUCCESS = 0, // payment successfuly completed
429
-
430
- // codes considered as "failure" for the operation
431
- PAYMENT_MALFORMED = -1, // bad input
432
- PAYMENT_UNDERFUNDED = -2, // not enough funds in source account
433
- PAYMENT_SRC_NO_TRUST = -3, // no trust line on source account
434
- PAYMENT_SRC_NOT_AUTHORIZED = -4, // source not authorized to transfer
435
- PAYMENT_NO_DESTINATION = -5, // destination account does not exist
436
- PAYMENT_NO_TRUST = -6, // destination missing a trust line for asset
437
- PAYMENT_NOT_AUTHORIZED = -7, // destination not authorized to hold asset
438
- PAYMENT_LINE_FULL = -8, // destination would go above their limit
439
- PAYMENT_NO_ISSUER = -9 // missing issuer on asset
440
- };
441
-
442
- union PaymentResult switch (PaymentResultCode code)
443
- {
444
- case PAYMENT_SUCCESS:
445
- void;
446
- default:
447
- void;
448
- };
449
-
450
- /******* Payment Result ********/
451
-
452
- enum PathPaymentResultCode
453
- {
454
- // codes considered as "success" for the operation
455
- PATH_PAYMENT_SUCCESS = 0, // success
456
-
457
- // codes considered as "failure" for the operation
458
- PATH_PAYMENT_MALFORMED = -1, // bad input
459
- PATH_PAYMENT_UNDERFUNDED = -2, // not enough funds in source account
460
- PATH_PAYMENT_SRC_NO_TRUST = -3, // no trust line on source account
461
- PATH_PAYMENT_SRC_NOT_AUTHORIZED = -4, // source not authorized to transfer
462
- PATH_PAYMENT_NO_DESTINATION = -5, // destination account does not exist
463
- PATH_PAYMENT_NO_TRUST = -6, // dest missing a trust line for asset
464
- PATH_PAYMENT_NOT_AUTHORIZED = -7, // dest not authorized to hold asset
465
- PATH_PAYMENT_LINE_FULL = -8, // dest would go above their limit
466
- PATH_PAYMENT_NO_ISSUER = -9, // missing issuer on one asset
467
- PATH_PAYMENT_TOO_FEW_OFFERS = -10, // not enough offers to satisfy path
468
- PATH_PAYMENT_OFFER_CROSS_SELF = -11, // would cross one of its own offers
469
- PATH_PAYMENT_OVER_SENDMAX = -12 // could not satisfy sendmax
470
- };
471
-
472
- struct SimplePaymentResult
473
- {
474
- AccountID destination;
475
- Asset asset;
476
- int64 amount;
477
- };
478
-
479
- union PathPaymentResult switch (PathPaymentResultCode code)
480
- {
481
- case PATH_PAYMENT_SUCCESS:
482
- struct
483
- {
484
- ClaimOfferAtom offers<>;
485
- SimplePaymentResult last;
486
- } success;
487
- case PATH_PAYMENT_NO_ISSUER:
488
- Asset noIssuer; // the asset that caused the error
489
- default:
490
- void;
491
- };
492
-
493
- /******* ManageSellOffer Result ********/
494
-
495
- enum ManageSellOfferResultCode
496
- {
497
- // codes considered as "success" for the operation
498
- MANAGE_SELL_OFFER_SUCCESS = 0,
499
-
500
- // codes considered as "failure" for the operation
501
- MANAGE_SELL_OFFER_MALFORMED = -1, // generated offer would be invalid
502
- MANAGE_SELL_OFFER_SELL_NO_TRUST = -2, // no trust line for what we're selling
503
- MANAGE_SELL_OFFER_BUY_NO_TRUST = -3, // no trust line for what we're buying
504
- MANAGE_SELL_OFFER_SELL_NOT_AUTHORIZED = -4, // not authorized to sell
505
- MANAGE_SELL_OFFER_BUY_NOT_AUTHORIZED = -5, // not authorized to buy
506
- MANAGE_SELL_OFFER_LINE_FULL = -6, // can't receive more of what it's buying
507
- MANAGE_SELL_OFFER_UNDERFUNDED = -7, // doesn't hold what it's trying to sell
508
- MANAGE_SELL_OFFER_CROSS_SELF = -8, // would cross an offer from the same user
509
- MANAGE_SELL_OFFER_SELL_NO_ISSUER = -9, // no issuer for what we're selling
510
- MANAGE_SELL_OFFER_BUY_NO_ISSUER = -10, // no issuer for what we're buying
511
-
512
- // update errors
513
- MANAGE_SELL_OFFER_NOT_FOUND = -11, // offerID does not match an existing offer
514
-
515
- MANAGE_SELL_OFFER_LOW_RESERVE = -12 // not enough funds to create a new Offer
516
- };
517
-
518
- enum ManageOfferEffect
519
- {
520
- MANAGE_OFFER_CREATED = 0,
521
- MANAGE_OFFER_UPDATED = 1,
522
- MANAGE_OFFER_DELETED = 2
523
- };
524
-
525
- struct ManageOfferSuccessResult
526
- {
527
- // offers that got claimed while creating this offer
528
- ClaimOfferAtom offersClaimed<>;
529
-
530
- union switch (ManageOfferEffect effect)
531
- {
532
- case MANAGE_OFFER_CREATED:
533
- case MANAGE_OFFER_UPDATED:
534
- OfferEntry offer;
535
- default:
536
- void;
537
- }
538
- offer;
539
- };
540
-
541
- union ManageSellOfferResult switch (ManageSellOfferResultCode code)
542
- {
543
- case MANAGE_SELL_OFFER_SUCCESS:
544
- ManageOfferSuccessResult success;
545
- default:
546
- void;
547
- };
548
-
549
- /******* ManageBuyOffer Result ********/
550
-
551
- enum ManageBuyOfferResultCode
552
- {
553
- // codes considered as "success" for the operation
554
- MANAGE_BUY_OFFER_SUCCESS = 0,
555
-
556
- // codes considered as "failure" for the operation
557
- MANAGE_BUY_OFFER_MALFORMED = -1, // generated offer would be invalid
558
- MANAGE_BUY_OFFER_SELL_NO_TRUST = -2, // no trust line for what we're selling
559
- MANAGE_BUY_OFFER_BUY_NO_TRUST = -3, // no trust line for what we're buying
560
- MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED = -4, // not authorized to sell
561
- MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED = -5, // not authorized to buy
562
- MANAGE_BUY_OFFER_LINE_FULL = -6, // can't receive more of what it's buying
563
- MANAGE_BUY_OFFER_UNDERFUNDED = -7, // doesn't hold what it's trying to sell
564
- MANAGE_BUY_OFFER_CROSS_SELF = -8, // would cross an offer from the same user
565
- MANAGE_BUY_OFFER_SELL_NO_ISSUER = -9, // no issuer for what we're selling
566
- MANAGE_BUY_OFFER_BUY_NO_ISSUER = -10, // no issuer for what we're buying
567
-
568
- // update errors
569
- MANAGE_BUY_OFFER_NOT_FOUND = -11, // offerID does not match an existing offer
570
-
571
- MANAGE_BUY_OFFER_LOW_RESERVE = -12 // not enough funds to create a new Offer
572
- };
573
-
574
- union ManageBuyOfferResult switch (ManageBuyOfferResultCode code)
575
- {
576
- case MANAGE_BUY_OFFER_SUCCESS:
577
- ManageOfferSuccessResult success;
578
- default:
579
- void;
580
- };
581
-
582
- /******* SetOptions Result ********/
583
-
584
- enum SetOptionsResultCode
585
- {
586
- // codes considered as "success" for the operation
587
- SET_OPTIONS_SUCCESS = 0,
588
- // codes considered as "failure" for the operation
589
- SET_OPTIONS_LOW_RESERVE = -1, // not enough funds to add a signer
590
- SET_OPTIONS_TOO_MANY_SIGNERS = -2, // max number of signers already reached
591
- SET_OPTIONS_BAD_FLAGS = -3, // invalid combination of clear/set flags
592
- SET_OPTIONS_INVALID_INFLATION = -4, // inflation account does not exist
593
- SET_OPTIONS_CANT_CHANGE = -5, // can no longer change this option
594
- SET_OPTIONS_UNKNOWN_FLAG = -6, // can't set an unknown flag
595
- SET_OPTIONS_THRESHOLD_OUT_OF_RANGE = -7, // bad value for weight/threshold
596
- SET_OPTIONS_BAD_SIGNER = -8, // signer cannot be masterkey
597
- SET_OPTIONS_INVALID_HOME_DOMAIN = -9 // malformed home domain
598
- };
599
-
600
- union SetOptionsResult switch (SetOptionsResultCode code)
601
- {
602
- case SET_OPTIONS_SUCCESS:
603
- void;
604
- default:
605
- void;
606
- };
607
-
608
- /******* ChangeTrust Result ********/
609
-
610
- enum ChangeTrustResultCode
611
- {
612
- // codes considered as "success" for the operation
613
- CHANGE_TRUST_SUCCESS = 0,
614
- // codes considered as "failure" for the operation
615
- CHANGE_TRUST_MALFORMED = -1, // bad input
616
- CHANGE_TRUST_NO_ISSUER = -2, // could not find issuer
617
- CHANGE_TRUST_INVALID_LIMIT = -3, // cannot drop limit below balance
618
- // cannot create with a limit of 0
619
- CHANGE_TRUST_LOW_RESERVE =
620
- -4, // not enough funds to create a new trust line,
621
- CHANGE_TRUST_SELF_NOT_ALLOWED = -5 // trusting self is not allowed
622
- };
623
-
624
- union ChangeTrustResult switch (ChangeTrustResultCode code)
625
- {
626
- case CHANGE_TRUST_SUCCESS:
627
- void;
628
- default:
629
- void;
630
- };
631
-
632
- /******* AllowTrust Result ********/
633
-
634
- enum AllowTrustResultCode
635
- {
636
- // codes considered as "success" for the operation
637
- ALLOW_TRUST_SUCCESS = 0,
638
- // codes considered as "failure" for the operation
639
- ALLOW_TRUST_MALFORMED = -1, // asset is not ASSET_TYPE_ALPHANUM
640
- ALLOW_TRUST_NO_TRUST_LINE = -2, // trustor does not have a trustline
641
- // source account does not require trust
642
- ALLOW_TRUST_TRUST_NOT_REQUIRED = -3,
643
- ALLOW_TRUST_CANT_REVOKE = -4, // source account can't revoke trust,
644
- ALLOW_TRUST_SELF_NOT_ALLOWED = -5 // trusting self is not allowed
645
- };
646
-
647
- union AllowTrustResult switch (AllowTrustResultCode code)
648
- {
649
- case ALLOW_TRUST_SUCCESS:
650
- void;
651
- default:
652
- void;
653
- };
654
-
655
- /******* AccountMerge Result ********/
656
-
657
- enum AccountMergeResultCode
658
- {
659
- // codes considered as "success" for the operation
660
- ACCOUNT_MERGE_SUCCESS = 0,
661
- // codes considered as "failure" for the operation
662
- ACCOUNT_MERGE_MALFORMED = -1, // can't merge onto itself
663
- ACCOUNT_MERGE_NO_ACCOUNT = -2, // destination does not exist
664
- ACCOUNT_MERGE_IMMUTABLE_SET = -3, // source account has AUTH_IMMUTABLE set
665
- ACCOUNT_MERGE_HAS_SUB_ENTRIES = -4, // account has trust lines/offers
666
- ACCOUNT_MERGE_SEQNUM_TOO_FAR = -5, // sequence number is over max allowed
667
- ACCOUNT_MERGE_DEST_FULL = -6 // can't add source balance to
668
- // destination balance
669
- };
670
-
671
- union AccountMergeResult switch (AccountMergeResultCode code)
672
- {
673
- case ACCOUNT_MERGE_SUCCESS:
674
- int64 sourceAccountBalance; // how much got transfered from source account
675
- default:
676
- void;
677
- };
678
-
679
- /******* Inflation Result ********/
680
-
681
- enum InflationResultCode
682
- {
683
- // codes considered as "success" for the operation
684
- INFLATION_SUCCESS = 0,
685
- // codes considered as "failure" for the operation
686
- INFLATION_NOT_TIME = -1
687
- };
688
-
689
- struct InflationPayout // or use PaymentResultAtom to limit types?
690
- {
691
- AccountID destination;
692
- int64 amount;
693
- };
694
-
695
- union InflationResult switch (InflationResultCode code)
696
- {
697
- case INFLATION_SUCCESS:
698
- InflationPayout payouts<>;
699
- default:
700
- void;
701
- };
702
-
703
- /******* ManageData Result ********/
704
-
705
- enum ManageDataResultCode
706
- {
707
- // codes considered as "success" for the operation
708
- MANAGE_DATA_SUCCESS = 0,
709
- // codes considered as "failure" for the operation
710
- MANAGE_DATA_NOT_SUPPORTED_YET =
711
- -1, // The network hasn't moved to this protocol change yet
712
- MANAGE_DATA_NAME_NOT_FOUND =
713
- -2, // Trying to remove a Data Entry that isn't there
714
- MANAGE_DATA_LOW_RESERVE = -3, // not enough funds to create a new Data Entry
715
- MANAGE_DATA_INVALID_NAME = -4 // Name not a valid string
716
- };
717
-
718
- union ManageDataResult switch (ManageDataResultCode code)
719
- {
720
- case MANAGE_DATA_SUCCESS:
721
- void;
722
- default:
723
- void;
724
- };
725
-
726
- /******* BumpSequence Result ********/
727
-
728
- enum BumpSequenceResultCode
729
- {
730
- // codes considered as "success" for the operation
731
- BUMP_SEQUENCE_SUCCESS = 0,
732
- // codes considered as "failure" for the operation
733
- BUMP_SEQUENCE_BAD_SEQ = -1 // `bumpTo` is not within bounds
734
- };
735
-
736
- union BumpSequenceResult switch (BumpSequenceResultCode code)
737
- {
738
- case BUMP_SEQUENCE_SUCCESS:
739
- void;
740
- default:
741
- void;
742
- };
743
- /* High level Operation Result */
744
-
745
- enum OperationResultCode
746
- {
747
- opINNER = 0, // inner object result is valid
748
-
749
- opBAD_AUTH = -1, // too few valid signatures / wrong network
750
- opNO_ACCOUNT = -2, // source account was not found
751
- opNOT_SUPPORTED = -3, // operation not supported at this time
752
- opTOO_MANY_SUBENTRIES = -4, // max number of subentries already reached
753
- opEXCEEDED_WORK_LIMIT = -5 // operation did too much work
754
- };
755
-
756
- union OperationResult switch (OperationResultCode code)
757
- {
758
- case opINNER:
759
- union switch (OperationType type)
760
- {
761
- case CREATE_ACCOUNT:
762
- CreateAccountResult createAccountResult;
763
- case PAYMENT:
764
- PaymentResult paymentResult;
765
- case PATH_PAYMENT:
766
- PathPaymentResult pathPaymentResult;
767
- case MANAGE_SELL_OFFER:
768
- ManageSellOfferResult manageSellOfferResult;
769
- case CREATE_PASSIVE_SELL_OFFER:
770
- ManageSellOfferResult createPassiveSellOfferResult;
771
- case SET_OPTIONS:
772
- SetOptionsResult setOptionsResult;
773
- case CHANGE_TRUST:
774
- ChangeTrustResult changeTrustResult;
775
- case ALLOW_TRUST:
776
- AllowTrustResult allowTrustResult;
777
- case ACCOUNT_MERGE:
778
- AccountMergeResult accountMergeResult;
779
- case INFLATION:
780
- InflationResult inflationResult;
781
- case MANAGE_DATA:
782
- ManageDataResult manageDataResult;
783
- case BUMP_SEQUENCE:
784
- BumpSequenceResult bumpSeqResult;
785
- case MANAGE_BUY_OFFER:
786
- ManageBuyOfferResult manageBuyOfferResult;
787
- }
788
- tr;
789
- default:
790
- void;
791
- };
792
-
793
- enum TransactionResultCode
794
- {
795
- txSUCCESS = 0, // all operations succeeded
796
-
797
- txFAILED = -1, // one of the operations failed (none were applied)
798
-
799
- txTOO_EARLY = -2, // ledger closeTime before minTime
800
- txTOO_LATE = -3, // ledger closeTime after maxTime
801
- txMISSING_OPERATION = -4, // no operation was specified
802
- txBAD_SEQ = -5, // sequence number does not match source account
803
-
804
- txBAD_AUTH = -6, // too few valid signatures / wrong network
805
- txINSUFFICIENT_BALANCE = -7, // fee would bring account below reserve
806
- txNO_ACCOUNT = -8, // source account not found
807
- txINSUFFICIENT_FEE = -9, // fee is too small
808
- txBAD_AUTH_EXTRA = -10, // unused signatures attached to transaction
809
- txINTERNAL_ERROR = -11 // an unknown error occured
810
- };
811
-
812
- struct TransactionResult
813
- {
814
- int64 feeCharged; // actual fee charged for the transaction
815
-
816
- union switch (TransactionResultCode code)
817
- {
818
- case txSUCCESS:
819
- case txFAILED:
820
- OperationResult results<>;
821
- default:
822
- void;
823
- }
824
- result;
825
-
826
- // reserved for future use
827
- union switch (int v)
828
- {
829
- case 0:
830
- void;
831
- }
832
- ext;
833
- };
834
- }