2.0.0-beta.23 • Published 3 years ago

@everipedia/prediqt-js v2.0.0-beta.23

Weekly downloads
65
License
MIT
Repository
github
Last release
3 years ago

PredIQt JavaScript/TypeScript Client Library

CircleCI npm version MIT licensed

General purpose library for the PredIQt

Installation

Using yarn:

yarn add @everipedia/prediqt-js

or using npm:

npm install --save @everipedia/prediqt-js

Quick Start

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);

API

setAuth

Set authorization to execute transactions

Parameters

resetAuth

Reset authorization to execute transactions

setFee

Set a fee for the platform (admin only)

Parameters

claimShares

Claim shares for a particular market

Parameters

cancelOrder

Cancel an order

Parameters

createMarket

Create a Market

Parameters

deleteMarket

Delete an existing Market

Parameters

limitOrder

Open an order for shares in a market

Parameters

getLimitOrderActions

Gets an action for an order for shares in a market

Parameters

marketResolve

Set the outcome of a market (only resolver)

Parameters

marketResolveOracle

Set the outcome of a market (only resolver)

Parameters

marketResolveIQ

IQ resolution method

Parameters

getTotalIqVotes

Get total IQ votes from IQ resolution method

proposeMarket

Propose a market to be part of the active markets

Parameters

rejectMarket

Reject a proposed market (resolver only)

Parameters

setResolver

Change resolver for a market (admin only)

Parameters

withdraw

Withdraw from user balance

Parameters

syncBank

Sync Bank

transferShares

Transfer shares to user

Parameters

cancelShares

Cancel transferred shares

Parameters

buyShares

Buy shares

Parameters

sellShares

Sell shares

Parameters

proposeMultiSig

Propose MultiSignature

Parameters

getAllowedAssets

Get allowed assets

getFees

Get fees related to the contract

Parameters

  • limit number (optional, default 100)
  • offset number (optional, default 0)

getShares

Get shares related to a market

Parameters

getReferrals

Get referral shares related to a market

Parameters

getMarkets

Get markets

Parameters

  • tableKey string (optional, default "")
  • limit number (optional, default 100)
  • offset number (optional, default 0)

getMarket

Get a single market

Parameters

getOrders

Get orders for a market

Parameters

  • data Object
    • data.nameId string takes "yes" or "no"
    • data.marketId number
    • data.tableKey string (optional, default "")
    • data.limit number (optional, default 100)
    • data.offset number (optional, default 0)

getBalance

Get balance of an user

Parameters

getIqBalance

Get IQ balance of an user

Parameters

getUserResources

Get resources of an user

Parameters

searchInOracles

Search user in table of oracles

Parameters

getAccount

Get account data of an user

Parameters

getContractForToken

Returns the appropriate smart contract for token

Parameters

Graph API

getProposedMarkets

Get proposed markets

Parameters

getMarkets

Get markets

Parameters

getMarket

Get market

Parameters

getMarketMetadata

Get market metadata only

Parameters

getMarketPage

Get market page

Parameters

getPlatformFees

Get platform fees

getCategoriesAndTags

Get categories and tags

getDappInfo

Get information about dapp

getUserProfile

Get user's profile

Parameters

getShareHolders

Get shareholders

Parameters

getChainInfo

Get info about node's backlog

getStatsByPeriod

Returns the platform stats by period (Weekly), limit: 20

Parameters

  • group_by

getLeaderboardByPeriod

Returns the leaderboard data group by period

Parameters

getUserSettings

Returns the user settings used for notifications

Parameters

2.0.0-beta.23

3 years ago

2.0.0-beta.21

4 years ago

2.0.0-beta.20

4 years ago

2.0.0-beta.19

4 years ago

2.0.0-beta.18

4 years ago

2.0.0-beta.17

4 years ago

2.0.0-beta.16

4 years ago

2.0.0-beta.15

4 years ago

2.0.0-beta.14

4 years ago

2.0.0-beta.12

4 years ago

2.0.0-beta.11

4 years ago

2.0.0-beta.10

4 years ago

2.0.0-beta.9

4 years ago

2.0.0-beta.8

4 years ago

2.0.0-beta.7

4 years ago

2.0.0-beta.6

4 years ago

2.0.0-beta.5

4 years ago

2.0.0-beta.4

4 years ago

2.0.0-beta.3

4 years ago

2.0.0-beta.2

4 years ago

2.0.0-beta.1

4 years ago

2.0.0-alpha.6

4 years ago

2.0.0-alpha.5

4 years ago

2.0.0-alpha.4

4 years ago

2.0.0-alpha.3

4 years ago

2.0.0-alpha.2

4 years ago

2.0.0-alpha.1

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.6-alpha

4 years ago

1.0.7-alpha

4 years ago

1.0.4-alpha

4 years ago

1.0.5-alpha

4 years ago

1.0.3-alpha

4 years ago

1.0.2-alpha

4 years ago

1.0.1-alpha

4 years ago

1.0.0

4 years ago

0.0.26

4 years ago

0.0.27

4 years ago

0.0.25

4 years ago

0.0.24

4 years ago

0.0.23

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.9

4 years ago

0.0.3

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago