Skip to main content

Indexs

getAllMarketIds

You can use this function to get all market IDs in the Zeitgeiest.

const sdk = await SDK.initialize(endpoint);

const res = await sdk.models.getAllMarketIds();

Code snippet

getAllMarkets

You can use this function to get all market in the Zeitgeiest.

const sdk = await SDK.initialize(endpoint);

const res = await sdk.models.getAllMarketIds();

Code snippet

createCpmmMarketAndDeployAssets

Create 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.

const sdk = await SDK.initialize(endpoint);

const poolId = await sdk.models.createCpmmMarketAndDeployAssets(
signer,
oracle,
marketPeriod,
advised ? "Advised" : "Permissionless",
marketType,
mdm,
amts,
baseAssetAmount,
wts,
kp,
metadata,
false
);

Arguments | Name | Type | Introduction | | ---- | ---- | ------------ | | signer | KeyringPairOrExtSigner | The actual signer provider to sign the transaction. | | oracle | string |The address that will be responsible for reporting the market. | | period | MarketPeriod |Start and end block numbers or unix timestamp of the market. | | creationType | string |"Permissionless" or "Advised", Advised as default | | marketType | string |"Categorical" or "Scalar" | | mdm | MarketDisputeMechanism |Dispute settlement can be authorized, court or simple_disputes | | keep | string[] |Specifies how many assets to keep. | | weights | string[] |List of relative denormalized weights of each asset price. | | baseAssetAmount | Amount for native currency liquidity | | amounts | string[] | List of amounts of each outcome asset that should be deployed.| | metadata | DecodedMarketMetadata |Market metadata | | paymentInfo | |"true" to get txn fee estimation otherwise "false" |

Code snippet

createCategoricalMarket

You can use this function to create a categorical market in the Zeitgeiest.

const sdk = await SDK.initialize(endpoint);

const marketId = await sdk.models.createCategoricalMarket(
signer,
oracle,
marketPeriod,
advised,
mdm,
cpmm,
metadata,
false
);

Arguments | Name | Type | Introduction | | ---- | ---- | ------------ | | signer | KeyringPairOrExtSigner | The actual signer provider to sign the transaction. | | oracle | string |The address that will be responsible for reporting the market. | | period | MarketPeriod |Start and end block numbers or unix timestamp of the market. | | creationType | string |"Permissionless" or "Advised", Advised as default | | mdm | MarketDisputeMechanism |Dispute settlement can be authorized, court or simple_disputes | | scoringRule | string | scoringRule you choose, CPMM as default| | metadata | DecodedMarketMetadata |Market metadata | | callbackOrPaymentInfo | |"true" to get txn fee estimation otherwise "false" |

Code snippet

createScalarMarket

You can use this function to create a scalar market in the Zeitgeiest.

const sdk = await SDK.initialize(endpoint);

const marketId = await sdk.models.createScalarMarket(
signer,
title,
description,
oracle,
marketPeriod,
advised,
bounds,
mdm,
cpmm,
false
);

Arguments | Name | Type | Introduction | | ---- | ---- | ------------ | | signer | KeyringPairOrExtSigner | The actual signer provider to sign the transaction. | | oracle | string |The address that will be responsible for reporting the market. | | period | MarketPeriod |Start and end block numbers or unix timestamp of the market. | | title | string | The title of the new prediction market. | | description | string | The description / extra information for the market. | | creationType | string |"Permissionless" or "Advised", Advised as default | | mdm | MarketDisputeMechanism |Dispute settlement can be authorized, court or simple_disputes | | scoringRule | string | scoringRule you choose, CPMM as default| | bounds | number[] |The array having lower and higher bound values denoting range set. [0,100] as default | | callbackOrPaymentInfo | |"true" to get txn fee estimation otherwise "false" |

Code snippet

fetchMarketData

You can use this function to fetch specify market's infomation by id in the Zeitgeiest.

const sdk = await SDK.initialize(endpoint);

const market = await sdk.models.fetchMarketData(Number(marketId));

Arguments | Name | Type | Introduction | | ---- | ---- | ------------ | | marketId | MarketId | The unique identifier for the market you want to fetch. |

Code snippet

getMarketCount

You can use this function to get market counts in the Zeitgeiest.

const sdk = await SDK.initialize(endpoint);

const res = await sdk.models.getMarketCount();

Code snippet

fetchDisputes

You can use this function to get all market IDs in the Zeitgeiest. Should throw errors where market status is such that no disputes can have been registered, but all registered disputes will still be returned even if, eg, resolved. To check if disputes are active, use viewMarket and check market_status for "Disputed"

const sdk = await SDK.initialize(endpoint);

const res = await sdk.models.fetchDisputes();

Arguments | Name | Type | Introduction | | ---- | ---- | ------------ | | marketId | MarketId | The unique identifier for the market you want to fetch. |

Code snippet

fetchPoolData

You can use this function to get specify pool infomation in the Zeitgeiest.

const sdk = await SDK.initialize(endpoint);

const swap = await sdk.models.fetchPoolData(swapId);
if (swap != null) {
console.log(swap.toJSONString());
}

Code snippet

assetSpotPricesInZtg

You can use this function to find prices at a particular block in the Zeitgeiest.

const sdk = await SDK.initialize(endpoint);

const res = await sdk.models.assetSpotPricesInZtg(blockHash);

Code snippet

getBlockData

You can use this function to get block infomation by blockhash in the Zeitgeiest.

const sdk = await SDK.initialize(endpoint);

const res = await sdk.models.getBlockData();

Code snippet

queryMarket

You can use this function to query market by GraphQL in the Zeitgeiest.

const sdk = await SDK.initialize(endpoint, { graphQlEndpoint });

const res = await sdk.models.queryMarket(marketId);

Code snippet

queryMarketsCount

You can use this function to query counts of markets for specified filter options by GraphQL in the Zeitgeiest.

const sdk = await SDK.initialize(endpoint, { graphQlEndpoint });

const count = await sdk.models.queryMarketsCount({ tags: [tag] });

Code snippet

queryAllActiveAssets

You can use this function to query all active assets from subsquid indexer in the Zeitgeiest.

const sdk = await SDK.initialize(endpoint, { graphQlEndpoint });

const res = await sdk.models.queryAllActiveAssets(marketSlug, pagination);

Arguments | Name | Type | Introduction | | ---- | ---- | ------------ | | marketSlugText | string | Filter assets by market slug | | pagination | { pageNumber: number; pageSize: number } | Options for pagination, not neccessary |

Code snippet

filterMarkets

You can use this function to query subsquid indexer for market data with pagination in the Zeitgeiest.

const sdk = await SDK.initialize(endpoint, { graphQlEndpoint });

const { result, count } = await sdk.models.filterMarkets(
{ statuses, creator, oracle, tags, searchText, liquidityOnly },
{
ordering,
orderBy,
pageSize,
pageNumber,
}
);

Code snippet

indexTransferRecipients

You can use this function to get all market IDs in the Zeitgeiest.

const sdk = await SDK.initialize(endpoint);

const res = await sdk.models.getAllMarketIds();

Code snippet

currencyTransfer

You can use this function to transfer specified asset from self to any account in the Zeitgeiest.

const sdk = await SDK.initialize(endpoint);

const res = await sdk.models.currencyTransfer(
signer,
dest,
currencyId,
amount,
false
);

Code snippet