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

Add address checking #120

Closed svklubnika closed 3 years ago

svklubnika commented 3 years ago

Im using xrpsign tool to build raw transaction. It seems this tool uses your package. User pass address rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaL (right is rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh) as target and tool NOT rised error. As a result - transaction with target address rEb8TK3gBgk5auZkwc6sHnwrGVJU5tvRe

natenichols commented 3 years ago

Hi @svklubnika. Thanks for opening an issue. Would you please provide a code snippet that is exhibiting this behavior, as well as the version of the binary-codec you're using.

When I initially try to duplicate this in ripple-binary-codec:

const acctGood = "rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaLh"
const acctBad = "rEb8TK3gBgk5auZkwc6sHnwrGVJH8DuaL"

console.log(AccountID.from(acctGood))
console.log(AccountID.from(acctBad))

I get:

AccountID {
  bytes: <Buffer a0 25 d8 b3 21 02 51 c9 4f a3 aa c9 2e 15 96 73 a1 40 fa d9>
}
/Users/n545n545/Documents/ripple-binary-codec/node_modules/ripple-address-codec/dist/xrp-codec.js:74
            throw new Error('checksum_invalid');

Which behaves as expected, allowing the valid address to be encoded, but throwing an error when encoding the invalid address. An example that displays this behavior would be helpful.

natenichols commented 3 years ago

I'm going to close this since there was no more information provided.