Skip to main content

Zeitgeist SDK Documentation

sdk version

The Zeitgeist SDK is written in Typescript and can be found here: @zeitgeistpm/sdk. You can do the following to install it directly into your javascript based project: npm i @zeitgeistpm/sdk or yarn add @zeitgeistpm/sdk.

tip

All amount parameters are in Pennock, so need to be multiplied by 10^10, which means if you want to transfer 1 ZTG, you should fill in 10000000000

Get Markets Datas

Function NameDescription
getAllMarketIdsget all market IDs in the Zeitgeiest.
getAllMarketsget all market in the Zeitgeiest.
getMarketCountget market counts in the Zeitgeiest.
fetchMarketDatafetch specify market's infomation by id in the Zeitgeiest.
queryMarketquery market by GraphQL in the Zeitgeiest.
queryMarketsCountquery counts of markets for specified filter options by GraphQL in the Zeitgeiest.
filterMarketsget all market in the Zeitgeiest.
filterMarketDataPopulate only selected attributes from the market data defined using filter.
indexTransferRecipientsquery subsquid indexer for market data with pagination in the Zeitgeiest.
getMarketDataForPoolsListget market datas by using pool's data
getEndTimestampget timestamp at the end of the market period.
fetchDisputesget all market IDs in the Zeitgeiest.
getDisputesfetch disputes for this market using unique identifier marketId.

Get Pools && Assets Datas

Function NameDescription
getPoolIdget pool id to be used for fetching data using sdk.models.market.getPool().
getPoolrecreate swap pool for this market using data fetched with poolId.
fetchPoolDataget specify pool infomation in the Zeitgeiest.
filterPoolsfilter some pools from Zeitgeist
queryAllActiveAssetsquery all active assets from subsquid indexer in the Zeitgeiest.
getAssetsForPoolsListget assets datas by using pool's data
getAssetPriceHistoryget assets' historic prices
assetSpotPricesInZtgfind prices at a particular block in the Zeitgeiest.
assetSpotPricesInZtgfind prices at a particular block using unique identifier.
getSpotPriceget spot price in the specified block.
fetchPoolSpotPricesfetch spot prices of specified blocks.
sharesIdfetch all shares' ids.

Get Accounts Datas

Function NameDescription
getAccountBalancesget balance of specific account.
getAccountHistoricalValuesget accounts' historic datas
accountIdfetch account id in this pool.

Create Markets Transactions

Function NameDescription
createCategoricalMarketcreate a categorical market in the Zeitgeiest.
createCpmmMarketAndDeployAssetsCreate a market using CPMM scoring rule, buy a complete set of the assets used and deploy within and deploy an arbitrary amount of those that's greater than the minimum amount.
createScalarMarketcreate a scalar market in the Zeitgeiest.
deploySwapPoolcreate swap pool for this market via api.tx.predictionMarkets.deploySwapPoolForMarket(marketId, weights).
assetSpotPricesInZtgfind prices at a particular block using unique identifier.
buyCompleteSetbuy a complete set of outcome shares for the market.
sellCompleteSetsell/destroy a complete set of outcome shares for the market.
reportOutcomereport an outcome for the market.
disputesubmit a disputed outcome for the market.
redeemSharesredeem the winning shares for the market.
approveapprove the Proposed market that is waiting for approval from the advisory committee.
rejectreject the Proposed market that is waiting for approval from the advisory committee.
cancelAdvisedallow the proposer of the market that is currently in a Proposed state to cancel the market proposal.
joinPooljoin pool.
poolJoinWithExactAssetAmountjoin exact asset amount to the pool.
joinPoolMultifuncjoin pool.
Three substrate join_pool_xxx functions in one
exitPoolretrieve a given set of assets from pool to the signer.
swapExactAmountInswap a given assetAmountIn of the assetIn/assetOut pair to pool.
swapExactAmountOutswap a given assetAmountOut of the assetIn/assetOut pair to pool.

Utils

Function NameDescription
getBlockInfoget block info in Zeitgeist.
getChainInfoget chain info about Zeitgeiest.
getBlockDataget block infomation by blockhash in the Zeitgeiest.
currencyTransfertransfer specified asset from self to any account in the Zeitgeiest.
toJSONStringconvert market object into string.
toFilteredJSONStringconvert market object into string with filters.