In our first application, we'll write a simple program to connect to the network and fetch the account details of a specific Ripple address.
Here's the code that connects to the Ripple test network and fetches the account details of the address: 'r41sFTd4rftxY1VCn5ZDDipb4KaV5VLFy2'. Let's run this code first and then get into the details to learn how it works. Save the following code into a file and give it the name 'get_account.js':
'use strict';
const RippleAPI = require('ripple-lib').RippleAPI;
const api = new RippleAPI({
server: 'wss://s.altnet.rippletest.net:51233' // Ripple Test Network Address
});
api.connect().then(() => {
const accountAddress = 'r41sFTd4rftxY1VCn5ZDDipb4KaV5VLFy2';
console.log('Fetching account details of', accountAddress);
return api.getAccountInfo...