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);
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
data
Object
Delete an existing Market
marketId
number
Open an order for shares in a market
data
Object
Gets an action for an order for shares in a market
data
Object
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
creator
stringresolver
stringipfs
stringtimeIn
numbersymbol
stringtransferToken
stringtransferMemo
string
Reject a proposed market (resolver only)
Change resolver for a market (admin only)
Withdraw from user balance
Sync Bank
Transfer shares to user
data
Object
Cancel transferred shares
Buy shares
data
Object
Sell shares
data
Object
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
tableKey
string (optional, default""
)limit
number (optional, default100
)offset
number (optional, default0
)
Get a single market
marketId
number
Get orders for a market
data
Object
Get balance of an user
Get IQ balance of an user
username
string
Get resources of an user
username
string
Search user in table of oracles
username
string
Get account data of an user
username
string
Returns the appropriate smart contract for token
token
string
Get proposed markets
Get markets
excludeInvalidIpfs
booleanskip
numbercount
numbercreator
stringfilterUrlParam
Object?isVerified
string
Get market
marketId
number
Get market metadata only
marketId
number
Get market page
Get platform fees
Get categories and tags
Get information about dapp
Get user's profile
username
string
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
username
string