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.
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
@@ -0,0 +1,18 @@
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 ClaimClaimableBalanceOp
9
+ # {
10
+ # ClaimableBalanceID balanceID;
11
+ # };
12
+ #
13
+ # ===========================================================================
14
+ module Stellar
15
+ class ClaimClaimableBalanceOp < XDR::Struct
16
+ attribute :balance_id, ClaimableBalanceID
17
+ end
18
+ end
@@ -0,0 +1,25 @@
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 ClaimClaimableBalanceResult switch (ClaimClaimableBalanceResultCode code)
9
+ # {
10
+ # case CLAIM_CLAIMABLE_BALANCE_SUCCESS:
11
+ # void;
12
+ # default:
13
+ # void;
14
+ # };
15
+ #
16
+ # ===========================================================================
17
+ module Stellar
18
+ class ClaimClaimableBalanceResult < XDR::Union
19
+ switch_on ClaimClaimableBalanceResultCode, :code
20
+
21
+ switch :claim_claimable_balance_success
22
+ switch :default
23
+
24
+ end
25
+ end
@@ -0,0 +1,31 @@
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
+ # enum ClaimClaimableBalanceResultCode
9
+ # {
10
+ # CLAIM_CLAIMABLE_BALANCE_SUCCESS = 0,
11
+ # CLAIM_CLAIMABLE_BALANCE_DOES_NOT_EXIST = -1,
12
+ # CLAIM_CLAIMABLE_BALANCE_CANNOT_CLAIM = -2,
13
+ # CLAIM_CLAIMABLE_BALANCE_LINE_FULL = -3,
14
+ # CLAIM_CLAIMABLE_BALANCE_NO_TRUST = -4,
15
+ # CLAIM_CLAIMABLE_BALANCE_NOT_AUTHORIZED = -5
16
+ #
17
+ # };
18
+ #
19
+ # ===========================================================================
20
+ module Stellar
21
+ class ClaimClaimableBalanceResultCode < XDR::Enum
22
+ member :claim_claimable_balance_success, 0
23
+ member :claim_claimable_balance_does_not_exist, -1
24
+ member :claim_claimable_balance_cannot_claim, -2
25
+ member :claim_claimable_balance_line_full, -3
26
+ member :claim_claimable_balance_no_trust, -4
27
+ member :claim_claimable_balance_not_authorized, -5
28
+
29
+ seal
30
+ end
31
+ end
@@ -0,0 +1,43 @@
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 ClaimPredicate switch (ClaimPredicateType type)
9
+ # {
10
+ # case CLAIM_PREDICATE_UNCONDITIONAL:
11
+ # void;
12
+ # case CLAIM_PREDICATE_AND:
13
+ # ClaimPredicate andPredicates<2>;
14
+ # case CLAIM_PREDICATE_OR:
15
+ # ClaimPredicate orPredicates<2>;
16
+ # case CLAIM_PREDICATE_NOT:
17
+ # ClaimPredicate* notPredicate;
18
+ # case CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME:
19
+ # int64 absBefore; // Predicate will be true if closeTime < absBefore
20
+ # case CLAIM_PREDICATE_BEFORE_RELATIVE_TIME:
21
+ # int64 relBefore; // Seconds since closeTime of the ledger in which the
22
+ # // ClaimableBalanceEntry was created
23
+ # };
24
+ #
25
+ # ===========================================================================
26
+ module Stellar
27
+ class ClaimPredicate < XDR::Union
28
+ switch_on ClaimPredicateType, :type
29
+
30
+ switch :claim_predicate_unconditional
31
+ switch :claim_predicate_and, :and_predicates
32
+ switch :claim_predicate_or, :or_predicates
33
+ switch :claim_predicate_not, :not_predicate
34
+ switch :claim_predicate_before_absolute_time, :abs_before
35
+ switch :claim_predicate_before_relative_time, :rel_before
36
+
37
+ attribute :and_predicates, XDR::VarArray[ClaimPredicate, 2]
38
+ attribute :or_predicates, XDR::VarArray[ClaimPredicate, 2]
39
+ attribute :not_predicate, XDR::Option[ClaimPredicate]
40
+ attribute :abs_before, Int64
41
+ attribute :rel_before, Int64
42
+ end
43
+ end
@@ -0,0 +1,30 @@
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
+ # enum ClaimPredicateType
9
+ # {
10
+ # CLAIM_PREDICATE_UNCONDITIONAL = 0,
11
+ # CLAIM_PREDICATE_AND = 1,
12
+ # CLAIM_PREDICATE_OR = 2,
13
+ # CLAIM_PREDICATE_NOT = 3,
14
+ # CLAIM_PREDICATE_BEFORE_ABSOLUTE_TIME = 4,
15
+ # CLAIM_PREDICATE_BEFORE_RELATIVE_TIME = 5
16
+ # };
17
+ #
18
+ # ===========================================================================
19
+ module Stellar
20
+ class ClaimPredicateType < XDR::Enum
21
+ member :claim_predicate_unconditional, 0
22
+ member :claim_predicate_and, 1
23
+ member :claim_predicate_or, 2
24
+ member :claim_predicate_not, 3
25
+ member :claim_predicate_before_absolute_time, 4
26
+ member :claim_predicate_before_relative_time, 5
27
+
28
+ seal
29
+ end
30
+ end
@@ -0,0 +1,44 @@
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 ClaimableBalanceEntry
9
+ # {
10
+ # // Unique identifier for this ClaimableBalanceEntry
11
+ # ClaimableBalanceID balanceID;
12
+ #
13
+ # // List of claimants with associated predicate
14
+ # Claimant claimants<10>;
15
+ #
16
+ # // Any asset including native
17
+ # Asset asset;
18
+ #
19
+ # // Amount of asset
20
+ # int64 amount;
21
+ #
22
+ # // reserved for future use
23
+ # union switch (int v)
24
+ # {
25
+ # case 0:
26
+ # void;
27
+ # }
28
+ # ext;
29
+ # };
30
+ #
31
+ # ===========================================================================
32
+ module Stellar
33
+ class ClaimableBalanceEntry < XDR::Struct
34
+ include XDR::Namespace
35
+
36
+ autoload :Ext
37
+
38
+ attribute :balance_id, ClaimableBalanceID
39
+ attribute :claimants, XDR::VarArray[Claimant, 10]
40
+ attribute :asset, Asset
41
+ attribute :amount, Int64
42
+ attribute :ext, Ext
43
+ end
44
+ 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 ClaimableBalanceEntry
17
+ class Ext < XDR::Union
18
+ switch_on XDR::Int, :v
19
+
20
+ switch 0
21
+
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,23 @@
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 ClaimableBalanceID switch (ClaimableBalanceIDType type)
9
+ # {
10
+ # case CLAIMABLE_BALANCE_ID_TYPE_V0:
11
+ # Hash v0;
12
+ # };
13
+ #
14
+ # ===========================================================================
15
+ module Stellar
16
+ class ClaimableBalanceID < XDR::Union
17
+ switch_on ClaimableBalanceIDType, :type
18
+
19
+ switch :claimable_balance_id_type_v0, :v0
20
+
21
+ attribute :v0, Hash
22
+ end
23
+ end
@@ -0,0 +1,20 @@
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
+ # enum ClaimableBalanceIDType
9
+ # {
10
+ # CLAIMABLE_BALANCE_ID_TYPE_V0 = 0
11
+ # };
12
+ #
13
+ # ===========================================================================
14
+ module Stellar
15
+ class ClaimableBalanceIDType < XDR::Enum
16
+ member :claimable_balance_id_type_v0, 0
17
+
18
+ seal
19
+ end
20
+ end
@@ -0,0 +1,31 @@
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 Claimant switch (ClaimantType type)
9
+ # {
10
+ # case CLAIMANT_TYPE_V0:
11
+ # struct
12
+ # {
13
+ # AccountID destination; // The account that can use this condition
14
+ # ClaimPredicate predicate; // Claimable if predicate is true
15
+ # } v0;
16
+ # };
17
+ #
18
+ # ===========================================================================
19
+ module Stellar
20
+ class Claimant < XDR::Union
21
+ include XDR::Namespace
22
+
23
+ autoload :V0
24
+
25
+ switch_on ClaimantType, :type
26
+
27
+ switch :claimant_type_v0, :v0
28
+
29
+ attribute :v0, V0
30
+ end
31
+ end
@@ -0,0 +1,22 @@
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
+ # AccountID destination; // The account that can use this condition
11
+ # ClaimPredicate predicate; // Claimable if predicate is true
12
+ # }
13
+ #
14
+ # ===========================================================================
15
+ module Stellar
16
+ class Claimant
17
+ class V0 < XDR::Struct
18
+ attribute :destination, AccountID
19
+ attribute :predicate, ClaimPredicate
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,20 @@
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
+ # enum ClaimantType
9
+ # {
10
+ # CLAIMANT_TYPE_V0 = 0
11
+ # };
12
+ #
13
+ # ===========================================================================
14
+ module Stellar
15
+ class ClaimantType < XDR::Enum
16
+ member :claimant_type_v0, 0
17
+
18
+ seal
19
+ end
20
+ end
@@ -0,0 +1,22 @@
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 CreateClaimableBalanceOp
9
+ # {
10
+ # Asset asset;
11
+ # int64 amount;
12
+ # Claimant claimants<10>;
13
+ # };
14
+ #
15
+ # ===========================================================================
16
+ module Stellar
17
+ class CreateClaimableBalanceOp < XDR::Struct
18
+ attribute :asset, Asset
19
+ attribute :amount, Int64
20
+ attribute :claimants, XDR::VarArray[Claimant, 10]
21
+ end
22
+ end
@@ -0,0 +1,27 @@
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 CreateClaimableBalanceResult switch (
9
+ # CreateClaimableBalanceResultCode code)
10
+ # {
11
+ # case CREATE_CLAIMABLE_BALANCE_SUCCESS:
12
+ # ClaimableBalanceID balanceID;
13
+ # default:
14
+ # void;
15
+ # };
16
+ #
17
+ # ===========================================================================
18
+ module Stellar
19
+ class CreateClaimableBalanceResult < XDR::Union
20
+ switch_on CreateClaimableBalanceResultCode, :code
21
+
22
+ switch :create_claimable_balance_success, :balance_id
23
+ switch :default
24
+
25
+ attribute :balance_id, ClaimableBalanceID
26
+ end
27
+ end
@@ -0,0 +1,30 @@
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
+ # enum CreateClaimableBalanceResultCode
9
+ # {
10
+ # CREATE_CLAIMABLE_BALANCE_SUCCESS = 0,
11
+ # CREATE_CLAIMABLE_BALANCE_MALFORMED = -1,
12
+ # CREATE_CLAIMABLE_BALANCE_LOW_RESERVE = -2,
13
+ # CREATE_CLAIMABLE_BALANCE_NO_TRUST = -3,
14
+ # CREATE_CLAIMABLE_BALANCE_NOT_AUTHORIZED = -4,
15
+ # CREATE_CLAIMABLE_BALANCE_UNDERFUNDED = -5
16
+ # };
17
+ #
18
+ # ===========================================================================
19
+ module Stellar
20
+ class CreateClaimableBalanceResultCode < XDR::Enum
21
+ member :create_claimable_balance_success, 0
22
+ member :create_claimable_balance_malformed, -1
23
+ member :create_claimable_balance_low_reserve, -2
24
+ member :create_claimable_balance_no_trust, -3
25
+ member :create_claimable_balance_not_authorized, -4
26
+ member :create_claimable_balance_underfunded, -5
27
+
28
+ seal
29
+ end
30
+ end
@@ -0,0 +1,25 @@
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 EndSponsoringFutureReservesResult switch (EndSponsoringFutureReservesResultCode code)
9
+ # {
10
+ # case END_SPONSORING_FUTURE_RESERVES_SUCCESS:
11
+ # void;
12
+ # default:
13
+ # void;
14
+ # };
15
+ #
16
+ # ===========================================================================
17
+ module Stellar
18
+ class EndSponsoringFutureReservesResult < XDR::Union
19
+ switch_on EndSponsoringFutureReservesResultCode, :code
20
+
21
+ switch :end_sponsoring_future_reserves_success
22
+ switch :default
23
+
24
+ end
25
+ end