Checking Payment Paths with path_find | XRPL Development in JavaScript - Level 3
This guide explains cross-currency payments by dealing with A.USD
issued by Issuer A and B.EUR
issued by Issuer B.
In the previous section, Alice provided liquidity by placing an offer to sell A.USD
issued by Issuer A and buy B.EUR
issued by Issuer B.
In this section, before executing a cross-currency payment, we will introduce the path_find command to search for payment paths.
Prerequisites
Alice has already provided liquidity by placing an offer to sell A.USD
issued by Issuer A and buy B.EUR
issued by Issuer B.
Daniel needs to make a payment to Charlie, who wants to receive A.USD
. However, Daniel currently does not hold any A.USD
.
Daniel only holds XRP or B.EUR
issued by Issuer B and is considering whether he can exchange his B.EUR
. If someone is willing to exchange B.EUR
for the desired amount of A.USD
, Daniel should be able to send his B.EUR
as A.USD
to Charlie.
Daniel wants to search if it is possible to send his B.EUR
to Charlie as A.USD
.
Creating the Script
-
Create a new file named
pathFinding.js
in your project directory. -
Paste the following code into
pathFinding.js
.
Running the Script
-
Run the following command in the command line to execute the script.
-
If you see logs like the following, the operation was successful.