open-core 0.3.0

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 (175) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.travis.yml +15 -0
  4. data/.yardopts +8 -0
  5. data/CONTRIBUTING.md +48 -0
  6. data/Gemfile +15 -0
  7. data/Guardfile +5 -0
  8. data/LICENSE.txt +202 -0
  9. data/README.md +83 -0
  10. data/Rakefile +4 -0
  11. data/examples/create_account.rb +26 -0
  12. data/examples/low_level_transaction_post.rb +46 -0
  13. data/examples/mid_level_transaction_post.rb +33 -0
  14. data/examples/non_native_payment.rb +60 -0
  15. data/examples/offer.rb +75 -0
  16. data/examples/transaction_merge.rb +23 -0
  17. data/generated/stellar-base-generated.rb +134 -0
  18. data/generated/stellar/account_entry.rb +53 -0
  19. data/generated/stellar/account_entry/ext.rb +24 -0
  20. data/generated/stellar/account_flags.rb +27 -0
  21. data/generated/stellar/account_merge_result.rb +26 -0
  22. data/generated/stellar/account_merge_result_code.rb +30 -0
  23. data/generated/stellar/allow_trust_op.rb +38 -0
  24. data/generated/stellar/allow_trust_op/asset.rb +33 -0
  25. data/generated/stellar/allow_trust_result.rb +25 -0
  26. data/generated/stellar/allow_trust_result_code.rb +31 -0
  27. data/generated/stellar/asset.rb +47 -0
  28. data/generated/stellar/asset/alpha_num12.rb +22 -0
  29. data/generated/stellar/asset/alpha_num4.rb +22 -0
  30. data/generated/stellar/asset_type.rb +24 -0
  31. data/generated/stellar/bucket_entry.rb +28 -0
  32. data/generated/stellar/bucket_entry_type.rb +22 -0
  33. data/generated/stellar/change_trust_op.rb +22 -0
  34. data/generated/stellar/change_trust_result.rb +25 -0
  35. data/generated/stellar/change_trust_result_code.rb +30 -0
  36. data/generated/stellar/claim_offer_atom.rb +33 -0
  37. data/generated/stellar/create_account_op.rb +20 -0
  38. data/generated/stellar/create_account_result.rb +25 -0
  39. data/generated/stellar/create_account_result_code.rb +32 -0
  40. data/generated/stellar/create_passive_offer_op.rb +24 -0
  41. data/generated/stellar/crypto_key_type.rb +20 -0
  42. data/generated/stellar/decorated_signature.rb +20 -0
  43. data/generated/stellar/dont_have.rb +20 -0
  44. data/generated/stellar/envelope_type.rb +22 -0
  45. data/generated/stellar/error.rb +20 -0
  46. data/generated/stellar/hello.rb +26 -0
  47. data/generated/stellar/inflation_payout.rb +20 -0
  48. data/generated/stellar/inflation_result.rb +26 -0
  49. data/generated/stellar/inflation_result_code.rb +24 -0
  50. data/generated/stellar/ledger_entry.rb +44 -0
  51. data/generated/stellar/ledger_entry/data.rb +33 -0
  52. data/generated/stellar/ledger_entry/ext.rb +24 -0
  53. data/generated/stellar/ledger_entry_change.rb +31 -0
  54. data/generated/stellar/ledger_entry_change_type.rb +24 -0
  55. data/generated/stellar/ledger_entry_type.rb +24 -0
  56. data/generated/stellar/ledger_header.rb +65 -0
  57. data/generated/stellar/ledger_header/ext.rb +24 -0
  58. data/generated/stellar/ledger_header_history_entry.rb +33 -0
  59. data/generated/stellar/ledger_header_history_entry/ext.rb +24 -0
  60. data/generated/stellar/ledger_key.rb +50 -0
  61. data/generated/stellar/ledger_key/account.rb +20 -0
  62. data/generated/stellar/ledger_key/offer.rb +22 -0
  63. data/generated/stellar/ledger_key/trust_line.rb +22 -0
  64. data/generated/stellar/ledger_upgrade.rb +27 -0
  65. data/generated/stellar/ledger_upgrade_type.rb +22 -0
  66. data/generated/stellar/manage_offer_effect.rb +24 -0
  67. data/generated/stellar/manage_offer_op.rb +28 -0
  68. data/generated/stellar/manage_offer_result.rb +26 -0
  69. data/generated/stellar/manage_offer_result_code.rb +48 -0
  70. data/generated/stellar/manage_offer_success_result.rb +34 -0
  71. data/generated/stellar/manage_offer_success_result/offer.rb +30 -0
  72. data/generated/stellar/memo.rb +38 -0
  73. data/generated/stellar/memo_type.rb +28 -0
  74. data/generated/stellar/message_type.rb +45 -0
  75. data/generated/stellar/offer_entry.rb +49 -0
  76. data/generated/stellar/offer_entry/ext.rb +24 -0
  77. data/generated/stellar/offer_entry_flags.rb +21 -0
  78. data/generated/stellar/operation.rb +51 -0
  79. data/generated/stellar/operation/body.rb +60 -0
  80. data/generated/stellar/operation_meta.rb +18 -0
  81. data/generated/stellar/operation_result.rb +53 -0
  82. data/generated/stellar/operation_result/tr.rb +61 -0
  83. data/generated/stellar/operation_result_code.rb +25 -0
  84. data/generated/stellar/operation_type.rb +38 -0
  85. data/generated/stellar/path_payment_op.rb +32 -0
  86. data/generated/stellar/path_payment_result.rb +34 -0
  87. data/generated/stellar/path_payment_result/success.rb +22 -0
  88. data/generated/stellar/path_payment_result_code.rb +45 -0
  89. data/generated/stellar/payment_op.rb +22 -0
  90. data/generated/stellar/payment_result.rb +25 -0
  91. data/generated/stellar/payment_result_code.rb +39 -0
  92. data/generated/stellar/peer_address.rb +22 -0
  93. data/generated/stellar/price.rb +20 -0
  94. data/generated/stellar/public_key.rb +23 -0
  95. data/generated/stellar/scp_ballot.rb +20 -0
  96. data/generated/stellar/scp_envelope.rb +20 -0
  97. data/generated/stellar/scp_nomination.rb +22 -0
  98. data/generated/stellar/scp_quorum_set.rb +22 -0
  99. data/generated/stellar/scp_statement.rb +59 -0
  100. data/generated/stellar/scp_statement/pledges.rb +64 -0
  101. data/generated/stellar/scp_statement/pledges/confirm.rb +28 -0
  102. data/generated/stellar/scp_statement/pledges/externalize.rb +28 -0
  103. data/generated/stellar/scp_statement/pledges/prepare.rb +32 -0
  104. data/generated/stellar/scp_statement_type.rb +26 -0
  105. data/generated/stellar/set_options_op.rb +41 -0
  106. data/generated/stellar/set_options_result.rb +25 -0
  107. data/generated/stellar/set_options_result_code.rb +38 -0
  108. data/generated/stellar/signer.rb +20 -0
  109. data/generated/stellar/simple_payment_result.rb +22 -0
  110. data/generated/stellar/stellar_message.rb +66 -0
  111. data/generated/stellar/stellar_value.rb +40 -0
  112. data/generated/stellar/stellar_value/ext.rb +24 -0
  113. data/generated/stellar/threshold_indexes.rb +26 -0
  114. data/generated/stellar/time_bounds.rb +20 -0
  115. data/generated/stellar/transaction.rb +50 -0
  116. data/generated/stellar/transaction/ext.rb +24 -0
  117. data/generated/stellar/transaction_envelope.rb +20 -0
  118. data/generated/stellar/transaction_history_entry.rb +33 -0
  119. data/generated/stellar/transaction_history_entry/ext.rb +24 -0
  120. data/generated/stellar/transaction_history_result_entry.rb +33 -0
  121. data/generated/stellar/transaction_history_result_entry/ext.rb +24 -0
  122. data/generated/stellar/transaction_meta.rb +31 -0
  123. data/generated/stellar/transaction_meta/v0.rb +22 -0
  124. data/generated/stellar/transaction_result.rb +43 -0
  125. data/generated/stellar/transaction_result/ext.rb +24 -0
  126. data/generated/stellar/transaction_result/result.rb +30 -0
  127. data/generated/stellar/transaction_result_code.rb +45 -0
  128. data/generated/stellar/transaction_result_pair.rb +20 -0
  129. data/generated/stellar/transaction_result_set.rb +18 -0
  130. data/generated/stellar/transaction_set.rb +20 -0
  131. data/generated/stellar/trust_line_entry.rb +41 -0
  132. data/generated/stellar/trust_line_entry/ext.rb +24 -0
  133. data/generated/stellar/trust_line_flags.rb +21 -0
  134. data/lib/stellar-base.rb +32 -0
  135. data/lib/stellar/account_flags.rb +28 -0
  136. data/lib/stellar/asset.rb +69 -0
  137. data/lib/stellar/base.rb +1 -0
  138. data/lib/stellar/base/version.rb +5 -0
  139. data/lib/stellar/convert.rb +32 -0
  140. data/lib/stellar/key_pair.rb +112 -0
  141. data/lib/stellar/networks.rb +45 -0
  142. data/lib/stellar/operation.rb +304 -0
  143. data/lib/stellar/path_payment_result.rb +17 -0
  144. data/lib/stellar/price.rb +32 -0
  145. data/lib/stellar/thresholds.rb +39 -0
  146. data/lib/stellar/transaction.rb +170 -0
  147. data/lib/stellar/transaction_envelope.rb +32 -0
  148. data/lib/stellar/util/continued_fraction.rb +96 -0
  149. data/lib/stellar/util/strkey.rb +43 -0
  150. data/open-core.gemspec +37 -0
  151. data/spec/lib/stellar/account_flags_spec.rb +19 -0
  152. data/spec/lib/stellar/asset_spec.rb +45 -0
  153. data/spec/lib/stellar/convert_spec.rb +61 -0
  154. data/spec/lib/stellar/key_pair_spec.rb +238 -0
  155. data/spec/lib/stellar/networks_spec.rb +77 -0
  156. data/spec/lib/stellar/path_payment_result_spec.rb +95 -0
  157. data/spec/lib/stellar/price_spec.rb +34 -0
  158. data/spec/lib/stellar/thresholds_spec.rb +62 -0
  159. data/spec/lib/stellar/transaction_envelope_spec.rb +93 -0
  160. data/spec/lib/stellar/transaction_spec.rb +54 -0
  161. data/spec/lib/stellar/util/strkey_spec.rb +46 -0
  162. data/spec/spec_helper.rb +16 -0
  163. data/spec/support/matchers/be_strkey.rb +9 -0
  164. data/spec/support/matchers/eq_bytes.rb +5 -0
  165. data/spec/support/matchers/have_length.rb +5 -0
  166. data/tasks/rspec.rake +6 -0
  167. data/tasks/travis.rake +1 -0
  168. data/tasks/xdr.rake +50 -0
  169. data/xdr/Stellar-SCP.x +87 -0
  170. data/xdr/Stellar-ledger-entries.x +222 -0
  171. data/xdr/Stellar-ledger.x +231 -0
  172. data/xdr/Stellar-overlay.x +87 -0
  173. data/xdr/Stellar-transaction.x +670 -0
  174. data/xdr/Stellar-types.x +34 -0
  175. metadata +444 -0
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This is an example of using the higher level "payment" wrapper. Notice
4
+ # that we are using KeyPair instead of the raw rbnacl keys and that we need
5
+ # not build the entire heirarchy of xdr object manually.
6
+ #
7
+ # You can see where these helpers are defined in the files underneath /lib,
8
+ # which is where we extend the xdrgen generated source files with our higher
9
+ # level api.
10
+
11
+ require 'stellar-base'
12
+ require 'faraday'
13
+ require 'faraday_middleware'
14
+
15
+ $server = Faraday.new(url: "http://localhost:39132") do |conn|
16
+ conn.response :json
17
+ conn.adapter Faraday.default_adapter
18
+ end
19
+
20
+ master = Stellar::KeyPair.from_raw_seed("allmylifemyhearthasbeensearching")
21
+ destination = Stellar::KeyPair.from_raw_seed("allmylifemyhearthasbeensearching")
22
+
23
+ tx = Stellar::Transaction.payment({
24
+ account: master,
25
+ destination: destination,
26
+ sequence: 1,
27
+ amount: [:native, 20 * Stellar::ONE]
28
+ })
29
+
30
+ b64 = tx.to_envelope(master).to_xdr(:base64)
31
+
32
+ result = $server.get('tx', blob: b64)
33
+ p result.body
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This is an example of using the higher level "payment" wrapper. Notice
4
+ # that we are using KeyPair instead of the raw rbnacl keys and that we need
5
+ # not build the entire heirarchy of xdr object manually.
6
+ #
7
+ # You can see where these helpers are defined in the files underneath /lib,
8
+ # which is where we extend the xdrgen generated source files with our higher
9
+ # level api.
10
+ #
11
+ # NOTE: due to the way that sequence number for a new account are set, this
12
+ # example is pretty cumbersome to run. It is only used for illustrative purposes
13
+ # of the flow
14
+
15
+ require 'stellar-base'
16
+ require 'faraday'
17
+ require 'faraday_middleware'
18
+
19
+ $server = Faraday.new(url: "http://localhost:39132") do |conn|
20
+ conn.response :json
21
+ conn.adapter Faraday.default_adapter
22
+ end
23
+
24
+ def submit(key, tx)
25
+ b64 = tx.to_envelope(key).to_xdr(:base64)
26
+ response = $server.get('tx', blob: b64)
27
+ raw = [response.body["result"]].pack("H*")
28
+ p response.body
29
+ end
30
+
31
+ master = Stellar::KeyPair.from_raw_seed("allmylifemyhearthasbeensearching")
32
+ destination = Stellar::KeyPair.from_raw_seed("allmylifemyhearthasbeensearching")
33
+
34
+ submit master, Stellar::Transaction.payment({
35
+ account: master,
36
+ destination: destination,
37
+ sequence: 1,
38
+ amount: [:native, 2000 * Stellar::ONE]
39
+ })
40
+
41
+ # NOTE: after this step, you need to get the sequence number for destination
42
+ # Which is based off of the ledger sequence number it was funded in.
43
+ gets # pause to get the account's sequence from the hayashi db
44
+
45
+ destination_sequence = FILL_ME_IN
46
+ # destination_sequence = 17179869185
47
+
48
+ submit destination, Stellar::Transaction.change_trust({
49
+ account: destination,
50
+ sequence: destination_sequence,
51
+ line: [:alphanum4, "USD\x00", master],
52
+ limit: 1000
53
+ })
54
+
55
+ submit master, Stellar::Transaction.payment({
56
+ account: master,
57
+ destination: destination,
58
+ sequence: 3,
59
+ amount: [:alphanum4, "USD\x00", master, 100]
60
+ })
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This is an example of using the higher level "payment" wrapper. Notice
4
+ # that we are using KeyPair instead of the raw rbnacl keys and that we need
5
+ # not build the entire heirarchy of xdr object manually.
6
+ #
7
+ # You can see where these helpers are defined in the files underneath /lib,
8
+ # which is where we extend the xdrgen generated source files with our higher
9
+ # level api.
10
+ #
11
+ # NOTE: due to the way that sequence number for a new account are set, this
12
+ # example is pretty cumbersome to run. It is only used for illustrative purposes
13
+ # of the flow
14
+
15
+ require 'stellar-base'
16
+ require 'faraday'
17
+ require 'faraday_middleware'
18
+
19
+ $server = Faraday.new(url: "http://localhost:39132") do |conn|
20
+ conn.response :json
21
+ conn.adapter Faraday.default_adapter
22
+ end
23
+
24
+ def submit(key, tx)
25
+ b64 = tx.to_envelope(key).to_xdr(:base64)
26
+ response = $server.get('tx', blob: b64)
27
+ p response.body
28
+ end
29
+
30
+ master = Stellar::KeyPair.from_raw_seed("allmylifemyhearthasbeensearching")
31
+ destination = Stellar::KeyPair.from_raw_seed("allmylifemyhearthasbeensearching")
32
+
33
+ submit master, Stellar::Transaction.payment({
34
+ account: master,
35
+ destination: destination,
36
+ sequence: 1,
37
+ amount: [:native, 2000 * Stellar::ONE]
38
+ })
39
+
40
+ # NOTE: after this step, you need to get the sequence number for destination
41
+ # Which is based off of the ledger sequence number it was funded in.
42
+ gets # pause to get the account's sequence from the hayashi db
43
+
44
+ destination_sequence = FILL_ME_IN
45
+ # destination_sequence = 17179869185
46
+
47
+ submit destination, Stellar::Transaction.change_trust({
48
+ account: destination,
49
+ sequence: destination_sequence,
50
+ line: [:alphanum4, "USD\x00", master],
51
+ limit: 1000
52
+ })
53
+
54
+ submit destination, Stellar::Transaction.change_trust({
55
+ account: destination,
56
+ sequence: destination_sequence + 1,
57
+ line: [:alphanum4, "EUR\x00", master],
58
+ limit: 1000
59
+ })
60
+
61
+ submit master, Stellar::Transaction.payment({
62
+ account: master,
63
+ destination: destination,
64
+ sequence: destination_sequence + 2,
65
+ amount: [:alphanum4, "USD\x00", master, 1000]
66
+ })
67
+
68
+ submit master, Stellar::Transaction.manage_offer({
69
+ account: destination,
70
+ sequence: destination_sequence + 3,
71
+ selling: [:alphanum4, "USD\x00", usd_gateway],
72
+ buying: [:alphanum4, "EUR\x00", eur_gateway],
73
+ amount: 100,
74
+ price: 2.0,
75
+ })
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'stellar-base'
4
+
5
+ master = Stellar::KeyPair.from_raw_seed("allmylifemyhearthasbeensearching")
6
+ destination = Stellar::KeyPair.from_raw_seed("allmylifemyhearthasbeensearching")
7
+
8
+ tx1 = Stellar::Transaction.payment({
9
+ account: master,
10
+ destination: destination,
11
+ sequence: 1,
12
+ amount: [:native, 20 * Stellar::ONE]
13
+ })
14
+
15
+ tx2 = Stellar::Transaction.payment({
16
+ account: master,
17
+ destination: destination,
18
+ sequence: 2,
19
+ amount: [:native, 20 * Stellar::ONE]
20
+ })
21
+
22
+ hex = tx1.merge(tx2).to_envelope(master).to_xdr(:base64)
23
+ puts hex
@@ -0,0 +1,134 @@
1
+ # This code was automatically generated using xdrgen
2
+ # DO NOT EDIT or your changes may be overwritten
3
+
4
+ require 'xdr'
5
+
6
+ module Stellar
7
+ include XDR::Namespace
8
+
9
+ Hash = XDR::Opaque[32]
10
+ Uint256 = XDR::Opaque[32]
11
+ Uint32 = XDR::UnsignedInt
12
+ Int32 = XDR::Int
13
+ Uint64 = XDR::UnsignedHyper
14
+ Int64 = XDR::Hyper
15
+ autoload :CryptoKeyType
16
+ autoload :PublicKey
17
+ Signature = XDR::VarOpaque[64]
18
+ SignatureHint = XDR::Opaque[4]
19
+ NodeID = PublicKey
20
+ end
21
+ module Stellar
22
+ include XDR::Namespace
23
+
24
+ AccountID = PublicKey
25
+ Thresholds = XDR::Opaque[4]
26
+ String32 = XDR::String[32]
27
+ SequenceNumber = Uint64
28
+ autoload :AssetType
29
+ autoload :Asset
30
+ autoload :Price
31
+ autoload :ThresholdIndexes
32
+ autoload :LedgerEntryType
33
+ autoload :Signer
34
+ autoload :AccountFlags
35
+ autoload :AccountEntry
36
+ autoload :TrustLineFlags
37
+ autoload :TrustLineEntry
38
+ autoload :OfferEntryFlags
39
+ autoload :OfferEntry
40
+ autoload :LedgerEntry
41
+ autoload :EnvelopeType
42
+ end
43
+ module Stellar
44
+ include XDR::Namespace
45
+
46
+ autoload :DecoratedSignature
47
+ autoload :OperationType
48
+ autoload :CreateAccountOp
49
+ autoload :PaymentOp
50
+ autoload :PathPaymentOp
51
+ autoload :ManageOfferOp
52
+ autoload :CreatePassiveOfferOp
53
+ autoload :SetOptionsOp
54
+ autoload :ChangeTrustOp
55
+ autoload :AllowTrustOp
56
+ autoload :Operation
57
+ autoload :MemoType
58
+ autoload :Memo
59
+ autoload :TimeBounds
60
+ autoload :Transaction
61
+ autoload :TransactionEnvelope
62
+ autoload :ClaimOfferAtom
63
+ autoload :CreateAccountResultCode
64
+ autoload :CreateAccountResult
65
+ autoload :PaymentResultCode
66
+ autoload :PaymentResult
67
+ autoload :PathPaymentResultCode
68
+ autoload :SimplePaymentResult
69
+ autoload :PathPaymentResult
70
+ autoload :ManageOfferResultCode
71
+ autoload :ManageOfferEffect
72
+ autoload :ManageOfferSuccessResult
73
+ autoload :ManageOfferResult
74
+ autoload :SetOptionsResultCode
75
+ autoload :SetOptionsResult
76
+ autoload :ChangeTrustResultCode
77
+ autoload :ChangeTrustResult
78
+ autoload :AllowTrustResultCode
79
+ autoload :AllowTrustResult
80
+ autoload :AccountMergeResultCode
81
+ autoload :AccountMergeResult
82
+ autoload :InflationResultCode
83
+ autoload :InflationPayout
84
+ autoload :InflationResult
85
+ autoload :OperationResultCode
86
+ autoload :OperationResult
87
+ autoload :TransactionResultCode
88
+ autoload :TransactionResult
89
+ end
90
+ module Stellar
91
+ include XDR::Namespace
92
+
93
+ UpgradeType = XDR::VarOpaque[128]
94
+ autoload :StellarValue
95
+ autoload :LedgerHeader
96
+ autoload :LedgerUpgradeType
97
+ autoload :LedgerUpgrade
98
+ autoload :LedgerKey
99
+ autoload :BucketEntryType
100
+ autoload :BucketEntry
101
+ MAX_TX_PER_LEDGER = 5000
102
+ autoload :TransactionSet
103
+ autoload :TransactionResultPair
104
+ autoload :TransactionResultSet
105
+ autoload :TransactionHistoryEntry
106
+ autoload :TransactionHistoryResultEntry
107
+ autoload :LedgerHeaderHistoryEntry
108
+ autoload :LedgerEntryChangeType
109
+ autoload :LedgerEntryChange
110
+ LedgerEntryChanges = XDR::VarArray[LedgerEntryChange]
111
+ autoload :OperationMeta
112
+ autoload :TransactionMeta
113
+ end
114
+ module Stellar
115
+ include XDR::Namespace
116
+
117
+ autoload :Error
118
+ autoload :Hello
119
+ autoload :PeerAddress
120
+ autoload :MessageType
121
+ autoload :DontHave
122
+ autoload :StellarMessage
123
+ end
124
+ module Stellar
125
+ include XDR::Namespace
126
+
127
+ Value = XDR::VarOpaque[]
128
+ autoload :SCPBallot
129
+ autoload :SCPStatementType
130
+ autoload :SCPNomination
131
+ autoload :SCPStatement
132
+ autoload :SCPEnvelope
133
+ autoload :SCPQuorumSet
134
+ end
@@ -0,0 +1,53 @@
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 AccountEntry
9
+ # {
10
+ # AccountID accountID; // master public key for this account
11
+ # int64 balance; // in stroops
12
+ # SequenceNumber seqNum; // last sequence number used for this account
13
+ # uint32 numSubEntries; // number of sub-entries this account has
14
+ # // drives the reserve
15
+ # AccountID* inflationDest; // Account to vote for during inflation
16
+ # uint32 flags; // see AccountFlags
17
+ #
18
+ # string32 homeDomain; // can be used for reverse federation and memo lookup
19
+ #
20
+ # // fields used for signatures
21
+ # // thresholds stores unsigned bytes: [weight of master|low|medium|high]
22
+ # Thresholds thresholds;
23
+ #
24
+ # Signer signers<20>; // possible signers for this account
25
+ #
26
+ # // reserved for future use
27
+ # union switch (int v)
28
+ # {
29
+ # case 0:
30
+ # void;
31
+ # }
32
+ # ext;
33
+ # };
34
+ #
35
+ # ===========================================================================
36
+ module Stellar
37
+ class AccountEntry < XDR::Struct
38
+ include XDR::Namespace
39
+
40
+ autoload :Ext
41
+
42
+ attribute :account_id, AccountID
43
+ attribute :balance, Int64
44
+ attribute :seq_num, SequenceNumber
45
+ attribute :num_sub_entries, Uint32
46
+ attribute :inflation_dest, XDR::Option[AccountID]
47
+ attribute :flags, Uint32
48
+ attribute :home_domain, String32
49
+ attribute :thresholds, Thresholds
50
+ attribute :signers, XDR::VarArray[Signer, 20]
51
+ attribute :ext, Ext
52
+ end
53
+ 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 AccountEntry
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,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
+ # enum AccountFlags
9
+ # { // masks for each flag
10
+ #
11
+ # // if set, TrustLines are created with authorized set to "false"
12
+ # // requiring the issuer to set it for each TrustLine
13
+ # AUTH_REQUIRED_FLAG = 0x1,
14
+ # // if set, the authorized flag in TrustLines can be cleared
15
+ # // otherwise, authorization cannot be revoked
16
+ # AUTH_REVOCABLE_FLAG = 0x2
17
+ # };
18
+ #
19
+ # ===========================================================================
20
+ module Stellar
21
+ class AccountFlags < XDR::Enum
22
+ member :auth_required_flag, 1
23
+ member :auth_revocable_flag, 2
24
+
25
+ seal
26
+ end
27
+ 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 AccountMergeResult switch (AccountMergeResultCode code)
9
+ # {
10
+ # case ACCOUNT_MERGE_SUCCESS:
11
+ # int64 sourceAccountBalance; // how much got transfered from source account
12
+ # default:
13
+ # void;
14
+ # };
15
+ #
16
+ # ===========================================================================
17
+ module Stellar
18
+ class AccountMergeResult < XDR::Union
19
+ switch_on AccountMergeResultCode, :code
20
+
21
+ switch :account_merge_success, :source_account_balance
22
+ switch :default
23
+
24
+ attribute :source_account_balance, Int64
25
+ end
26
+ end