sails-js-parser
TypeScript icon, indicating that this package has built-in type declarations

0.4.3 • Public • Published

Overview

The sails-js-parser is designed to parse Sails IDL files, producing an output that can be used to generate client libraries or facilitate interaction with Gear blockchain programs.

Installation

To install the sails-js-parser library:

npm install sails-js-parser

Usage

Initialization

import { SailsIdlParser } from 'sails-js-parser';

const parser = await SailsIdlParser.new();

Often used with sails-js:

import { Sails } from 'sails-js';
import { SailsIdlParser } from 'sails-js-parser';

const parser = await SailsIdlParser.new();
const sails = new Sails(parser);

Parsing

const idl = `
  constructor {
    New : ();
  };

  service SailsApp {
    DoSomething : () -> str;
  };
`
const program = parser.parse(idl);

The parse method returns a Program instance representing the parsed IDL.

/sails-js-parser/

    Package Sidebar

    Install

    npm i sails-js-parser

    Weekly Downloads

    293

    Version

    0.4.3

    License

    GPL-3.0

    Unpacked Size

    266 kB

    Total Files

    26

    Last publish

    Collaborators

    • osipov-mit