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,318 +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
- enum StellarValueType
14
- {
15
- STELLAR_VALUE_BASIC = 0,
16
- STELLAR_VALUE_SIGNED = 1
17
- };
18
-
19
- struct LedgerCloseValueSignature
20
- {
21
- NodeID nodeID; // which node introduced the value
22
- Signature signature; // nodeID's signature
23
- };
24
-
25
- /* StellarValue is the value used by SCP to reach consensus on a given ledger
26
- */
27
- struct StellarValue
28
- {
29
- Hash txSetHash; // transaction set to apply to previous ledger
30
- TimePoint closeTime; // network close time
31
-
32
- // upgrades to apply to the previous ledger (usually empty)
33
- // this is a vector of encoded 'LedgerUpgrade' so that nodes can drop
34
- // unknown steps during consensus if needed.
35
- // see notes below on 'LedgerUpgrade' for more detail
36
- // max size is dictated by number of upgrade types (+ room for future)
37
- UpgradeType upgrades<6>;
38
-
39
- // reserved for future use
40
- union switch (StellarValueType v)
41
- {
42
- case STELLAR_VALUE_BASIC:
43
- void;
44
- case STELLAR_VALUE_SIGNED:
45
- LedgerCloseValueSignature lcValueSignature;
46
- }
47
- ext;
48
- };
49
-
50
- /* The LedgerHeader is the highest level structure representing the
51
- * state of a ledger, cryptographically linked to previous ledgers.
52
- */
53
- struct LedgerHeader
54
- {
55
- uint32 ledgerVersion; // the protocol version of the ledger
56
- Hash previousLedgerHash; // hash of the previous ledger header
57
- StellarValue scpValue; // what consensus agreed to
58
- Hash txSetResultHash; // the TransactionResultSet that led to this ledger
59
- Hash bucketListHash; // hash of the ledger state
60
-
61
- uint32 ledgerSeq; // sequence number of this ledger
62
-
63
- int64 totalCoins; // total number of stroops in existence.
64
- // 10,000,000 stroops in 1 XLM
65
-
66
- int64 feePool; // fees burned since last inflation run
67
- uint32 inflationSeq; // inflation sequence number
68
-
69
- uint64 idPool; // last used global ID, used for generating objects
70
-
71
- uint32 baseFee; // base fee per operation in stroops
72
- uint32 baseReserve; // account base reserve in stroops
73
-
74
- uint32 maxTxSetSize; // maximum size a transaction set can be
75
-
76
- Hash skipList[4]; // hashes of ledgers in the past. allows you to jump back
77
- // in time without walking the chain back ledger by ledger
78
- // each slot contains the oldest ledger that is mod of
79
- // either 50 5000 50000 or 500000 depending on index
80
- // skipList[0] mod(50), skipList[1] mod(5000), etc
81
-
82
- // reserved for future use
83
- union switch (int v)
84
- {
85
- case 0:
86
- void;
87
- }
88
- ext;
89
- };
90
-
91
- /* Ledger upgrades
92
- note that the `upgrades` field from StellarValue is normalized such that
93
- it only contains one entry per LedgerUpgradeType, and entries are sorted
94
- in ascending order
95
- */
96
- enum LedgerUpgradeType
97
- {
98
- LEDGER_UPGRADE_VERSION = 1,
99
- LEDGER_UPGRADE_BASE_FEE = 2,
100
- LEDGER_UPGRADE_MAX_TX_SET_SIZE = 3,
101
- LEDGER_UPGRADE_BASE_RESERVE = 4
102
- };
103
-
104
- union LedgerUpgrade switch (LedgerUpgradeType type)
105
- {
106
- case LEDGER_UPGRADE_VERSION:
107
- uint32 newLedgerVersion; // update ledgerVersion
108
- case LEDGER_UPGRADE_BASE_FEE:
109
- uint32 newBaseFee; // update baseFee
110
- case LEDGER_UPGRADE_MAX_TX_SET_SIZE:
111
- uint32 newMaxTxSetSize; // update maxTxSetSize
112
- case LEDGER_UPGRADE_BASE_RESERVE:
113
- uint32 newBaseReserve; // update baseReserve
114
- };
115
-
116
- /* Entries used to define the bucket list */
117
-
118
- union LedgerKey switch (LedgerEntryType type)
119
- {
120
- case ACCOUNT:
121
- struct
122
- {
123
- AccountID accountID;
124
- } account;
125
-
126
- case TRUSTLINE:
127
- struct
128
- {
129
- AccountID accountID;
130
- Asset asset;
131
- } trustLine;
132
-
133
- case OFFER:
134
- struct
135
- {
136
- AccountID sellerID;
137
- int64 offerID;
138
- } offer;
139
-
140
- case DATA:
141
- struct
142
- {
143
- AccountID accountID;
144
- string64 dataName;
145
- } data;
146
- };
147
-
148
- enum BucketEntryType
149
- {
150
- METAENTRY =
151
- -1, // At-and-after protocol 11: bucket metadata, should come first.
152
- LIVEENTRY = 0, // Before protocol 11: created-or-updated;
153
- // At-and-after protocol 11: only updated.
154
- DEADENTRY = 1,
155
- INITENTRY = 2 // At-and-after protocol 11: only created.
156
- };
157
-
158
- struct BucketMetadata
159
- {
160
- // Indicates the protocol version used to create / merge this bucket.
161
- uint32 ledgerVersion;
162
-
163
- // reserved for future use
164
- union switch (int v)
165
- {
166
- case 0:
167
- void;
168
- }
169
- ext;
170
- };
171
-
172
- union BucketEntry switch (BucketEntryType type)
173
- {
174
- case LIVEENTRY:
175
- case INITENTRY:
176
- LedgerEntry liveEntry;
177
-
178
- case DEADENTRY:
179
- LedgerKey deadEntry;
180
- case METAENTRY:
181
- BucketMetadata metaEntry;
182
- };
183
-
184
- // Transaction sets are the unit used by SCP to decide on transitions
185
- // between ledgers
186
- struct TransactionSet
187
- {
188
- Hash previousLedgerHash;
189
- TransactionEnvelope txs<>;
190
- };
191
-
192
- struct TransactionResultPair
193
- {
194
- Hash transactionHash;
195
- TransactionResult result; // result for the transaction
196
- };
197
-
198
- // TransactionResultSet is used to recover results between ledgers
199
- struct TransactionResultSet
200
- {
201
- TransactionResultPair results<>;
202
- };
203
-
204
- // Entries below are used in the historical subsystem
205
-
206
- struct TransactionHistoryEntry
207
- {
208
- uint32 ledgerSeq;
209
- TransactionSet txSet;
210
-
211
- // reserved for future use
212
- union switch (int v)
213
- {
214
- case 0:
215
- void;
216
- }
217
- ext;
218
- };
219
-
220
- struct TransactionHistoryResultEntry
221
- {
222
- uint32 ledgerSeq;
223
- TransactionResultSet txResultSet;
224
-
225
- // reserved for future use
226
- union switch (int v)
227
- {
228
- case 0:
229
- void;
230
- }
231
- ext;
232
- };
233
-
234
- struct LedgerHeaderHistoryEntry
235
- {
236
- Hash hash;
237
- LedgerHeader header;
238
-
239
- // reserved for future use
240
- union switch (int v)
241
- {
242
- case 0:
243
- void;
244
- }
245
- ext;
246
- };
247
-
248
- // historical SCP messages
249
-
250
- struct LedgerSCPMessages
251
- {
252
- uint32 ledgerSeq;
253
- SCPEnvelope messages<>;
254
- };
255
-
256
- // note: ledgerMessages may refer to any quorumSets encountered
257
- // in the file so far, not just the one from this entry
258
- struct SCPHistoryEntryV0
259
- {
260
- SCPQuorumSet quorumSets<>; // additional quorum sets used by ledgerMessages
261
- LedgerSCPMessages ledgerMessages;
262
- };
263
-
264
- // SCP history file is an array of these
265
- union SCPHistoryEntry switch (int v)
266
- {
267
- case 0:
268
- SCPHistoryEntryV0 v0;
269
- };
270
-
271
- // represents the meta in the transaction table history
272
-
273
- // STATE is emitted every time a ledger entry is modified/deleted
274
- // and the entry was not already modified in the current ledger
275
-
276
- enum LedgerEntryChangeType
277
- {
278
- LEDGER_ENTRY_CREATED = 0, // entry was added to the ledger
279
- LEDGER_ENTRY_UPDATED = 1, // entry was modified in the ledger
280
- LEDGER_ENTRY_REMOVED = 2, // entry was removed from the ledger
281
- LEDGER_ENTRY_STATE = 3 // value of the entry
282
- };
283
-
284
- union LedgerEntryChange switch (LedgerEntryChangeType type)
285
- {
286
- case LEDGER_ENTRY_CREATED:
287
- LedgerEntry created;
288
- case LEDGER_ENTRY_UPDATED:
289
- LedgerEntry updated;
290
- case LEDGER_ENTRY_REMOVED:
291
- LedgerKey removed;
292
- case LEDGER_ENTRY_STATE:
293
- LedgerEntry state;
294
- };
295
-
296
- typedef LedgerEntryChange LedgerEntryChanges<>;
297
-
298
- struct OperationMeta
299
- {
300
- LedgerEntryChanges changes;
301
- };
302
-
303
- struct TransactionMetaV1
304
- {
305
- LedgerEntryChanges txChanges; // tx level changes if any
306
- OperationMeta operations<>; // meta for each operation
307
- };
308
-
309
- // this is the meta produced when applying transactions
310
- // it does not include pre-apply updates such as fees
311
- union TransactionMeta switch (int v)
312
- {
313
- case 0:
314
- OperationMeta operations<>;
315
- case 1:
316
- TransactionMetaV1 v1;
317
- };
318
- }
@@ -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
- }