DEV Community

SchlaubiDev
SchlaubiDev

Posted on • Updated on

Adding support for Xahau to our XRPL project

Overview

To add support for Xahau we had to make some changes to our XRPL project DalliPay. The following may help you to update your own project.

Changes

  1. Support multiple ledgers (XRPL, Xahau)
  2. Calculate TX fees per transaction ("fee" command)
  3. Implement NetworkID
  4. Add "manual exchange rate"
  5. Disable integrated wallet faucet

Support multiple ledgers (XRPL, Xahau)

We added a small dropdown for users to switch between XRPL and Xahau ledger and endpoints (Eg. Testnet, Mainnet). Users are also able to add custom endpoints.
Xahau and XRPLs consumer API is mostly identical. Therefor our Xahau.Ledger class inherits from Xrpl.Ledger and differences like the native currency (XAH instead of XRP) are defined in Xahau.Ledger class.
Due the added support for multiple ledgers, we had to separate available ledger explorers. For XRPL DalliPay supports Bithomp, XRPSCAN and xrpl.org. For Xahau another one was added.

Calculate TX fees per transaction (Hook fees)

On XRPL the +/- same fee can be applied to all transactions (tx) sent in a small timeframe. On Xahau the fees vary heavily due different hooks involved. Every executed hook increases the tx fee needed. Therefore the fee must be calculated per tx. Xahau offers a WebSocket command "fee" for that. See Hook Fees for technical details.

Implement NetworkID

XRPL supports a NetworkID field which wasn't implemented in DalliPay before. For every tx on Xahau the correct value must been set for that field.

  • Xahau Mainnet (NetworkID 21337)
  • Xahau Testnet (NetworkID 21338)

Add "manual exchange rate"

To calculate fiat amounts of ledger transactions and vice versa, DalliPay needs an exchange API to get current exchange rates. Due there isn't one available at the time of this writing, we decided to add a new feature "manual exchange rate" to let the user enter an exchange rate. Exchange rates may be available from various sources and websites.

Disable integrated wallet faucet

Updated 2023-10-20: The same API for Xahau is available at HTTP POST https://xahau-test.net/accounts. Our used lib xrpl4j adds "/accounts" internally. Therefor https://xahau-test.net must be passed to FaucetClient.construct() to successfully fund a test wallet.
Outdated: For XRPL DalliPay offers an integrated way to create test wallets and fund them for various testnets. Due Xahau currently uses a different API, we decided to disable that feature for Xahau at the moment.

Helpful resources

Top comments (0)