How to Cancel an Offer | XRPL Development with JavaScript Level 2
Introduction
The XRPL (XRP Ledger) provides native Decentralized Exchange (DEX) functionality, allowing users to create offers (orders) to buy and sell assets. In this article, we will explain how to cancel an offer created on XRPL.
Preparation
Please prepare the wallet address used in the previous section when creating offers.
Create the Script
-
Create a new file named
cancel_offer.js
in your project directory. -
Paste the following code into
cancel_offer.js
.
Run the Script
-
Run the following command in the command line to execute the script.
-
If successful, the console will display the following.
-
Check the offers again.
-
If successful, the console will display the following, confirming that the offer has been successfully canceled.
Summary
In this guide, we explained the concept of XRPL’s DEX, how to create offers, and how to cancel offers on the DEX.
While dealing with DEXs generally become very complex, XRPL makes it relatively easy to interact with them using the JavaScript library.
Having covered trust lines, token issuance and transfer, and offer creation, checking, and cancellation, the next step will be an explanation on “cross-currency payments.”