Install

Intro

The pm-js library offers a convenient way of accesing the Helena contracts for prediction markets with Javascript and Node.js. We recommend the use of pm-js for dealing with the automated market maker functions: BUY and SELL shares*.

Install

Install pm-contracts and pm-js into your project as a dependency using:

npm install --save '@frontier-token-research/pm-contracts' '@frontier-token-research/pm-js'

Be sure to issue this command with this exact spelling. The quotes are there in case you use Powershell. In the project directory, you can experiment with the Helena API by opening up a node shell and importing the library like so:

const Gnosis = require('@frontier-token.research/pm-js')

This will import the transpiled library through the dist/index entry point, which exports the Helena class.

Browser use

The helena.js file and its minified version helena.min.js are self-contained and can be used directly in a webpage. For example, you may copy helena.min.js into a folder or onto your server, and in an HTML page, use the following code to import the library:

<script src="gnosis.min.js"></script>
<script>
// Gnosis should be available as a global after the above script import, so this subsequent script tag can make use of the API.
</script>

After opening the page, the browser console can also be used to experiment with the API.

Last updated

Was this helpful?