Closed tadejgolobic closed 1 year ago
Good point!
Challenge. That's actually part of the ripple-binary-codec
. Going to dive in and add something to make this a config option on xrpl-accountlib
construction.
Yes, the perfect way to implement this would be probably in ripple-binary-codec
however, that can probably take some time. This is why I opened issue here.
Not really sure what would be the best way to implement this in this library. I used it for signing transaction offline, and then copying transaction blob to online computer and submitting transaction there. This was my use case if it helps :)
@tadejgolobic Implemented and added to our custom repo used by xrpl-accountlib
This is now published in xrpl-accountlib@3.0.0
- https://www.npmjs.com/package/xrpl-accountlib/v/3.0.0
This implementation automatically determines the native asset and right encoding based on the NetworkID
.
So: if you would try your TX again without NetworkID, it assumes default & XRP
as native asset.
If you try your TX again with NetworkID 21337
or 21338
(Xahau mainnet & testnet) it will automatically use XAH as native asset and use a regular IOU XRP
for XRP.
When you are on non-xrp native ledger / sidechain, XRP currency is encoded as 00000...00. However, 0000...00 represents native currency (on Xahau network, that is XAH) adn thus transaction fails.
Imagine following scenario
on Xahau chain, this will actually try to make trustline to above issuer for currency XAH. In order to create / use XRP in IOU way, you need to manually specify a long 40 nibble currency code with 'X' 'R' 'P' (0000000000000000000000005852500000000000) and then it is working.
I am also attaching binary visualizer of one of my trustset transaction (it is not the above transaction). Note the currency code, even though XRP was specified as currency.