auction-ruby-base 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (226) 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/CHANGELOG.md +58 -0
  6. data/CONTRIBUTING.md +48 -0
  7. data/Gemfile +15 -0
  8. data/Guardfile +5 -0
  9. data/LICENSE.txt +202 -0
  10. data/README.md +83 -0
  11. data/Rakefile +4 -0
  12. data/auction-ruby-base.gemspec +35 -0
  13. data/examples/create_account.rb +26 -0
  14. data/examples/low_level_transaction_post.rb +46 -0
  15. data/examples/mid_level_transaction_post.rb +33 -0
  16. data/examples/non_native_payment.rb +60 -0
  17. data/examples/offer.rb +75 -0
  18. data/examples/transaction_merge.rb +23 -0
  19. data/generated/stellar-base-generated.rb +174 -0
  20. data/generated/stellar/account_entry.rb +55 -0
  21. data/generated/stellar/account_entry/ext.rb +24 -0
  22. data/generated/stellar/account_flags.rb +31 -0
  23. data/generated/stellar/account_merge_result.rb +26 -0
  24. data/generated/stellar/account_merge_result_code.rb +30 -0
  25. data/generated/stellar/affirm_fail_op.rb +22 -0
  26. data/generated/stellar/affirm_fail_result.rb +25 -0
  27. data/generated/stellar/affirm_fail_result_code.rb +22 -0
  28. data/generated/stellar/affirm_pass_op.rb +24 -0
  29. data/generated/stellar/affirm_pass_result.rb +25 -0
  30. data/generated/stellar/affirm_pass_result_code.rb +22 -0
  31. data/generated/stellar/allow_trust_op.rb +38 -0
  32. data/generated/stellar/allow_trust_op/asset.rb +33 -0
  33. data/generated/stellar/allow_trust_result.rb +25 -0
  34. data/generated/stellar/allow_trust_result_code.rb +31 -0
  35. data/generated/stellar/asset.rb +47 -0
  36. data/generated/stellar/asset/alpha_num12.rb +22 -0
  37. data/generated/stellar/asset/alpha_num4.rb +22 -0
  38. data/generated/stellar/asset_type.rb +24 -0
  39. data/generated/stellar/auth.rb +20 -0
  40. data/generated/stellar/auth_cert.rb +22 -0
  41. data/generated/stellar/authenticated_message.rb +32 -0
  42. data/generated/stellar/authenticated_message/v0.rb +24 -0
  43. data/generated/stellar/bucket_entry.rb +28 -0
  44. data/generated/stellar/bucket_entry_type.rb +22 -0
  45. data/generated/stellar/change_trust_op.rb +22 -0
  46. data/generated/stellar/change_trust_result.rb +25 -0
  47. data/generated/stellar/change_trust_result_code.rb +31 -0
  48. data/generated/stellar/claim_offer_atom.rb +33 -0
  49. data/generated/stellar/create_account_op.rb +20 -0
  50. data/generated/stellar/create_account_result.rb +25 -0
  51. data/generated/stellar/create_account_result_code.rb +32 -0
  52. data/generated/stellar/create_bid_op.rb +20 -0
  53. data/generated/stellar/create_bid_result.rb +25 -0
  54. data/generated/stellar/create_bid_result_code.rb +22 -0
  55. data/generated/stellar/create_lot_op.rb +46 -0
  56. data/generated/stellar/create_lot_result.rb +25 -0
  57. data/generated/stellar/create_lot_result_code.rb +22 -0
  58. data/generated/stellar/create_passive_offer_op.rb +24 -0
  59. data/generated/stellar/crypto_key_type.rb +20 -0
  60. data/generated/stellar/curve25519_public.rb +18 -0
  61. data/generated/stellar/curve25519_secret.rb +18 -0
  62. data/generated/stellar/decorated_signature.rb +20 -0
  63. data/generated/stellar/dont_have.rb +20 -0
  64. data/generated/stellar/envelope_type.rb +24 -0
  65. data/generated/stellar/error.rb +20 -0
  66. data/generated/stellar/error_code.rb +28 -0
  67. data/generated/stellar/hello.rb +34 -0
  68. data/generated/stellar/hmac_sha256_key.rb +18 -0
  69. data/generated/stellar/hmac_sha256_mac.rb +18 -0
  70. data/generated/stellar/inflation_payout.rb +20 -0
  71. data/generated/stellar/inflation_result.rb +26 -0
  72. data/generated/stellar/inflation_result_code.rb +24 -0
  73. data/generated/stellar/ip_addr_type.rb +22 -0
  74. data/generated/stellar/ledger_entry.rb +52 -0
  75. data/generated/stellar/ledger_entry/data.rb +49 -0
  76. data/generated/stellar/ledger_entry/ext.rb +24 -0
  77. data/generated/stellar/ledger_entry_change.rb +35 -0
  78. data/generated/stellar/ledger_entry_change_type.rb +26 -0
  79. data/generated/stellar/ledger_entry_type.rb +32 -0
  80. data/generated/stellar/ledger_header.rb +69 -0
  81. data/generated/stellar/ledger_header/ext.rb +24 -0
  82. data/generated/stellar/ledger_header_history_entry.rb +33 -0
  83. data/generated/stellar/ledger_header_history_entry/ext.rb +24 -0
  84. data/generated/stellar/ledger_key.rb +87 -0
  85. data/generated/stellar/ledger_key/account.rb +20 -0
  86. data/generated/stellar/ledger_key/lot.rb +22 -0
  87. data/generated/stellar/ledger_key/message.rb +22 -0
  88. data/generated/stellar/ledger_key/offer.rb +22 -0
  89. data/generated/stellar/ledger_key/participant.rb +22 -0
  90. data/generated/stellar/ledger_key/proof.rb +22 -0
  91. data/generated/stellar/ledger_key/trust_line.rb +22 -0
  92. data/generated/stellar/ledger_scp_messages.rb +20 -0
  93. data/generated/stellar/ledger_upgrade.rb +31 -0
  94. data/generated/stellar/ledger_upgrade_type.rb +24 -0
  95. data/generated/stellar/lot_branch.rb +21 -0
  96. data/generated/stellar/lot_entry.rb +64 -0
  97. data/generated/stellar/lot_entry/ext.rb +24 -0
  98. data/generated/stellar/lot_type.rb +21 -0
  99. data/generated/stellar/manage_offer_effect.rb +24 -0
  100. data/generated/stellar/manage_offer_op.rb +28 -0
  101. data/generated/stellar/manage_offer_result.rb +26 -0
  102. data/generated/stellar/manage_offer_result_code.rb +50 -0
  103. data/generated/stellar/manage_offer_success_result.rb +34 -0
  104. data/generated/stellar/manage_offer_success_result/offer.rb +30 -0
  105. data/generated/stellar/memo.rb +38 -0
  106. data/generated/stellar/memo_type.rb +28 -0
  107. data/generated/stellar/message_entry.rb +38 -0
  108. data/generated/stellar/message_entry/ext.rb +24 -0
  109. data/generated/stellar/message_type.rb +51 -0
  110. data/generated/stellar/offer_entry.rb +49 -0
  111. data/generated/stellar/offer_entry/ext.rb +24 -0
  112. data/generated/stellar/offer_entry_flags.rb +21 -0
  113. data/generated/stellar/operation.rb +65 -0
  114. data/generated/stellar/operation/body.rb +88 -0
  115. data/generated/stellar/operation_meta.rb +18 -0
  116. data/generated/stellar/operation_result.rb +67 -0
  117. data/generated/stellar/operation_result/tr.rb +89 -0
  118. data/generated/stellar/operation_result_code.rb +25 -0
  119. data/generated/stellar/operation_type.rb +52 -0
  120. data/generated/stellar/participant_entry.rb +39 -0
  121. data/generated/stellar/participant_entry/ext.rb +24 -0
  122. data/generated/stellar/participant_state.rb +25 -0
  123. data/generated/stellar/path_payment_op.rb +32 -0
  124. data/generated/stellar/path_payment_result.rb +38 -0
  125. data/generated/stellar/path_payment_result/success.rb +22 -0
  126. data/generated/stellar/path_payment_result_code.rb +47 -0
  127. data/generated/stellar/payment_op.rb +22 -0
  128. data/generated/stellar/payment_result.rb +25 -0
  129. data/generated/stellar/payment_result_code.rb +41 -0
  130. data/generated/stellar/peer_address.rb +33 -0
  131. data/generated/stellar/peer_address/ip.rb +29 -0
  132. data/generated/stellar/price.rb +20 -0
  133. data/generated/stellar/proof_entry.rb +42 -0
  134. data/generated/stellar/proof_entry/ext.rb +24 -0
  135. data/generated/stellar/provide_proof_op.rb +24 -0
  136. data/generated/stellar/provide_proof_result.rb +25 -0
  137. data/generated/stellar/provide_proof_result_code.rb +22 -0
  138. data/generated/stellar/public_key.rb +23 -0
  139. data/generated/stellar/register_participant_op.rb +22 -0
  140. data/generated/stellar/register_participant_result.rb +25 -0
  141. data/generated/stellar/register_participant_result_code.rb +22 -0
  142. data/generated/stellar/scp_ballot.rb +20 -0
  143. data/generated/stellar/scp_envelope.rb +20 -0
  144. data/generated/stellar/scp_history_entry.rb +23 -0
  145. data/generated/stellar/scp_history_entry_v0.rb +20 -0
  146. data/generated/stellar/scp_nomination.rb +22 -0
  147. data/generated/stellar/scp_quorum_set.rb +22 -0
  148. data/generated/stellar/scp_statement.rb +58 -0
  149. data/generated/stellar/scp_statement/pledges.rb +63 -0
  150. data/generated/stellar/scp_statement/pledges/confirm.rb +30 -0
  151. data/generated/stellar/scp_statement/pledges/externalize.rb +26 -0
  152. data/generated/stellar/scp_statement/pledges/prepare.rb +32 -0
  153. data/generated/stellar/scp_statement_type.rb +26 -0
  154. data/generated/stellar/send_message_op.rb +22 -0
  155. data/generated/stellar/send_message_result.rb +25 -0
  156. data/generated/stellar/send_message_result_code.rb +22 -0
  157. data/generated/stellar/set_options_op.rb +41 -0
  158. data/generated/stellar/set_options_result.rb +25 -0
  159. data/generated/stellar/set_options_result_code.rb +40 -0
  160. data/generated/stellar/signer.rb +20 -0
  161. data/generated/stellar/simple_payment_result.rb +22 -0
  162. data/generated/stellar/stellar_message.rb +74 -0
  163. data/generated/stellar/stellar_value.rb +41 -0
  164. data/generated/stellar/stellar_value/ext.rb +24 -0
  165. data/generated/stellar/threshold_indexes.rb +26 -0
  166. data/generated/stellar/time_bounds.rb +20 -0
  167. data/generated/stellar/transaction.rb +50 -0
  168. data/generated/stellar/transaction/ext.rb +24 -0
  169. data/generated/stellar/transaction_envelope.rb +20 -0
  170. data/generated/stellar/transaction_history_entry.rb +33 -0
  171. data/generated/stellar/transaction_history_entry/ext.rb +24 -0
  172. data/generated/stellar/transaction_history_result_entry.rb +33 -0
  173. data/generated/stellar/transaction_history_result_entry/ext.rb +24 -0
  174. data/generated/stellar/transaction_meta.rb +23 -0
  175. data/generated/stellar/transaction_result.rb +43 -0
  176. data/generated/stellar/transaction_result/ext.rb +24 -0
  177. data/generated/stellar/transaction_result/result.rb +30 -0
  178. data/generated/stellar/transaction_result_code.rb +45 -0
  179. data/generated/stellar/transaction_result_pair.rb +20 -0
  180. data/generated/stellar/transaction_result_set.rb +18 -0
  181. data/generated/stellar/transaction_set.rb +20 -0
  182. data/generated/stellar/trust_line_entry.rb +41 -0
  183. data/generated/stellar/trust_line_entry/ext.rb +24 -0
  184. data/generated/stellar/trust_line_flags.rb +21 -0
  185. data/lib/stellar-base.rb +33 -0
  186. data/lib/stellar/account_flags.rb +28 -0
  187. data/lib/stellar/asset.rb +69 -0
  188. data/lib/stellar/base.rb +1 -0
  189. data/lib/stellar/base/version.rb +5 -0
  190. data/lib/stellar/convert.rb +32 -0
  191. data/lib/stellar/key_pair.rb +112 -0
  192. data/lib/stellar/networks.rb +45 -0
  193. data/lib/stellar/operation.rb +384 -0
  194. data/lib/stellar/path_payment_result.rb +17 -0
  195. data/lib/stellar/price.rb +32 -0
  196. data/lib/stellar/thresholds.rb +39 -0
  197. data/lib/stellar/transaction.rb +205 -0
  198. data/lib/stellar/transaction_envelope.rb +32 -0
  199. data/lib/stellar/util/continued_fraction.rb +96 -0
  200. data/lib/stellar/util/strkey.rb +43 -0
  201. data/spec/lib/stellar/account_flags_spec.rb +19 -0
  202. data/spec/lib/stellar/asset_spec.rb +45 -0
  203. data/spec/lib/stellar/convert_spec.rb +61 -0
  204. data/spec/lib/stellar/key_pair_spec.rb +238 -0
  205. data/spec/lib/stellar/networks_spec.rb +77 -0
  206. data/spec/lib/stellar/operation_spec.rb +13 -0
  207. data/spec/lib/stellar/path_payment_result_spec.rb +95 -0
  208. data/spec/lib/stellar/price_spec.rb +34 -0
  209. data/spec/lib/stellar/thresholds_spec.rb +62 -0
  210. data/spec/lib/stellar/transaction_envelope_spec.rb +93 -0
  211. data/spec/lib/stellar/transaction_spec.rb +83 -0
  212. data/spec/lib/stellar/util/strkey_spec.rb +46 -0
  213. data/spec/spec_helper.rb +16 -0
  214. data/spec/support/matchers/be_strkey.rb +9 -0
  215. data/spec/support/matchers/eq_bytes.rb +5 -0
  216. data/spec/support/matchers/have_length.rb +5 -0
  217. data/tasks/rspec.rake +6 -0
  218. data/tasks/travis.rake +1 -0
  219. data/tasks/xdr.rake +50 -0
  220. data/xdr/Stellar-SCP.x +86 -0
  221. data/xdr/Stellar-ledger-entries.x +351 -0
  222. data/xdr/Stellar-ledger.x +288 -0
  223. data/xdr/Stellar-overlay.x +146 -0
  224. data/xdr/Stellar-transaction.x +936 -0
  225. data/xdr/Stellar-types.x +55 -0
  226. metadata +495 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2c9d491851bb500c4768584488bacccd32595fbb
4
+ data.tar.gz: 362d75cccf933bcee3331fda3416b0b09fbc4d07
5
+ SHA512:
6
+ metadata.gz: dded88ffcbef9231c1051801aa0ab98319fe21b056fbf55fbd286de5d2d958f805fd10d752e887a5c3ba5f06d2eeddb1fdf9353e8b5c086f185f9df44ee37869
7
+ data.tar.gz: 76dcce204858f30f3ee036c9f6a544f4be84bcd2cbaec03b86d21a0df637dcabfb49b1b21ac342a5b357b2f8eb160982795babf4dfc9e588d0fa8f8d7d452642
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ .DS_Store
data/.travis.yml ADDED
@@ -0,0 +1,15 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
4
+ - 2.1.5
5
+ - 2.0.0
6
+ - 1.9.3
7
+ - jruby-1.7.20
8
+ - jruby-head
9
+ script: bundle exec rake travis
10
+ notifications:
11
+ slack:
12
+ secure: V/6a8KFe067uukrbCJA2R1HPO4xy0YSQ1pwmHVRi5StX+yl+lYsWWJdjdBdT0j3iJBYyPRqU4bQYck+OloxtELnrHCX+OkodxcxW8W/ACc914iIf0FyY9pnusK7ck2awmt4Iuf94YPgi0XTm1aCcm+f0yU7wiIVFpftoXSk1EDY=
13
+ matrix:
14
+ allow_failures:
15
+ - rvm: jruby-head
data/.yardopts ADDED
@@ -0,0 +1,8 @@
1
+ --output-dir doc/generated
2
+ --protected
3
+ --no-private
4
+ --embed-mixin ClassMethods
5
+ lib/**/*.rb
6
+ generated/**/*.rb
7
+ -
8
+ doc/*.md
data/CHANGELOG.md ADDED
@@ -0,0 +1,58 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this
4
+ file. This project adheres to [Semantic Versioning](http://semver.org/).
5
+
6
+ As this project is pre 1.0, breaking changes may happen for minor version
7
+ bumps. A breaking change will get clearly notified in this log.
8
+
9
+ ## [unreleased](https://github.com/stellar/ruby-stellar-base/compare/v0.10.0...master)
10
+ ## [0.10.0](https://github.com/stellar/ruby-stellar-base/compare/v0.0.0...v0.10.0)
11
+
12
+ - Added memo helpers to `Stellar::Transaction.for_account`, allowing any operation builder (such as `Stellar::Transaction.payment) to provide a custom memo using the `:memo` attribute.
13
+
14
+ ## [0.9.0](https://github.com/stellar/ruby-stellar-base/compare/v0.8.0...v0.9.0)
15
+
16
+ ### Changed
17
+ - XDR Definitions have been updated to stellar-core commit eed89649c2060b8e9dacffe2cec4e8b258b32416
18
+
19
+ ## [0.8.0](https://github.com/stellar/ruby-stellar-base/compare/v0.7.0...v0.8.0)
20
+
21
+ ### Changed
22
+ - BREAKING CHANGE: The default network for this library is now the stellar test network.
23
+ To enable this library for the production network use `Stellar.default_network = Stellar::Networks::PUBLIC`
24
+ at the head of your script or in your configuration function.
25
+
26
+ ## [0.7.0](https://github.com/stellar/ruby-stellar-base/compare/v0.6.1...v0.7.0)
27
+
28
+ ### Changed
29
+
30
+ - Bump xdr dependency to 1.0.0
31
+
32
+ ## [0.6.1](https://github.com/stellar/ruby-stellar-base/compare/v0.6.0...v0.6.1)
33
+
34
+ ### Changed
35
+
36
+ - Update default fee for transactions to new minimum of 100 stroops
37
+
38
+
39
+ ## [0.6.0](https://github.com/stellar/ruby-stellar-base/compare/v0.5.0...v0.6.0)
40
+
41
+ ### Changed
42
+
43
+ - Update to latest xdr (stellar-core commit ad22bccafbbc14a358f05a989f7b95714dc9d4c6)
44
+
45
+ ## [0.5.0](https://github.com/stellar/ruby-stellar-base/compare/v0.4.0...v0.5.0)
46
+
47
+ ### Changed
48
+
49
+ - Update to latest xdr
50
+
51
+ ## [0.4.0](https://github.com/stellar/ruby-stellar-base/compare/v0.3.0...v0.4.0)
52
+
53
+ ### Changed
54
+ - BREAKING CHANGE: "Amounts", that is, input parameters that represent a
55
+ certain amount of a given asset, such as the `:starting_balance` option for
56
+ `Operation.create_account` are now interpreted using the convention of 7
57
+ fixed-decimal places. For example, specifying a payment where the amount is
58
+ `50` will result in a transaction with an amount set to `500000000`.
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,48 @@
1
+ # How to contribute
2
+
3
+ Your contributions to the Stellar network will help improve the world’s financial
4
+ infrastructure, faster.
5
+
6
+ We want to make it as easy as possible to contribute changes that
7
+ help the Stellar network grow and thrive. There are a few guidelines that we
8
+ ask contributors to follow so that we can merge your changes quickly.
9
+
10
+ ## Getting Started
11
+
12
+ * Create a GitHub issue for your contribution, assuming one does not already exist.
13
+ * Clearly describe the issue including steps to reproduce if it is a bug.
14
+ * Fork the repository on GitHub
15
+
16
+ ## Making Changes
17
+
18
+ * Create a topic branch from where you want to base your work.
19
+ * This is usually the master branch.
20
+ * Please avoid working directly on the `master` branch.
21
+ * Make sure you have added the necessary tests for your changes, and make sure all tests pass.
22
+
23
+ ## Submitting Changes
24
+
25
+ * <a href="https://docs.google.com/forms/d/1g7EF6PERciwn7zfmfke5Sir2n10yddGGSXyZsq98tVY/viewform?usp=send_form">Sign the Contributor License Agreement</a>
26
+ * Push your changes to a topic branch in your fork of the repository.
27
+ * Submit a pull request to the corresponding repository in the Stellar organization.
28
+ * Include a descriptive [commit message](https://github.com/erlang/otp/wiki/Writing-good-commit-messages).
29
+ * Changes contributed via pull request should focus on a single issue at a time.
30
+ * Rebase your local changes against the master branch. Resolve any conflicts that arise.
31
+
32
+ At this point you're waiting on us. We like to at least comment on pull requests within three
33
+ business days. We may suggest some changes or improvements or alternatives.
34
+
35
+ # Additional Resources
36
+
37
+ * [Bug tracker (Github)](https://github.com/stellar/ruby-stellar-base/issues)
38
+ * <a href="https://docs.google.com/forms/d/1g7EF6PERciwn7zfmfke5Sir2n10yddGGSXyZsq98tVY/viewform?usp=send_form">Contributor License Agreement</a>
39
+ * #stellar-dev IRC channel on freenode.org and Slack chat on stellar-public.slack.com
40
+
41
+
42
+ This document is inspired by:
43
+
44
+ https://github.com/puppetlabs/puppet/blob/master/CONTRIBUTING.md
45
+
46
+ https://github.com/thoughtbot/factory_girl_rails/blob/master/CONTRIBUTING.md
47
+
48
+ https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ # gem "xdr", git: "https://github.com/stellar/ruby-xdr.git"
6
+ # gem "xdr", path: "../ruby-xdr"
7
+
8
+ group :development do
9
+ gem "xdrgen", git: "https://github.com/stellar/xdrgen.git"
10
+ # gem "xdrgen", path: "../xdrgen"
11
+ gem "pry"
12
+ gem "faraday"
13
+ gem "faraday_middleware"
14
+ end
15
+
data/Guardfile ADDED
@@ -0,0 +1,5 @@
1
+ guard :rspec, cmd: 'bundle exec rspec' do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { "spec" }
5
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2015 Stellar Development Foundation
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # Stellar::Base
2
+
3
+ [![Build Status](https://travis-ci.org/stellar/ruby-stellar-base.svg)](https://travis-ci.org/stellar/ruby-stellar-base)
4
+ [![Code Climate](https://codeclimate.com/github/stellar/ruby-stellar-base/badges/gpa.svg)](https://codeclimate.com/github/stellar/ruby-stellar-base)
5
+
6
+ The stellar-base library is the lowest-level stellar helper library. It consists of classes
7
+ to read, write, hash, and sign the xdr structures that are used in stellard.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'stellar-base'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install stellar-base
24
+
25
+ Also requires libsodium. Installable via `brew install libsodium` on OS X.
26
+
27
+ ## Supported Ruby Versions
28
+
29
+ Please see [travis.yml](.travis.yml) for what versions of ruby are currently tested by our continuous integration system. Any ruby in that list is officially supported.
30
+
31
+ ### JRuby
32
+
33
+ It seems as though jruby is particularly slow when it comes to BigDecimal math; the source behind this slowness has not been investigated, but it is something to be aware of.
34
+
35
+ ## Usage
36
+
37
+ [Examples are here](examples)
38
+
39
+ In addition to the code generated from the XDR definition files (see [ruby-xdr](https://github.com/stellar/ruby-xdr) for example usage), this library also provides some stellar specific features. Let's look at some of them.
40
+
41
+ We wrap rbnacl with `Stellar::KeyPair`, providing some stellar specific functionality as seen below:
42
+
43
+ ```ruby
44
+
45
+ # Create a keypair from a stellar secret seed
46
+ signer = Stellar::KeyPair.from_seed("SCBASSEX34FJNIPLUYQPSMZHHYXXQNWOOV42XYZFXM6EGYX2DPIZVIA3")
47
+
48
+ # Create a keypair from a stellar address
49
+ verifier = Stellar::KeyPair.from_address("GBQWWBFLRP3BXD2RI2FH7XNNU2MKIYVUI7QXUAIVG34JY6MQGXVUO3RX")
50
+
51
+ # Produce a stellar compliant "decorated signature" that is compliant with stellar transactions
52
+
53
+ signer.sign_decorated("Hello world!") # => #<Stellar::DecoratedSignature ...>
54
+
55
+ ```
56
+
57
+ This library also provides an impementation of Stellar's "StrKey" encoding (RFC-4648 Base32 + CCITT-XModem CRC16):
58
+
59
+ ```ruby
60
+
61
+ Stellar::Util::StrCheck.check_encode(:account_id, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF") # => "GD777777777764TU"
62
+ Stellar::Util::StrCheck.check_encode(:seed, "\x00\x00\x00\x00\x00\x00\x39") # => "SAAAAAAAAAADST3H"
63
+
64
+ # To prevent interpretation mistakes, you must pass the expected version byte
65
+ # when decoding a check_encoded value
66
+
67
+ encoded = Stellar::Util::StrCheck.check_encode(:account_id, "\x61\x6b\x04\xab\x8b\xf6\x1b")
68
+ Stellar::Util::StrCheck.check_decode(:account_id, encoded) # => "\x61\x6b\x04\xab\x8b\xf6\x1b"
69
+ Stellar::Util::StrCheck.check_decode(:seed, encoded) # => throws ArgumentError: Unexpected version: :account_id
70
+
71
+ ```
72
+
73
+ ## Updating Generated Code
74
+
75
+ The generated code of this library must be refreshed each time the Stellar network's protocol is updated. To perform this task, run `rake xdr:update`, which will download the latest `.x` files into the `xdr` folder and will run `xdrgen` to regenerate the built ruby code.
76
+
77
+ ## Caveats
78
+
79
+ The current integration of user-written code with auto-generated classes is to put it nicely, weird. We intend to segregate the auto-generated code into its own namespace and refrain from monkey patching them. This will happen before 1.0, and hopefully will happen soon.
80
+
81
+ ## Contributing
82
+
83
+ Please [see CONTRIBUTING.md for details](CONTRIBUTING.md).