Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Programmatic Requests

We can also write a simple script to make cURL requests. This will allow us to build around the RPC responses. This will make it easier to call different endpoints with different arguments and handle data that we receive from the RPC calls.

First, let’s set up the typescript project.

  1. check node and npm (node package manager) versions:

In your terminal, enter:

node --version
npm --version

It should give something like:

v18.17.1
10.1.0

If these packages are not installed, run:

sudo apt install nodejs npm
  1. Create a project directory and navigate into it:
mkdir telSimpleCalls
cd telSimpleCalls
  1. Open a new VsCode (or alternative IDE) window of your directory:
code .
  1. Initialise a new project:
npm init -y
  1. As we will need typescript and axios packages, we install them using:
npm install typescript axios
  1. Initialise the TypeScript configuration:
npx tsc --init

This command creates a tsconfig.json file in your project directory. You can leave the settings as default.

You should now have your TypeScript project set up! Let’s get into writing some scripts!