PredIQt.JS (front-end library)
General purpose library for the PredIQt
Using yarn:
yarn add @everipedia/prediqt-js
or using npm:
npm install --save @everipedia/prediqt-js
API initialization
Frontend usage
import { Prediqt } from "@everipedia/prediqt-js"
const nodeEndpoint = "https://api.kylin.alohaeos.com"; // you can use any other node endpoint
const client = new Prediqt(
{ createApi: { signatureProvider, nodeEndpoint }}, // create signatureProvider with eosjs or based on it libs
auth, // (optional) Array with authorization objects, you can set it later with setAuth method
contracts // (optional) Object that takes prediqt, prediqtMarket, iqToken, prediqtBank contracts' names
);
// or you can pass created api
import { Api, JsonRpc } from "eosjs";
const rpc = new JsonRpc(nodeEndpoint);
const api = new Api({ rpc, signatureProvider }); // create rpc and signatureProvider with eosjs or based on it libs
const client = new Prediqt(
{ customApi: api },
... // the same parameters
);
Server usage
...
// or you can pass created api
const { Prediqt } = require("@everipedia/prediqt-js");
const { Api, JsonRpc } = require("eosjs");
const fetch = require("isomorphic-fetch");
const rpc = new JsonRpc(nodeEndpoint, { fetch });
const api = new Api({ rpc, signatureProvider }); // create rpc and signatureProvider with eosjs or based on it libs
const client = new Prediqt(
{ customApi: api },
... // the same parameters
);
Graph API initialization
import { PrediqtGraph } from "@everipedia/prediqt-js";
const apiEndponit = "https://prediqt-api-kylin.azurewebsites.net/graphql"; // endpoint for mainnet - https://prediqt-api-mainnet.azurewebsites.net/graphql
const graphClient = new PrediqtGraph(apiEndponit);
Utils methods
Set authorization to execute transactions
Parameters
Reset authorization to execute transactions
Methods that require authorization
Set a fee for the platform (admin only)
Parameters
Accept a proposed market
Parameters
Claim shares for a particular market
Parameters
Cancel an order
Parameters
Create a Market
Parameters
Delete an existing Market
Parameters
Open an order for shares in a market
Parameters
Set a market as invalid (only resolver)
Parameters
Set the outcome of a market (only resolver)
Parameters
Set the outcome of a market (only resolver)
Parameters
Propose a market to be part of the active markets
Parameters
Reject a proposed market (resolver only)
Parameters
Change resolver for a market (admin only)
Parameters
Withdraw from user balance
Parameters
Sync Bank
Transfer shares to user
Parameters
Cancel transferred shares
Parameters
Buy shares
Parameters
Sell shares
Parameters
Propose MultiSignature
Parameters
Methods that don't require authorization
Get fees related to the contract
Parameters
Get shares related to a market
Parameters
Get referral shares related to a market
Parameters
Get markets
Parameters
Get a single market
Parameters
Get orders for a market
Parameters
Get balance of an user
Parameters
Get IQ balance of an user
Parameters
Get resources of an user
Parameters
Search user in table of oracles
Parameters
Get account data of an user
Parameters
Get proposed markets
Parameters
Get markets
Parameters
Get market
Parameters
Get market page
Parameters
Get platform fees
Get categories and tags
Get information about dapp
Get user's profile
Parameters
Get shareholders
Parameters
Get info about node's backlog
To embed a market in your page, you just need to add code like:
<iframe src="https://prediqt.everipedia.org/embedded?marketId=54" width="100%" height="350" />
Last modified 2yr ago