stellar-base 0.24.0 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +79 -56
  3. data/README.md +7 -7
  4. data/generated/stellar-base-generated.rb +15 -0
  5. data/generated/stellar/account_flags.rb +9 -4
  6. data/generated/stellar/account_merge_result.rb +1 -1
  7. data/generated/stellar/allow_trust_op.rb +3 -18
  8. data/generated/stellar/asset_code.rb +30 -0
  9. data/generated/stellar/begin_sponsoring_future_reserves_result.rb +2 -1
  10. data/generated/stellar/claimable_balance_entry.rb +2 -0
  11. data/generated/stellar/claimable_balance_entry/ext.rb +4 -0
  12. data/generated/stellar/claimable_balance_entry_extension_v1.rb +30 -0
  13. data/generated/stellar/claimable_balance_entry_extension_v1/ext.rb +24 -0
  14. data/generated/stellar/claimable_balance_flags.rb +22 -0
  15. data/generated/stellar/clawback_claimable_balance_op.rb +18 -0
  16. data/generated/stellar/clawback_claimable_balance_result.rb +26 -0
  17. data/generated/stellar/clawback_claimable_balance_result_code.rb +29 -0
  18. data/generated/stellar/clawback_op.rb +22 -0
  19. data/generated/stellar/clawback_result.rb +25 -0
  20. data/generated/stellar/clawback_result_code.rb +31 -0
  21. data/generated/stellar/create_passive_sell_offer_op.rb +1 -1
  22. data/generated/stellar/end_sponsoring_future_reserves_result.rb +2 -1
  23. data/generated/stellar/operation.rb +6 -0
  24. data/generated/stellar/operation/body.rb +12 -0
  25. data/generated/stellar/operation_id.rb +1 -1
  26. data/generated/stellar/operation_id/id.rb +2 -2
  27. data/generated/stellar/operation_result.rb +6 -0
  28. data/generated/stellar/operation_result/tr.rb +12 -0
  29. data/generated/stellar/operation_type.rb +7 -1
  30. data/generated/stellar/payment_result_code.rb +1 -1
  31. data/generated/stellar/revoke_sponsorship_op.rb +1 -2
  32. data/generated/stellar/set_options_result_code.rb +14 -11
  33. data/generated/stellar/set_trust_line_flags_op.rb +25 -0
  34. data/generated/stellar/set_trust_line_flags_result.rb +25 -0
  35. data/generated/stellar/set_trust_line_flags_result_code.rb +31 -0
  36. data/generated/stellar/transaction_result_code.rb +1 -1
  37. data/generated/stellar/trust_line_flags.rb +5 -1
  38. data/lib/stellar-base.rb +6 -2
  39. data/lib/stellar/account.rb +59 -0
  40. data/lib/stellar/asset.rb +10 -0
  41. data/lib/stellar/compat.rb +6 -7
  42. data/lib/stellar/concerns/transaction.rb +5 -4
  43. data/lib/stellar/dsl.rb +32 -5
  44. data/lib/stellar/ext/xdr.rb +8 -7
  45. data/lib/stellar/key_pair.rb +22 -23
  46. data/lib/stellar/ledger_key.rb +4 -2
  47. data/lib/stellar/muxed_account.rb +16 -0
  48. data/lib/stellar/operation.rb +89 -19
  49. data/lib/stellar/transaction.rb +1 -1
  50. data/lib/stellar/transaction_builder.rb +20 -7
  51. data/lib/stellar/transaction_envelope.rb +6 -16
  52. data/lib/stellar/transaction_v0.rb +2 -10
  53. data/lib/stellar/trust_line_flags.rb +53 -0
  54. data/lib/stellar/util/strkey.rb +15 -7
  55. data/lib/stellar/version.rb +3 -0
  56. metadata +34 -16
  57. data/generated/stellar/allow_trust_op/asset.rb +0 -33
  58. data/lib/stellar/base/version.rb +0 -5
@@ -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
@@ -5,7 +5,8 @@ require 'xdr'
5
5
 
6
6
  # === xdr source ============================================================
7
7
  #
8
- # union BeginSponsoringFutureReservesResult switch (BeginSponsoringFutureReservesResultCode code)
8
+ # union BeginSponsoringFutureReservesResult switch (
9
+ # BeginSponsoringFutureReservesResultCode code)
9
10
  # {
10
11
  # case BEGIN_SPONSORING_FUTURE_RESERVES_SUCCESS:
11
12
  # void;
@@ -24,6 +24,8 @@ require 'xdr'
24
24
  # {
25
25
  # case 0:
26
26
  # void;
27
+ # case 1:
28
+ # ClaimableBalanceEntryExtensionV1 v1;
27
29
  # }
28
30
  # ext;
29
31
  # };
@@ -9,6 +9,8 @@ require 'xdr'
9
9
  # {
10
10
  # case 0:
11
11
  # void;
12
+ # case 1:
13
+ # ClaimableBalanceEntryExtensionV1 v1;
12
14
  # }
13
15
  #
14
16
  # ===========================================================================
@@ -18,7 +20,9 @@ module Stellar
18
20
  switch_on XDR::Int, :v
19
21
 
20
22
  switch 0
23
+ switch 1, :v1
21
24
 
25
+ attribute :v1, ClaimableBalanceEntryExtensionV1
22
26
  end
23
27
  end
24
28
  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
+ # struct ClaimableBalanceEntryExtensionV1
9
+ # {
10
+ # union switch (int v)
11
+ # {
12
+ # case 0:
13
+ # void;
14
+ # }
15
+ # ext;
16
+ #
17
+ # uint32 flags; // see ClaimableBalanceFlags
18
+ # };
19
+ #
20
+ # ===========================================================================
21
+ module Stellar
22
+ class ClaimableBalanceEntryExtensionV1 < XDR::Struct
23
+ include XDR::Namespace
24
+
25
+ autoload :Ext
26
+
27
+ attribute :ext, Ext
28
+ attribute :flags, Uint32
29
+ end
30
+ 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 ClaimableBalanceEntryExtensionV1
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,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
+ # enum ClaimableBalanceFlags
9
+ # {
10
+ # // If set, the issuer account of the asset held by the claimable balance may
11
+ # // clawback the claimable balance
12
+ # CLAIMABLE_BALANCE_CLAWBACK_ENABLED_FLAG = 0x1
13
+ # };
14
+ #
15
+ # ===========================================================================
16
+ module Stellar
17
+ class ClaimableBalanceFlags < XDR::Enum
18
+ member :claimable_balance_clawback_enabled_flag, 1
19
+
20
+ seal
21
+ end
22
+ 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 ClawbackClaimableBalanceOp
9
+ # {
10
+ # ClaimableBalanceID balanceID;
11
+ # };
12
+ #
13
+ # ===========================================================================
14
+ module Stellar
15
+ class ClawbackClaimableBalanceOp < XDR::Struct
16
+ attribute :balance_id, ClaimableBalanceID
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 ClawbackClaimableBalanceResult switch (
9
+ # ClawbackClaimableBalanceResultCode code)
10
+ # {
11
+ # case CLAWBACK_CLAIMABLE_BALANCE_SUCCESS:
12
+ # void;
13
+ # default:
14
+ # void;
15
+ # };
16
+ #
17
+ # ===========================================================================
18
+ module Stellar
19
+ class ClawbackClaimableBalanceResult < XDR::Union
20
+ switch_on ClawbackClaimableBalanceResultCode, :code
21
+
22
+ switch :clawback_claimable_balance_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 ClawbackClaimableBalanceResultCode
9
+ # {
10
+ # // codes considered as "success" for the operation
11
+ # CLAWBACK_CLAIMABLE_BALANCE_SUCCESS = 0,
12
+ #
13
+ # // codes considered as "failure" for the operation
14
+ # CLAWBACK_CLAIMABLE_BALANCE_DOES_NOT_EXIST = -1,
15
+ # CLAWBACK_CLAIMABLE_BALANCE_NOT_ISSUER = -2,
16
+ # CLAWBACK_CLAIMABLE_BALANCE_NOT_CLAWBACK_ENABLED = -3
17
+ # };
18
+ #
19
+ # ===========================================================================
20
+ module Stellar
21
+ class ClawbackClaimableBalanceResultCode < XDR::Enum
22
+ member :clawback_claimable_balance_success, 0
23
+ member :clawback_claimable_balance_does_not_exist, -1
24
+ member :clawback_claimable_balance_not_issuer, -2
25
+ member :clawback_claimable_balance_not_clawback_enabled, -3
26
+
27
+ seal
28
+ end
29
+ 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 ClawbackOp
9
+ # {
10
+ # Asset asset;
11
+ # MuxedAccount from;
12
+ # int64 amount;
13
+ # };
14
+ #
15
+ # ===========================================================================
16
+ module Stellar
17
+ class ClawbackOp < XDR::Struct
18
+ attribute :asset, Asset
19
+ attribute :from, MuxedAccount
20
+ attribute :amount, Int64
21
+ end
22
+ 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 ClawbackResult switch (ClawbackResultCode code)
9
+ # {
10
+ # case CLAWBACK_SUCCESS:
11
+ # void;
12
+ # default:
13
+ # void;
14
+ # };
15
+ #
16
+ # ===========================================================================
17
+ module Stellar
18
+ class ClawbackResult < XDR::Union
19
+ switch_on ClawbackResultCode, :code
20
+
21
+ switch :clawback_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 ClawbackResultCode
9
+ # {
10
+ # // codes considered as "success" for the operation
11
+ # CLAWBACK_SUCCESS = 0,
12
+ #
13
+ # // codes considered as "failure" for the operation
14
+ # CLAWBACK_MALFORMED = -1,
15
+ # CLAWBACK_NOT_CLAWBACK_ENABLED = -2,
16
+ # CLAWBACK_NO_TRUST = -3,
17
+ # CLAWBACK_UNDERFUNDED = -4
18
+ # };
19
+ #
20
+ # ===========================================================================
21
+ module Stellar
22
+ class ClawbackResultCode < XDR::Enum
23
+ member :clawback_success, 0
24
+ member :clawback_malformed, -1
25
+ member :clawback_not_clawback_enabled, -2
26
+ member :clawback_no_trust, -3
27
+ member :clawback_underfunded, -4
28
+
29
+ seal
30
+ end
31
+ end
@@ -9,7 +9,7 @@ require 'xdr'
9
9
  # {
10
10
  # Asset selling; // A
11
11
  # Asset buying; // B
12
- # int64 amount; // amount taker gets. if set to 0, delete the offer
12
+ # int64 amount; // amount taker gets
13
13
  # Price price; // cost of A in terms of B
14
14
  # };
15
15
  #
@@ -5,7 +5,8 @@ require 'xdr'
5
5
 
6
6
  # === xdr source ============================================================
7
7
  #
8
- # union EndSponsoringFutureReservesResult switch (EndSponsoringFutureReservesResultCode code)
8
+ # union EndSponsoringFutureReservesResult switch (
9
+ # EndSponsoringFutureReservesResultCode code)
9
10
  # {
10
11
  # case END_SPONSORING_FUTURE_RESERVES_SUCCESS:
11
12
  # void;
@@ -52,6 +52,12 @@ require 'xdr'
52
52
  # void;
53
53
  # case REVOKE_SPONSORSHIP:
54
54
  # RevokeSponsorshipOp revokeSponsorshipOp;
55
+ # case CLAWBACK:
56
+ # ClawbackOp clawbackOp;
57
+ # case CLAWBACK_CLAIMABLE_BALANCE:
58
+ # ClawbackClaimableBalanceOp clawbackClaimableBalanceOp;
59
+ # case SET_TRUST_LINE_FLAGS:
60
+ # SetTrustLineFlagsOp setTrustLineFlagsOp;
55
61
  # }
56
62
  # body;
57
63
  # };
@@ -45,6 +45,12 @@ require 'xdr'
45
45
  # void;
46
46
  # case REVOKE_SPONSORSHIP:
47
47
  # RevokeSponsorshipOp revokeSponsorshipOp;
48
+ # case CLAWBACK:
49
+ # ClawbackOp clawbackOp;
50
+ # case CLAWBACK_CLAIMABLE_BALANCE:
51
+ # ClawbackClaimableBalanceOp clawbackClaimableBalanceOp;
52
+ # case SET_TRUST_LINE_FLAGS:
53
+ # SetTrustLineFlagsOp setTrustLineFlagsOp;
48
54
  # }
49
55
  #
50
56
  # ===========================================================================
@@ -72,6 +78,9 @@ module Stellar
72
78
  switch :begin_sponsoring_future_reserves, :begin_sponsoring_future_reserves_op
73
79
  switch :end_sponsoring_future_reserves
74
80
  switch :revoke_sponsorship, :revoke_sponsorship_op
81
+ switch :clawback, :clawback_op
82
+ switch :clawback_claimable_balance, :clawback_claimable_balance_op
83
+ switch :set_trust_line_flags, :set_trust_line_flags_op
75
84
 
76
85
  attribute :create_account_op, CreateAccountOp
77
86
  attribute :payment_op, PaymentOp
@@ -90,6 +99,9 @@ module Stellar
90
99
  attribute :claim_claimable_balance_op, ClaimClaimableBalanceOp
91
100
  attribute :begin_sponsoring_future_reserves_op, BeginSponsoringFutureReservesOp
92
101
  attribute :revoke_sponsorship_op, RevokeSponsorshipOp
102
+ attribute :clawback_op, ClawbackOp
103
+ attribute :clawback_claimable_balance_op, ClawbackClaimableBalanceOp
104
+ attribute :set_trust_line_flags_op, SetTrustLineFlagsOp
93
105
  end
94
106
  end
95
107
  end
@@ -10,7 +10,7 @@ require 'xdr'
10
10
  # case ENVELOPE_TYPE_OP_ID:
11
11
  # struct
12
12
  # {
13
- # MuxedAccount sourceAccount;
13
+ # AccountID sourceAccount;
14
14
  # SequenceNumber seqNum;
15
15
  # uint32 opNum;
16
16
  # } id;
@@ -7,7 +7,7 @@ require 'xdr'
7
7
  #
8
8
  # struct
9
9
  # {
10
- # MuxedAccount sourceAccount;
10
+ # AccountID sourceAccount;
11
11
  # SequenceNumber seqNum;
12
12
  # uint32 opNum;
13
13
  # }
@@ -16,7 +16,7 @@ require 'xdr'
16
16
  module Stellar
17
17
  class OperationID
18
18
  class Id < XDR::Struct
19
- attribute :source_account, MuxedAccount
19
+ attribute :source_account, AccountID
20
20
  attribute :seq_num, SequenceNumber
21
21
  attribute :op_num, Uint32
22
22
  end