stellar-base 0.23.1 → 0.24.0.pre.1
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 +4 -4
- data/CHANGELOG.md +88 -0
- data/generated/stellar-base-generated.rb +29 -1
- data/generated/stellar/account_entry.rb +3 -13
- data/generated/stellar/account_entry/ext.rb +2 -16
- data/generated/stellar/account_entry_extension_v1.rb +32 -0
- data/generated/stellar/account_entry_extension_v1/ext.rb +28 -0
- data/generated/stellar/account_entry_extension_v2.rb +34 -0
- data/generated/stellar/{account_entry/ext/v1 → account_entry_extension_v2}/ext.rb +8 -12
- data/generated/stellar/account_merge_result_code.rb +3 -1
- data/generated/stellar/begin_sponsoring_future_reserves_op.rb +18 -0
- data/generated/stellar/begin_sponsoring_future_reserves_result.rb +25 -0
- data/generated/stellar/begin_sponsoring_future_reserves_result_code.rb +29 -0
- data/generated/stellar/claim_claimable_balance_op.rb +18 -0
- data/generated/stellar/claim_claimable_balance_result.rb +25 -0
- data/generated/stellar/claim_claimable_balance_result_code.rb +31 -0
- data/generated/stellar/claim_predicate.rb +43 -0
- data/generated/stellar/claim_predicate_type.rb +30 -0
- data/generated/stellar/claimable_balance_entry.rb +44 -0
- data/generated/stellar/claimable_balance_entry/ext.rb +24 -0
- data/generated/stellar/claimable_balance_id.rb +23 -0
- data/generated/stellar/claimable_balance_id_type.rb +20 -0
- data/generated/stellar/claimant.rb +31 -0
- data/generated/stellar/claimant/v0.rb +22 -0
- data/generated/stellar/claimant_type.rb +20 -0
- data/generated/stellar/create_claimable_balance_op.rb +22 -0
- data/generated/stellar/create_claimable_balance_result.rb +27 -0
- data/generated/stellar/create_claimable_balance_result_code.rb +30 -0
- data/generated/stellar/end_sponsoring_future_reserves_result.rb +25 -0
- data/generated/stellar/end_sponsoring_future_reserves_result_code.rb +25 -0
- data/generated/stellar/envelope_type.rb +3 -1
- data/generated/stellar/inner_transaction_result.rb +2 -1
- data/generated/stellar/inner_transaction_result/result.rb +3 -1
- data/generated/stellar/ledger_entry.rb +4 -0
- data/generated/stellar/ledger_entry/data.rb +12 -8
- data/generated/stellar/ledger_entry/ext.rb +4 -0
- data/generated/stellar/ledger_entry_extension_v1.rb +30 -0
- data/generated/stellar/ledger_entry_extension_v1/ext.rb +24 -0
- data/generated/stellar/ledger_entry_type.rb +7 -5
- data/generated/stellar/ledger_key.rb +17 -8
- data/generated/stellar/ledger_key/claimable_balance.rb +20 -0
- data/generated/stellar/operation.rb +10 -0
- data/generated/stellar/operation/body.rb +45 -26
- data/generated/stellar/operation_id.rb +32 -0
- data/generated/stellar/operation_id/id.rb +24 -0
- data/generated/stellar/operation_result.rb +10 -0
- data/generated/stellar/operation_result/tr.rb +48 -28
- data/generated/stellar/operation_result_code.rb +3 -1
- data/generated/stellar/operation_type.rb +25 -15
- data/generated/stellar/path_payment_strict_receive_result.rb +2 -1
- data/generated/stellar/revoke_sponsorship_op.rb +36 -0
- data/generated/stellar/revoke_sponsorship_op/signer.rb +22 -0
- data/generated/stellar/revoke_sponsorship_result.rb +25 -0
- data/generated/stellar/revoke_sponsorship_result_code.rb +31 -0
- data/generated/stellar/revoke_sponsorship_type.rb +22 -0
- data/generated/stellar/transaction_result_code.rb +4 -2
- data/lib/stellar-base.rb +15 -5
- data/lib/stellar/account_flags.rb +1 -1
- data/lib/stellar/{version.rb → base/version.rb} +1 -1
- data/lib/stellar/claim_predicate.rb +198 -0
- data/lib/stellar/compat.rb +2 -11
- data/lib/stellar/dsl.rb +85 -0
- data/lib/stellar/ext/xdr.rb +49 -0
- data/lib/stellar/key_pair.rb +43 -35
- data/lib/stellar/ledger_key.rb +30 -0
- data/lib/stellar/networks.rb +12 -12
- data/lib/stellar/operation.rb +58 -1
- data/lib/stellar/price.rb +11 -2
- data/lib/stellar/transaction.rb +0 -168
- data/lib/stellar/transaction_builder.rb +28 -2
- data/lib/stellar/transaction_envelope.rb +3 -29
- data/lib/stellar/util/strkey.rb +6 -6
- metadata +162 -32
- data/generated/stellar/account_entry/ext/v1.rb +0 -34
- 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
|