xrpl-ruby 0.6.1 → 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 +4 -4
- data/CHANGELOG.md +73 -0
- data/README.md +42 -0
- data/lib/binary-codec/enums/definitions.json +3716 -112
- data/lib/binary-codec/enums/definitions.rb +8 -0
- data/lib/binary-codec/types/amount.rb +5 -2
- data/lib/binary-codec/types/currency.rb +8 -1
- data/lib/binary-codec/types/issue.rb +68 -23
- data/lib/binary-codec/types/number.rb +196 -0
- data/lib/binary-codec/types/serialized_type.rb +5 -2
- data/lib/binary-codec/types/st_array.rb +17 -19
- data/lib/binary-codec/types/st_object.rb +15 -13
- data/lib/binary-codec/types/uint.rb +23 -5
- data/lib/binary-codec/types/xchain_bridge.rb +17 -2
- data/lib/xrpl/client.rb +17 -3
- data/lib/xrpl/transaction.rb +202 -0
- data/lib/xrpl/version.rb +1 -1
- data/lib/xrpl-ruby.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e07e1a6fd2b134d36dbbdaaa977cc39e8e9176499a29e69bd84e69ddfd6f6979
|
|
4
|
+
data.tar.gz: bcca5b159608288c0cdeffc562a76332fe4e831e4dc9813676f66d46c53546ac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fffeb72058c2a328c01bda6e6bfd63718147fc12326385c18c304b9d0e92013e60ba9ad11424af2ee6bd72c69e016494113db5c05ed26e10ee2501bc0873288a
|
|
7
|
+
data.tar.gz: 3aa7f43f67c50faaf0139a5f42737a35c5fd59408dc3098144a7a0b3a57bab5dad3eac3fa68fb9819749ba2dd0b7f91460de5e87899279e49b6ab07fcae87c83
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,79 @@ 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
|
+
|
|
8
81
|
## [0.6.1] - 2026-08-12
|
|
9
82
|
|
|
10
83
|
### Added
|
data/README.md
CHANGED
|
@@ -69,6 +69,48 @@ puts result.dig('result', 'meta', 'TransactionResult') # => "tesSUCCESS"
|
|
|
69
69
|
client.disconnect
|
|
70
70
|
```
|
|
71
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
|
+
|
|
72
114
|
The client is silent by default. To see diagnostic output, pass a logger:
|
|
73
115
|
|
|
74
116
|
```ruby
|