stellar-base 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59ccf30d51104989ef078751dd5f6ce3bf2facf1
4
- data.tar.gz: 7a9aaffc482a6a95101a1bbf361dc9f239651d4d
3
+ metadata.gz: d1f8db8c0eef99ea37838371a5718d8ab6df3e0d
4
+ data.tar.gz: 3170f3c49015a46b0d8337769ea1672194d4f584
5
5
  SHA512:
6
- metadata.gz: 3c59e6fa06c50718053befe0e7b3785243a4590b66fec841aa9e94577a31dac4891210b35fc182cb3e20973ca4efc2ce3242f19d95aac5ce2e64e3e9a97c9b62
7
- data.tar.gz: dee133d72af36e8616c3e5afd7b0e9d8dfe19c3c90dc98089b428e851d47d1ea1e5e5f788ecf05f298648b7b87b72c13ff22fa95e4e8d2bef46eab0e426c93fb
6
+ metadata.gz: c4ce937a9b9ac9c8b14c1cd8b8557182e1d24c3e6c3d432801c8109fb5df8f3b0b7bb909352368d01cbd67d4d75b46a67495a5e93be274d95aafbbd3a5c76cff
7
+ data.tar.gz: 632997ffa01f3bf3d380aabb2b56553cbfba65cd74b92af20bd896f054c54f59ec070238d3aca36739a4937106b9fa1c6cc13e31b36e74f0fe5b386d40fc723d
data/.travis.yml CHANGED
@@ -4,7 +4,7 @@ rvm:
4
4
  - 2.1.5
5
5
  - 2.0.0
6
6
  - 1.9.3
7
- - jruby-1.7.9
7
+ - jruby-1.7.20
8
8
  - jruby-head
9
9
  script: bundle exec rake travis
10
10
  notifications:
data/README.md CHANGED
@@ -24,6 +24,14 @@ Or install it yourself as:
24
24
 
25
25
  Also requires libsodium. Installable via `brew install libsodium` on OS X.
26
26
 
27
+ ## Supported Ruby Versions
28
+
29
+ Please see [travis.yml](.travis.yml) for what versions of ruby are currently tested by our continuous integration system. Any ruby in that list is officially supported.
30
+
31
+ ### JRuby
32
+
33
+ It seems as though jruby is particularly slow when it comes to BigDecimal math; the source behind this slowness has not been investigated, but it is something to be aware of.
34
+
27
35
  ## Usage
28
36
 
29
37
  [Examples are here](examples)
@@ -12,7 +12,7 @@ require 'xdr'
12
12
  # SequenceNumber seqNum; // last sequence number used for this account
13
13
  # uint32 numSubEntries; // number of sub-entries this account has
14
14
  # // drives the reserve
15
- # AccountID* inflationDest; // Account to vote during inflation
15
+ # AccountID* inflationDest; // Account to vote for during inflation
16
16
  # uint32 flags; // see AccountFlags
17
17
  #
18
18
  # string32 homeDomain; // can be used for reverse federation and memo lookup
@@ -8,7 +8,7 @@ require 'xdr'
8
8
  # union AccountMergeResult switch (AccountMergeResultCode code)
9
9
  # {
10
10
  # case ACCOUNT_MERGE_SUCCESS:
11
- # void;
11
+ # int64 sourceAccountBalance; // how much got transfered from source account
12
12
  # default:
13
13
  # void;
14
14
  # };
@@ -18,8 +18,9 @@ module Stellar
18
18
  class AccountMergeResult < XDR::Union
19
19
  switch_on AccountMergeResultCode, :code
20
20
 
21
- switch :account_merge_success
21
+ switch :account_merge_success, :source_account_balance
22
22
  switch :default
23
23
 
24
+ attribute :source_account_balance, Int64
24
25
  end
25
26
  end
@@ -14,7 +14,7 @@ require 'xdr'
14
14
  # case ASSET_TYPE_CREDIT_ALPHANUM4:
15
15
  # opaque assetCode4[4];
16
16
  #
17
- # case ASSET_TYPE_CREDIT_ALPHANUM12:
17
+ # case ASSET_TYPE_CREDIT_ALPHANUM12:
18
18
  # opaque assetCode12[12];
19
19
  #
20
20
  # // add other asset types here in the future
@@ -11,7 +11,7 @@ require 'xdr'
11
11
  # case ASSET_TYPE_CREDIT_ALPHANUM4:
12
12
  # opaque assetCode4[4];
13
13
  #
14
- # case ASSET_TYPE_CREDIT_ALPHANUM12:
14
+ # case ASSET_TYPE_CREDIT_ALPHANUM12:
15
15
  # opaque assetCode12[12];
16
16
  #
17
17
  # // add other asset types here in the future
@@ -8,26 +8,26 @@ require 'xdr'
8
8
  # struct ClaimOfferAtom
9
9
  # {
10
10
  # // emited to identify the offer
11
- # AccountID offerOwner; // Account that owns the offer
11
+ # AccountID sellerID; // Account that owns the offer
12
12
  # uint64 offerID;
13
13
  #
14
14
  # // amount and asset taken from the owner
15
- # Asset assetClaimed;
16
- # int64 amountClaimed;
15
+ # Asset assetSold;
16
+ # int64 amountSold;
17
17
  #
18
- # // amount and assetsent to the owner
19
- # Asset assetSend;
20
- # int64 amountSend;
18
+ # // amount and asset sent to the owner
19
+ # Asset assetBought;
20
+ # int64 amountBought;
21
21
  # };
22
22
  #
23
23
  # ===========================================================================
24
24
  module Stellar
25
25
  class ClaimOfferAtom < XDR::Struct
26
- attribute :offer_owner, AccountID
27
- attribute :offer_id, Uint64
28
- attribute :asset_claimed, Asset
29
- attribute :amount_claimed, Int64
30
- attribute :asset_send, Asset
31
- attribute :amount_send, Int64
26
+ attribute :seller_id, AccountID
27
+ attribute :offer_id, Uint64
28
+ attribute :asset_sold, Asset
29
+ attribute :amount_sold, Int64
30
+ attribute :asset_bought, Asset
31
+ attribute :amount_bought, Int64
32
32
  end
33
33
  end
@@ -7,10 +7,10 @@ require 'xdr'
7
7
  #
8
8
  # struct CreatePassiveOfferOp
9
9
  # {
10
- # Asset selling; // A
11
- # Asset buying; // B
12
- # int64 amount; // amount taker gets. if set to 0, delete the offer
13
- # Price price; // cost of A in terms of B
10
+ # Asset selling; // A
11
+ # Asset buying; // B
12
+ # int64 amount; // amount taker gets. if set to 0, delete the offer
13
+ # Price price; // cost of A in terms of B
14
14
  # };
15
15
  #
16
16
  # ===========================================================================
@@ -5,27 +5,40 @@ require 'xdr'
5
5
 
6
6
  # === xdr source ============================================================
7
7
  #
8
- # union LedgerEntry switch (LedgerEntryType type)
8
+ # struct LedgerEntry
9
9
  # {
10
- # case ACCOUNT:
11
- # AccountEntry account;
12
- # case TRUSTLINE:
13
- # TrustLineEntry trustLine;
14
- # case OFFER:
15
- # OfferEntry offer;
10
+ # uint32 lastModifiedLedgerSeq; // ledger the LedgerEntry was last changed
11
+ #
12
+ # union switch (LedgerEntryType type)
13
+ # {
14
+ # case ACCOUNT:
15
+ # AccountEntry account;
16
+ # case TRUSTLINE:
17
+ # TrustLineEntry trustLine;
18
+ # case OFFER:
19
+ # OfferEntry offer;
20
+ # }
21
+ # data;
22
+ #
23
+ # // reserved for future use
24
+ # union switch (int v)
25
+ # {
26
+ # case 0:
27
+ # void;
28
+ # }
29
+ # ext;
16
30
  # };
17
31
  #
18
32
  # ===========================================================================
19
33
  module Stellar
20
- class LedgerEntry < XDR::Union
21
- switch_on LedgerEntryType, :type
34
+ class LedgerEntry < XDR::Struct
35
+ include XDR::Namespace
22
36
 
23
- switch :account, :account
24
- switch :trustline, :trust_line
25
- switch :offer, :offer
37
+ autoload :Data
38
+ autoload :Ext
26
39
 
27
- attribute :account, AccountEntry
28
- attribute :trust_line, TrustLineEntry
29
- attribute :offer, OfferEntry
40
+ attribute :last_modified_ledger_seq, Uint32
41
+ attribute :data, Data
42
+ attribute :ext, Ext
30
43
  end
31
44
  end
@@ -0,0 +1,33 @@
1
+ # This code was automatically generated using xdrgen
2
+ # DO NOT EDIT or your changes may be overwritten
3
+
4
+ require 'xdr'
5
+
6
+ # === xdr source ============================================================
7
+ #
8
+ # union switch (LedgerEntryType type)
9
+ # {
10
+ # case ACCOUNT:
11
+ # AccountEntry account;
12
+ # case TRUSTLINE:
13
+ # TrustLineEntry trustLine;
14
+ # case OFFER:
15
+ # OfferEntry offer;
16
+ # }
17
+ #
18
+ # ===========================================================================
19
+ module Stellar
20
+ class LedgerEntry
21
+ class Data < XDR::Union
22
+ switch_on LedgerEntryType, :type
23
+
24
+ switch :account, :account
25
+ switch :trustline, :trust_line
26
+ switch :offer, :offer
27
+
28
+ attribute :account, AccountEntry
29
+ attribute :trust_line, TrustLineEntry
30
+ attribute :offer, OfferEntry
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,24 @@
1
+ # This code was automatically generated using xdrgen
2
+ # DO NOT EDIT or your changes may be overwritten
3
+
4
+ require 'xdr'
5
+
6
+ # === xdr source ============================================================
7
+ #
8
+ # union switch (int v)
9
+ # {
10
+ # case 0:
11
+ # void;
12
+ # }
13
+ #
14
+ # ===========================================================================
15
+ module Stellar
16
+ class LedgerEntry
17
+ class Ext < XDR::Union
18
+ switch_on XDR::Int, :v
19
+
20
+ switch 0
21
+
22
+ end
23
+ end
24
+ end
@@ -10,8 +10,8 @@ require 'xdr'
10
10
  # AccountID sellerID;
11
11
  # uint64 offerID;
12
12
  # Asset selling; // A
13
- # Asset buying; // B
14
- # int64 amount; // amount of A
13
+ # Asset buying; // B
14
+ # int64 amount; // amount of A
15
15
  #
16
16
  # /* price for this offer:
17
17
  # price of A in terms of B
@@ -8,12 +8,12 @@ require 'xdr'
8
8
  # struct PathPaymentOp
9
9
  # {
10
10
  # Asset sendAsset; // asset we pay with
11
- # int64 sendMax; // the maximum amount of sendAsset to
12
- # // send (excluding fees).
13
- # // The operation will fail if can't be met
11
+ # int64 sendMax; // the maximum amount of sendAsset to
12
+ # // send (excluding fees).
13
+ # // The operation will fail if can't be met
14
14
  #
15
15
  # AccountID destination; // recipient of the payment
16
- # Asset destAsset; // what they end up with
16
+ # Asset destAsset; // what they end up with
17
17
  # int64 destAmount; // amount they end up with
18
18
  #
19
19
  # Asset path<5>; // additional hops it must go through to get there
@@ -16,11 +16,12 @@ require 'xdr'
16
16
  # PATH_PAYMENT_SRC_NO_TRUST = -3, // no trust line on source account
17
17
  # PATH_PAYMENT_SRC_NOT_AUTHORIZED = -4, // source not authorized to transfer
18
18
  # PATH_PAYMENT_NO_DESTINATION = -5, // destination account does not exist
19
- # PATH_PAYMENT_NO_TRUST = -6, // dest missing a trust line for asset
20
- # PATH_PAYMENT_NOT_AUTHORIZED = -7, // dest not authorized to hold asset
21
- # PATH_PAYMENT_LINE_FULL = -8, // dest would go above their limit
22
- # PATH_PAYMENT_TOO_FEW_OFFERS = -9, // not enough offers to satisfy path
23
- # PATH_PAYMENT_OVER_SENDMAX = -10 // could not satisfy sendmax
19
+ # PATH_PAYMENT_NO_TRUST = -6, // dest missing a trust line for asset
20
+ # PATH_PAYMENT_NOT_AUTHORIZED = -7, // dest not authorized to hold asset
21
+ # PATH_PAYMENT_LINE_FULL = -8, // dest would go above their limit
22
+ # PATH_PAYMENT_TOO_FEW_OFFERS = -9, // not enough offers to satisfy path
23
+ # PATH_PAYMENT_OFFER_CROSS_SELF = -10, // would cross one of its own offers
24
+ # PATH_PAYMENT_OVER_SENDMAX = -11 // could not satisfy sendmax
24
25
  # };
25
26
  #
26
27
  # ===========================================================================
@@ -36,7 +37,8 @@ module Stellar
36
37
  member :path_payment_not_authorized, -7
37
38
  member :path_payment_line_full, -8
38
39
  member :path_payment_too_few_offers, -9
39
- member :path_payment_over_sendmax, -10
40
+ member :path_payment_offer_cross_self, -10
41
+ member :path_payment_over_sendmax, -11
40
42
 
41
43
  seal
42
44
  end
@@ -8,7 +8,7 @@ require 'xdr'
8
8
  # struct PaymentOp
9
9
  # {
10
10
  # AccountID destination; // recipient of the payment
11
- # Asset asset; // what they end up with
11
+ # Asset asset; // what they end up with
12
12
  # int64 amount; // amount they end up with
13
13
  # };
14
14
  #
@@ -16,7 +16,7 @@ require 'xdr'
16
16
  # PAYMENT_SRC_NO_TRUST = -3, // no trust line on source account
17
17
  # PAYMENT_SRC_NOT_AUTHORIZED = -4, // source not authorized to transfer
18
18
  # PAYMENT_NO_DESTINATION = -5, // destination account does not exist
19
- # PAYMENT_NO_TRUST = -6, // destination missing a trust line for asset
19
+ # PAYMENT_NO_TRUST = -6, // destination missing a trust line for asset
20
20
  # PAYMENT_NOT_AUTHORIZED = -7, // destination not authorized to hold asset
21
21
  # PAYMENT_LINE_FULL = -8 // destination would go above their limit
22
22
  # };
@@ -9,7 +9,7 @@ require 'xdr'
9
9
  # {
10
10
  # txSUCCESS = 0, // all operations succeeded
11
11
  #
12
- # txFAILED = -1, // one of the operations failed (but none were applied)
12
+ # txFAILED = -1, // one of the operations failed (none were applied)
13
13
  #
14
14
  # txTOO_EARLY = -2, // ledger closeTime before minTime
15
15
  # txTOO_LATE = -3, // ledger closeTime after maxTime
@@ -8,7 +8,7 @@ require 'xdr'
8
8
  # struct TrustLineEntry
9
9
  # {
10
10
  # AccountID accountID; // account this trustline belongs to
11
- # Asset asset; // type of asset (with issuer)
11
+ # Asset asset; // type of asset (with issuer)
12
12
  # int64 balance; // how much of this asset the user has.
13
13
  # // Asset defines the unit for this;
14
14
  #
@@ -1,5 +1,5 @@
1
1
  module Stellar
2
2
  module Base
3
- VERSION = "0.1.4"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -1,3 +1,5 @@
1
+ require 'bigdecimal'
2
+
1
3
  module Stellar
2
4
  class Operation
3
5
 
@@ -135,7 +137,7 @@ module Stellar
135
137
  selling = Asset.send(*attributes[:selling])
136
138
  amount = attributes[:amount]
137
139
  offer_id = attributes[:offer_id] || 0
138
- price = Price.from_f(attributes[:price])
140
+ price = interpret_price(attributes[:price])
139
141
 
140
142
  op = ManageOfferOp.new({
141
143
  buying: buying,
@@ -154,7 +156,7 @@ module Stellar
154
156
  buying = Asset.send(*attributes[:buying])
155
157
  selling = Asset.send(*attributes[:selling])
156
158
  amount = attributes[:amount]
157
- price = Price.from_f(attributes[:price])
159
+ price = interpret_price(attributes[:price])
158
160
 
159
161
  op = CreatePassiveOfferOp.new({
160
162
  buying: buying,
@@ -283,5 +285,20 @@ module Stellar
283
285
 
284
286
  return asset, amount
285
287
  end
288
+
289
+
290
+ def self.interpret_price(price)
291
+ case price
292
+ when String
293
+ bd = BigDecimal.new(price)
294
+ Price.from_f(bd)
295
+ when Numeric
296
+ Price.from_f(price)
297
+ when Stellar::Price
298
+ price
299
+ else
300
+ raise ArgumentError, "Invalid price type: #{price.class}. Must be String, Numeric, or Stellar::Price"
301
+ end
302
+ end
286
303
  end
287
304
  end
@@ -7,10 +7,10 @@ module Stellar
7
7
  s = success!
8
8
  return s.last.amount if s.offers.blank?
9
9
 
10
- source_asset = s.offers.first.asset_send
11
- source_offers = s.offers.take_while{|o| o.asset_send == source_asset}
10
+ source_asset = s.offers.first.asset_bought
11
+ source_offers = s.offers.take_while{|o| o.asset_bought == source_asset}
12
12
 
13
- source_offers.map(&:amount_send).sum
13
+ source_offers.map(&:amount_bought).sum
14
14
  end
15
15
 
16
16
  end
@@ -40,6 +40,6 @@ describe Stellar::Asset, "#code" do
40
40
  end
41
41
 
42
42
  it "raises an error when called on a native asset" do
43
- expect{ Stellar::Asset.native.code }.to raise_error
43
+ expect{ Stellar::Asset.native.code }.to raise_error(RuntimeError)
44
44
  end
45
45
  end
@@ -26,7 +26,7 @@ describe Stellar::PathPaymentResult, "#send_amount" do
26
26
  context "with simple 1-hop result" do
27
27
  let(:simple_success){ Stellar::SimplePaymentResult.new(amount: 100) }
28
28
  let(:offers) do
29
- [Stellar::ClaimOfferAtom.new(asset_send: Stellar::Asset.native, amount_send: 200)]
29
+ [Stellar::ClaimOfferAtom.new(asset_bought: Stellar::Asset.native, amount_bought: 200)]
30
30
  end
31
31
 
32
32
  let(:path_success) do
@@ -47,8 +47,8 @@ describe Stellar::PathPaymentResult, "#send_amount" do
47
47
  let(:simple_success){ Stellar::SimplePaymentResult.new(amount: 100) }
48
48
  let(:offers) do
49
49
  [
50
- Stellar::ClaimOfferAtom.new(asset_send: Stellar::Asset.native, amount_send: 200),
51
- Stellar::ClaimOfferAtom.new(asset_send: Stellar::Asset.native, amount_send: 200),
50
+ Stellar::ClaimOfferAtom.new(asset_bought: Stellar::Asset.native, amount_bought: 200),
51
+ Stellar::ClaimOfferAtom.new(asset_bought: Stellar::Asset.native, amount_bought: 200),
52
52
  ]
53
53
  end
54
54
 
@@ -72,9 +72,9 @@ describe Stellar::PathPaymentResult, "#send_amount" do
72
72
  let(:otherAsset){ Stellar::Asset.alphanum4("USD", Stellar::KeyPair.random) }
73
73
  let(:offers) do
74
74
  [
75
- Stellar::ClaimOfferAtom.new(asset_send: Stellar::Asset.native, amount_send: 200),
76
- Stellar::ClaimOfferAtom.new(asset_send: Stellar::Asset.native, amount_send: 200),
77
- Stellar::ClaimOfferAtom.new(asset_send: otherAsset, amount_send: 200),
75
+ Stellar::ClaimOfferAtom.new(asset_bought: Stellar::Asset.native, amount_bought: 200),
76
+ Stellar::ClaimOfferAtom.new(asset_bought: Stellar::Asset.native, amount_bought: 200),
77
+ Stellar::ClaimOfferAtom.new(asset_bought: otherAsset, amount_bought: 200),
78
78
  ]
79
79
  end
80
80
 
@@ -18,4 +18,17 @@ describe Stellar::Price, "#from_f" do
18
18
  end
19
19
  end
20
20
 
21
+ it "works with bigdecimal" do
22
+ whole = random.rand(1_000_000)
23
+ fractional = random.rand(10_000_000) # seven significant digits available for fractional
24
+
25
+ expected = BigDecimal.new("#{whole}.#{fractional}")
26
+ actual_p = subject.from_f(expected)
27
+ actual = BigDecimal.new(actual_p.n) / BigDecimal.new(actual_p.d)
28
+
29
+ expect(actual).to be_within(BigDecimal.new("0.000000001")).of(actual)
30
+ expect(actual_p.n).to be <= Stellar::Price::MAX_PRECISION
31
+ expect(actual_p.d).to be <= Stellar::Price::MAX_PRECISION
32
+ end
33
+
21
34
  end
@@ -31,28 +31,28 @@ describe Stellar::Thresholds, ".make" do
31
31
  end
32
32
 
33
33
  it "errors unless all components are provided" do
34
- expect{ subject.make(good.except(:master_weight)) }.to raise_error
35
- expect{ subject.make(good.except(:low)) }.to raise_error
36
- expect{ subject.make(good.except(:medium)) }.to raise_error
37
- expect{ subject.make(good.except(:high)) }.to raise_error
34
+ expect{ subject.make(good.except(:master_weight)) }.to raise_error(ArgumentError)
35
+ expect{ subject.make(good.except(:low)) }.to raise_error(ArgumentError)
36
+ expect{ subject.make(good.except(:medium)) }.to raise_error(ArgumentError)
37
+ expect{ subject.make(good.except(:high)) }.to raise_error(ArgumentError)
38
38
  end
39
39
 
40
40
  it "errors unless all components are numbers" do
41
- expect{ subject.make(good.merge(master_weight: "hello")) }.to raise_error
42
- expect{ subject.make(good.merge(low: "hello")) }.to raise_error
43
- expect{ subject.make(good.merge(medium: "hello")) }.to raise_error
44
- expect{ subject.make(good.merge(high: "hello")) }.to raise_error
41
+ expect{ subject.make(good.merge(master_weight: "hello")) }.to raise_error(ArgumentError)
42
+ expect{ subject.make(good.merge(low: "hello")) }.to raise_error(ArgumentError)
43
+ expect{ subject.make(good.merge(medium: "hello")) }.to raise_error(ArgumentError)
44
+ expect{ subject.make(good.merge(high: "hello")) }.to raise_error(ArgumentError)
45
45
  end
46
46
 
47
47
  it "errors unless all components are in (0..255)" do
48
- expect{ subject.make(good.merge(master_weight: -1)) }.to raise_error
49
- expect{ subject.make(good.merge(master_weight: 256)) }.to raise_error
50
- expect{ subject.make(good.merge(low: -1)) }.to raise_error
51
- expect{ subject.make(good.merge(low: 256)) }.to raise_error
52
- expect{ subject.make(good.merge(medium: -1)) }.to raise_error
53
- expect{ subject.make(good.merge(medium: 256)) }.to raise_error
54
- expect{ subject.make(good.merge(high: -1)) }.to raise_error
55
- expect{ subject.make(good.merge(high: 256)) }.to raise_error
48
+ expect{ subject.make(good.merge(master_weight: -1)) }.to raise_error(ArgumentError)
49
+ expect{ subject.make(good.merge(master_weight: 256)) }.to raise_error(ArgumentError)
50
+ expect{ subject.make(good.merge(low: -1)) }.to raise_error(ArgumentError)
51
+ expect{ subject.make(good.merge(low: 256)) }.to raise_error(ArgumentError)
52
+ expect{ subject.make(good.merge(medium: -1)) }.to raise_error(ArgumentError)
53
+ expect{ subject.make(good.merge(medium: 256)) }.to raise_error(ArgumentError)
54
+ expect{ subject.make(good.merge(high: -1)) }.to raise_error(ArgumentError)
55
+ expect{ subject.make(good.merge(high: 256)) }.to raise_error(ArgumentError)
56
56
  end
57
57
 
58
58
  it "ignores additional keys" do
@@ -98,7 +98,7 @@ struct AccountEntry
98
98
  SequenceNumber seqNum; // last sequence number used for this account
99
99
  uint32 numSubEntries; // number of sub-entries this account has
100
100
  // drives the reserve
101
- AccountID* inflationDest; // Account to vote during inflation
101
+ AccountID* inflationDest; // Account to vote for during inflation
102
102
  uint32 flags; // see AccountFlags
103
103
 
104
104
  string32 homeDomain; // can be used for reverse federation and memo lookup
@@ -133,7 +133,7 @@ enum TrustLineFlags
133
133
  struct TrustLineEntry
134
134
  {
135
135
  AccountID accountID; // account this trustline belongs to
136
- Asset asset; // type of asset (with issuer)
136
+ Asset asset; // type of asset (with issuer)
137
137
  int64 balance; // how much of this asset the user has.
138
138
  // Asset defines the unit for this;
139
139
 
@@ -167,8 +167,8 @@ struct OfferEntry
167
167
  AccountID sellerID;
168
168
  uint64 offerID;
169
169
  Asset selling; // A
170
- Asset buying; // B
171
- int64 amount; // amount of A
170
+ Asset buying; // B
171
+ int64 amount; // amount of A
172
172
 
173
173
  /* price for this offer:
174
174
  price of A in terms of B
@@ -187,14 +187,28 @@ struct OfferEntry
187
187
  ext;
188
188
  };
189
189
 
190
- union LedgerEntry switch (LedgerEntryType type)
190
+ struct LedgerEntry
191
191
  {
192
- case ACCOUNT:
193
- AccountEntry account;
194
- case TRUSTLINE:
195
- TrustLineEntry trustLine;
196
- case OFFER:
197
- OfferEntry offer;
192
+ uint32 lastModifiedLedgerSeq; // ledger the LedgerEntry was last changed
193
+
194
+ union switch (LedgerEntryType type)
195
+ {
196
+ case ACCOUNT:
197
+ AccountEntry account;
198
+ case TRUSTLINE:
199
+ TrustLineEntry trustLine;
200
+ case OFFER:
201
+ OfferEntry offer;
202
+ }
203
+ data;
204
+
205
+ // reserved for future use
206
+ union switch (int v)
207
+ {
208
+ case 0:
209
+ void;
210
+ }
211
+ ext;
198
212
  };
199
213
 
200
214
  // list of all envelope types used in the application
@@ -205,5 +219,4 @@ enum EnvelopeType
205
219
  ENVELOPE_TYPE_SCP = 1,
206
220
  ENVELOPE_TYPE_TX = 2
207
221
  };
208
-
209
222
  }
@@ -53,7 +53,7 @@ struct CreateAccountOp
53
53
  struct PaymentOp
54
54
  {
55
55
  AccountID destination; // recipient of the payment
56
- Asset asset; // what they end up with
56
+ Asset asset; // what they end up with
57
57
  int64 amount; // amount they end up with
58
58
  };
59
59
 
@@ -71,12 +71,12 @@ Result: PathPaymentResult
71
71
  struct PathPaymentOp
72
72
  {
73
73
  Asset sendAsset; // asset we pay with
74
- int64 sendMax; // the maximum amount of sendAsset to
75
- // send (excluding fees).
76
- // The operation will fail if can't be met
74
+ int64 sendMax; // the maximum amount of sendAsset to
75
+ // send (excluding fees).
76
+ // The operation will fail if can't be met
77
77
 
78
78
  AccountID destination; // recipient of the payment
79
- Asset destAsset; // what they end up with
79
+ Asset destAsset; // what they end up with
80
80
  int64 destAmount; // amount they end up with
81
81
 
82
82
  Asset path<5>; // additional hops it must go through to get there
@@ -109,10 +109,10 @@ Result: CreatePassiveOfferResult
109
109
  */
110
110
  struct CreatePassiveOfferOp
111
111
  {
112
- Asset selling; // A
113
- Asset buying; // B
114
- int64 amount; // amount taker gets. if set to 0, delete the offer
115
- Price price; // cost of A in terms of B
112
+ Asset selling; // A
113
+ Asset buying; // B
114
+ int64 amount; // amount taker gets. if set to 0, delete the offer
115
+ Price price; // cost of A in terms of B
116
116
  };
117
117
 
118
118
  /* Set Account Options
@@ -178,7 +178,7 @@ struct AllowTrustOp
178
178
  case ASSET_TYPE_CREDIT_ALPHANUM4:
179
179
  opaque assetCode4[4];
180
180
 
181
- case ASSET_TYPE_CREDIT_ALPHANUM12:
181
+ case ASSET_TYPE_CREDIT_ALPHANUM12:
182
182
  opaque assetCode12[12];
183
183
 
184
184
  // add other asset types here in the future
@@ -316,16 +316,16 @@ struct TransactionEnvelope
316
316
  struct ClaimOfferAtom
317
317
  {
318
318
  // emited to identify the offer
319
- AccountID offerOwner; // Account that owns the offer
319
+ AccountID sellerID; // Account that owns the offer
320
320
  uint64 offerID;
321
321
 
322
322
  // amount and asset taken from the owner
323
- Asset assetClaimed;
324
- int64 amountClaimed;
323
+ Asset assetSold;
324
+ int64 amountSold;
325
325
 
326
- // amount and assetsent to the owner
327
- Asset assetSend;
328
- int64 amountSend;
326
+ // amount and asset sent to the owner
327
+ Asset assetBought;
328
+ int64 amountBought;
329
329
  };
330
330
 
331
331
  /******* CreateAccount Result ********/
@@ -364,7 +364,7 @@ enum PaymentResultCode
364
364
  PAYMENT_SRC_NO_TRUST = -3, // no trust line on source account
365
365
  PAYMENT_SRC_NOT_AUTHORIZED = -4, // source not authorized to transfer
366
366
  PAYMENT_NO_DESTINATION = -5, // destination account does not exist
367
- PAYMENT_NO_TRUST = -6, // destination missing a trust line for asset
367
+ PAYMENT_NO_TRUST = -6, // destination missing a trust line for asset
368
368
  PAYMENT_NOT_AUTHORIZED = -7, // destination not authorized to hold asset
369
369
  PAYMENT_LINE_FULL = -8 // destination would go above their limit
370
370
  };
@@ -390,11 +390,12 @@ enum PathPaymentResultCode
390
390
  PATH_PAYMENT_SRC_NO_TRUST = -3, // no trust line on source account
391
391
  PATH_PAYMENT_SRC_NOT_AUTHORIZED = -4, // source not authorized to transfer
392
392
  PATH_PAYMENT_NO_DESTINATION = -5, // destination account does not exist
393
- PATH_PAYMENT_NO_TRUST = -6, // dest missing a trust line for asset
394
- PATH_PAYMENT_NOT_AUTHORIZED = -7, // dest not authorized to hold asset
395
- PATH_PAYMENT_LINE_FULL = -8, // dest would go above their limit
396
- PATH_PAYMENT_TOO_FEW_OFFERS = -9, // not enough offers to satisfy path
397
- PATH_PAYMENT_OVER_SENDMAX = -10 // could not satisfy sendmax
393
+ PATH_PAYMENT_NO_TRUST = -6, // dest missing a trust line for asset
394
+ PATH_PAYMENT_NOT_AUTHORIZED = -7, // dest not authorized to hold asset
395
+ PATH_PAYMENT_LINE_FULL = -8, // dest would go above their limit
396
+ PATH_PAYMENT_TOO_FEW_OFFERS = -9, // not enough offers to satisfy path
397
+ PATH_PAYMENT_OFFER_CROSS_SELF = -10, // would cross one of its own offers
398
+ PATH_PAYMENT_OVER_SENDMAX = -11 // could not satisfy sendmax
398
399
  };
399
400
 
400
401
  struct SimplePaymentResult
@@ -555,7 +556,7 @@ enum AccountMergeResultCode
555
556
  union AccountMergeResult switch (AccountMergeResultCode code)
556
557
  {
557
558
  case ACCOUNT_MERGE_SUCCESS:
558
- void;
559
+ int64 sourceAccountBalance; // how much got transfered from source account
559
560
  default:
560
561
  void;
561
562
  };
@@ -629,7 +630,7 @@ enum TransactionResultCode
629
630
  {
630
631
  txSUCCESS = 0, // all operations succeeded
631
632
 
632
- txFAILED = -1, // one of the operations failed (but none were applied)
633
+ txFAILED = -1, // one of the operations failed (none were applied)
633
634
 
634
635
  txTOO_EARLY = -2, // ledger closeTime before minTime
635
636
  txTOO_LATE = -3, // ledger closeTime after maxTime
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stellar-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Fleckenstein
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-24 00:00:00.000000000 Z
11
+ date: 2015-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xdr
@@ -276,6 +276,8 @@ files:
276
276
  - generated/stellar/inflation_result.rb
277
277
  - generated/stellar/inflation_result_code.rb
278
278
  - generated/stellar/ledger_entry.rb
279
+ - generated/stellar/ledger_entry/data.rb
280
+ - generated/stellar/ledger_entry/ext.rb
279
281
  - generated/stellar/ledger_entry_change.rb
280
282
  - generated/stellar/ledger_entry_change_type.rb
281
283
  - generated/stellar/ledger_entry_type.rb