stellar-base 0.22.0 → 0.23.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/{LICENSE.txt → LICENSE} +0 -0
  4. data/README.md +0 -4
  5. data/generated/stellar-base-generated.rb +10 -1
  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 +1 -1
  25. data/generated/stellar/manage_buy_offer_result_code.rb +5 -4
  26. data/generated/stellar/manage_sell_offer_result_code.rb +12 -8
  27. data/generated/stellar/muxed_account.rb +35 -0
  28. data/generated/stellar/muxed_account/med25519.rb +22 -0
  29. data/generated/stellar/operation.rb +3 -3
  30. data/generated/stellar/operation/body.rb +2 -2
  31. data/generated/stellar/operation_result.rb +1 -1
  32. data/generated/stellar/operation_result/tr.rb +1 -1
  33. data/generated/stellar/operation_result_code.rb +3 -3
  34. data/generated/stellar/path_payment_strict_receive_op.rb +4 -4
  35. data/generated/stellar/path_payment_strict_receive_result_code.rb +21 -12
  36. data/generated/stellar/path_payment_strict_send_op.rb +6 -6
  37. data/generated/stellar/path_payment_strict_send_result_code.rb +20 -12
  38. data/generated/stellar/payment_op.rb +4 -4
  39. data/generated/stellar/survey_response_body.rb +2 -2
  40. data/generated/stellar/transaction.rb +2 -2
  41. data/generated/stellar/transaction_envelope.rb +17 -8
  42. data/generated/stellar/transaction_result.rb +3 -0
  43. data/generated/stellar/transaction_result/result.rb +9 -3
  44. data/generated/stellar/transaction_result_code.rb +21 -14
  45. data/generated/stellar/transaction_signature_payload.rb +3 -1
  46. data/generated/stellar/transaction_signature_payload/tagged_transaction.rb +7 -3
  47. data/generated/stellar/transaction_v0.rb +39 -0
  48. data/generated/stellar/transaction_v0/ext.rb +24 -0
  49. data/generated/stellar/transaction_v0_envelope.rb +22 -0
  50. data/generated/stellar/transaction_v1_envelope.rb +22 -0
  51. data/generated/stellar/trust_line_flags.rb +6 -2
  52. data/lib/stellar-base.rb +27 -25
  53. data/lib/stellar/account_flags.rb +2 -4
  54. data/lib/stellar/asset.rb +6 -6
  55. data/lib/stellar/base.rb +1 -1
  56. data/lib/stellar/{base/compat.rb → compat.rb} +6 -7
  57. data/lib/stellar/concerns/transaction.rb +49 -0
  58. data/lib/stellar/convert.rb +2 -2
  59. data/lib/stellar/factories.rb +1 -3
  60. data/lib/stellar/fee_bump_transaction.rb +21 -0
  61. data/lib/stellar/key_pair.rb +9 -6
  62. data/lib/stellar/networks.rb +5 -7
  63. data/lib/stellar/operation.rb +421 -416
  64. data/lib/stellar/path_payment_strict_receive_result.rb +1 -2
  65. data/lib/stellar/price.rb +2 -4
  66. data/lib/stellar/signer_key.rb +4 -8
  67. data/lib/stellar/thresholds.rb +5 -7
  68. data/lib/stellar/transaction.rb +169 -195
  69. data/lib/stellar/transaction_builder.rb +59 -25
  70. data/lib/stellar/transaction_envelope.rb +40 -8
  71. data/lib/stellar/transaction_v0.rb +51 -0
  72. data/lib/stellar/util/continued_fraction.rb +19 -19
  73. data/lib/stellar/util/strkey.rb +39 -14
  74. data/lib/stellar/{base/version.rb → version.rb} +1 -1
  75. metadata +35 -204
  76. data/.gitignore +0 -17
  77. data/.travis.yml +0 -16
  78. data/.yardopts +0 -8
  79. data/CONTRIBUTING.md +0 -48
  80. data/Gemfile +0 -9
  81. data/Guardfile +0 -5
  82. data/Rakefile +0 -4
  83. data/examples/allow_trust.rb +0 -51
  84. data/examples/create_account.rb +0 -26
  85. data/examples/low_level_transaction_post.rb +0 -46
  86. data/examples/mid_level_transaction_post.rb +0 -33
  87. data/examples/non_native_payment.rb +0 -60
  88. data/examples/offer.rb +0 -75
  89. data/examples/transaction_merge.rb +0 -23
  90. data/ruby-stellar-base.gemspec +0 -34
  91. data/spec/lib/stellar/account_flags_spec.rb +0 -19
  92. data/spec/lib/stellar/asset_spec.rb +0 -45
  93. data/spec/lib/stellar/convert_spec.rb +0 -61
  94. data/spec/lib/stellar/key_pair_spec.rb +0 -251
  95. data/spec/lib/stellar/networks_spec.rb +0 -77
  96. data/spec/lib/stellar/operation_spec.rb +0 -131
  97. data/spec/lib/stellar/path_payment_strict_receive_result_spec.rb +0 -95
  98. data/spec/lib/stellar/price_spec.rb +0 -34
  99. data/spec/lib/stellar/signer_key_spec.rb +0 -26
  100. data/spec/lib/stellar/thresholds_spec.rb +0 -62
  101. data/spec/lib/stellar/transaction_builder_spec.rb +0 -263
  102. data/spec/lib/stellar/transaction_envelope_spec.rb +0 -93
  103. data/spec/lib/stellar/transaction_spec.rb +0 -132
  104. data/spec/lib/stellar/util/strkey_spec.rb +0 -54
  105. data/spec/spec_helper.rb +0 -16
  106. data/spec/support/matchers/be_strkey.rb +0 -9
  107. data/spec/support/matchers/eq_bytes.rb +0 -5
  108. data/spec/support/matchers/have_length.rb +0 -5
  109. data/tasks/rspec.rake +0 -6
  110. data/tasks/travis.rake +0 -1
  111. data/tasks/xdr.rake +0 -45
  112. data/xdr/Stellar-SCP.x +0 -86
  113. data/xdr/Stellar-ledger-entries.x +0 -295
  114. data/xdr/Stellar-ledger.x +0 -372
  115. data/xdr/Stellar-overlay.x +0 -229
  116. data/xdr/Stellar-transaction.x +0 -901
  117. data/xdr/Stellar-types.x +0 -81
@@ -1,295 +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-types.h"
6
-
7
- namespace stellar
8
- {
9
-
10
- typedef PublicKey AccountID;
11
- typedef opaque Thresholds[4];
12
- typedef string string32<32>;
13
- typedef string string64<64>;
14
- typedef int64 SequenceNumber;
15
- typedef uint64 TimePoint;
16
- typedef opaque DataValue<64>;
17
-
18
- // 1-4 alphanumeric characters right-padded with 0 bytes
19
- typedef opaque AssetCode4[4];
20
-
21
- // 5-12 alphanumeric characters right-padded with 0 bytes
22
- typedef opaque AssetCode12[12];
23
-
24
- enum AssetType
25
- {
26
- ASSET_TYPE_NATIVE = 0,
27
- ASSET_TYPE_CREDIT_ALPHANUM4 = 1,
28
- ASSET_TYPE_CREDIT_ALPHANUM12 = 2
29
- };
30
-
31
- union Asset switch (AssetType type)
32
- {
33
- case ASSET_TYPE_NATIVE: // Not credit
34
- void;
35
-
36
- case ASSET_TYPE_CREDIT_ALPHANUM4:
37
- struct
38
- {
39
- AssetCode4 assetCode;
40
- AccountID issuer;
41
- } alphaNum4;
42
-
43
- case ASSET_TYPE_CREDIT_ALPHANUM12:
44
- struct
45
- {
46
- AssetCode12 assetCode;
47
- AccountID issuer;
48
- } alphaNum12;
49
-
50
- // add other asset types here in the future
51
- };
52
-
53
- // price in fractional representation
54
- struct Price
55
- {
56
- int32 n; // numerator
57
- int32 d; // denominator
58
- };
59
-
60
- struct Liabilities
61
- {
62
- int64 buying;
63
- int64 selling;
64
- };
65
-
66
- // the 'Thresholds' type is packed uint8_t values
67
- // defined by these indexes
68
- enum ThresholdIndexes
69
- {
70
- THRESHOLD_MASTER_WEIGHT = 0,
71
- THRESHOLD_LOW = 1,
72
- THRESHOLD_MED = 2,
73
- THRESHOLD_HIGH = 3
74
- };
75
-
76
- enum LedgerEntryType
77
- {
78
- ACCOUNT = 0,
79
- TRUSTLINE = 1,
80
- OFFER = 2,
81
- DATA = 3
82
- };
83
-
84
- struct Signer
85
- {
86
- SignerKey key;
87
- uint32 weight; // really only need 1 byte
88
- };
89
-
90
- enum AccountFlags
91
- { // masks for each flag
92
-
93
- // Flags set on issuer accounts
94
- // TrustLines are created with authorized set to "false" requiring
95
- // the issuer to set it for each TrustLine
96
- AUTH_REQUIRED_FLAG = 0x1,
97
- // If set, the authorized flag in TrustLines can be cleared
98
- // otherwise, authorization cannot be revoked
99
- AUTH_REVOCABLE_FLAG = 0x2,
100
- // Once set, causes all AUTH_* flags to be read-only
101
- AUTH_IMMUTABLE_FLAG = 0x4
102
- };
103
-
104
- // mask for all valid flags
105
- const MASK_ACCOUNT_FLAGS = 0x7;
106
-
107
- /* AccountEntry
108
-
109
- Main entry representing a user in Stellar. All transactions are
110
- performed using an account.
111
-
112
- Other ledger entries created require an account.
113
-
114
- */
115
- struct AccountEntry
116
- {
117
- AccountID accountID; // master public key for this account
118
- int64 balance; // in stroops
119
- SequenceNumber seqNum; // last sequence number used for this account
120
- uint32 numSubEntries; // number of sub-entries this account has
121
- // drives the reserve
122
- AccountID* inflationDest; // Account to vote for during inflation
123
- uint32 flags; // see AccountFlags
124
-
125
- string32 homeDomain; // can be used for reverse federation and memo lookup
126
-
127
- // fields used for signatures
128
- // thresholds stores unsigned bytes: [weight of master|low|medium|high]
129
- Thresholds thresholds;
130
-
131
- Signer signers<20>; // possible signers for this account
132
-
133
- // reserved for future use
134
- union switch (int v)
135
- {
136
- case 0:
137
- void;
138
- case 1:
139
- struct
140
- {
141
- Liabilities liabilities;
142
-
143
- union switch (int v)
144
- {
145
- case 0:
146
- void;
147
- }
148
- ext;
149
- } v1;
150
- }
151
- ext;
152
- };
153
-
154
- /* TrustLineEntry
155
- A trust line represents a specific trust relationship with
156
- a credit/issuer (limit, authorization)
157
- as well as the balance.
158
- */
159
-
160
- enum TrustLineFlags
161
- {
162
- // issuer has authorized account to perform transactions with its credit
163
- AUTHORIZED_FLAG = 1
164
- };
165
-
166
- // mask for all trustline flags
167
- const MASK_TRUSTLINE_FLAGS = 1;
168
-
169
- struct TrustLineEntry
170
- {
171
- AccountID accountID; // account this trustline belongs to
172
- Asset asset; // type of asset (with issuer)
173
- int64 balance; // how much of this asset the user has.
174
- // Asset defines the unit for this;
175
-
176
- int64 limit; // balance cannot be above this
177
- uint32 flags; // see TrustLineFlags
178
-
179
- // reserved for future use
180
- union switch (int v)
181
- {
182
- case 0:
183
- void;
184
- case 1:
185
- struct
186
- {
187
- Liabilities liabilities;
188
-
189
- union switch (int v)
190
- {
191
- case 0:
192
- void;
193
- }
194
- ext;
195
- } v1;
196
- }
197
- ext;
198
- };
199
-
200
- enum OfferEntryFlags
201
- {
202
- // issuer has authorized account to perform transactions with its credit
203
- PASSIVE_FLAG = 1
204
- };
205
-
206
- // Mask for OfferEntry flags
207
- const MASK_OFFERENTRY_FLAGS = 1;
208
-
209
- /* OfferEntry
210
- An offer is the building block of the offer book, they are automatically
211
- claimed by payments when the price set by the owner is met.
212
-
213
- For example an Offer is selling 10A where 1A is priced at 1.5B
214
-
215
- */
216
- struct OfferEntry
217
- {
218
- AccountID sellerID;
219
- int64 offerID;
220
- Asset selling; // A
221
- Asset buying; // B
222
- int64 amount; // amount of A
223
-
224
- /* price for this offer:
225
- price of A in terms of B
226
- price=AmountB/AmountA=priceNumerator/priceDenominator
227
- price is after fees
228
- */
229
- Price price;
230
- uint32 flags; // see OfferEntryFlags
231
-
232
- // reserved for future use
233
- union switch (int v)
234
- {
235
- case 0:
236
- void;
237
- }
238
- ext;
239
- };
240
-
241
- /* DataEntry
242
- Data can be attached to accounts.
243
- */
244
- struct DataEntry
245
- {
246
- AccountID accountID; // account this data belongs to
247
- string64 dataName;
248
- DataValue dataValue;
249
-
250
- // reserved for future use
251
- union switch (int v)
252
- {
253
- case 0:
254
- void;
255
- }
256
- ext;
257
- };
258
-
259
- struct LedgerEntry
260
- {
261
- uint32 lastModifiedLedgerSeq; // ledger the LedgerEntry was last changed
262
-
263
- union switch (LedgerEntryType type)
264
- {
265
- case ACCOUNT:
266
- AccountEntry account;
267
- case TRUSTLINE:
268
- TrustLineEntry trustLine;
269
- case OFFER:
270
- OfferEntry offer;
271
- case DATA:
272
- DataEntry data;
273
- }
274
- data;
275
-
276
- // reserved for future use
277
- union switch (int v)
278
- {
279
- case 0:
280
- void;
281
- }
282
- ext;
283
- };
284
-
285
- // list of all envelope types used in the application
286
- // those are prefixes used when building signatures for
287
- // the respective envelopes
288
- enum EnvelopeType
289
- {
290
- ENVELOPE_TYPE_SCP = 1,
291
- ENVELOPE_TYPE_TX = 2,
292
- ENVELOPE_TYPE_AUTH = 3,
293
- ENVELOPE_TYPE_SCPVALUE = 4
294
- };
295
- }
@@ -1,372 +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
- struct TransactionMetaV2
310
- {
311
- LedgerEntryChanges txChangesBefore; // tx level changes before operations
312
- // are applied if any
313
- OperationMeta operations<>; // meta for each operation
314
- LedgerEntryChanges txChangesAfter; // tx level changes after operations are
315
- // applied if any
316
- };
317
-
318
- // this is the meta produced when applying transactions
319
- // it does not include pre-apply updates such as fees
320
- union TransactionMeta switch (int v)
321
- {
322
- case 0:
323
- OperationMeta operations<>;
324
- case 1:
325
- TransactionMetaV1 v1;
326
- case 2:
327
- TransactionMetaV2 v2;
328
- };
329
-
330
- // This struct groups together changes on a per transaction basis
331
- // note however that fees and transaction application are done in separate
332
- // phases
333
- struct TransactionResultMeta
334
- {
335
- TransactionResultPair result;
336
- LedgerEntryChanges feeProcessing;
337
- TransactionMeta txApplyProcessing;
338
- };
339
-
340
- // this represents a single upgrade that was performed as part of a ledger
341
- // upgrade
342
- struct UpgradeEntryMeta
343
- {
344
- LedgerUpgrade upgrade;
345
- LedgerEntryChanges changes;
346
- };
347
-
348
- struct LedgerCloseMetaV0
349
- {
350
- LedgerHeaderHistoryEntry ledgerHeader;
351
- // NB: txSet is sorted in "Hash order"
352
- TransactionSet txSet;
353
-
354
- // NB: transactions are sorted in apply order here
355
- // fees for all transactions are processed first
356
- // followed by applying transactions
357
- TransactionResultMeta txProcessing<>;
358
-
359
- // upgrades are applied last
360
- UpgradeEntryMeta upgradesProcessing<>;
361
-
362
- // other misc information attached to the ledger close
363
- SCPHistoryEntry scpInfo<>;
364
- };
365
-
366
- union LedgerCloseMeta switch (int v)
367
- {
368
- case 0:
369
- LedgerCloseMetaV0 v0;
370
- };
371
-
372
- }