ripple / ripple-binary-codec

Convert between json and hex representations of transactions and ledger entries on the XRP Ledger. Moved to: https://github.com/XRPLF/xrpl.js/tree/develop/packages/ripple-binary-codec
https://github.com/XRPLF/xrpl.js/tree/develop/packages/ripple-binary-codec
ISC License
19 stars 45 forks source link

encode - improve error message when there is a typo in the TransactionType #126

Closed intelliot closed 2 years ago

intelliot commented 3 years ago

When trying to sign a transaction, if the TransactionType is invalid, the error message is cryptic and doesn't make it easy for developers to identify what the problem is.

Example:

In txJSON, if the TransactionType is "payment", the error looks like:

ripple-binary-codec/dist/serdes/binary-serializer.js:124
        assert(associatedValue.toBytesSink !== undefined);
                               ^
TypeError: Cannot read property 'toBytesSink' of undefined
    at BinarySerializer.writeFieldAndValue [...]

(The correct TransactionType would be "Payment" as it is case-sensitive.)

intelliot commented 2 years ago

Replaced by https://github.com/XRPLF/xrpl.js/issues/1808