@oddmaki-protocol/sdk 1.6.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -2,6 +2,10 @@ import * as viem from 'viem';
2
2
  import { Chain, Transport, Address, PublicClient, WalletClient, Account } from 'viem';
3
3
  import * as node_modules_viem__types_actions_siwe_verifySiweMessage from 'node_modules/viem/_types/actions/siwe/verifySiweMessage';
4
4
  import * as node_modules_viem__types_utils_ccip from 'node_modules/viem/_types/utils/ccip';
5
+ import { RequestDocument } from 'graphql-request';
6
+ export { ClientError, GraphQLClient, RequestDocument, Variables, gql } from 'graphql-request';
7
+ import { TypedDocumentNode } from '@graphql-typed-document-node/core';
8
+ export { TypedDocumentNode } from '@graphql-typed-document-node/core';
5
9
  import * as viem_chains from 'viem/chains';
6
10
 
7
11
  interface OddMakiConfig {
@@ -19,7 +23,7 @@ interface OddMakiClientConfig extends OddMakiConfig {
19
23
  declare class SubgraphClient {
20
24
  private client;
21
25
  constructor(endpoint: string);
22
- request<T>(query: string, variables?: Record<string, any>): Promise<T>;
26
+ request<T>(query: RequestDocument | TypedDocumentNode<T, Record<string, unknown>>, variables?: Record<string, unknown>): Promise<T>;
23
27
  }
24
28
 
25
29
  declare abstract class BaseModule {
@@ -9088,9 +9092,31 @@ declare class PublicModule extends BaseModule {
9088
9092
  }): Promise<any>;
9089
9093
  /**
9090
9094
  * Merge and sort unified feed results
9091
- * Combines standaloneMarkets and marketGroups into a single sorted array
9095
+ * Combines standaloneMarkets, marketGroups, and priceMarketSeries into a single sorted array.
9096
+ * Each row in the merged feed carries a `type` discriminator: 'standalone' | 'group' | 'series'.
9092
9097
  */
9093
9098
  mergeAndSortFeed(feedData: any, sortBy?: 'created' | 'volume', limit?: number): Array<any>;
9099
+ /**
9100
+ * Get a PriceMarketSeries with all its member markets.
9101
+ *
9102
+ * Used by the market detail page to render the time-button navigation strip
9103
+ * showing past, current, and upcoming windows for the same asset+interval.
9104
+ *
9105
+ * @param params.venueId - Venue the series belongs to
9106
+ * @param params.seriesKey - Series key, e.g. "btc-updown-5m"
9107
+ * @returns The series with `markets` array, or null if not found
9108
+ */
9109
+ getPriceMarketSeries(params: {
9110
+ venueId: bigint;
9111
+ seriesKey: string;
9112
+ }): Promise<any | null>;
9113
+ /**
9114
+ * Helper: extract the seriesKey from a market's tags.
9115
+ *
9116
+ * A market belongs to a price series iff its tags contain both "price-market"
9117
+ * and a "series:<key>" tag. Returns the key (without prefix) or null.
9118
+ */
9119
+ extractSeriesKey(tags: string[] | undefined | null): string | null;
9094
9120
  /**
9095
9121
  * Calculate probability for a market using mark price waterfall.
9096
9122
  * Returns probability as a decimal string (e.g., "0.65" for 65%)
@@ -9193,6 +9219,39 @@ declare class PublicModule extends BaseModule {
9193
9219
  marketId: string;
9194
9220
  first?: number;
9195
9221
  }): Promise<any>;
9222
+ /**
9223
+ * Run an arbitrary GraphQL query against the same subgraph endpoint the SDK
9224
+ * uses. Lets external services (e.g. cron workers) share the SDK's
9225
+ * subgraph connection without instantiating their own GraphQLClient.
9226
+ */
9227
+ raw<T = unknown>(query: string | TypedDocumentNode<T>, variables?: Record<string, unknown>): Promise<T>;
9228
+ /**
9229
+ * Find an unresolved PriceMarket matching (feedId, closeTime) created by
9230
+ * `creator`. Returns null when no match exists. Used as a create-idempotency
9231
+ * check by price-market bots before submitting a new market.
9232
+ */
9233
+ findPriceMarketByFeedAndCloseTime(params: {
9234
+ pythFeedId: `0x${string}`;
9235
+ closeTime: bigint;
9236
+ creator: `0x${string}`;
9237
+ }): Promise<{
9238
+ marketId: bigint;
9239
+ } | null>;
9240
+ /**
9241
+ * List unresolved PriceMarkets created by `creator` whose closeTime is in
9242
+ * the past and whose parent Market is still Active, ordered by closeTime
9243
+ * ascending. Used by resolution cron workers to find markets that need
9244
+ * settling.
9245
+ */
9246
+ findExpiredOpenPriceMarkets(params: {
9247
+ creator: `0x${string}`;
9248
+ now: bigint;
9249
+ first?: number;
9250
+ }): Promise<Array<{
9251
+ marketId: bigint;
9252
+ feedId: `0x${string}`;
9253
+ closeTime: bigint;
9254
+ }>>;
9196
9255
  }
9197
9256
 
9198
9257
  declare class TokenModule extends BaseModule {
@@ -17308,6 +17367,11 @@ declare const GET_ALL_MARKETS_FEED: string;
17308
17367
  * Get all markets across all venues sorted by volume
17309
17368
  */
17310
17369
  declare const GET_ALL_MARKETS_FEED_BY_VOLUME: string;
17370
+ /**
17371
+ * Get a single PriceMarketSeries with all its member markets, ordered by closeTime.
17372
+ * Used by the market detail page to render the time-button navigation strip.
17373
+ */
17374
+ declare const GET_PRICE_MARKET_SERIES: string;
17311
17375
  /**
17312
17376
  * Get recent trades across all venues (for activity feed / ticker)
17313
17377
  */
@@ -17410,4 +17474,4 @@ declare function parseMetadata<T extends {
17410
17474
 
17411
17475
  declare const version = "0.1.0";
17412
17476
 
17413
- export { AccessControlFacet as AccessControlFacetABI, AccessControlModule, BatchOrdersFacet as BatchOrdersFacetABI, CONTRACT_ADDRESSES, type ChancePercentInput, ConditionalTokens as ConditionalTokensABI, DEFAULT_CHAIN, ERC20 as ERC20ABI, FeedProvider, GET_ALL_MARKETS_FEED, GET_ALL_MARKETS_FEED_BY_VOLUME, GET_CHART_TRADES, GET_CHART_TRADES_ALL, GET_GROUP_MARKETS, GET_LEADERBOARD, GET_MARKET, GET_MARKETS, GET_MARKETS_WITH_PRICING, GET_MARKET_GROUP, GET_MARKET_GROUPS, GET_MARKET_GROUP_ITEM, GET_MARKET_TOP_HOLDERS, GET_ORDERS, GET_PROTOCOL_STATS, GET_QUESTION, GET_QUESTIONS, GET_RECENT_MARKETS, GET_RECENT_TRADES, GET_TOP_OF_BOOK, GET_TRADER_CLOSED_POSITIONS, GET_TRADER_FILLS, GET_TRADER_POSITIONS, GET_TRADER_PROFILE, GET_TRADES, GET_UNIFIED_MARKET_FEED, GET_UNIFIED_MARKET_FEED_BY_VOLUME, GET_USER, GET_VENUES, LimitOrdersFacet as LimitOrdersFacetABI, MarketGroupFacet as MarketGroupFacetABI, type MarketMetadata, MarketModule, MarketOrdersFacet as MarketOrdersFacetABI, type MarketQuestion, type MarketStatus, MarketsFacet as MarketsFacetABI, MatchingFacet as MatchingFacetABI, MetadataFacet as MetadataFacetABI, NegRiskFacet as NegRiskFacetABI, OddMakiClient, type OddMakiClientConfig, type OddMakiConfig, OrderBookFacet as OrderBookFacetABI, PROTOCOL_FEES, type PriceMarketData, PriceMarketFacet as PriceMarketFacetABI, PriceMarketModule, ProtocolFacet as ProtocolFacetABI, PublicModule, PythResolutionFacet as PythResolutionFacetABI, type PythUpdate, ResolutionFacet as ResolutionFacetABI, SUBGRAPH_IDS, SubgraphClient, type SubgraphMarketPriceData, TICK_SIZE_FINE, TICK_SIZE_STANDARD, TagsFacet as TagsFacetABI, TokenModule, type TopOfBookEntry, TradeModule, UMA_DEFAULTS, UmaModule, UmaOracle as UmaOracleABI, VALID_TICK_SIZES, VaultFacet as VaultFacetABI, VenueFacet as VenueFacetABI, type VenueMetadata, VenueModule, WhitelistAccessControl as WhitelistAccessControlABI, buildSubgraphGatewayUrl, calculateChancePercent, clearDecimalsCache, createExpiry, createOddMakiClient, formatAmount, formatAncillaryData, formatTimestamp, getCachedTokenDecimals, getOutcomePrice, getTokenDecimals, isValidTickSize, parseAmount, parseAncillaryData, parseMetadata, parseTokenAmount, priceToTick, resolveIPFSUri, tickToPercentage, tickToPrice, version };
17477
+ export { AccessControlFacet as AccessControlFacetABI, AccessControlModule, BatchOrdersFacet as BatchOrdersFacetABI, CONTRACT_ADDRESSES, type ChancePercentInput, ConditionalTokens as ConditionalTokensABI, DEFAULT_CHAIN, ERC20 as ERC20ABI, FeedProvider, GET_ALL_MARKETS_FEED, GET_ALL_MARKETS_FEED_BY_VOLUME, GET_CHART_TRADES, GET_CHART_TRADES_ALL, GET_GROUP_MARKETS, GET_LEADERBOARD, GET_MARKET, GET_MARKETS, GET_MARKETS_WITH_PRICING, GET_MARKET_GROUP, GET_MARKET_GROUPS, GET_MARKET_GROUP_ITEM, GET_MARKET_TOP_HOLDERS, GET_ORDERS, GET_PRICE_MARKET_SERIES, GET_PROTOCOL_STATS, GET_QUESTION, GET_QUESTIONS, GET_RECENT_MARKETS, GET_RECENT_TRADES, GET_TOP_OF_BOOK, GET_TRADER_CLOSED_POSITIONS, GET_TRADER_FILLS, GET_TRADER_POSITIONS, GET_TRADER_PROFILE, GET_TRADES, GET_UNIFIED_MARKET_FEED, GET_UNIFIED_MARKET_FEED_BY_VOLUME, GET_USER, GET_VENUES, LimitOrdersFacet as LimitOrdersFacetABI, MarketGroupFacet as MarketGroupFacetABI, type MarketMetadata, MarketModule, MarketOrdersFacet as MarketOrdersFacetABI, type MarketQuestion, type MarketStatus, MarketsFacet as MarketsFacetABI, MatchingFacet as MatchingFacetABI, MetadataFacet as MetadataFacetABI, NegRiskFacet as NegRiskFacetABI, OddMakiClient, type OddMakiClientConfig, type OddMakiConfig, OrderBookFacet as OrderBookFacetABI, PROTOCOL_FEES, type PriceMarketData, PriceMarketFacet as PriceMarketFacetABI, PriceMarketModule, ProtocolFacet as ProtocolFacetABI, PublicModule, PythResolutionFacet as PythResolutionFacetABI, type PythUpdate, ResolutionFacet as ResolutionFacetABI, SUBGRAPH_IDS, SubgraphClient, type SubgraphMarketPriceData, TICK_SIZE_FINE, TICK_SIZE_STANDARD, TagsFacet as TagsFacetABI, TokenModule, type TopOfBookEntry, TradeModule, UMA_DEFAULTS, UmaModule, UmaOracle as UmaOracleABI, VALID_TICK_SIZES, VaultFacet as VaultFacetABI, VenueFacet as VenueFacetABI, type VenueMetadata, VenueModule, WhitelistAccessControl as WhitelistAccessControlABI, buildSubgraphGatewayUrl, calculateChancePercent, clearDecimalsCache, createExpiry, createOddMakiClient, formatAmount, formatAncillaryData, formatTimestamp, getCachedTokenDecimals, getOutcomePrice, getTokenDecimals, isValidTickSize, parseAmount, parseAncillaryData, parseMetadata, parseTokenAmount, priceToTick, resolveIPFSUri, tickToPercentage, tickToPrice, version };
package/dist/index.d.ts CHANGED
@@ -2,6 +2,10 @@ import * as viem from 'viem';
2
2
  import { Chain, Transport, Address, PublicClient, WalletClient, Account } from 'viem';
3
3
  import * as node_modules_viem__types_actions_siwe_verifySiweMessage from 'node_modules/viem/_types/actions/siwe/verifySiweMessage';
4
4
  import * as node_modules_viem__types_utils_ccip from 'node_modules/viem/_types/utils/ccip';
5
+ import { RequestDocument } from 'graphql-request';
6
+ export { ClientError, GraphQLClient, RequestDocument, Variables, gql } from 'graphql-request';
7
+ import { TypedDocumentNode } from '@graphql-typed-document-node/core';
8
+ export { TypedDocumentNode } from '@graphql-typed-document-node/core';
5
9
  import * as viem_chains from 'viem/chains';
6
10
 
7
11
  interface OddMakiConfig {
@@ -19,7 +23,7 @@ interface OddMakiClientConfig extends OddMakiConfig {
19
23
  declare class SubgraphClient {
20
24
  private client;
21
25
  constructor(endpoint: string);
22
- request<T>(query: string, variables?: Record<string, any>): Promise<T>;
26
+ request<T>(query: RequestDocument | TypedDocumentNode<T, Record<string, unknown>>, variables?: Record<string, unknown>): Promise<T>;
23
27
  }
24
28
 
25
29
  declare abstract class BaseModule {
@@ -9088,9 +9092,31 @@ declare class PublicModule extends BaseModule {
9088
9092
  }): Promise<any>;
9089
9093
  /**
9090
9094
  * Merge and sort unified feed results
9091
- * Combines standaloneMarkets and marketGroups into a single sorted array
9095
+ * Combines standaloneMarkets, marketGroups, and priceMarketSeries into a single sorted array.
9096
+ * Each row in the merged feed carries a `type` discriminator: 'standalone' | 'group' | 'series'.
9092
9097
  */
9093
9098
  mergeAndSortFeed(feedData: any, sortBy?: 'created' | 'volume', limit?: number): Array<any>;
9099
+ /**
9100
+ * Get a PriceMarketSeries with all its member markets.
9101
+ *
9102
+ * Used by the market detail page to render the time-button navigation strip
9103
+ * showing past, current, and upcoming windows for the same asset+interval.
9104
+ *
9105
+ * @param params.venueId - Venue the series belongs to
9106
+ * @param params.seriesKey - Series key, e.g. "btc-updown-5m"
9107
+ * @returns The series with `markets` array, or null if not found
9108
+ */
9109
+ getPriceMarketSeries(params: {
9110
+ venueId: bigint;
9111
+ seriesKey: string;
9112
+ }): Promise<any | null>;
9113
+ /**
9114
+ * Helper: extract the seriesKey from a market's tags.
9115
+ *
9116
+ * A market belongs to a price series iff its tags contain both "price-market"
9117
+ * and a "series:<key>" tag. Returns the key (without prefix) or null.
9118
+ */
9119
+ extractSeriesKey(tags: string[] | undefined | null): string | null;
9094
9120
  /**
9095
9121
  * Calculate probability for a market using mark price waterfall.
9096
9122
  * Returns probability as a decimal string (e.g., "0.65" for 65%)
@@ -9193,6 +9219,39 @@ declare class PublicModule extends BaseModule {
9193
9219
  marketId: string;
9194
9220
  first?: number;
9195
9221
  }): Promise<any>;
9222
+ /**
9223
+ * Run an arbitrary GraphQL query against the same subgraph endpoint the SDK
9224
+ * uses. Lets external services (e.g. cron workers) share the SDK's
9225
+ * subgraph connection without instantiating their own GraphQLClient.
9226
+ */
9227
+ raw<T = unknown>(query: string | TypedDocumentNode<T>, variables?: Record<string, unknown>): Promise<T>;
9228
+ /**
9229
+ * Find an unresolved PriceMarket matching (feedId, closeTime) created by
9230
+ * `creator`. Returns null when no match exists. Used as a create-idempotency
9231
+ * check by price-market bots before submitting a new market.
9232
+ */
9233
+ findPriceMarketByFeedAndCloseTime(params: {
9234
+ pythFeedId: `0x${string}`;
9235
+ closeTime: bigint;
9236
+ creator: `0x${string}`;
9237
+ }): Promise<{
9238
+ marketId: bigint;
9239
+ } | null>;
9240
+ /**
9241
+ * List unresolved PriceMarkets created by `creator` whose closeTime is in
9242
+ * the past and whose parent Market is still Active, ordered by closeTime
9243
+ * ascending. Used by resolution cron workers to find markets that need
9244
+ * settling.
9245
+ */
9246
+ findExpiredOpenPriceMarkets(params: {
9247
+ creator: `0x${string}`;
9248
+ now: bigint;
9249
+ first?: number;
9250
+ }): Promise<Array<{
9251
+ marketId: bigint;
9252
+ feedId: `0x${string}`;
9253
+ closeTime: bigint;
9254
+ }>>;
9196
9255
  }
9197
9256
 
9198
9257
  declare class TokenModule extends BaseModule {
@@ -17308,6 +17367,11 @@ declare const GET_ALL_MARKETS_FEED: string;
17308
17367
  * Get all markets across all venues sorted by volume
17309
17368
  */
17310
17369
  declare const GET_ALL_MARKETS_FEED_BY_VOLUME: string;
17370
+ /**
17371
+ * Get a single PriceMarketSeries with all its member markets, ordered by closeTime.
17372
+ * Used by the market detail page to render the time-button navigation strip.
17373
+ */
17374
+ declare const GET_PRICE_MARKET_SERIES: string;
17311
17375
  /**
17312
17376
  * Get recent trades across all venues (for activity feed / ticker)
17313
17377
  */
@@ -17410,4 +17474,4 @@ declare function parseMetadata<T extends {
17410
17474
 
17411
17475
  declare const version = "0.1.0";
17412
17476
 
17413
- export { AccessControlFacet as AccessControlFacetABI, AccessControlModule, BatchOrdersFacet as BatchOrdersFacetABI, CONTRACT_ADDRESSES, type ChancePercentInput, ConditionalTokens as ConditionalTokensABI, DEFAULT_CHAIN, ERC20 as ERC20ABI, FeedProvider, GET_ALL_MARKETS_FEED, GET_ALL_MARKETS_FEED_BY_VOLUME, GET_CHART_TRADES, GET_CHART_TRADES_ALL, GET_GROUP_MARKETS, GET_LEADERBOARD, GET_MARKET, GET_MARKETS, GET_MARKETS_WITH_PRICING, GET_MARKET_GROUP, GET_MARKET_GROUPS, GET_MARKET_GROUP_ITEM, GET_MARKET_TOP_HOLDERS, GET_ORDERS, GET_PROTOCOL_STATS, GET_QUESTION, GET_QUESTIONS, GET_RECENT_MARKETS, GET_RECENT_TRADES, GET_TOP_OF_BOOK, GET_TRADER_CLOSED_POSITIONS, GET_TRADER_FILLS, GET_TRADER_POSITIONS, GET_TRADER_PROFILE, GET_TRADES, GET_UNIFIED_MARKET_FEED, GET_UNIFIED_MARKET_FEED_BY_VOLUME, GET_USER, GET_VENUES, LimitOrdersFacet as LimitOrdersFacetABI, MarketGroupFacet as MarketGroupFacetABI, type MarketMetadata, MarketModule, MarketOrdersFacet as MarketOrdersFacetABI, type MarketQuestion, type MarketStatus, MarketsFacet as MarketsFacetABI, MatchingFacet as MatchingFacetABI, MetadataFacet as MetadataFacetABI, NegRiskFacet as NegRiskFacetABI, OddMakiClient, type OddMakiClientConfig, type OddMakiConfig, OrderBookFacet as OrderBookFacetABI, PROTOCOL_FEES, type PriceMarketData, PriceMarketFacet as PriceMarketFacetABI, PriceMarketModule, ProtocolFacet as ProtocolFacetABI, PublicModule, PythResolutionFacet as PythResolutionFacetABI, type PythUpdate, ResolutionFacet as ResolutionFacetABI, SUBGRAPH_IDS, SubgraphClient, type SubgraphMarketPriceData, TICK_SIZE_FINE, TICK_SIZE_STANDARD, TagsFacet as TagsFacetABI, TokenModule, type TopOfBookEntry, TradeModule, UMA_DEFAULTS, UmaModule, UmaOracle as UmaOracleABI, VALID_TICK_SIZES, VaultFacet as VaultFacetABI, VenueFacet as VenueFacetABI, type VenueMetadata, VenueModule, WhitelistAccessControl as WhitelistAccessControlABI, buildSubgraphGatewayUrl, calculateChancePercent, clearDecimalsCache, createExpiry, createOddMakiClient, formatAmount, formatAncillaryData, formatTimestamp, getCachedTokenDecimals, getOutcomePrice, getTokenDecimals, isValidTickSize, parseAmount, parseAncillaryData, parseMetadata, parseTokenAmount, priceToTick, resolveIPFSUri, tickToPercentage, tickToPrice, version };
17477
+ export { AccessControlFacet as AccessControlFacetABI, AccessControlModule, BatchOrdersFacet as BatchOrdersFacetABI, CONTRACT_ADDRESSES, type ChancePercentInput, ConditionalTokens as ConditionalTokensABI, DEFAULT_CHAIN, ERC20 as ERC20ABI, FeedProvider, GET_ALL_MARKETS_FEED, GET_ALL_MARKETS_FEED_BY_VOLUME, GET_CHART_TRADES, GET_CHART_TRADES_ALL, GET_GROUP_MARKETS, GET_LEADERBOARD, GET_MARKET, GET_MARKETS, GET_MARKETS_WITH_PRICING, GET_MARKET_GROUP, GET_MARKET_GROUPS, GET_MARKET_GROUP_ITEM, GET_MARKET_TOP_HOLDERS, GET_ORDERS, GET_PRICE_MARKET_SERIES, GET_PROTOCOL_STATS, GET_QUESTION, GET_QUESTIONS, GET_RECENT_MARKETS, GET_RECENT_TRADES, GET_TOP_OF_BOOK, GET_TRADER_CLOSED_POSITIONS, GET_TRADER_FILLS, GET_TRADER_POSITIONS, GET_TRADER_PROFILE, GET_TRADES, GET_UNIFIED_MARKET_FEED, GET_UNIFIED_MARKET_FEED_BY_VOLUME, GET_USER, GET_VENUES, LimitOrdersFacet as LimitOrdersFacetABI, MarketGroupFacet as MarketGroupFacetABI, type MarketMetadata, MarketModule, MarketOrdersFacet as MarketOrdersFacetABI, type MarketQuestion, type MarketStatus, MarketsFacet as MarketsFacetABI, MatchingFacet as MatchingFacetABI, MetadataFacet as MetadataFacetABI, NegRiskFacet as NegRiskFacetABI, OddMakiClient, type OddMakiClientConfig, type OddMakiConfig, OrderBookFacet as OrderBookFacetABI, PROTOCOL_FEES, type PriceMarketData, PriceMarketFacet as PriceMarketFacetABI, PriceMarketModule, ProtocolFacet as ProtocolFacetABI, PublicModule, PythResolutionFacet as PythResolutionFacetABI, type PythUpdate, ResolutionFacet as ResolutionFacetABI, SUBGRAPH_IDS, SubgraphClient, type SubgraphMarketPriceData, TICK_SIZE_FINE, TICK_SIZE_STANDARD, TagsFacet as TagsFacetABI, TokenModule, type TopOfBookEntry, TradeModule, UMA_DEFAULTS, UmaModule, UmaOracle as UmaOracleABI, VALID_TICK_SIZES, VaultFacet as VaultFacetABI, VenueFacet as VenueFacetABI, type VenueMetadata, VenueModule, WhitelistAccessControl as WhitelistAccessControlABI, buildSubgraphGatewayUrl, calculateChancePercent, clearDecimalsCache, createExpiry, createOddMakiClient, formatAmount, formatAncillaryData, formatTimestamp, getCachedTokenDecimals, getOutcomePrice, getTokenDecimals, isValidTickSize, parseAmount, parseAncillaryData, parseMetadata, parseTokenAmount, priceToTick, resolveIPFSUri, tickToPercentage, tickToPrice, version };