Lets install the software and packages needed to run a nodejs application and try to connect with the XUMM platform.
Software Required
1. Visual Studio Code Editor
2. Nodejs
Package To Be Installed
xumm-sdk (install via node package manager).
Video Tutorial: Prepare Your Project & Start Coding: XUMM SDK
[youtube https://www.youtube.com/watch?v=pgSckFopZ6Q]
Lets test our installation
After installing Visual Studio Code Editor and Nodejs, lets create a new project. Create a file called index.js inside the project folder.
index.js
console.log("WELCOME TO XUMM SDK/API VIDEO TUTORIALS!")
Running Node Application
Command
>node index.js
Output
WELCOME TO XUMM SDK/API VIDEO TUTORIALS!
If you get above output then your installation is working correctly. Lets move forward.
Installing xumm-sdk Package
Lets install xumm-sdk node package and try to connect with XUMM platform.
npm install xumm-sdk
It might take couple of seconds to couple of minutes depending on your internet connection speed. So you may have to wait patiently.
Error Message: Your npm doesn’t work with the version of Node
If you start getting error messages like: “npm WARN npm npm does not support Node.js” Just download lower version of Nodejs and try to run the program once again. In most of the cases the issue will be resolved.
Source Code: Importing xumm-sdk package into our project
const {XummSdk} = require('xumm-sdk') const Sdk = new XummSdk('Your-API-Id', 'Your-API-Secret') const main = async () => { console.log('XUMM SDK VIDEO TUTORIALS!') } main()
Run The Application
Command
>node index.js
Output
XUMM SDK VIDEO TUTORIALS!
In the first line, we are importing xumm-sdk package. Next we create an instance of XummSdk, by passing XUMM application credentials.
Next we write a asynchronous function, which creates a child progress or a thread and waits for the response. Meanwhile the main thread or the main process continues to execute the code after it.
In above code, we simply output a message to the console window.
Note: By connecting to XUMM platform we can indirectly interact with XRP Ledger(XRPL).
For full “XUMM SDK/API” free video tutorial list visit: Working With XUMM SDK/API: XRPL