stellar-base 0.23.1 → 0.24.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +88 -0
  3. data/generated/stellar-base-generated.rb +29 -1
  4. data/generated/stellar/account_entry.rb +3 -13
  5. data/generated/stellar/account_entry/ext.rb +2 -16
  6. data/generated/stellar/account_entry_extension_v1.rb +32 -0
  7. data/generated/stellar/account_entry_extension_v1/ext.rb +28 -0
  8. data/generated/stellar/account_entry_extension_v2.rb +34 -0
  9. data/generated/stellar/{account_entry/ext/v1 → account_entry_extension_v2}/ext.rb +8 -12
  10. data/generated/stellar/account_merge_result_code.rb +3 -1
  11. data/generated/stellar/begin_sponsoring_future_reserves_op.rb +18 -0
  12. data/generated/stellar/begin_sponsoring_future_reserves_result.rb +25 -0
  13. data/generated/stellar/begin_sponsoring_future_reserves_result_code.rb +29 -0
  14. data/generated/stellar/claim_claimable_balance_op.rb +18 -0
  15. data/generated/stellar/claim_claimable_balance_result.rb +25 -0
  16. data/generated/stellar/claim_claimable_balance_result_code.rb +31 -0
  17. data/generated/stellar/claim_predicate.rb +43 -0
  18. data/generated/stellar/claim_predicate_type.rb +30 -0
  19. data/generated/stellar/claimable_balance_entry.rb +44 -0
  20. data/generated/stellar/claimable_balance_entry/ext.rb +24 -0
  21. data/generated/stellar/claimable_balance_id.rb +23 -0
  22. data/generated/stellar/claimable_balance_id_type.rb +20 -0
  23. data/generated/stellar/claimant.rb +31 -0
  24. data/generated/stellar/claimant/v0.rb +22 -0
  25. data/generated/stellar/claimant_type.rb +20 -0
  26. data/generated/stellar/create_claimable_balance_op.rb +22 -0
  27. data/generated/stellar/create_claimable_balance_result.rb +27 -0
  28. data/generated/stellar/create_claimable_balance_result_code.rb +30 -0
  29. data/generated/stellar/end_sponsoring_future_reserves_result.rb +25 -0
  30. data/generated/stellar/end_sponsoring_future_reserves_result_code.rb +25 -0
  31. data/generated/stellar/envelope_type.rb +3 -1
  32. data/generated/stellar/inner_transaction_result.rb +2 -1
  33. data/generated/stellar/inner_transaction_result/result.rb +3 -1
  34. data/generated/stellar/ledger_entry.rb +4 -0
  35. data/generated/stellar/ledger_entry/data.rb +12 -8
  36. data/generated/stellar/ledger_entry/ext.rb +4 -0
  37. data/generated/stellar/ledger_entry_extension_v1.rb +30 -0
  38. data/generated/stellar/ledger_entry_extension_v1/ext.rb +24 -0
  39. data/generated/stellar/ledger_entry_type.rb +7 -5
  40. data/generated/stellar/ledger_key.rb +17 -8
  41. data/generated/stellar/ledger_key/claimable_balance.rb +20 -0
  42. data/generated/stellar/operation.rb +10 -0
  43. data/generated/stellar/operation/body.rb +45 -26
  44. data/generated/stellar/operation_id.rb +32 -0
  45. data/generated/stellar/operation_id/id.rb +24 -0
  46. data/generated/stellar/operation_result.rb +10 -0
  47. data/generated/stellar/operation_result/tr.rb +48 -28
  48. data/generated/stellar/operation_result_code.rb +3 -1
  49. data/generated/stellar/operation_type.rb +25 -15
  50. data/generated/stellar/path_payment_strict_receive_result.rb +2 -1
  51. data/generated/stellar/revoke_sponsorship_op.rb +36 -0
  52. data/generated/stellar/revoke_sponsorship_op/signer.rb +22 -0
  53. data/generated/stellar/revoke_sponsorship_result.rb +25 -0
  54. data/generated/stellar/revoke_sponsorship_result_code.rb +31 -0
  55. data/generated/stellar/revoke_sponsorship_type.rb +22 -0
  56. data/generated/stellar/transaction_result_code.rb +4 -2
  57. data/lib/stellar-base.rb +15 -5
  58. data/lib/stellar/account_flags.rb +1 -1
  59. data/lib/stellar/{version.rb → base/version.rb} +1 -1
  60. data/lib/stellar/claim_predicate.rb +198 -0
  61. data/lib/stellar/compat.rb +2 -11
  62. data/lib/stellar/dsl.rb +85 -0
  63. data/lib/stellar/ext/xdr.rb +49 -0
  64. data/lib/stellar/key_pair.rb +43 -35
  65. data/lib/stellar/ledger_key.rb +30 -0
  66. data/lib/stellar/networks.rb +12 -12
  67. data/lib/stellar/operation.rb +58 -1
  68. data/lib/stellar/price.rb +11 -2
  69. data/lib/stellar/transaction.rb +0 -168
  70. data/lib/stellar/transaction_builder.rb +28 -2
  71. data/lib/stellar/transaction_envelope.rb +3 -29
  72. data/lib/stellar/util/strkey.rb +6 -6
  73. metadata +162 -32
  74. data/generated/stellar/account_entry/ext/v1.rb +0 -34
  75. data/lib/stellar/util/continued_fraction.rb +0 -96
@@ -1,34 +0,0 @@
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
- # struct
9
- # {
10
- # Liabilities liabilities;
11
- #
12
- # union switch (int v)
13
- # {
14
- # case 0:
15
- # void;
16
- # }
17
- # ext;
18
- # }
19
- #
20
- # ===========================================================================
21
- module Stellar
22
- class AccountEntry
23
- class Ext
24
- class V1 < XDR::Struct
25
- include XDR::Namespace
26
-
27
- autoload :Ext
28
-
29
- attribute :liabilities, Liabilities
30
- attribute :ext, Ext
31
- end
32
- end
33
- end
34
- end
@@ -1,96 +0,0 @@
1
- module Stellar
2
- module Util
3
- class ContinuedFraction
4
- MAX_PRECISION = (2**32) - 1
5
- attr_reader :i
6
- attr_reader :f
7
-
8
- def self.best_r(number, max_precision = MAX_PRECISION)
9
- cur_cf = new(number)
10
-
11
- loop do
12
- next_cf = cur_cf.extend
13
- cur_r = cur_cf.to_r(max_precision)
14
- next_r = next_cf.to_r(max_precision)
15
-
16
- break cur_r if cur_cf.done? || cur_r == next_r
17
-
18
- cur_cf = next_cf
19
- end
20
-
21
- cur_cf.to_r(max_precision)
22
- end
23
-
24
- def initialize(val, parents = [])
25
- @i = val.floor
26
- @f = val - @i
27
- @parents = parents
28
- end
29
-
30
- def to_a
31
- @parents + [i]
32
- end
33
-
34
- def error(actual)
35
- (actual - to_f).abs
36
- end
37
-
38
- def to_f
39
- convergent = convergents.last
40
- convergent.n / convergent.d.to_f
41
- end
42
-
43
- def convergents
44
- return @convergents if defined? @convergents
45
-
46
- c = [Fraction.new(0, 1), Fraction.new(1, 0)]
47
- to_a.each_with_index do |a, i|
48
- i += 2
49
-
50
- h = a * c[i - 1].n + c[i - 2].n
51
- k = a * c[i - 1].d + c[i - 2].d
52
- c << Fraction.new(h, k)
53
- end
54
-
55
- @converegents = c[2..-1]
56
- end
57
-
58
- def to_r(max_precision = MAX_PRECISION)
59
- fraction = convergents.take_while { |c|
60
- c.n <= max_precision && c.d <= max_precision
61
- }.last
62
-
63
- Rational(fraction.n, fraction.d)
64
- end
65
-
66
- def done?
67
- @f == 0
68
- end
69
-
70
- def extend(count = 1)
71
- result = self
72
-
73
- count.times do
74
- break if result.done?
75
- result = ContinuedFraction.new(1 / result.f, result.to_a)
76
- end
77
-
78
- result
79
- end
80
-
81
- class Fraction
82
- attr_reader :n
83
- attr_reader :d
84
-
85
- def initialize(n, d)
86
- @n = n
87
- @d = d
88
- end
89
-
90
- def to_r
91
- Rational(@n, @d)
92
- end
93
- end
94
- end
95
- end
96
- end