digitalbits-base 0.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (252) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +202 -0
  3. data/README.md +84 -0
  4. data/generated/digitalbits-base-generated.rb +228 -0
  5. data/generated/digitalbits/account_entry.rb +55 -0
  6. data/generated/digitalbits/account_entry/ext.rb +28 -0
  7. data/generated/digitalbits/account_entry_extension_v1.rb +32 -0
  8. data/generated/digitalbits/account_entry_extension_v1/ext.rb +28 -0
  9. data/generated/digitalbits/account_entry_extension_v2.rb +34 -0
  10. data/generated/digitalbits/account_entry_extension_v2/ext.rb +24 -0
  11. data/generated/digitalbits/account_flags.rb +31 -0
  12. data/generated/digitalbits/account_merge_result.rb +26 -0
  13. data/generated/digitalbits/account_merge_result_code.rb +37 -0
  14. data/generated/digitalbits/allow_trust_op.rb +39 -0
  15. data/generated/digitalbits/allow_trust_op/asset.rb +33 -0
  16. data/generated/digitalbits/allow_trust_result.rb +25 -0
  17. data/generated/digitalbits/allow_trust_result_code.rb +33 -0
  18. data/generated/digitalbits/asset.rb +47 -0
  19. data/generated/digitalbits/asset/alpha_num12.rb +22 -0
  20. data/generated/digitalbits/asset/alpha_num4.rb +22 -0
  21. data/generated/digitalbits/asset_type.rb +24 -0
  22. data/generated/digitalbits/auth.rb +20 -0
  23. data/generated/digitalbits/auth_cert.rb +22 -0
  24. data/generated/digitalbits/authenticated_message.rb +32 -0
  25. data/generated/digitalbits/authenticated_message/v0.rb +24 -0
  26. data/generated/digitalbits/begin_sponsoring_future_reserves_op.rb +18 -0
  27. data/generated/digitalbits/begin_sponsoring_future_reserves_result.rb +25 -0
  28. data/generated/digitalbits/begin_sponsoring_future_reserves_result_code.rb +29 -0
  29. data/generated/digitalbits/bucket_entry.rb +34 -0
  30. data/generated/digitalbits/bucket_entry_type.rb +28 -0
  31. data/generated/digitalbits/bucket_metadata.rb +32 -0
  32. data/generated/digitalbits/bucket_metadata/ext.rb +24 -0
  33. data/generated/digitalbits/bump_sequence_op.rb +18 -0
  34. data/generated/digitalbits/bump_sequence_result.rb +25 -0
  35. data/generated/digitalbits/bump_sequence_result_code.rb +24 -0
  36. data/generated/digitalbits/change_trust_op.rb +22 -0
  37. data/generated/digitalbits/change_trust_result.rb +25 -0
  38. data/generated/digitalbits/change_trust_result_code.rb +34 -0
  39. data/generated/digitalbits/claim_claimable_balance_op.rb +18 -0
  40. data/generated/digitalbits/claim_claimable_balance_result.rb +25 -0
  41. data/generated/digitalbits/claim_claimable_balance_result_code.rb +31 -0
  42. data/generated/digitalbits/claim_offer_atom.rb +33 -0
  43. data/generated/digitalbits/claim_predicate.rb +43 -0
  44. data/generated/digitalbits/claim_predicate_type.rb +30 -0
  45. data/generated/digitalbits/claimable_balance_entry.rb +44 -0
  46. data/generated/digitalbits/claimable_balance_entry/ext.rb +24 -0
  47. data/generated/digitalbits/claimable_balance_id.rb +23 -0
  48. data/generated/digitalbits/claimable_balance_id_type.rb +20 -0
  49. data/generated/digitalbits/claimant.rb +31 -0
  50. data/generated/digitalbits/claimant/v0.rb +22 -0
  51. data/generated/digitalbits/claimant_type.rb +20 -0
  52. data/generated/digitalbits/create_account_op.rb +20 -0
  53. data/generated/digitalbits/create_account_result.rb +25 -0
  54. data/generated/digitalbits/create_account_result_code.rb +32 -0
  55. data/generated/digitalbits/create_claimable_balance_op.rb +22 -0
  56. data/generated/digitalbits/create_claimable_balance_result.rb +27 -0
  57. data/generated/digitalbits/create_claimable_balance_result_code.rb +30 -0
  58. data/generated/digitalbits/create_passive_sell_offer_op.rb +24 -0
  59. data/generated/digitalbits/crypto_key_type.rb +28 -0
  60. data/generated/digitalbits/curve25519_public.rb +18 -0
  61. data/generated/digitalbits/curve25519_secret.rb +18 -0
  62. data/generated/digitalbits/data_entry.rb +35 -0
  63. data/generated/digitalbits/data_entry/ext.rb +24 -0
  64. data/generated/digitalbits/decorated_signature.rb +20 -0
  65. data/generated/digitalbits/digital_bits_message.rb +84 -0
  66. data/generated/digitalbits/digital_bits_value.rb +43 -0
  67. data/generated/digitalbits/digital_bits_value/ext.rb +28 -0
  68. data/generated/digitalbits/digital_bits_value_type.rb +22 -0
  69. data/generated/digitalbits/dont_have.rb +20 -0
  70. data/generated/digitalbits/end_sponsoring_future_reserves_result.rb +25 -0
  71. data/generated/digitalbits/end_sponsoring_future_reserves_result_code.rb +25 -0
  72. data/generated/digitalbits/envelope_type.rb +32 -0
  73. data/generated/digitalbits/error.rb +20 -0
  74. data/generated/digitalbits/error_code.rb +28 -0
  75. data/generated/digitalbits/fee_bump_transaction.rb +39 -0
  76. data/generated/digitalbits/fee_bump_transaction/ext.rb +24 -0
  77. data/generated/digitalbits/fee_bump_transaction/inner_tx.rb +25 -0
  78. data/generated/digitalbits/fee_bump_transaction_envelope.rb +22 -0
  79. data/generated/digitalbits/hello.rb +34 -0
  80. data/generated/digitalbits/hmac_sha256_key.rb +18 -0
  81. data/generated/digitalbits/hmac_sha256_mac.rb +18 -0
  82. data/generated/digitalbits/inflation_payout.rb +20 -0
  83. data/generated/digitalbits/inflation_result.rb +26 -0
  84. data/generated/digitalbits/inflation_result_code.rb +24 -0
  85. data/generated/digitalbits/inner_transaction_result.rb +57 -0
  86. data/generated/digitalbits/inner_transaction_result/ext.rb +24 -0
  87. data/generated/digitalbits/inner_transaction_result/result.rb +54 -0
  88. data/generated/digitalbits/inner_transaction_result_pair.rb +20 -0
  89. data/generated/digitalbits/ip_addr_type.rb +22 -0
  90. data/generated/digitalbits/ledger_close_meta.rb +23 -0
  91. data/generated/digitalbits/ledger_close_meta_v0.rb +35 -0
  92. data/generated/digitalbits/ledger_close_value_signature.rb +20 -0
  93. data/generated/digitalbits/ledger_entry.rb +50 -0
  94. data/generated/digitalbits/ledger_entry/data.rb +41 -0
  95. data/generated/digitalbits/ledger_entry/ext.rb +28 -0
  96. data/generated/digitalbits/ledger_entry_change.rb +35 -0
  97. data/generated/digitalbits/ledger_entry_change_type.rb +26 -0
  98. data/generated/digitalbits/ledger_entry_extension_v1.rb +30 -0
  99. data/generated/digitalbits/ledger_entry_extension_v1/ext.rb +24 -0
  100. data/generated/digitalbits/ledger_entry_type.rb +28 -0
  101. data/generated/digitalbits/ledger_header.rb +69 -0
  102. data/generated/digitalbits/ledger_header/ext.rb +24 -0
  103. data/generated/digitalbits/ledger_header_history_entry.rb +33 -0
  104. data/generated/digitalbits/ledger_header_history_entry/ext.rb +24 -0
  105. data/generated/digitalbits/ledger_key.rb +69 -0
  106. data/generated/digitalbits/ledger_key/account.rb +20 -0
  107. data/generated/digitalbits/ledger_key/claimable_balance.rb +20 -0
  108. data/generated/digitalbits/ledger_key/data.rb +22 -0
  109. data/generated/digitalbits/ledger_key/offer.rb +22 -0
  110. data/generated/digitalbits/ledger_key/trust_line.rb +22 -0
  111. data/generated/digitalbits/ledger_scp_messages.rb +20 -0
  112. data/generated/digitalbits/ledger_upgrade.rb +35 -0
  113. data/generated/digitalbits/ledger_upgrade_type.rb +26 -0
  114. data/generated/digitalbits/liabilities.rb +20 -0
  115. data/generated/digitalbits/manage_buy_offer_op.rb +29 -0
  116. data/generated/digitalbits/manage_buy_offer_result.rb +26 -0
  117. data/generated/digitalbits/manage_buy_offer_result_code.rb +51 -0
  118. data/generated/digitalbits/manage_data_op.rb +20 -0
  119. data/generated/digitalbits/manage_data_result.rb +25 -0
  120. data/generated/digitalbits/manage_data_result_code.rb +32 -0
  121. data/generated/digitalbits/manage_offer_effect.rb +24 -0
  122. data/generated/digitalbits/manage_offer_success_result.rb +34 -0
  123. data/generated/digitalbits/manage_offer_success_result/offer.rb +30 -0
  124. data/generated/digitalbits/manage_sell_offer_op.rb +28 -0
  125. data/generated/digitalbits/manage_sell_offer_result.rb +26 -0
  126. data/generated/digitalbits/manage_sell_offer_result_code.rb +54 -0
  127. data/generated/digitalbits/memo.rb +38 -0
  128. data/generated/digitalbits/memo_type.rb +28 -0
  129. data/generated/digitalbits/message_type.rb +56 -0
  130. data/generated/digitalbits/muxed_account.rb +35 -0
  131. data/generated/digitalbits/muxed_account/med25519.rb +22 -0
  132. data/generated/digitalbits/offer_entry.rb +49 -0
  133. data/generated/digitalbits/offer_entry/ext.rb +24 -0
  134. data/generated/digitalbits/offer_entry_flags.rb +21 -0
  135. data/generated/digitalbits/operation.rb +69 -0
  136. data/generated/digitalbits/operation/body.rb +95 -0
  137. data/generated/digitalbits/operation_id.rb +32 -0
  138. data/generated/digitalbits/operation_id/id.rb +24 -0
  139. data/generated/digitalbits/operation_meta.rb +18 -0
  140. data/generated/digitalbits/operation_result.rb +71 -0
  141. data/generated/digitalbits/operation_result/tr.rb +97 -0
  142. data/generated/digitalbits/operation_result_code.rb +33 -0
  143. data/generated/digitalbits/operation_type.rb +56 -0
  144. data/generated/digitalbits/path_payment_strict_receive_op.rb +32 -0
  145. data/generated/digitalbits/path_payment_strict_receive_result.rb +39 -0
  146. data/generated/digitalbits/path_payment_strict_receive_result/success.rb +22 -0
  147. data/generated/digitalbits/path_payment_strict_receive_result_code.rb +56 -0
  148. data/generated/digitalbits/path_payment_strict_send_op.rb +32 -0
  149. data/generated/digitalbits/path_payment_strict_send_result.rb +38 -0
  150. data/generated/digitalbits/path_payment_strict_send_result/success.rb +22 -0
  151. data/generated/digitalbits/path_payment_strict_send_result_code.rb +55 -0
  152. data/generated/digitalbits/payment_op.rb +22 -0
  153. data/generated/digitalbits/payment_result.rb +25 -0
  154. data/generated/digitalbits/payment_result_code.rb +41 -0
  155. data/generated/digitalbits/peer_address.rb +33 -0
  156. data/generated/digitalbits/peer_address/ip.rb +29 -0
  157. data/generated/digitalbits/peer_stats.rb +48 -0
  158. data/generated/digitalbits/price.rb +20 -0
  159. data/generated/digitalbits/public_key.rb +23 -0
  160. data/generated/digitalbits/public_key_type.rb +20 -0
  161. data/generated/digitalbits/revoke_sponsorship_op.rb +36 -0
  162. data/generated/digitalbits/revoke_sponsorship_op/signer.rb +22 -0
  163. data/generated/digitalbits/revoke_sponsorship_result.rb +25 -0
  164. data/generated/digitalbits/revoke_sponsorship_result_code.rb +31 -0
  165. data/generated/digitalbits/revoke_sponsorship_type.rb +22 -0
  166. data/generated/digitalbits/scp_ballot.rb +20 -0
  167. data/generated/digitalbits/scp_envelope.rb +20 -0
  168. data/generated/digitalbits/scp_history_entry.rb +23 -0
  169. data/generated/digitalbits/scp_history_entry_v0.rb +20 -0
  170. data/generated/digitalbits/scp_nomination.rb +22 -0
  171. data/generated/digitalbits/scp_quorum_set.rb +22 -0
  172. data/generated/digitalbits/scp_statement.rb +58 -0
  173. data/generated/digitalbits/scp_statement/pledges.rb +63 -0
  174. data/generated/digitalbits/scp_statement/pledges/confirm.rb +30 -0
  175. data/generated/digitalbits/scp_statement/pledges/externalize.rb +26 -0
  176. data/generated/digitalbits/scp_statement/pledges/prepare.rb +32 -0
  177. data/generated/digitalbits/scp_statement_type.rb +26 -0
  178. data/generated/digitalbits/set_options_op.rb +41 -0
  179. data/generated/digitalbits/set_options_result.rb +25 -0
  180. data/generated/digitalbits/set_options_result_code.rb +40 -0
  181. data/generated/digitalbits/signed_survey_request_message.rb +20 -0
  182. data/generated/digitalbits/signed_survey_response_message.rb +20 -0
  183. data/generated/digitalbits/signer.rb +20 -0
  184. data/generated/digitalbits/signer_key.rb +33 -0
  185. data/generated/digitalbits/signer_key_type.rb +24 -0
  186. data/generated/digitalbits/simple_payment_result.rb +22 -0
  187. data/generated/digitalbits/survey_message_command_type.rb +20 -0
  188. data/generated/digitalbits/survey_request_message.rb +26 -0
  189. data/generated/digitalbits/survey_response_body.rb +23 -0
  190. data/generated/digitalbits/survey_response_message.rb +26 -0
  191. data/generated/digitalbits/threshold_indexes.rb +26 -0
  192. data/generated/digitalbits/time_bounds.rb +20 -0
  193. data/generated/digitalbits/topology_response_body.rb +25 -0
  194. data/generated/digitalbits/transaction.rb +50 -0
  195. data/generated/digitalbits/transaction/ext.rb +24 -0
  196. data/generated/digitalbits/transaction_envelope.rb +31 -0
  197. data/generated/digitalbits/transaction_history_entry.rb +33 -0
  198. data/generated/digitalbits/transaction_history_entry/ext.rb +24 -0
  199. data/generated/digitalbits/transaction_history_result_entry.rb +33 -0
  200. data/generated/digitalbits/transaction_history_result_entry/ext.rb +24 -0
  201. data/generated/digitalbits/transaction_meta.rb +31 -0
  202. data/generated/digitalbits/transaction_meta_v1.rb +20 -0
  203. data/generated/digitalbits/transaction_meta_v2.rb +24 -0
  204. data/generated/digitalbits/transaction_result.rb +46 -0
  205. data/generated/digitalbits/transaction_result/ext.rb +24 -0
  206. data/generated/digitalbits/transaction_result/result.rb +36 -0
  207. data/generated/digitalbits/transaction_result_code.rb +54 -0
  208. data/generated/digitalbits/transaction_result_meta.rb +22 -0
  209. data/generated/digitalbits/transaction_result_pair.rb +20 -0
  210. data/generated/digitalbits/transaction_result_set.rb +18 -0
  211. data/generated/digitalbits/transaction_set.rb +20 -0
  212. data/generated/digitalbits/transaction_signature_payload.rb +32 -0
  213. data/generated/digitalbits/transaction_signature_payload/tagged_transaction.rb +30 -0
  214. data/generated/digitalbits/transaction_v0.rb +39 -0
  215. data/generated/digitalbits/transaction_v0/ext.rb +24 -0
  216. data/generated/digitalbits/transaction_v0_envelope.rb +22 -0
  217. data/generated/digitalbits/transaction_v1_envelope.rb +22 -0
  218. data/generated/digitalbits/trust_line_entry.rb +53 -0
  219. data/generated/digitalbits/trust_line_entry/ext.rb +42 -0
  220. data/generated/digitalbits/trust_line_entry/ext/v1.rb +34 -0
  221. data/generated/digitalbits/trust_line_entry/ext/v1/ext.rb +28 -0
  222. data/generated/digitalbits/trust_line_flags.rb +25 -0
  223. data/generated/digitalbits/upgrade_entry_meta.rb +20 -0
  224. data/lib/digitalbits-base.rb +51 -0
  225. data/lib/digitalbits/account_flags.rb +26 -0
  226. data/lib/digitalbits/asset.rb +81 -0
  227. data/lib/digitalbits/base.rb +1 -0
  228. data/lib/digitalbits/claim_predicate.rb +197 -0
  229. data/lib/digitalbits/compat.rb +9 -0
  230. data/lib/digitalbits/concerns/transaction.rb +50 -0
  231. data/lib/digitalbits/convert.rb +32 -0
  232. data/lib/digitalbits/dsl.rb +93 -0
  233. data/lib/digitalbits/ext/xdr.rb +50 -0
  234. data/lib/digitalbits/factories.rb +59 -0
  235. data/lib/digitalbits/fee_bump_transaction.rb +21 -0
  236. data/lib/digitalbits/key_pair.rb +126 -0
  237. data/lib/digitalbits/ledger_key.rb +32 -0
  238. data/lib/digitalbits/muxed_account.rb +16 -0
  239. data/lib/digitalbits/networks.rb +43 -0
  240. data/lib/digitalbits/operation.rb +603 -0
  241. data/lib/digitalbits/path_payment_strict_receive_result.rb +16 -0
  242. data/lib/digitalbits/price.rb +39 -0
  243. data/lib/digitalbits/signer_key.rb +46 -0
  244. data/lib/digitalbits/thresholds.rb +37 -0
  245. data/lib/digitalbits/transaction.rb +37 -0
  246. data/lib/digitalbits/transaction_builder.rb +166 -0
  247. data/lib/digitalbits/transaction_envelope.rb +35 -0
  248. data/lib/digitalbits/transaction_v0.rb +43 -0
  249. data/lib/digitalbits/trust_line_flags.rb +53 -0
  250. data/lib/digitalbits/util/strkey.rb +70 -0
  251. data/lib/digitalbits/version.rb +3 -0
  252. metadata +459 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 01d8ef68986ef49901cc412969186d4226d2c1d8f0eb25261bebba931a56c0cf
4
+ data.tar.gz: f2e2905199fcaa6860250d676a60b6a296f2d370571905f71ddb5406f7fc9ccb
5
+ SHA512:
6
+ metadata.gz: 032a7799de807ba1df906b9078b3cd5b1403adf4921df5f693e536d161f86c6b180cd6bb3b81649060b5bf1c73abe224d4e8a481fa4b950bed9703d91b13ca2c
7
+ data.tar.gz: c5c109b2ecc3b7cabb803a2507809c2089fa56dd7c9325b674c0ece5f89a064fa915c3c1ecd509ca02cc62f89481651f1b8e292d910317643d6e3d901251007b
data/LICENSE 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 2021 XDB 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,84 @@
1
+ # DigitalBits SDK for Ruby: XDR and Low Level Abstractions
2
+
3
+ The digitalbits-base library is the lowest-level digitalbits helper library. It consists of classes
4
+ to read, write, hash, and sign the xdr structures that are used in digitalbits.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'digitalbits-base'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Also requires libsodium. Installable via `brew install libsodium` on OS X.
19
+
20
+ ## Supported Ruby Versions
21
+
22
+ Please see [CI Workflow](https://github.com/xdbfoundation/ruby-digitalbits-sdk/actions/workflows/ci.yml) for what versions of ruby are currently tested by our continuous integration system. Any ruby in that list is officially supported.
23
+
24
+ ### JRuby
25
+
26
+ 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.
27
+
28
+ ## Usage
29
+
30
+ [Examples are here](examples)
31
+
32
+ In addition to the code generated from the XDR definition files, this library also provides some digitalbits specific features. Let's look at some of them.
33
+
34
+ We wrap rbnacl with `DigitalBits::KeyPair`, providing some digitalbits specific functionality as seen below:
35
+
36
+ ```ruby
37
+
38
+ # Create a keypair from a digitalbits secret seed
39
+ signer = DigitalBits::KeyPair.from_seed("SCBASSEX34FJNIPLUYQPSMZHHYXXQNWOOV42XYZFXM6EGYX2DPIZVIA3")
40
+
41
+ # Create a keypair from a digitalbits address
42
+ verifier = DigitalBits::KeyPair.from_address("GBQWWBFLRP3BXD2RI2FH7XNNU2MKIYVUI7QXUAIVG34JY6MQGXVUO3RX")
43
+
44
+ # Produce a digitalbits compliant "decorated signature" that is compliant with digitalbits transactions
45
+
46
+ signer.sign_decorated("Hello world!") # => #<DigitalBits::DecoratedSignature ...>
47
+
48
+ ```
49
+
50
+ This library also provides an impementation of DigitalBits's "StrKey" encoding (RFC-4648 Base32 + CCITT-XModem CRC16):
51
+
52
+ ```ruby
53
+
54
+ DigitalBits::Util::StrKey.check_encode(:account_id, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF") # => "GD777777777764TU"
55
+ DigitalBits::Util::StrKey.check_encode(:seed, "\x00\x00\x00\x00\x00\x00\x39") # => "SAAAAAAAAAADST3H"
56
+
57
+ # To prevent interpretation mistakes, you must pass the expected version byte
58
+ # when decoding a check_encoded value
59
+
60
+ encoded = DigitalBits::Util::StrCheck.check_encode(:account_id, "\x61\x6b\x04\xab\x8b\xf6\x1b")
61
+ DigitalBits::Util::StrKey.check_decode(:account_id, encoded) # => "\x61\x6b\x04\xab\x8b\xf6\x1b"
62
+ DigitalBits::Util::StrKey.check_decode(:seed, encoded) # => throws ArgumentError: Unexpected version: :account_id
63
+
64
+ ```
65
+
66
+ During development of your app, you may include the [FactoryBot](https://github.com/thoughtbot/factory_bot) definitions in your specs:
67
+
68
+ ```ruby
69
+ require "digitalbits-base/factories"
70
+ ```
71
+
72
+ See the factories file for information on what factories are available.
73
+
74
+ ## Updating Generated Code
75
+
76
+ The generated code of this library must be refreshed each time the DigitalBits 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.
77
+
78
+ ## Caveats
79
+
80
+ 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.
81
+
82
+ ## Contributing
83
+
84
+ Please [see CONTRIBUTING.md for details](../CONTRIBUTING.md).
@@ -0,0 +1,228 @@
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 Digitalbits
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 :PublicKeyType
17
+ autoload :SignerKeyType
18
+ autoload :PublicKey
19
+ autoload :SignerKey
20
+ Signature = XDR::VarOpaque[64]
21
+ SignatureHint = XDR::Opaque[4]
22
+ NodeID = PublicKey
23
+ autoload :Curve25519Secret
24
+ autoload :Curve25519Public
25
+ autoload :HmacSha256Key
26
+ autoload :HmacSha256Mac
27
+ end
28
+ module Digitalbits
29
+ include XDR::Namespace
30
+
31
+ AccountID = PublicKey
32
+ Thresholds = XDR::Opaque[4]
33
+ String32 = XDR::String[32]
34
+ String64 = XDR::String[64]
35
+ SequenceNumber = Int64
36
+ TimePoint = Uint64
37
+ DataValue = XDR::VarOpaque[64]
38
+ AssetCode4 = XDR::Opaque[4]
39
+ AssetCode12 = XDR::Opaque[12]
40
+ autoload :AssetType
41
+ autoload :Asset
42
+ autoload :Price
43
+ autoload :Liabilities
44
+ autoload :ThresholdIndexes
45
+ autoload :LedgerEntryType
46
+ autoload :Signer
47
+ autoload :AccountFlags
48
+ MASK_ACCOUNT_FLAGS = 0x7
49
+ MAX_SIGNERS = 20
50
+ SponsorshipDescriptor = XDR::Option[AccountID]
51
+ autoload :AccountEntryExtensionV2
52
+ autoload :AccountEntryExtensionV1
53
+ autoload :AccountEntry
54
+ autoload :TrustLineFlags
55
+ MASK_TRUSTLINE_FLAGS = 1
56
+ MASK_TRUSTLINE_FLAGS_V13 = 3
57
+ autoload :TrustLineEntry
58
+ autoload :OfferEntryFlags
59
+ MASK_OFFERENTRY_FLAGS = 1
60
+ autoload :OfferEntry
61
+ autoload :DataEntry
62
+ autoload :ClaimPredicateType
63
+ autoload :ClaimPredicate
64
+ autoload :ClaimantType
65
+ autoload :Claimant
66
+ autoload :ClaimableBalanceIDType
67
+ autoload :ClaimableBalanceID
68
+ autoload :ClaimableBalanceEntry
69
+ autoload :LedgerEntryExtensionV1
70
+ autoload :LedgerEntry
71
+ autoload :LedgerKey
72
+ autoload :EnvelopeType
73
+ end
74
+ module Digitalbits
75
+ include XDR::Namespace
76
+
77
+ autoload :MuxedAccount
78
+ autoload :DecoratedSignature
79
+ autoload :OperationType
80
+ autoload :CreateAccountOp
81
+ autoload :PaymentOp
82
+ autoload :PathPaymentStrictReceiveOp
83
+ autoload :PathPaymentStrictSendOp
84
+ autoload :ManageSellOfferOp
85
+ autoload :ManageBuyOfferOp
86
+ autoload :CreatePassiveSellOfferOp
87
+ autoload :SetOptionsOp
88
+ autoload :ChangeTrustOp
89
+ autoload :AllowTrustOp
90
+ autoload :ManageDataOp
91
+ autoload :BumpSequenceOp
92
+ autoload :CreateClaimableBalanceOp
93
+ autoload :ClaimClaimableBalanceOp
94
+ autoload :BeginSponsoringFutureReservesOp
95
+ autoload :RevokeSponsorshipType
96
+ autoload :RevokeSponsorshipOp
97
+ autoload :Operation
98
+ autoload :OperationID
99
+ autoload :MemoType
100
+ autoload :Memo
101
+ autoload :TimeBounds
102
+ MAX_OPS_PER_TX = 100
103
+ autoload :TransactionV0
104
+ autoload :TransactionV0Envelope
105
+ autoload :Transaction
106
+ autoload :TransactionV1Envelope
107
+ autoload :FeeBumpTransaction
108
+ autoload :FeeBumpTransactionEnvelope
109
+ autoload :TransactionEnvelope
110
+ autoload :TransactionSignaturePayload
111
+ autoload :ClaimOfferAtom
112
+ autoload :CreateAccountResultCode
113
+ autoload :CreateAccountResult
114
+ autoload :PaymentResultCode
115
+ autoload :PaymentResult
116
+ autoload :PathPaymentStrictReceiveResultCode
117
+ autoload :SimplePaymentResult
118
+ autoload :PathPaymentStrictReceiveResult
119
+ autoload :PathPaymentStrictSendResultCode
120
+ autoload :PathPaymentStrictSendResult
121
+ autoload :ManageSellOfferResultCode
122
+ autoload :ManageOfferEffect
123
+ autoload :ManageOfferSuccessResult
124
+ autoload :ManageSellOfferResult
125
+ autoload :ManageBuyOfferResultCode
126
+ autoload :ManageBuyOfferResult
127
+ autoload :SetOptionsResultCode
128
+ autoload :SetOptionsResult
129
+ autoload :ChangeTrustResultCode
130
+ autoload :ChangeTrustResult
131
+ autoload :AllowTrustResultCode
132
+ autoload :AllowTrustResult
133
+ autoload :AccountMergeResultCode
134
+ autoload :AccountMergeResult
135
+ autoload :InflationResultCode
136
+ autoload :InflationPayout
137
+ autoload :InflationResult
138
+ autoload :ManageDataResultCode
139
+ autoload :ManageDataResult
140
+ autoload :BumpSequenceResultCode
141
+ autoload :BumpSequenceResult
142
+ autoload :CreateClaimableBalanceResultCode
143
+ autoload :CreateClaimableBalanceResult
144
+ autoload :ClaimClaimableBalanceResultCode
145
+ autoload :ClaimClaimableBalanceResult
146
+ autoload :BeginSponsoringFutureReservesResultCode
147
+ autoload :BeginSponsoringFutureReservesResult
148
+ autoload :EndSponsoringFutureReservesResultCode
149
+ autoload :EndSponsoringFutureReservesResult
150
+ autoload :RevokeSponsorshipResultCode
151
+ autoload :RevokeSponsorshipResult
152
+ autoload :OperationResultCode
153
+ autoload :OperationResult
154
+ autoload :TransactionResultCode
155
+ autoload :InnerTransactionResult
156
+ autoload :InnerTransactionResultPair
157
+ autoload :TransactionResult
158
+ end
159
+ module Digitalbits
160
+ include XDR::Namespace
161
+
162
+ UpgradeType = XDR::VarOpaque[128]
163
+ autoload :DigitalBitsValueType
164
+ autoload :LedgerCloseValueSignature
165
+ autoload :DigitalBitsValue
166
+ autoload :LedgerHeader
167
+ autoload :LedgerUpgradeType
168
+ autoload :LedgerUpgrade
169
+ autoload :BucketEntryType
170
+ autoload :BucketMetadata
171
+ autoload :BucketEntry
172
+ autoload :TransactionSet
173
+ autoload :TransactionResultPair
174
+ autoload :TransactionResultSet
175
+ autoload :TransactionHistoryEntry
176
+ autoload :TransactionHistoryResultEntry
177
+ autoload :LedgerHeaderHistoryEntry
178
+ autoload :LedgerSCPMessages
179
+ autoload :SCPHistoryEntryV0
180
+ autoload :SCPHistoryEntry
181
+ autoload :LedgerEntryChangeType
182
+ autoload :LedgerEntryChange
183
+ LedgerEntryChanges = XDR::VarArray[LedgerEntryChange]
184
+ autoload :OperationMeta
185
+ autoload :TransactionMetaV1
186
+ autoload :TransactionMetaV2
187
+ autoload :TransactionMeta
188
+ autoload :TransactionResultMeta
189
+ autoload :UpgradeEntryMeta
190
+ autoload :LedgerCloseMetaV0
191
+ autoload :LedgerCloseMeta
192
+ end
193
+ module Digitalbits
194
+ include XDR::Namespace
195
+
196
+ autoload :ErrorCode
197
+ autoload :Error
198
+ autoload :AuthCert
199
+ autoload :Hello
200
+ autoload :Auth
201
+ autoload :IPAddrType
202
+ autoload :PeerAddress
203
+ autoload :MessageType
204
+ autoload :DontHave
205
+ autoload :SurveyMessageCommandType
206
+ autoload :SurveyRequestMessage
207
+ autoload :SignedSurveyRequestMessage
208
+ EncryptedBody = XDR::VarOpaque[64000]
209
+ autoload :SurveyResponseMessage
210
+ autoload :SignedSurveyResponseMessage
211
+ autoload :PeerStats
212
+ PeerStatList = XDR::VarArray[PeerStats, 25]
213
+ autoload :TopologyResponseBody
214
+ autoload :SurveyResponseBody
215
+ autoload :DigitalBitsMessage
216
+ autoload :AuthenticatedMessage
217
+ end
218
+ module Digitalbits
219
+ include XDR::Namespace
220
+
221
+ Value = XDR::VarOpaque[]
222
+ autoload :SCPBallot
223
+ autoload :SCPStatementType
224
+ autoload :SCPNomination
225
+ autoload :SCPStatement
226
+ autoload :SCPEnvelope
227
+ autoload :SCPQuorumSet
228
+ end