stellar-base 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.travis.yml +15 -0
  4. data/.yardopts +8 -0
  5. data/Gemfile +15 -0
  6. data/Guardfile +5 -0
  7. data/LICENSE.txt +202 -0
  8. data/README.md +79 -0
  9. data/Rakefile +6 -0
  10. data/examples/low_level_transaction_post.rb +53 -0
  11. data/examples/mid_level_transaction_post.rb +34 -0
  12. data/examples/non_native_payment.rb +60 -0
  13. data/generated/stellar/account_entry.rb +37 -0
  14. data/generated/stellar/account_flags.rb +20 -0
  15. data/generated/stellar/account_merge_result.rb +25 -0
  16. data/generated/stellar/account_merge_result_code.rb +30 -0
  17. data/generated/stellar/allow_trust_op/currency.rb +28 -0
  18. data/generated/stellar/allow_trust_op.rb +35 -0
  19. data/generated/stellar/allow_trust_result.rb +25 -0
  20. data/generated/stellar/allow_trust_result_code.rb +28 -0
  21. data/generated/stellar/bucket_entry.rb +28 -0
  22. data/generated/stellar/bucket_entry_type.rb +22 -0
  23. data/generated/stellar/change_trust_op.rb +22 -0
  24. data/generated/stellar/change_trust_result.rb +25 -0
  25. data/generated/stellar/change_trust_result_code.rb +28 -0
  26. data/generated/stellar/claim_offer_atom.rb +29 -0
  27. data/generated/stellar/create_offer_effect.rb +24 -0
  28. data/generated/stellar/create_offer_op.rb +28 -0
  29. data/generated/stellar/create_offer_result.rb +26 -0
  30. data/generated/stellar/create_offer_result_code.rb +45 -0
  31. data/generated/stellar/create_offer_success_result/offer.rb +30 -0
  32. data/generated/stellar/create_offer_success_result.rb +34 -0
  33. data/generated/stellar/currency.rb +29 -0
  34. data/generated/stellar/currency_type.rb +22 -0
  35. data/generated/stellar/decorated_signature.rb +20 -0
  36. data/generated/stellar/dont_have.rb +20 -0
  37. data/generated/stellar/error.rb +20 -0
  38. data/generated/stellar/hello.rb +24 -0
  39. data/generated/stellar/inflation_payout.rb +20 -0
  40. data/generated/stellar/inflation_result.rb +26 -0
  41. data/generated/stellar/inflation_result_code.rb +24 -0
  42. data/generated/stellar/iso_currency_issuer.rb +20 -0
  43. data/generated/stellar/ledger_entry.rb +33 -0
  44. data/generated/stellar/ledger_entry_type.rb +24 -0
  45. data/generated/stellar/ledger_header.rb +45 -0
  46. data/generated/stellar/ledger_header_history_entry.rb +20 -0
  47. data/generated/stellar/ledger_key/account.rb +20 -0
  48. data/generated/stellar/ledger_key/offer.rb +22 -0
  49. data/generated/stellar/ledger_key/trust_line.rb +22 -0
  50. data/generated/stellar/ledger_key.rb +50 -0
  51. data/generated/stellar/message_type.rb +45 -0
  52. data/generated/stellar/offer_entry.rb +34 -0
  53. data/generated/stellar/operation/body.rb +49 -0
  54. data/generated/stellar/operation.rb +45 -0
  55. data/generated/stellar/operation_result/tr.rb +49 -0
  56. data/generated/stellar/operation_result.rb +47 -0
  57. data/generated/stellar/operation_result_code.rb +25 -0
  58. data/generated/stellar/operation_type.rb +32 -0
  59. data/generated/stellar/payment_op.rb +35 -0
  60. data/generated/stellar/payment_result.rb +29 -0
  61. data/generated/stellar/payment_result_code.rb +41 -0
  62. data/generated/stellar/payment_success_multi_result.rb +20 -0
  63. data/generated/stellar/peer_address.rb +22 -0
  64. data/generated/stellar/price.rb +20 -0
  65. data/generated/stellar/scp_ballot.rb +20 -0
  66. data/generated/stellar/scp_envelope.rb +22 -0
  67. data/generated/stellar/scp_quorum_set.rb +20 -0
  68. data/generated/stellar/scp_statement/pledges/prepare.rb +24 -0
  69. data/generated/stellar/scp_statement/pledges.rb +40 -0
  70. data/generated/stellar/scp_statement.rb +42 -0
  71. data/generated/stellar/scp_statement_type.rb +26 -0
  72. data/generated/stellar/set_options_op.rb +31 -0
  73. data/generated/stellar/set_options_result.rb +25 -0
  74. data/generated/stellar/set_options_result_code.rb +28 -0
  75. data/generated/stellar/signer.rb +20 -0
  76. data/generated/stellar/simple_payment_result.rb +22 -0
  77. data/generated/stellar/stellar_ballot.rb +22 -0
  78. data/generated/stellar/stellar_ballot_value.rb +22 -0
  79. data/generated/stellar/stellar_message.rb +66 -0
  80. data/generated/stellar/transaction.rb +37 -0
  81. data/generated/stellar/transaction_envelope.rb +20 -0
  82. data/generated/stellar/transaction_history_entry.rb +20 -0
  83. data/generated/stellar/transaction_history_result_entry.rb +20 -0
  84. data/generated/stellar/transaction_meta.rb +18 -0
  85. data/generated/stellar/transaction_result/result.rb +30 -0
  86. data/generated/stellar/transaction_result.rb +33 -0
  87. data/generated/stellar/transaction_result_code.rb +46 -0
  88. data/generated/stellar/transaction_result_pair.rb +20 -0
  89. data/generated/stellar/transaction_result_set.rb +18 -0
  90. data/generated/stellar/transaction_set.rb +20 -0
  91. data/generated/stellar/trust_line_entry.rb +28 -0
  92. data/generated/stellar-base-generated.rb +160 -0
  93. data/lib/stellar/base/version.rb +5 -0
  94. data/lib/stellar/base.rb +1 -0
  95. data/lib/stellar/change_trust_op.rb +10 -0
  96. data/lib/stellar/currency.rb +28 -0
  97. data/lib/stellar/key_pair.rb +94 -0
  98. data/lib/stellar/payment_op.rb +38 -0
  99. data/lib/stellar/transaction.rb +72 -0
  100. data/lib/stellar/transaction_envelope.rb +32 -0
  101. data/lib/stellar/util/base58.rb +127 -0
  102. data/lib/stellar-base.rb +23 -0
  103. data/ruby-stellar-base.gemspec +34 -0
  104. data/spec/lib/stellar/key_pair_spec.rb +199 -0
  105. data/spec/lib/stellar/transaction_envelope_spec.rb +93 -0
  106. data/spec/lib/stellar/transaction_spec.rb +43 -0
  107. data/spec/lib/stellar/util/base58_spec.rb +74 -0
  108. data/spec/spec_helper.rb +16 -0
  109. data/spec/support/matchers/be_base58_check.rb +9 -0
  110. data/spec/support/matchers/eq_bytes.rb +5 -0
  111. data/spec/support/matchers/have_length.rb +5 -0
  112. data/tasks/rspec.rake +6 -0
  113. data/tasks/travis.rake +9 -0
  114. data/tasks/xdr.rake +48 -0
  115. data/xdr/SCPXDR.x +61 -0
  116. data/xdr/Stellar-ledger-entries.x +105 -0
  117. data/xdr/Stellar-ledger.x +117 -0
  118. data/xdr/Stellar-overlay.x +100 -0
  119. data/xdr/Stellar-transaction.x +497 -0
  120. data/xdr/Stellar-types.x +53 -0
  121. data/xdr/StellarXDR.x +11 -0
  122. metadata +342 -0
@@ -0,0 +1,497 @@
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 "generated/Stellar-ledger-entries.h"
6
+
7
+ namespace stellar
8
+ {
9
+
10
+ struct DecoratedSignature
11
+ {
12
+ opaque hint[4]; // first 4 bytes of the public key, used as a hint
13
+ uint512 signature; // actual signature
14
+ };
15
+
16
+ enum OperationType
17
+ {
18
+ PAYMENT = 0,
19
+ CREATE_OFFER = 1,
20
+ SET_OPTIONS = 2,
21
+ CHANGE_TRUST = 3,
22
+ ALLOW_TRUST = 4,
23
+ ACCOUNT_MERGE = 5,
24
+ INFLATION = 6
25
+ };
26
+
27
+ /* Payment
28
+
29
+ send an amount to a destination account, optionally through a path.
30
+ XLM payments create the destination account if it does not exist
31
+
32
+ Threshold: med
33
+
34
+ Result: PaymentResult
35
+ */
36
+ struct PaymentOp
37
+ {
38
+ AccountID destination; // recipient of the payment
39
+ Currency currency; // what they end up with
40
+ int64 amount; // amount they end up with
41
+
42
+ opaque memo<32>;
43
+ opaque sourceMemo<32>; // used to return a payment
44
+
45
+ // payment over path
46
+ Currency path<5>; // what hops it must go through to get there
47
+ int64 sendMax; // the maximum amount of the source currency (==path[0]) to
48
+ // send (excluding fees).
49
+ // The operation will fail if can't be met
50
+ };
51
+
52
+ /* Creates, updates or deletes an offer
53
+
54
+ Threshold: med
55
+
56
+ Result: CreateOfferResult
57
+
58
+ */
59
+ struct CreateOfferOp
60
+ {
61
+ Currency takerGets;
62
+ Currency takerPays;
63
+ int64 amount; // amount taker gets. if set to 0, delete the offer
64
+ Price price; // =takerPaysAmount/takerGetsAmount
65
+
66
+ // 0=create a new offer, otherwise edit an existing offer
67
+ uint64 offerID;
68
+ };
69
+
70
+ /* Set Account Options
71
+
72
+ updates "AccountEntry" fields.
73
+ note: updating thresholds or signers requires high threshold
74
+
75
+ Threshold: med or high
76
+
77
+ Result: SetOptionsResult
78
+ */
79
+
80
+ struct SetOptionsOp
81
+ {
82
+ AccountID* inflationDest; // sets the inflation destination
83
+
84
+ uint32* clearFlags; // which flags to clear
85
+ uint32* setFlags; // which flags to set
86
+
87
+ Thresholds* thresholds; // update the thresholds for the account
88
+
89
+ // Add, update or remove a signer for the account
90
+ // signer is deleted if the weight is 0
91
+ Signer* signer;
92
+ };
93
+
94
+ /* Creates, updates or deletes a trust line
95
+
96
+ Threshold: med
97
+
98
+ Result: ChangeTrustResult
99
+
100
+ */
101
+ struct ChangeTrustOp
102
+ {
103
+ Currency line;
104
+
105
+ // if limit is set to 0, deletes the trust line
106
+ int64 limit;
107
+ };
108
+
109
+ /* Updates the "authorized" flag of an existing trust line
110
+ this is called by the issuer of the related currency.
111
+
112
+ Threshold: low
113
+
114
+ Result: AllowTrustResult
115
+ */
116
+ struct AllowTrustOp
117
+ {
118
+ AccountID trustor;
119
+ union switch (CurrencyType type)
120
+ {
121
+ // NATIVE is not allowed
122
+ case ISO4217:
123
+ opaque currencyCode[4];
124
+
125
+ // add other currency types here in the future
126
+ }
127
+ currency;
128
+
129
+ bool authorize;
130
+ };
131
+
132
+ /* Inflation
133
+ Runs inflation
134
+
135
+ Threshold: low
136
+
137
+ Result: InflationResult
138
+
139
+ */
140
+
141
+ /* AccountMerge
142
+ Transfers native balance to destination account.
143
+
144
+ Threshold: high
145
+
146
+ Result : AccountMergeResult
147
+ */
148
+
149
+ /* An operation is the lowest unit of work that a transaction does */
150
+ struct Operation
151
+ {
152
+ // sourceAccount is the account used to run the operation
153
+ // if not set, the runtime defaults to "account" specified at
154
+ // the transaction level
155
+ AccountID* sourceAccount;
156
+
157
+ union switch (OperationType type)
158
+ {
159
+ case PAYMENT:
160
+ PaymentOp paymentOp;
161
+ case CREATE_OFFER:
162
+ CreateOfferOp createOfferOp;
163
+ case SET_OPTIONS:
164
+ SetOptionsOp setOptionsOp;
165
+ case CHANGE_TRUST:
166
+ ChangeTrustOp changeTrustOp;
167
+ case ALLOW_TRUST:
168
+ AllowTrustOp allowTrustOp;
169
+ case ACCOUNT_MERGE:
170
+ uint256 destination;
171
+ case INFLATION:
172
+ uint32 inflationSeq;
173
+ }
174
+ body;
175
+ };
176
+
177
+ /* a transaction is a container for a set of operations
178
+ - is executed by an account
179
+ - fees are collected from the account
180
+ - operations are executed in order as one ACID transaction
181
+ either all operations are applied or none are
182
+ if any returns a failing code
183
+ */
184
+
185
+ struct Transaction
186
+ {
187
+ // account used to run the transaction
188
+ AccountID sourceAccount;
189
+
190
+ // maximum fee this transaction can collect
191
+ // the transaction is aborted if the fee is higher
192
+ int32 maxFee;
193
+
194
+ // sequence number to consume in the account
195
+ SequenceNumber seqNum;
196
+
197
+ // validity range (inclusive) for the ledger sequence number
198
+ uint32 minLedger;
199
+ uint32 maxLedger;
200
+
201
+ Operation operations<100>;
202
+ };
203
+
204
+ /* A TransactionEnvelope wraps a transaction with signatures. */
205
+ struct TransactionEnvelope
206
+ {
207
+ Transaction tx;
208
+ DecoratedSignature signatures<20>;
209
+ };
210
+
211
+ /* Operation Results section */
212
+
213
+ /* This result is used when offers are taken during an operation */
214
+ struct ClaimOfferAtom
215
+ {
216
+ // emited to identify the offer
217
+ AccountID offerOwner; // Account that owns the offer
218
+ uint64 offerID;
219
+
220
+ // amount and currency taken from the owner
221
+ Currency currencyClaimed;
222
+ int64 amountClaimed;
223
+
224
+ // should we also include the amount that the owner gets in return?
225
+ };
226
+
227
+ /******* Payment Result ********/
228
+
229
+ enum PaymentResultCode
230
+ {
231
+ // codes considered as "success" for the operation
232
+ PAYMENT_SUCCESS = 0, // simple payment success
233
+ PAYMENT_SUCCESS_MULTI = 1, // multi-path payment success
234
+
235
+ // codes considered as "failure" for the operation
236
+ PAYMENT_UNDERFUNDED = 2, // not enough funds in source account
237
+ PAYMENT_NO_DESTINATION = 3, // destination account does not exist
238
+ PAYMENT_NO_TRUST = 4, // destination missing a trust line for currency
239
+ PAYMENT_NOT_AUTHORIZED = 5, // destination not authorized to hold currency
240
+ PAYMENT_LINE_FULL = 6, // destination would go above their limit
241
+ PAYMENT_TOO_FEW_OFFERS = 7, // not enough offers to satisfy path payment
242
+ PAYMENT_OVER_SENDMAX = 8, // multi-path payment could not satisfy sendmax
243
+ PAYMENT_LOW_RESERVE = 9 // would create an account below the min reserve
244
+ };
245
+
246
+ struct SimplePaymentResult
247
+ {
248
+ AccountID destination;
249
+ Currency currency;
250
+ int64 amount;
251
+ };
252
+
253
+ struct PaymentSuccessMultiResult
254
+ {
255
+ ClaimOfferAtom offers<>;
256
+ SimplePaymentResult last;
257
+ };
258
+
259
+ union PaymentResult switch (PaymentResultCode code)
260
+ {
261
+ case PAYMENT_SUCCESS:
262
+ void;
263
+ case PAYMENT_SUCCESS_MULTI:
264
+ PaymentSuccessMultiResult multi;
265
+ default:
266
+ void;
267
+ };
268
+
269
+ /******* CreateOffer Result ********/
270
+
271
+ enum CreateOfferResultCode
272
+ {
273
+ // codes considered as "success" for the operation
274
+ CREATE_OFFER_SUCCESS = 0,
275
+
276
+ // codes considered as "failure" for the operation
277
+ CREATE_OFFER_NO_TRUST = 1, // can't hold what it's buying
278
+ CREATE_OFFER_NOT_AUTHORIZED = 2, // not authorized to hold what it's buying
279
+ CREATE_OFFER_LINE_FULL = 3, // can't receive more of what it's buying
280
+ CREATE_OFFER_MALFORMED = 4, // generated offer would be invalid
281
+ CREATE_OFFER_UNDERFUNDED = 5, // doesn't hold what it's trying to sell
282
+ CREATE_OFFER_CROSS_SELF = 6, // would cross an offer from the same user
283
+
284
+ // update errors
285
+ CREATE_OFFER_NOT_FOUND = 7, // offerID does not match an existing offer
286
+ CREATE_OFFER_MISMATCH = 8, // currencies don't match offer
287
+
288
+ CREATE_OFFER_LOW_RESERVE = 9 // not enough funds to create a new Offer
289
+
290
+ };
291
+
292
+ enum CreateOfferEffect
293
+ {
294
+ CREATE_OFFER_CREATED = 0,
295
+ CREATE_OFFER_UPDATED = 1,
296
+ CREATE_OFFER_DELETED = 2
297
+ };
298
+
299
+ struct CreateOfferSuccessResult
300
+ {
301
+ // offers that got claimed while creating this offer
302
+ ClaimOfferAtom offersClaimed<>;
303
+
304
+ union switch (CreateOfferEffect effect)
305
+ {
306
+ case CREATE_OFFER_CREATED:
307
+ case CREATE_OFFER_UPDATED:
308
+ OfferEntry offer;
309
+ default:
310
+ void;
311
+ }
312
+ offer;
313
+ };
314
+
315
+ union CreateOfferResult switch (CreateOfferResultCode code)
316
+ {
317
+ case CREATE_OFFER_SUCCESS:
318
+ CreateOfferSuccessResult success;
319
+ default:
320
+ void;
321
+ };
322
+
323
+ /******* SetOptions Result ********/
324
+
325
+ enum SetOptionsResultCode
326
+ {
327
+ // codes considered as "success" for the operation
328
+ SET_OPTIONS_SUCCESS = 0,
329
+ // codes considered as "failure" for the operation
330
+ SET_OPTIONS_LOW_RESERVE = 1, // not enough funds to add a signer
331
+ SET_OPTIONS_TOO_MANY_SIGNERS = 2, // max number of signers already reached
332
+ SET_OPTIONS_BAD_FLAGS = 3 // invalid combination of clear/set flags
333
+ };
334
+
335
+ union SetOptionsResult switch (SetOptionsResultCode code)
336
+ {
337
+ case SET_OPTIONS_SUCCESS:
338
+ void;
339
+ default:
340
+ void;
341
+ };
342
+
343
+ /******* ChangeTrust Result ********/
344
+
345
+ enum ChangeTrustResultCode
346
+ {
347
+ // codes considered as "success" for the operation
348
+ CHANGE_TRUST_SUCCESS = 0,
349
+ // codes considered as "failure" for the operation
350
+ CHANGE_TRUST_NO_ISSUER = 1, // could not find issuer
351
+ CHANGE_TRUST_INVALID_LIMIT = 2, // cannot drop limit below balance
352
+ CHANGE_TRUST_LOW_RESERVE = 3 // not enough funds to create a new trust line
353
+ };
354
+
355
+ union ChangeTrustResult switch (ChangeTrustResultCode code)
356
+ {
357
+ case CHANGE_TRUST_SUCCESS:
358
+ void;
359
+ default:
360
+ void;
361
+ };
362
+
363
+ /******* AllowTrust Result ********/
364
+
365
+ enum AllowTrustResultCode
366
+ {
367
+ // codes considered as "success" for the operation
368
+ ALLOW_TRUST_SUCCESS = 0,
369
+ // codes considered as "failure" for the operation
370
+ ALLOW_TRUST_MALFORMED = 1, // currency is not ISO4217
371
+ ALLOW_TRUST_NO_TRUST_LINE = 2, // trustor does not have a trustline
372
+ ALLOW_TRUST_TRUST_NOT_REQUIRED = 3 // source account does not require trust
373
+ };
374
+
375
+ union AllowTrustResult switch (AllowTrustResultCode code)
376
+ {
377
+ case ALLOW_TRUST_SUCCESS:
378
+ void;
379
+ default:
380
+ void;
381
+ };
382
+
383
+ /******* AccountMerge Result ********/
384
+
385
+ enum AccountMergeResultCode
386
+ {
387
+ // codes considered as "success" for the operation
388
+ ACCOUNT_MERGE_SUCCESS = 0,
389
+ // codes considered as "failure" for the operation
390
+ ACCOUNT_MERGE_MALFORMED = 1, // can't merge onto itself
391
+ ACCOUNT_MERGE_NO_ACCOUNT = 2, // destination does not exist
392
+ ACCOUNT_MERGE_HAS_CREDIT = 3, // account has active trust lines
393
+ ACCOUNT_MERGE_CREDIT_HELD = 4 // an issuer cannot be merged if used
394
+ };
395
+
396
+ union AccountMergeResult switch (AccountMergeResultCode code)
397
+ {
398
+ case ACCOUNT_MERGE_SUCCESS:
399
+ void;
400
+ default:
401
+ void;
402
+ };
403
+
404
+ /******* Inflation Result ********/
405
+
406
+ enum InflationResultCode
407
+ {
408
+ // codes considered as "success" for the operation
409
+ INFLATION_SUCCESS = 0,
410
+ // codes considered as "failure" for the operation
411
+ INFLATION_NOT_TIME = 1
412
+ };
413
+
414
+ struct inflationPayout // or use PaymentResultAtom to limit types?
415
+ {
416
+ AccountID destination;
417
+ int64 amount;
418
+ };
419
+
420
+ union InflationResult switch (InflationResultCode code)
421
+ {
422
+ case INFLATION_SUCCESS:
423
+ inflationPayout payouts<>;
424
+ default:
425
+ void;
426
+ };
427
+
428
+ /* High level Operation Result */
429
+
430
+ enum OperationResultCode
431
+ {
432
+ opINNER = 0, // inner object result is valid
433
+
434
+ opBAD_AUTH = 1, // not enough signatures to perform operation
435
+ opNO_ACCOUNT = 2 // source account was not found
436
+ };
437
+
438
+ union OperationResult switch (OperationResultCode code)
439
+ {
440
+ case opINNER:
441
+ union switch (OperationType type)
442
+ {
443
+ case PAYMENT:
444
+ PaymentResult paymentResult;
445
+ case CREATE_OFFER:
446
+ CreateOfferResult createOfferResult;
447
+ case SET_OPTIONS:
448
+ SetOptionsResult setOptionsResult;
449
+ case CHANGE_TRUST:
450
+ ChangeTrustResult changeTrustResult;
451
+ case ALLOW_TRUST:
452
+ AllowTrustResult allowTrustResult;
453
+ case ACCOUNT_MERGE:
454
+ AccountMergeResult accountMergeResult;
455
+ case INFLATION:
456
+ InflationResult inflationResult;
457
+ }
458
+ tr;
459
+ default:
460
+ void;
461
+ };
462
+
463
+ enum TransactionResultCode
464
+ {
465
+ txSUCCESS = 0, // all operations succeeded
466
+
467
+ txDUPLICATE = 1, // transaction was already submited
468
+
469
+ txFAILED = 2, // one of the operations failed (but none were applied)
470
+
471
+ txBAD_LEDGER = 3, // ledger is not in range [minLeder; maxLedger]
472
+ txMISSING_OPERATION = 4, // no operation was specified
473
+ txBAD_SEQ = 5, // sequence number does not match source account
474
+
475
+ txBAD_AUTH = 6, // not enough signatures to perform transaction
476
+ txINSUFFICIENT_BALANCE = 7, // fee would bring account below reserve
477
+ txNO_ACCOUNT = 8, // source account not found
478
+ txINSUFFICIENT_FEE = 9, // max fee is too small
479
+ txBAD_AUTH_EXTRA = 10, // too many signatures on transaction
480
+ txINTERNAL_ERROR = 0xFFFFFFFF // an unknown error occured
481
+ };
482
+
483
+ struct TransactionResult
484
+ {
485
+ int64 feeCharged; // actual fee charged for the transaction
486
+
487
+ union switch (TransactionResultCode code)
488
+ {
489
+ case txSUCCESS:
490
+ case txFAILED:
491
+ OperationResult results<>;
492
+ default:
493
+ void;
494
+ }
495
+ result;
496
+ };
497
+ }
@@ -0,0 +1,53 @@
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 "generated/SCPXDR.h"
6
+
7
+ namespace stellar
8
+ {
9
+
10
+ // messages
11
+ typedef opaque uint512[64];
12
+ typedef opaque uint256[32];
13
+ typedef unsigned hyper uint64;
14
+ typedef hyper int64;
15
+ typedef unsigned int uint32;
16
+ typedef int int32;
17
+ typedef opaque AccountID[32];
18
+ typedef opaque Signature[64];
19
+ typedef opaque Hash[32];
20
+ typedef opaque Thresholds[4];
21
+
22
+ typedef uint64 SequenceNumber;
23
+
24
+ enum CurrencyType
25
+ {
26
+ NATIVE = 0,
27
+ ISO4217 = 1
28
+ };
29
+
30
+ struct ISOCurrencyIssuer
31
+ {
32
+ opaque currencyCode[4];
33
+ AccountID issuer;
34
+ };
35
+
36
+ union Currency switch (CurrencyType type)
37
+ {
38
+ case NATIVE:
39
+ void;
40
+
41
+ case ISO4217:
42
+ ISOCurrencyIssuer isoCI;
43
+
44
+ // add other currency types here in the future
45
+ };
46
+
47
+ // price in fractional representation
48
+ struct Price
49
+ {
50
+ int32 n; // numerator
51
+ int32 d; // denominator
52
+ };
53
+ }
data/xdr/StellarXDR.x ADDED
@@ -0,0 +1,11 @@
1
+
2
+ %#include "generated/Stellar-types.h"
3
+ %#include "generated/Stellar-ledger-entries.h"
4
+ %#include "generated/Stellar-transaction.h"
5
+ %#include "generated/Stellar-ledger.h"
6
+ %#include "generated/Stellar-overlay.h"
7
+
8
+ namespace stellar
9
+ {
10
+ }
11
+