Starting the Project | XRPL Development Level 4
Let’s start by creating the project.
Required Tools
Section titled “Required Tools”- Text Editor(VS Code is recommended)
- Install Node.js
Creating the Project
Section titled “Creating the Project”Since there are only two characters involved, a simple project will suffice.
Create the project as follows:
// Create and navigate to the directorymkdir xrpl-payment-functionscd xrpl-payment-functions
// Initialize the projectnpm init -ynpm install xrpl
Enabling ES6 Modules
Section titled “Enabling ES6 Modules”Next, add the following setting to package.json to enable ES6 modules.
The location doesn’t matter, but modify it as shown below:
{ "name": "xrpl-payment-functions", "version": "1.0.0", "main": "index.js", "type": "module", // Add this line "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC", "description": "", "dependencies": { "xrpl": "^3.0.0" }}
Creating Configuration Files
Section titled “Creating Configuration Files”To enhance learning efficiency, create a config file at the root of the directory for reuse in the upcoming source code.
import { Client, Wallet } from 'xrpl';
// XRPL Clientexport const client = new Client('wss://s.altnet.rippletest.net:51233'); // Testnet
// Walletsexport const aliceWallet = Wallet.fromSeed('s████████████████████████████'); // Enter Alice's seedexport const bobWallet = Wallet.fromSeed('s████████████████████████████'); // Enter Bob's seed