General purpose library for the PredIQt
Using yarn:
yarn add @everipedia/prediqt-jsor using npm:
npm install --save @everipedia/prediqt-jsAPI 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);Set authorization to execute transactions
Reset authorization to execute transactions
Set a fee for the platform (admin only)
Claim shares for a particular market
Cancel an order
Create a Market
dataObject
Delete an existing Market
marketIdnumber
Open an order for shares in a market
dataObject
Gets an action for an order for shares in a market
dataObject
Set the outcome of a market (only resolver)
Set the outcome of a market (only resolver)
IQ resolution method
Get total IQ votes from IQ resolution method
Propose a market to be part of the active markets
creatorstringresolverstringipfsstringtimeInnumbersymbolstringtransferTokenstringtransferMemostring
Reject a proposed market (resolver only)
Change resolver for a market (admin only)
Withdraw from user balance
Sync Bank
Transfer shares to user
dataObject
Cancel transferred shares
Buy shares
dataObject
Sell shares
dataObject
Propose MultiSignature
Get allowed assets
Get fees related to the contract
Get shares related to a market
Get referral shares related to a market
Get markets
tableKeystring (optional, default"")limitnumber (optional, default100)offsetnumber (optional, default0)
Get a single market
marketIdnumber
Get orders for a market
dataObject
Get balance of an user
Get IQ balance of an user
usernamestring
Get resources of an user
usernamestring
Search user in table of oracles
usernamestring
Get account data of an user
usernamestring
Returns the appropriate smart contract for token
tokenstring
Get proposed markets
Get markets
excludeInvalidIpfsbooleanskipnumbercountnumbercreatorstringfilterUrlParamObject?isVerifiedstring
Get market
marketIdnumber
Get market metadata only
marketIdnumber
Get market page
Get platform fees
Get categories and tags
Get information about dapp
Get user's profile
usernamestring
Get shareholders
Get info about node's backlog
Returns the platform stats by period (Weekly), limit: 20
group_by
Returns the leaderboard data group by period
Returns the user settings used for notifications
usernamestring