Abstract

You can get to know about RPC API first before reading this documentation as most of the RPC API data in this project is directly exposed

Installation

  • npm
    npm install @vite/vitejs

  • yarn
    yarn add @vite/vitejs

Quick Start

node/without webpack


import provider from '@vite/vitejs/dist/es5/provider/WS';
import { client, constant } from '@vite/vitejs';

const { method } = constant;
let WS_RPC = new provider("https://example.com");

let myClient = new client(WS_RPC, (_myClient) => {
    console.log("Connected");
});
myClient.ledger.getSnapshotChainHeight().then((result) => {
    console.log(result);
}).catch((err) => {
    console.warn(err);
});

Webpack

webpack.config

// ...
    resolve: {
        alias: {
            WSprovider: '@vite/vitejs/dist/es5/provider/WS'
        }
    }
// ...

Usage


import provider from "WSprovider";
import { client } from '@vite/vitejs';

let WS_RPC = new provider("https://example.com");
let myClient = new client(WS_RPC);