stellar-base 0.23.1 → 0.27.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +134 -29
  3. data/README.md +7 -7
  4. data/generated/stellar-base-generated.rb +44 -1
  5. data/generated/stellar/account_entry.rb +3 -13
  6. data/generated/stellar/account_entry/ext.rb +2 -16
  7. data/generated/stellar/account_entry_extension_v1.rb +32 -0
  8. data/generated/stellar/account_entry_extension_v1/ext.rb +28 -0
  9. data/generated/stellar/account_entry_extension_v2.rb +34 -0
  10. data/generated/stellar/{account_entry/ext/v1 → account_entry_extension_v2}/ext.rb +8 -12
  11. data/generated/stellar/account_flags.rb +9 -4
  12. data/generated/stellar/account_merge_result.rb +1 -1
  13. data/generated/stellar/account_merge_result_code.rb +3 -1
  14. data/generated/stellar/allow_trust_op.rb +3 -18
  15. data/generated/stellar/asset_code.rb +30 -0
  16. data/generated/stellar/begin_sponsoring_future_reserves_op.rb +18 -0
  17. data/generated/stellar/begin_sponsoring_future_reserves_result.rb +26 -0
  18. data/generated/stellar/begin_sponsoring_future_reserves_result_code.rb +29 -0
  19. data/generated/stellar/claim_claimable_balance_op.rb +18 -0
  20. data/generated/stellar/claim_claimable_balance_result.rb +25 -0
  21. data/generated/stellar/claim_claimable_balance_result_code.rb +31 -0
  22. data/generated/stellar/claim_predicate.rb +43 -0
  23. data/generated/stellar/claim_predicate_type.rb +30 -0
  24. data/generated/stellar/claimable_balance_entry.rb +46 -0
  25. data/generated/stellar/claimable_balance_entry/ext.rb +28 -0
  26. data/generated/stellar/claimable_balance_entry_extension_v1.rb +30 -0
  27. data/generated/stellar/claimable_balance_entry_extension_v1/ext.rb +24 -0
  28. data/generated/stellar/claimable_balance_flags.rb +22 -0
  29. data/generated/stellar/claimable_balance_id.rb +23 -0
  30. data/generated/stellar/claimable_balance_id_type.rb +20 -0
  31. data/generated/stellar/claimant.rb +31 -0
  32. data/generated/stellar/claimant/v0.rb +22 -0
  33. data/generated/stellar/claimant_type.rb +20 -0
  34. data/generated/stellar/clawback_claimable_balance_op.rb +18 -0
  35. data/generated/stellar/clawback_claimable_balance_result.rb +26 -0
  36. data/generated/stellar/clawback_claimable_balance_result_code.rb +29 -0
  37. data/generated/stellar/clawback_op.rb +22 -0
  38. data/generated/stellar/clawback_result.rb +25 -0
  39. data/generated/stellar/clawback_result_code.rb +31 -0
  40. data/generated/stellar/create_claimable_balance_op.rb +22 -0
  41. data/generated/stellar/create_claimable_balance_result.rb +27 -0
  42. data/generated/stellar/create_claimable_balance_result_code.rb +30 -0
  43. data/generated/stellar/create_passive_sell_offer_op.rb +1 -1
  44. data/generated/stellar/end_sponsoring_future_reserves_result.rb +26 -0
  45. data/generated/stellar/end_sponsoring_future_reserves_result_code.rb +25 -0
  46. data/generated/stellar/envelope_type.rb +3 -1
  47. data/generated/stellar/inner_transaction_result.rb +2 -1
  48. data/generated/stellar/inner_transaction_result/result.rb +3 -1
  49. data/generated/stellar/ledger_entry.rb +4 -0
  50. data/generated/stellar/ledger_entry/data.rb +12 -8
  51. data/generated/stellar/ledger_entry/ext.rb +4 -0
  52. data/generated/stellar/ledger_entry_extension_v1.rb +30 -0
  53. data/generated/stellar/ledger_entry_extension_v1/ext.rb +24 -0
  54. data/generated/stellar/ledger_entry_type.rb +7 -5
  55. data/generated/stellar/ledger_key.rb +17 -8
  56. data/generated/stellar/ledger_key/claimable_balance.rb +20 -0
  57. data/generated/stellar/operation.rb +16 -0
  58. data/generated/stellar/operation/body.rb +57 -26
  59. data/generated/stellar/operation_id.rb +32 -0
  60. data/generated/stellar/operation_id/id.rb +24 -0
  61. data/generated/stellar/operation_result.rb +16 -0
  62. data/generated/stellar/operation_result/tr.rb +60 -28
  63. data/generated/stellar/operation_result_code.rb +3 -1
  64. data/generated/stellar/operation_type.rb +31 -15
  65. data/generated/stellar/path_payment_strict_receive_result.rb +2 -1
  66. data/generated/stellar/payment_result_code.rb +1 -1
  67. data/generated/stellar/revoke_sponsorship_op.rb +35 -0
  68. data/generated/stellar/revoke_sponsorship_op/signer.rb +22 -0
  69. data/generated/stellar/revoke_sponsorship_result.rb +25 -0
  70. data/generated/stellar/revoke_sponsorship_result_code.rb +31 -0
  71. data/generated/stellar/revoke_sponsorship_type.rb +22 -0
  72. data/generated/stellar/set_options_result_code.rb +14 -11
  73. data/generated/stellar/set_trust_line_flags_op.rb +25 -0
  74. data/generated/stellar/set_trust_line_flags_result.rb +25 -0
  75. data/generated/stellar/set_trust_line_flags_result_code.rb +31 -0
  76. data/generated/stellar/transaction_result_code.rb +5 -3
  77. data/generated/stellar/trust_line_flags.rb +5 -1
  78. data/lib/stellar-base.rb +18 -5
  79. data/lib/stellar/account_flags.rb +1 -1
  80. data/lib/stellar/asset.rb +10 -0
  81. data/lib/stellar/claim_predicate.rb +198 -0
  82. data/lib/stellar/compat.rb +4 -16
  83. data/lib/stellar/concerns/transaction.rb +5 -4
  84. data/lib/stellar/dsl.rb +93 -0
  85. data/lib/stellar/ext/xdr.rb +50 -0
  86. data/lib/stellar/key_pair.rb +60 -53
  87. data/lib/stellar/ledger_key.rb +32 -0
  88. data/lib/stellar/muxed_account.rb +16 -0
  89. data/lib/stellar/networks.rb +12 -12
  90. data/lib/stellar/operation.rb +144 -17
  91. data/lib/stellar/price.rb +11 -2
  92. data/lib/stellar/transaction.rb +1 -169
  93. data/lib/stellar/transaction_builder.rb +28 -2
  94. data/lib/stellar/transaction_envelope.rb +7 -43
  95. data/lib/stellar/transaction_v0.rb +2 -10
  96. data/lib/stellar/trust_line_flags.rb +53 -0
  97. data/lib/stellar/util/strkey.rb +6 -6
  98. data/lib/stellar/version.rb +1 -3
  99. metadata +177 -30
  100. data/generated/stellar/account_entry/ext/v1.rb +0 -34
  101. data/generated/stellar/allow_trust_op/asset.rb +0 -33
  102. data/lib/stellar/util/continued_fraction.rb +0 -96
@@ -10,33 +10,19 @@ require 'xdr'
10
10
  # case 0:
11
11
  # void;
12
12
  # case 1:
13
- # struct
14
- # {
15
- # Liabilities liabilities;
16
- #
17
- # union switch (int v)
18
- # {
19
- # case 0:
20
- # void;
21
- # }
22
- # ext;
23
- # } v1;
13
+ # AccountEntryExtensionV1 v1;
24
14
  # }
25
15
  #
26
16
  # ===========================================================================
27
17
  module Stellar
28
18
  class AccountEntry
29
19
  class Ext < XDR::Union
30
- include XDR::Namespace
31
-
32
- autoload :V1
33
-
34
20
  switch_on XDR::Int, :v
35
21
 
36
22
  switch 0
37
23
  switch 1, :v1
38
24
 
39
- attribute :v1, V1
25
+ attribute :v1, AccountEntryExtensionV1
40
26
  end
41
27
  end
42
28
  end
@@ -0,0 +1,32 @@
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 AccountEntryExtensionV1
9
+ # {
10
+ # Liabilities liabilities;
11
+ #
12
+ # union switch (int v)
13
+ # {
14
+ # case 0:
15
+ # void;
16
+ # case 2:
17
+ # AccountEntryExtensionV2 v2;
18
+ # }
19
+ # ext;
20
+ # };
21
+ #
22
+ # ===========================================================================
23
+ module Stellar
24
+ class AccountEntryExtensionV1 < XDR::Struct
25
+ include XDR::Namespace
26
+
27
+ autoload :Ext
28
+
29
+ attribute :liabilities, Liabilities
30
+ attribute :ext, Ext
31
+ end
32
+ end
@@ -0,0 +1,28 @@
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
+ # case 2:
13
+ # AccountEntryExtensionV2 v2;
14
+ # }
15
+ #
16
+ # ===========================================================================
17
+ module Stellar
18
+ class AccountEntryExtensionV1
19
+ class Ext < XDR::Union
20
+ switch_on XDR::Int, :v
21
+
22
+ switch 0
23
+ switch 2, :v2
24
+
25
+ attribute :v2, AccountEntryExtensionV2
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,34 @@
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 AccountEntryExtensionV2
9
+ # {
10
+ # uint32 numSponsored;
11
+ # uint32 numSponsoring;
12
+ # SponsorshipDescriptor signerSponsoringIDs<MAX_SIGNERS>;
13
+ #
14
+ # union switch (int v)
15
+ # {
16
+ # case 0:
17
+ # void;
18
+ # }
19
+ # ext;
20
+ # };
21
+ #
22
+ # ===========================================================================
23
+ module Stellar
24
+ class AccountEntryExtensionV2 < XDR::Struct
25
+ include XDR::Namespace
26
+
27
+ autoload :Ext
28
+
29
+ attribute :num_sponsored, Uint32
30
+ attribute :num_sponsoring, Uint32
31
+ attribute :signer_sponsoring_i_ds, XDR::VarArray[SponsorshipDescriptor, MAX_SIGNERS]
32
+ attribute :ext, Ext
33
+ end
34
+ end
@@ -6,23 +6,19 @@ require 'xdr'
6
6
  # === xdr source ============================================================
7
7
  #
8
8
  # union switch (int v)
9
- # {
10
- # case 0:
11
- # void;
12
- # }
9
+ # {
10
+ # case 0:
11
+ # void;
12
+ # }
13
13
  #
14
14
  # ===========================================================================
15
15
  module Stellar
16
- class AccountEntry
17
- class Ext
18
- class V1
19
- class Ext < XDR::Union
20
- switch_on XDR::Int, :v
16
+ class AccountEntryExtensionV2
17
+ class Ext < XDR::Union
18
+ switch_on XDR::Int, :v
21
19
 
22
- switch 0
20
+ switch 0
23
21
 
24
- end
25
- end
26
22
  end
27
23
  end
28
24
  end
@@ -16,15 +16,20 @@ require 'xdr'
16
16
  # // otherwise, authorization cannot be revoked
17
17
  # AUTH_REVOCABLE_FLAG = 0x2,
18
18
  # // Once set, causes all AUTH_* flags to be read-only
19
- # AUTH_IMMUTABLE_FLAG = 0x4
19
+ # AUTH_IMMUTABLE_FLAG = 0x4,
20
+ # // Trustlines are created with clawback enabled set to "true",
21
+ # // and claimable balances created from those trustlines are created
22
+ # // with clawback enabled set to "true"
23
+ # AUTH_CLAWBACK_ENABLED_FLAG = 0x8
20
24
  # };
21
25
  #
22
26
  # ===========================================================================
23
27
  module Stellar
24
28
  class AccountFlags < XDR::Enum
25
- member :auth_required_flag, 1
26
- member :auth_revocable_flag, 2
27
- member :auth_immutable_flag, 4
29
+ member :auth_required_flag, 1
30
+ member :auth_revocable_flag, 2
31
+ member :auth_immutable_flag, 4
32
+ member :auth_clawback_enabled_flag, 8
28
33
 
29
34
  seal
30
35
  end
@@ -8,7 +8,7 @@ require 'xdr'
8
8
  # union AccountMergeResult switch (AccountMergeResultCode code)
9
9
  # {
10
10
  # case ACCOUNT_MERGE_SUCCESS:
11
- # int64 sourceAccountBalance; // how much got transfered from source account
11
+ # int64 sourceAccountBalance; // how much got transferred from source account
12
12
  # default:
13
13
  # void;
14
14
  # };
@@ -15,8 +15,9 @@ require 'xdr'
15
15
  # ACCOUNT_MERGE_IMMUTABLE_SET = -3, // source account has AUTH_IMMUTABLE set
16
16
  # ACCOUNT_MERGE_HAS_SUB_ENTRIES = -4, // account has trust lines/offers
17
17
  # ACCOUNT_MERGE_SEQNUM_TOO_FAR = -5, // sequence number is over max allowed
18
- # ACCOUNT_MERGE_DEST_FULL = -6 // can't add source balance to
18
+ # ACCOUNT_MERGE_DEST_FULL = -6, // can't add source balance to
19
19
  # // destination balance
20
+ # ACCOUNT_MERGE_IS_SPONSOR = -7 // can't merge account that is a sponsor
20
21
  # };
21
22
  #
22
23
  # ===========================================================================
@@ -29,6 +30,7 @@ module Stellar
29
30
  member :account_merge_has_sub_entries, -4
30
31
  member :account_merge_seqnum_too_far, -5
31
32
  member :account_merge_dest_full, -6
33
+ member :account_merge_is_sponsor, -7
32
34
 
33
35
  seal
34
36
  end
@@ -8,32 +8,17 @@ require 'xdr'
8
8
  # struct AllowTrustOp
9
9
  # {
10
10
  # AccountID trustor;
11
- # union switch (AssetType type)
12
- # {
13
- # // ASSET_TYPE_NATIVE is not allowed
14
- # case ASSET_TYPE_CREDIT_ALPHANUM4:
15
- # AssetCode4 assetCode4;
11
+ # AssetCode asset;
16
12
  #
17
- # case ASSET_TYPE_CREDIT_ALPHANUM12:
18
- # AssetCode12 assetCode12;
19
- #
20
- # // add other asset types here in the future
21
- # }
22
- # asset;
23
- #
24
- # // 0, or any bitwise combination of TrustLineFlags
13
+ # // One of 0, AUTHORIZED_FLAG, or AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG
25
14
  # uint32 authorize;
26
15
  # };
27
16
  #
28
17
  # ===========================================================================
29
18
  module Stellar
30
19
  class AllowTrustOp < XDR::Struct
31
- include XDR::Namespace
32
-
33
- autoload :Asset
34
-
35
20
  attribute :trustor, AccountID
36
- attribute :asset, Asset
21
+ attribute :asset, AssetCode
37
22
  attribute :authorize, Uint32
38
23
  end
39
24
  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
+ # union AssetCode switch (AssetType type)
9
+ # {
10
+ # case ASSET_TYPE_CREDIT_ALPHANUM4:
11
+ # AssetCode4 assetCode4;
12
+ #
13
+ # case ASSET_TYPE_CREDIT_ALPHANUM12:
14
+ # AssetCode12 assetCode12;
15
+ #
16
+ # // add other asset types here in the future
17
+ # };
18
+ #
19
+ # ===========================================================================
20
+ module Stellar
21
+ class AssetCode < XDR::Union
22
+ switch_on AssetType, :type
23
+
24
+ switch :asset_type_credit_alphanum4, :asset_code4
25
+ switch :asset_type_credit_alphanum12, :asset_code12
26
+
27
+ attribute :asset_code4, AssetCode4
28
+ attribute :asset_code12, AssetCode12
29
+ end
30
+ end
@@ -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 BeginSponsoringFutureReservesOp
9
+ # {
10
+ # AccountID sponsoredID;
11
+ # };
12
+ #
13
+ # ===========================================================================
14
+ module Stellar
15
+ class BeginSponsoringFutureReservesOp < XDR::Struct
16
+ attribute :sponsored_id, AccountID
17
+ end
18
+ end
@@ -0,0 +1,26 @@
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 BeginSponsoringFutureReservesResult switch (
9
+ # BeginSponsoringFutureReservesResultCode code)
10
+ # {
11
+ # case BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS:
12
+ # void;
13
+ # default:
14
+ # void;
15
+ # };
16
+ #
17
+ # ===========================================================================
18
+ module Stellar
19
+ class BeginSponsoringFutureReservesResult < XDR::Union
20
+ switch_on BeginSponsoringFutureReservesResultCode, :code
21
+
22
+ switch :begin_sponsoring_future_reserves_success
23
+ switch :default
24
+
25
+ end
26
+ end
@@ -0,0 +1,29 @@
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 BeginSponsoringFutureReservesResultCode
9
+ # {
10
+ # // codes considered as "success" for the operation
11
+ # BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS = 0,
12
+ #
13
+ # // codes considered as "failure" for the operation
14
+ # BEGIN_SPONSORING_FUTURE_RESERVES_MALFORMED = -1,
15
+ # BEGIN_SPONSORING_FUTURE_RESERVES_ALREADY_SPONSORED = -2,
16
+ # BEGIN_SPONSORING_FUTURE_RESERVES_RECURSIVE = -3
17
+ # };
18
+ #
19
+ # ===========================================================================
20
+ module Stellar
21
+ class BeginSponsoringFutureReservesResultCode < XDR::Enum
22
+ member :begin_sponsoring_future_reserves_success, 0
23
+ member :begin_sponsoring_future_reserves_malformed, -1
24
+ member :begin_sponsoring_future_reserves_already_sponsored, -2
25
+ member :begin_sponsoring_future_reserves_recursive, -3
26
+
27
+ seal
28
+ end
29
+ end
@@ -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