/pab-api-js

PAB API JavaScript wrapper

Primary LanguageTypeScriptApache License 2.0Apache-2.0

pab-api-js

JavaScript wrapper for PAB (Plutus Application Backend) API. Works in both the browser and on Node.js. Includes TypeScript types definitions.

Installation

  npm install --save git+https://github.com/fullstack-development/pab-api-js.git

Usage

import { Pab } from 'pab-api-js';

const pab = new Pab('http://localhost:9080/');

const getReport = async () => {
  try {
    const result = await pab.getFullReport();
    console.log(result);
  } catch (error) {
    console.log(error);
  }
};

getReport();

Examples

In folder examples/simple there is an example of using this lib with Uniswap-clone contract. It repeats steps from lesson 10 of the plutus-pioneer-program.

To run the example, you first need to run plutus-pab from plutus repo (link, tag: 71a0805f), command cabal run plutus-uniswap.

  npm run example

The examples/uniswap-playground folder contains the Uniswap playground. Installation and usage - README

Documentation

To learn more about the uniswap example you can check the documentation folder.

Development

To bundle the result code, run

  npm run build

To format code (in folder src)

  npm run format

For tests, you first need to run PAB with any contract

  npm run test