WSL Setup

Windows Subsystem for Linux (WSL) provides a seamless way to run a Linux environment on Windows, enabling developers to work with Flexo SDK efficiently. This guide walks you through setting up WSL, installing dependencies, and running Flexo SDK on your Windows machine.


Prerequisites

Before installing Flexo SDK on WSL, ensure you have:

  • Windows 10 (version 2004+) or Windows 11

  • WSL 2 installed and configured

  • Node.js and npm (or yarn) installed in WSL


Step 1: Install WSL

If you haven’t already set up WSL, install it using the following command in PowerShell (Admin):

wsl --install

This will:

Enable WSL 2

Install Ubuntu (default distribution)

To check the installed version, run:

wsl --list --verbose

If WSL is already installed but not using WSL 2, upgrade it:

wsl --set-version Ubuntu 2

Step 2: Set Up Your Development Environment

- Update Ubuntu

Once WSL is installed, open Ubuntu from the Start Menu and update the system:

sudo apt update && sudo apt upgrade -y

- Install Node.js and npm

To install Node.js (LTS) and npm, run:

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs

Verify installation:

node -v
npm -v

Alternatively, you can use nvm (Node Version Manager) for managing multiple Node.js versions:

curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
source ~/.bashrc
nvm install 18
nvm use 18

Step 3: Install Flexo SDK

With Node.js and Solana CLI installed, you can now install Flexo SDK:

npm install flexo-sdk
# or
yarn add flexo-sdk

Step 4: Run Flexo SDK

Now you can start using Flexo SDK inside WSL.

Example: Token Analysis

import FlexoClient from 'flexo-sdk';

async function analyzeToken(address: string) {
  const client = new FlexoClient();
  const analysis = await client.getToken(address);

  console.log(`Token Score: ${analysis.data.score}`);
}

analyzeToken('your-token-address');

Run the script with:

node script.js

Last updated