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

Creates a market using CPMM scoring rule, buys a complete set of the assets used and deploys the funds.

const sdk = await SDK.initialize(endpoint);

const res = await sdk.models.createCpmmMarketAndDeployAssets({
signer: util.signerFromSeed(`//Alice`),
oracle: `dE3pPiRvdKqPD5bUDBu3Xpi83McE3Zf3UG8CbhWBQfvUywd7U`,
period: { block: [4000, 5000] },
marketType: { categorical: 5 },
metadata: {
categories: [
{ name: `karura` },
{ name: `moonriver` },
{ name: `phala` },
{ name: `robonomics` },
{ name: `kilt` },
],
slug: `kusama-derby-example`,
description: `example description`,
question: `who will win?`,
},
mdm: { authorized: `dE3pPiRvdKqPD5bUDBu3Xpi83McE3Zf3UG8CbhWBQfvUywd7U` },
swapFee: `1000000000`,
amount: `10000000000`,
weights: [
`10000000000`,
`10000000000`,
`10000000000`,
`10000000000`,
`10000000000`,
],
callbackOrPaymentInfo: false,
});

Object Arguments

NameTypeDescription
signerKeyringPairOrExtSignerThe actual signer provider to sign the transaction
oraclestringThe address that will be responsible for reporting the market
periodMarketPeriodStart and end block numbers or milliseconds since epoch
marketTypeMarketTypeOfCategorical or Scalar
metadataDecodedMarketMetadataA hash pointer to the metadata of the market
mdmMarketDisputeMechanismDispute settlement can only be Authorized currently
swapFeestringThe fee applied to each swap after pool creation
amountstringThe amount of each token to add to the pool
weightsstring[]List of relative denormalized weights of each outcome asset
callbackOrPaymentInfobooleantrue to get txn fee estimation otherwise false

createMarket

You can use this function to create categorical or scalar market using below arguments.

const sdk = await SDK.initialize(endpoint);

const marketId = await sdk.models.createMarket({
signer,
oracle,
period: marketPeriod,
metadata,
creationType: advised ? `Advised` : `Permissionless`,
marketType: { Scalar: bounds ? bounds : [0, 100] },
mdm,
scoringRule: cpmm ? `CPMM` : `RikiddoSigmoidFeeMarketEma`,
callbackOrPaymentInfo: false,
});

Object Arguments

NameTypeDescription
signerKeyringPairOrExtSignerThe actual signer provider to sign the transaction
oraclestringThe address that will be responsible for reporting the market
periodMarketPeriodStart and end block numbers or milliseconds since epoch
metadataDecodedMarketMetadataA hash pointer to the metadata of the market
creationTypestringPermissionless or Advised
marketTypeMarketTypeOfCategorical or Scalar
mdmMarketDisputeMechanismDispute settlement can only be Authorized currently
scoringRulestringThe scoring rule of the market
callbackOrPaymentInfobooleantrue 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

NameTypeDescription
marketIdMarketIdThe unique identifier for the market you want to fetch.

Code snippet

getMarketCount

You can use this function to get total number of markets registered with the network.

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

NameTypeDescription
marketIdMarketIdThe 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

NameTypeDescription
marketSlugTextstringFilter 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