xrpl-ruby 0.6.0 → 0.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a26ce8102c50640eec9433b64a9296c7d92635d66c42f2995456d913fff60d75
4
- data.tar.gz: 60d3c026f1378a1d7cb79adcd6bbf830d518bb554b35286fe980010a14f4f11a
3
+ metadata.gz: e07e1a6fd2b134d36dbbdaaa977cc39e8e9176499a29e69bd84e69ddfd6f6979
4
+ data.tar.gz: bcca5b159608288c0cdeffc562a76332fe4e831e4dc9813676f66d46c53546ac
5
5
  SHA512:
6
- metadata.gz: 975f1af5db2890d44ba6ac7266c2a927dc5e8bf4d3000a8e70bd864734dbba1e90495718b48300df5ca183077076de844b00c2844aa87c050d61263d5e43a12a
7
- data.tar.gz: 85a70a5ebc31bde02941394182c93aeb1c09a57987fbadfcbac26efdd16e1b30fe786d1aefdefd2ee1fa3cf742b18dbde2edbb2983052869b8165411b6207fd5
6
+ metadata.gz: fffeb72058c2a328c01bda6e6bfd63718147fc12326385c18c304b9d0e92013e60ba9ad11424af2ee6bd72c69e016494113db5c05ed26e10ee2501bc0873288a
7
+ data.tar.gz: 3aa7f43f67c50faaf0139a5f42737a35c5fd59408dc3098144a7a0b3a57bab5dad3eac3fa68fb9819749ba2dd0b7f91460de5e87899279e49b6ab07fcae87c83
data/CHANGELOG.md CHANGED
@@ -5,6 +5,92 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.7.0] - 2026-08-26
9
+
10
+ The binary codec now passes the full ripple-binary-codec reference fixture set
11
+ (287 cases, both directions). It previously passed none of them on decode: the
12
+ fixtures had been vendored in `spec/binary-codec/fixtures/` for a long time
13
+ without any spec loading them, so the suite reported green while decoding
14
+ 0 of 261 ledger objects.
15
+
16
+ ### Breaking
17
+
18
+ - **`binary_to_json` returns different types.** UInt8/16/32 fields come back as
19
+ numbers instead of zero-padded hex strings (`Sequence` is `1`, not
20
+ `"00000001"`), and native XRP amounts come back as strings instead of
21
+ integers (`Balance` is `"370000000"`, not `370000000`). This is what rippled
22
+ itself returns; the previous output matched no implementation.
23
+ - **`STObject#to_json` returns a Hash**, not a JSON string. The string return
24
+ forced every nested value through a parse on the way out, which is what
25
+ turned native amounts into integers.
26
+ - **Malformed input raises.** `STObject#to_json` and `STArray#to_json` caught
27
+ every parser error and returned a partially decoded object. A codec that
28
+ silently drops fields is worse than one that fails, so the rescues are gone.
29
+ - `tecHOOK_REJECTED` is no longer a known transaction result. It is a Xahau
30
+ code and never belonged in the XRP Ledger definitions.
31
+
32
+ ### Added
33
+
34
+ - **Transaction models** — `XRPL::Transaction::Payment`, `::EscrowCreate` and
35
+ 80 more, generated at load time from `TRANSACTION_FORMATS` so they cannot
36
+ drift from the definitions. Fields are written in snake_case and stored under
37
+ the ledger's own names; `#validate!` reports missing required fields before a
38
+ round trip is spent, and each type carries its flags as constants
39
+ (`Payment::TF_PARTIAL_PAYMENT`). A plain Hash still works everywhere a
40
+ transaction is accepted.
41
+ - **`BinaryCodec::Number`** — the STNumber type (12 bytes: int64 mantissa,
42
+ int32 exponent). 17 serialised fields reference it — the Vault and Lending
43
+ Protocol amounts — and no class existed, so those fields could not be
44
+ encoded at all. The gap predates this release.
45
+ - **`Issue` supports MPT** (`mpt_issuance_id`), in both directions.
46
+ - **Conformance spec** running `codec-fixtures.json`, and a definitions spec
47
+ that checks every type a serialised field uses resolves to a class.
48
+
49
+ ### Changed
50
+
51
+ - **`definitions.json` synced verbatim with XRPLF.** FIELDS 343 → 381,
52
+ TRANSACTION_TYPES 76 → 83, LEDGER_ENTRY_TYPES 31 → 32, TRANSACTION_RESULTS
53
+ 189 → 195. Adds the Sponsorship and Confidential MPT fields and transactions,
54
+ `TakerGetsMPT`, `TakerPaysMPT` and `ReferenceHolding`. Renames `UInt384`/
55
+ `UInt512` to `Hash384`/`Hash512` and `MutableFlags` to `ImmutableFlags`; the
56
+ type map keeps the old names resolving.
57
+ - `Client#autofill`, `#submit` and `#submit_and_wait` accept a transaction
58
+ model as well as a Hash.
59
+ - The gemspec packages everything under `lib/`, not only the `.rb` files. Data
60
+ files previously needed an entry of their own, and a forgotten one would have
61
+ broken the installed gem while every local run stayed green, because the
62
+ working copy has the file either way. `spec/packaging_spec.rb` checks it now.
63
+
64
+ ### Fixed
65
+
66
+ - **`Issue` read a fixed 40 bytes.** An XRP issue is 20, so the rest came out
67
+ of the following field: `Asset` and `Asset2` decoded as `nil` and
68
+ `IssuingChainDoor` as the zero account.
69
+ - **`STArray.from_parser` dropped the ArrayEndMarker** it is meant to restore.
70
+ The reconstructed bytes had no terminator, so re-parsing them ran the array
71
+ on into the fields that followed — `AMMBid` lost `Asset` and `Asset2` into
72
+ `AuthAccounts`.
73
+ - **`Currency#to_json` took no arguments** while every type is called as
74
+ `to_json(definitions, field_name)`. It raised `ArgumentError` for every
75
+ nested Currency field, which the silent rescue then swallowed — that is how
76
+ `BaseAsset` and `QuoteAsset` disappeared from `PriceDataSeries`.
77
+ - **`XChainBridge` omitted the `0x14` length prefix** before each account,
78
+ which is why all eight XChain fixtures failed to serialise.
79
+ - **A zero IOU rendered as `"-0"`** instead of `"0"`.
80
+
81
+ ## [0.6.1] - 2026-08-12
82
+
83
+ ### Added
84
+ - CI matrix now covers Ruby 3.2, 3.3, 3.4 and (experimental) 4.0.
85
+
86
+ ### Changed
87
+ - Raised minimum Ruby to **3.2**; dropped end-of-life 3.0 and 3.1 from the support matrix.
88
+
89
+ ### Fixed
90
+ - **Ruby 3.4 / 4.0 compatibility**: declare `bigdecimal` as an explicit runtime dependency.
91
+ It was removed from Ruby's default gems in 3.4, which broke `require 'bigdecimal'` in the
92
+ binary codec on Ruby 3.4 and 4.0.
93
+
8
94
  ## [0.6.0] - 2026-08-05
9
95
 
10
96
  ### Added
data/README.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # XRPL-Ruby
2
2
 
3
+ [![CI](https://github.com/AlexanderBuzz/xrpl-ruby/actions/workflows/ci.yml/badge.svg)](https://github.com/AlexanderBuzz/xrpl-ruby/actions/workflows/ci.yml)
4
+ [![codecov](https://codecov.io/gh/AlexanderBuzz/xrpl-ruby/branch/main/graph/badge.svg)](https://codecov.io/gh/AlexanderBuzz/xrpl-ruby)
5
+ [![Gem Version](https://badge.fury.io/rb/xrpl-ruby.svg)](https://rubygems.org/gems/xrpl-ruby)
6
+ [![Downloads](https://img.shields.io/gem/dt/xrpl-ruby)](https://rubygems.org/gems/xrpl-ruby)
7
+ [![Ruby](https://img.shields.io/badge/ruby->=_3.0-CC342D?logo=ruby&logoColor=white)](https://www.ruby-lang.org)
8
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
9
+
3
10
  A pure-Ruby library to interact with the [XRP Ledger](https://xrpl.org) (XRPL) blockchain.
4
11
 
5
12
  ## Features
@@ -62,6 +69,48 @@ puts result.dig('result', 'meta', 'TransactionResult') # => "tesSUCCESS"
62
69
  client.disconnect
63
70
  ```
64
71
 
72
+ ## Transactions
73
+
74
+ A transaction can always be a plain Hash, as above. The transaction classes
75
+ are an addition on top of that: they are generated from the field formats in
76
+ `definitions.json`, so they know which fields a type accepts, which of them
77
+ are required, and what its flags are called.
78
+
79
+ ```ruby
80
+ payment = XRPL::Transaction::Payment.new(
81
+ account: wallet.classic_address,
82
+ destination: receiver.classic_address,
83
+ amount: '1000000',
84
+ flags: XRPL::Transaction::Payment::TF_PARTIAL_PAYMENT
85
+ )
86
+
87
+ payment.validate! # raises before a round trip is spent
88
+ client.submit_and_wait(payment, wallet: wallet)
89
+ ```
90
+
91
+ Fields are written in snake_case and stored under the ledger's own names, so
92
+ `#to_h` produces exactly what the binary codec expects:
93
+
94
+ ```ruby
95
+ payment.to_h
96
+ # => {"TransactionType"=>"Payment", "Account"=>"r...", "Destination"=>"r...",
97
+ # "Amount"=>"1000000", "Flags"=>131072}
98
+ ```
99
+
100
+ A field the type does not define is rejected when it is set, rather than by
101
+ the server several seconds later:
102
+
103
+ ```ruby
104
+ payment.limit_amount = {} # NoMethodError
105
+ XRPL::Transaction::Payment.new(limit_amount: {})
106
+ # => XRPL::Transaction::ValidationError: Payment has no field LimitAmount
107
+ ```
108
+
109
+ `XRPL::Transaction.from(hash)` builds the matching class from a transaction
110
+ hash, which is useful for anything read back off the ledger. Note that
111
+ `validate!` follows rippled's formats: it checks what the ledger requires for
112
+ serialisation, which is not always what a transaction needs to be meaningful.
113
+
65
114
  The client is silent by default. To see diagnostic output, pass a logger:
66
115
 
67
116
  ```ruby