Ledger Enterprise
API Documentation V2
API Documentation V2
  • Introduction
    • Getting Started
    • Overview
  • Guides
    • Authentication
    • Balance Reporting Bot
      • 1. Project setup
      • 2. Connect to revault-api
      • 3. Fetch accounts balances
      • 4. Conclusion
  • reference
    • API reference
      • Users
      • Accounts
        • Transactions
      • Groups
      • Whitelists
      • Policies
      • Entities
      • Requests
        • Generate registration challenge
        • Confirm registration challenge
        • Challenge
        • Approve
        • Reject
      • Auth
        • Token
          • Refresh
      • Permissions
        • Allowed actions
        • Resources
      • Assets
        • Currencies
        • Tokens
      • Tradelink
        • Network
          • Blueprint
    • Specification
Powered by GitBook
On this page
  • Initialize repository ​
  • Initialize Typescript package ​
  • Setup the main script ​
  1. Guides
  2. Balance Reporting Bot

1. Project setup

Let's go step-by-step into initializing the project for this tutorial.ng bo

Initialize repository ​

Create working directory ​

Let's start from scratch from an empty directory:

# create folder & jump into it
mkdir vault-bot && cd vault-bot

# init your git repository
git init

Mark un-needed files as ignored for Git ​

Create a .gitignore file with this content to ignore the node_modules folder & the env file (we will create it on next steps):

node_modules
.env

Initialize Typescript package ​

Create the Node.js package ​

This command will create the package.json with default content:

# using `-y` option will make the init use all the defaults options
npm init -y

Install dependencies ​

Install the production dependencies:

npm install --save axios dotenv

Then install the development dependencies:

npm install --save-dev typescript tsx @types/node

Initialize Typescript configuration ​

Run this init command to create the tsconfig.json with default values:

./node_modules/.bin/tsc --init

If everything worked correctly, you should have now a tsconfig.json file at the root of the repo.


Setup the main script ​

Create the script file ​

Let's create a main.ts file that will contain our code:

console.log("Hello world!");

Add a npm script to run it ​

Edit the package.json file to add a new script entry. Let's remove the test script and add a dev script:

  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
    "dev": "tsx main.ts"
  },
  "keywords": [],
  "author": "",

Verify that the setup works ​

Now, you can run this command to check that everything is OK:

bash

npm run dev

That should output:

> [email protected] dev
> tsx main.tsx

Hello world!

Congratulations 🎉, we are ready to move to next step.

PreviousBalance Reporting BotNext2. Connect to revault-api

Last updated 28 days ago