XRPLF / xrpl4j

A 100% Java implementation to interact with the XRP Ledger.
ISC License
80 stars 45 forks source link

java.lang.IllegalArgumentException: Unsupported Currency representation of (Coin Format for ISO)[a-zA-Z]{3} #519

Closed Try-Parser closed 4 months ago

Try-Parser commented 5 months ago

Hi guys i just have questions if this library only support 3 character coin in CurrencyType as i saw in the

https://github.com/XRPLF/xrpl4j/blob/3c4a07692e8debf1aacb7ef924a47d8c8b2e07fa/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/codec/binary/types/CurrencyType.java#L65-L72

example :

    "taker_get": {
        "value": "10",
        "currency": "XRP"
    },
    "taker_pay": {
        "value": "1000000",
        "currency": "SHIB",  > 3 = Unsupported currency representation
        "issuer": "raGYAQYuvZXxQmE53TA5cRcCBM2DRuhkJk"
    }
sappenin commented 5 months ago

Hi @Try-Parser - thanks for your question.

The library does support issued currency codes that are longer than 3 characters. However, you'll need to use a special encoding (hex, plus padding). Only XRP and 3-character ISO codes are supported in raw text.

For an example of how this can work in Java, see here.

And for a full description, you can read more here about how currency codes work.

Try-Parser commented 4 months ago

Hi @sappenin that make sense thank you for responding ill close this ticket