@prophecy-dev/sdk 0.1.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/__tests__/chain.test.d.ts +2 -0
- package/dist/__tests__/chain.test.d.ts.map +1 -0
- package/dist/__tests__/market-creation.test.d.ts +2 -0
- package/dist/__tests__/market-creation.test.d.ts.map +1 -0
- package/dist/__tests__/permits.test.d.ts +2 -0
- package/dist/__tests__/permits.test.d.ts.map +1 -0
- package/dist/arbiter.d.ts +39 -0
- package/dist/arbiter.d.ts.map +1 -0
- package/dist/auth.d.ts +13 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/cache.d.ts +19 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/chain.d.ts +59 -0
- package/dist/chain.d.ts.map +1 -0
- package/dist/client.d.ts +102 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/events-api.d.ts +133 -0
- package/dist/events-api.d.ts.map +1 -0
- package/dist/events.d.ts +22 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/faucet.d.ts +30 -0
- package/dist/faucet.d.ts.map +1 -0
- package/dist/http.d.ts +14 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/identity.d.ts +32 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/index.cjs +27 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +7 -0
- package/dist/leaderboard.d.ts +62 -0
- package/dist/leaderboard.d.ts.map +1 -0
- package/dist/llm.d.ts +22 -0
- package/dist/llm.d.ts.map +1 -0
- package/dist/market-creation.d.ts +68 -0
- package/dist/market-creation.d.ts.map +1 -0
- package/dist/markets.d.ts +42 -0
- package/dist/markets.d.ts.map +1 -0
- package/dist/permits.d.ts +44 -0
- package/dist/permits.d.ts.map +1 -0
- package/dist/points.d.ts +38 -0
- package/dist/points.d.ts.map +1 -0
- package/dist/season.d.ts +31 -0
- package/dist/season.d.ts.map +1 -0
- package/dist/user.d.ts +91 -0
- package/dist/user.d.ts.map +1 -0
- package/dist/venue.d.ts +56 -0
- package/dist/venue.d.ts.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/chain.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"market-creation.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/market-creation.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permits.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/permits.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface ArbiterRatingRequest {
|
|
2
|
+
prompt: string;
|
|
3
|
+
answerType: string;
|
|
4
|
+
sourceUrls: string[];
|
|
5
|
+
minAgreement: number;
|
|
6
|
+
tradingStart: string;
|
|
7
|
+
tradingEnd: string;
|
|
8
|
+
resolutionStart: string;
|
|
9
|
+
resolutionEnd: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ArbiterCriterion {
|
|
12
|
+
key: string;
|
|
13
|
+
name: string;
|
|
14
|
+
criterionType: 'gate' | 'score';
|
|
15
|
+
evaluation: 'static' | 'llm';
|
|
16
|
+
status: 'pass' | 'fail';
|
|
17
|
+
summary: string;
|
|
18
|
+
weight?: number;
|
|
19
|
+
score?: number;
|
|
20
|
+
weightedScore?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface ArbiterRatingBand {
|
|
23
|
+
rating: string;
|
|
24
|
+
minScore: number;
|
|
25
|
+
maxScore: number;
|
|
26
|
+
definition: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ArbiterRating {
|
|
29
|
+
ratedAt: string;
|
|
30
|
+
finalScore: number;
|
|
31
|
+
ratingBand: ArbiterRatingBand;
|
|
32
|
+
criteria: ArbiterCriterion[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Rate a market definition via the Arbiter API.
|
|
36
|
+
* Returns a quality score, rating band, and per-criterion breakdown.
|
|
37
|
+
*/
|
|
38
|
+
export declare function rateMarketDraft(arbiterUrl: string, input: ArbiterRatingRequest): Promise<ArbiterRating>;
|
|
39
|
+
//# sourceMappingURL=arbiter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arbiter.d.ts","sourceRoot":"","sources":["../src/arbiter.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;CACtB;AAID,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,GAAG,OAAO,CAAA;IAC/B,UAAU,EAAE,QAAQ,GAAG,KAAK,CAAA;IAC5B,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,iBAAiB,CAAA;IAC7B,QAAQ,EAAE,gBAAgB,EAAE,CAAA;CAC7B;AAmED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,aAAa,CAAC,CAOxB"}
|
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Venue API key auth.
|
|
3
|
+
* Simple bearer token — no crypto, no signing, no token exchange.
|
|
4
|
+
* The key is generated in the admin UI and stored as an env var in the venue backend.
|
|
5
|
+
*/
|
|
6
|
+
export interface VenueAuth {
|
|
7
|
+
/** The venue ID. */
|
|
8
|
+
venueId: string;
|
|
9
|
+
/** Get the Authorization header value. */
|
|
10
|
+
getAuthHeader(): string;
|
|
11
|
+
}
|
|
12
|
+
export declare function createVenueAuth(venueId: string, apiKey: string): VenueAuth;
|
|
13
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,SAAS;IACxB,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,0CAA0C;IAC1C,aAAa,IAAI,MAAM,CAAA;CACxB;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAK1E"}
|
package/dist/cache.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple in-memory TTL cache for SDK responses.
|
|
3
|
+
* Client-side layer — reduces redundant fetches within the same process.
|
|
4
|
+
* Works alongside server-side Cache-Control headers from the Partners API.
|
|
5
|
+
*
|
|
6
|
+
* Edge-safe — no globals, each client gets its own cache instance.
|
|
7
|
+
*/
|
|
8
|
+
export interface CacheConfig {
|
|
9
|
+
/** Default client-side cache TTL in milliseconds. 0 = disabled. Default: 15000 (15s). */
|
|
10
|
+
defaultTtlMs?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function createCache(config?: CacheConfig): {
|
|
13
|
+
get<T>(key: string): T | undefined;
|
|
14
|
+
set(key: string, data: unknown, ttlMs?: number): void;
|
|
15
|
+
invalidate(prefix: string): void;
|
|
16
|
+
clear(): void;
|
|
17
|
+
};
|
|
18
|
+
export type Cache = ReturnType<typeof createCache>;
|
|
19
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,MAAM,WAAW,WAAW;IAC1B,yFAAyF;IACzF,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,wBAAgB,WAAW,CAAC,MAAM,GAAE,WAAgB;QAK5C,CAAC,OAAO,MAAM,GAAG,CAAC,GAAG,SAAS;aAWzB,MAAM,QAAQ,OAAO,UAAU,MAAM,GAAG,IAAI;uBAMlC,MAAM,GAAG,IAAI;aAMvB,IAAI;EAIhB;AAED,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAA"}
|
package/dist/chain.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type Address } from 'viem';
|
|
2
|
+
export interface ChainConfig {
|
|
3
|
+
rpcUrl: string;
|
|
4
|
+
chainId: number;
|
|
5
|
+
venueRegistryAddress: Address;
|
|
6
|
+
prophecyCoreAddress: Address;
|
|
7
|
+
prophecySettlementAddress?: Address;
|
|
8
|
+
}
|
|
9
|
+
export interface SharePosition {
|
|
10
|
+
yes: bigint;
|
|
11
|
+
no: bigint;
|
|
12
|
+
claimed: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface MarketCore {
|
|
15
|
+
tradingStartTs: bigint;
|
|
16
|
+
tradingEndTs: bigint;
|
|
17
|
+
resolutionStartTs: bigint;
|
|
18
|
+
resolutionEndTs: bigint;
|
|
19
|
+
creator: Address;
|
|
20
|
+
resolver: Address;
|
|
21
|
+
stakeToken: Address;
|
|
22
|
+
resolved: boolean;
|
|
23
|
+
outcome: number;
|
|
24
|
+
totalYesShares: bigint;
|
|
25
|
+
totalNoShares: bigint;
|
|
26
|
+
totalShares: bigint;
|
|
27
|
+
participantCount: bigint;
|
|
28
|
+
initialLiquidityBase: bigint;
|
|
29
|
+
feeBps: bigint;
|
|
30
|
+
}
|
|
31
|
+
export interface ChainClient {
|
|
32
|
+
/** Get the permit nonce for a user on a venue (VenueRegistry.getNonce) */
|
|
33
|
+
getVenueNonce(venueId: bigint, user: Address): Promise<bigint>;
|
|
34
|
+
/** Get market core data (ProphecyCore.getMarketCore) */
|
|
35
|
+
getMarketCore(marketId: bigint): Promise<{
|
|
36
|
+
core: MarketCore;
|
|
37
|
+
name: string;
|
|
38
|
+
}>;
|
|
39
|
+
/** Get current AMM reserves (ProphecyCore.getCurrentReserves) */
|
|
40
|
+
getReserves(marketId: bigint): Promise<{
|
|
41
|
+
yesPool: bigint;
|
|
42
|
+
noPool: bigint;
|
|
43
|
+
}>;
|
|
44
|
+
/** Get a user's share position for a single market */
|
|
45
|
+
getUserPosition(marketId: bigint, user: Address): Promise<SharePosition>;
|
|
46
|
+
/** Batch-read user positions across multiple markets via multicall */
|
|
47
|
+
getUserPositions(marketIds: bigint[], user: Address): Promise<(SharePosition | null)[]>;
|
|
48
|
+
/** Encode a claimSettlement transaction (for the user to sign and send) */
|
|
49
|
+
encodeClaimSettlement(marketId: bigint): {
|
|
50
|
+
to: Address;
|
|
51
|
+
data: `0x${string}`;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Create a chain client for reading on-chain state.
|
|
56
|
+
* Used by the SDK for nonce lookups (before permit signing) and market queries.
|
|
57
|
+
*/
|
|
58
|
+
export declare function createChainClient(config: ChainConfig): ChainClient;
|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;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC5E,iEAAiE;IACjE,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC3E,sDAAsD;IACtD,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;IACxE,sEAAsE;IACtE,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,aAAa,GAAG,IAAI,CAAC,EAAE,CAAC,CAAA;IACvF,2EAA2E;IAC3E,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,KAAK,MAAM,EAAE,CAAA;KAAE,CAAA;CAC9E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAqFlE"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified Prophecy client.
|
|
3
|
+
* Configure once, access all SDK services. Edge-runtime safe — no globals, no classes.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* const prophecy = createProphecyClient({
|
|
7
|
+
* chainId: 50312,
|
|
8
|
+
* rpcUrl: 'https://dream-rpc.somnia.network',
|
|
9
|
+
* dataApiUrl: 'https://api.prophecy.fun',
|
|
10
|
+
* partnersApiUrl: 'https://partners.prophecy.fun',
|
|
11
|
+
* venueRegistryAddress: '0x...',
|
|
12
|
+
* prophecyCoreAddress: '0x...',
|
|
13
|
+
* venueId: '46',
|
|
14
|
+
* operatorPrivateKey: '0x...',
|
|
15
|
+
* })
|
|
16
|
+
*
|
|
17
|
+
* await prophecy.events.socialShare('0xUser...', 'market-1')
|
|
18
|
+
*/
|
|
19
|
+
import type { Address } from 'viem';
|
|
20
|
+
import { type ArbiterRating, type ArbiterRatingRequest } from './arbiter';
|
|
21
|
+
import { type VenueAuth } from './auth';
|
|
22
|
+
import { type CacheConfig } from './cache';
|
|
23
|
+
import { type ChainClient } from './chain';
|
|
24
|
+
import { type EventsNamespace } from './events';
|
|
25
|
+
import { type EventsApiNamespace } from './events-api';
|
|
26
|
+
import { type FaucetNamespace } from './faucet';
|
|
27
|
+
import { type PnLLeaderboardEntry, type PnLLeaderboardParams, type PPLeaderboardEntry, type PPLeaderboardParams, type VolumeLeaderboardEntry, type VolumeLeaderboardParams } from './leaderboard';
|
|
28
|
+
import { type MarketsNamespace } from './markets';
|
|
29
|
+
import { type SeasonNamespace } from './season';
|
|
30
|
+
import { type UserNamespace } from './user';
|
|
31
|
+
import { type VenueNamespace } from './venue';
|
|
32
|
+
export interface ProphecyClientConfig {
|
|
33
|
+
/** Somnia chain ID */
|
|
34
|
+
chainId: number;
|
|
35
|
+
/** RPC endpoint URL */
|
|
36
|
+
rpcUrl: string;
|
|
37
|
+
/** Go Data API base URL (e.g. https://api.prophecy.fun) */
|
|
38
|
+
dataApiUrl: string;
|
|
39
|
+
/** Partners API base URL (e.g. https://partners.prophecy.fun) */
|
|
40
|
+
partnersApiUrl: string;
|
|
41
|
+
/** VenueRegistry contract address */
|
|
42
|
+
venueRegistryAddress: Address;
|
|
43
|
+
/** ProphecyCore contract address */
|
|
44
|
+
prophecyCoreAddress: Address;
|
|
45
|
+
/** ProphecySettlement contract address. Required for claim operations. */
|
|
46
|
+
prophecySettlementAddress?: Address;
|
|
47
|
+
/** Arbiter API base URL (e.g. https://arbiter.prophecy.fun). Optional — only needed for market rating. */
|
|
48
|
+
arbiterUrl?: string;
|
|
49
|
+
/** Client-side cache config. Default: 15s TTL. Set defaultTtlMs: 0 to disable. */
|
|
50
|
+
cache?: CacheConfig;
|
|
51
|
+
/**
|
|
52
|
+
* Venue config — required for write operations (events, venue market management).
|
|
53
|
+
* If omitted, read-only namespaces still work.
|
|
54
|
+
*/
|
|
55
|
+
venueId?: string;
|
|
56
|
+
/** Venue API key (vk_...). Generated in admin UI. Server-side only — never expose to browsers. */
|
|
57
|
+
venueApiKey?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface ProphecyClient {
|
|
60
|
+
/** On-chain reads: nonces, market data, AMM reserves */
|
|
61
|
+
chain: ChainClient;
|
|
62
|
+
/** Protocol-wide market data: search, get details */
|
|
63
|
+
markets: MarketsNamespace;
|
|
64
|
+
/** Prediction events with grouped outcome markets */
|
|
65
|
+
eventsApi: EventsApiNamespace;
|
|
66
|
+
/** Venue management: curated markets, stats */
|
|
67
|
+
venue: VenueNamespace;
|
|
68
|
+
/** User data: points, wallet linking */
|
|
69
|
+
user: UserNamespace;
|
|
70
|
+
/** Leaderboards: PP, PnL, volume rankings */
|
|
71
|
+
leaderboard: {
|
|
72
|
+
pp(params?: PPLeaderboardParams): Promise<{
|
|
73
|
+
traders: PPLeaderboardEntry[];
|
|
74
|
+
}>;
|
|
75
|
+
pnl(params?: PnLLeaderboardParams): Promise<{
|
|
76
|
+
traders: PnLLeaderboardEntry[];
|
|
77
|
+
nextCursor?: string;
|
|
78
|
+
}>;
|
|
79
|
+
volume(params?: VolumeLeaderboardParams): Promise<{
|
|
80
|
+
traders: VolumeLeaderboardEntry[];
|
|
81
|
+
nextCursor?: string;
|
|
82
|
+
}>;
|
|
83
|
+
};
|
|
84
|
+
/** Season info: active season, config, time remaining */
|
|
85
|
+
season: SeasonNamespace;
|
|
86
|
+
/** Protocol faucet: claim daily tokens for users */
|
|
87
|
+
faucet: FaucetNamespace;
|
|
88
|
+
/** Off-chain event reporting (requires venueId + venueApiKey) */
|
|
89
|
+
events: EventsNamespace;
|
|
90
|
+
/** Arbiter: rate market definitions for quality before on-chain submission */
|
|
91
|
+
arbiter: {
|
|
92
|
+
rate(input: ArbiterRatingRequest): Promise<ArbiterRating>;
|
|
93
|
+
};
|
|
94
|
+
/** Venue auth manager (null if no API key configured) */
|
|
95
|
+
auth: VenueAuth | null;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Create a Prophecy client. Configure API URLs once, use everywhere.
|
|
99
|
+
* Safe for edge runtimes — pure closure, no global state.
|
|
100
|
+
*/
|
|
101
|
+
export declare function createProphecyClient(config: ProphecyClientConfig): ProphecyClient;
|
|
102
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,oBAAoB,EAAmB,MAAM,WAAW,CAAA;AAC1F,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAA;AACxD,OAAO,EAAE,KAAK,WAAW,EAAe,MAAM,SAAS,CAAA;AACvD,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,SAAS,CAAA;AAC7D,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,UAAU,CAAA;AACtE,OAAO,EAA4B,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAChF,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,UAAU,CAAA;AACtE,OAAO,EAIL,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC7B,MAAM,eAAe,CAAA;AACtB,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAA;AACzE,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,UAAU,CAAA;AACtE,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAA;AAChE,OAAO,EAAwB,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AAO,EAAE,sBAAsB,EAAE,CAAC;YAAC,UAAU,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KACvE,CAAA;IACD,yDAAyD;IACzD,MAAM,EAAE,eAAe,CAAA;IACvB,oDAAoD;IACpD,MAAM,EAAE,eAAe,CAAA;IACvB,iEAAiE;IACjE,MAAM,EAAE,eAAe,CAAA;IACvB,8EAA8E;IAC9E,OAAO,EAAE;QACP,IAAI,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;KAC1D,CAAA;IACD,yDAAyD;IACzD,IAAI,EAAE,SAAS,GAAG,IAAI,CAAA;CACvB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,cAAc,CAmDjF"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event operations — the primary way to browse prediction markets.
|
|
3
|
+
*
|
|
4
|
+
* Events are the parent container for markets. An event has a question
|
|
5
|
+
* (e.g. "Will BTC reach $100k?") and one or more outcome markets
|
|
6
|
+
* (e.g. "Yes" / "No", or "Up" / "Down" / "Flat").
|
|
7
|
+
*
|
|
8
|
+
* Use events.search() instead of markets.search() to get meaningful
|
|
9
|
+
* names and grouped outcomes.
|
|
10
|
+
*/
|
|
11
|
+
import type { Cache } from './cache';
|
|
12
|
+
export interface EventMarketPrice {
|
|
13
|
+
timestamp: string;
|
|
14
|
+
values: {
|
|
15
|
+
yes: string;
|
|
16
|
+
no: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface EventMarketStats {
|
|
20
|
+
current_liquidity: string;
|
|
21
|
+
total_volume: string;
|
|
22
|
+
}
|
|
23
|
+
export interface EventToken {
|
|
24
|
+
chain_id: number;
|
|
25
|
+
contract_address: string;
|
|
26
|
+
decimals: number;
|
|
27
|
+
symbol: string;
|
|
28
|
+
token_type: string;
|
|
29
|
+
}
|
|
30
|
+
export interface EventContracts {
|
|
31
|
+
prophecy_core: string;
|
|
32
|
+
resolver?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface EventMarketConditionFilter {
|
|
35
|
+
indexed: boolean;
|
|
36
|
+
operator: string;
|
|
37
|
+
param_index: number;
|
|
38
|
+
param_type: string;
|
|
39
|
+
value: string;
|
|
40
|
+
}
|
|
41
|
+
export interface EventMarketCondition {
|
|
42
|
+
absence_outcome: number;
|
|
43
|
+
event_signature: string;
|
|
44
|
+
event_source: string;
|
|
45
|
+
filters: EventMarketConditionFilter[];
|
|
46
|
+
logical_op: string;
|
|
47
|
+
occurrence_type: string;
|
|
48
|
+
occurrence_value: string;
|
|
49
|
+
}
|
|
50
|
+
/** A single outcome market within an event */
|
|
51
|
+
export interface EventMarketData {
|
|
52
|
+
market_id: number;
|
|
53
|
+
name: string;
|
|
54
|
+
market_type: string;
|
|
55
|
+
status: string;
|
|
56
|
+
outcome: string;
|
|
57
|
+
venue_id: string;
|
|
58
|
+
opening_at: string;
|
|
59
|
+
closing_at: string;
|
|
60
|
+
resolving_at: string;
|
|
61
|
+
resolved_at: string;
|
|
62
|
+
created_at: string;
|
|
63
|
+
created_by: string;
|
|
64
|
+
price: EventMarketPrice;
|
|
65
|
+
stats: EventMarketStats;
|
|
66
|
+
token: EventToken;
|
|
67
|
+
contracts: EventContracts;
|
|
68
|
+
tags: string[];
|
|
69
|
+
conditions?: EventMarketCondition[];
|
|
70
|
+
}
|
|
71
|
+
export interface EventResolverParams {
|
|
72
|
+
prompt: string;
|
|
73
|
+
urls: string[];
|
|
74
|
+
result_type: string;
|
|
75
|
+
min_agreement: number;
|
|
76
|
+
num_sources: number;
|
|
77
|
+
resolve_url: boolean;
|
|
78
|
+
string_options: string[];
|
|
79
|
+
}
|
|
80
|
+
export interface EventResolver {
|
|
81
|
+
type: string;
|
|
82
|
+
params: EventResolverParams;
|
|
83
|
+
}
|
|
84
|
+
export interface EventResolution {
|
|
85
|
+
[key: string]: unknown;
|
|
86
|
+
}
|
|
87
|
+
export interface EventStats {
|
|
88
|
+
market_count: number;
|
|
89
|
+
total_liquidity: string;
|
|
90
|
+
total_volume: string;
|
|
91
|
+
}
|
|
92
|
+
/** A prediction event with its outcome markets */
|
|
93
|
+
export interface EventData {
|
|
94
|
+
event_id: string;
|
|
95
|
+
name: string;
|
|
96
|
+
venue_id: string;
|
|
97
|
+
status: string;
|
|
98
|
+
contracts: EventContracts;
|
|
99
|
+
opening_at: string;
|
|
100
|
+
closing_at: string;
|
|
101
|
+
resolving_at?: string;
|
|
102
|
+
resolved_at?: string;
|
|
103
|
+
created_at: string;
|
|
104
|
+
created_by: string;
|
|
105
|
+
stats: EventStats;
|
|
106
|
+
token: EventToken;
|
|
107
|
+
markets: EventMarketData[];
|
|
108
|
+
resolver?: EventResolver;
|
|
109
|
+
resolution?: EventResolution;
|
|
110
|
+
}
|
|
111
|
+
export interface SearchEventsParams {
|
|
112
|
+
query?: string;
|
|
113
|
+
status?: string[];
|
|
114
|
+
venue?: string;
|
|
115
|
+
tag?: string;
|
|
116
|
+
createdBy?: string;
|
|
117
|
+
sort?: string;
|
|
118
|
+
order?: 'asc' | 'desc';
|
|
119
|
+
limit?: number;
|
|
120
|
+
cursor?: string;
|
|
121
|
+
}
|
|
122
|
+
export interface EventsApiNamespace {
|
|
123
|
+
/** Search events across the protocol. Returns events with nested markets. */
|
|
124
|
+
search(params?: SearchEventsParams): Promise<{
|
|
125
|
+
items: EventData[];
|
|
126
|
+
hasMore: boolean;
|
|
127
|
+
nextCursor?: string;
|
|
128
|
+
}>;
|
|
129
|
+
/** Get a single event by contract address and event ID. */
|
|
130
|
+
get(contractAddress: string, eventId: string): Promise<EventData>;
|
|
131
|
+
}
|
|
132
|
+
export declare function createEventsApiNamespace(dataApiUrl: string, cache: Cache): EventsApiNamespace;
|
|
133
|
+
//# sourceMappingURL=events-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events-api.d.ts","sourceRoot":"","sources":["../src/events-api.ts"],"names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CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,UAAU,CAAA;IACjB,KAAK,EAAE,UAAU,CAAA;IACjB,OAAO,EAAE,eAAe,EAAE,CAAA;IAC1B,QAAQ,CAAC,EAAE,aAAa,CAAA;IACxB,UAAU,CAAC,EAAE,eAAe,CAAA;CAC7B;AAID,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAID,MAAM,WAAW,kBAAkB;IACjC,6EAA6E;IAC7E,MAAM,CACJ,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC;QAAE,KAAK,EAAE,SAAS,EAAE,CAAC;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACzE,2DAA2D;IAC3D,GAAG,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA;CAClE;AAED,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,kBAAkB,CA0C7F"}
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Off-chain event reporting.
|
|
3
|
+
* Venue backends use these to report user actions (social shares, receipts, challenges).
|
|
4
|
+
* Authenticated via venue API key (auto-attached by VenueAuth).
|
|
5
|
+
*/
|
|
6
|
+
import type { VenueAuth } from './auth';
|
|
7
|
+
export interface EventsNamespace {
|
|
8
|
+
/** Report a social share. */
|
|
9
|
+
socialShare(wallet: string, marketId: string): Promise<EventResult>;
|
|
10
|
+
/** Report a resolution receipt inspection. */
|
|
11
|
+
receiptInspect(wallet: string, marketId: string): Promise<EventResult>;
|
|
12
|
+
/** Report daily challenge completion. */
|
|
13
|
+
dailyChallenge(wallet: string): Promise<EventResult>;
|
|
14
|
+
}
|
|
15
|
+
export interface EventResult {
|
|
16
|
+
recorded: boolean;
|
|
17
|
+
pp: number;
|
|
18
|
+
seasonId: string;
|
|
19
|
+
reason?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function createEventsNamespace(partnersApiUrl: string, venueAuth: VenueAuth): EventsNamespace;
|
|
22
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAEvC,MAAM,WAAW,eAAe;IAC9B,6BAA6B;IAC7B,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;IACnE,8CAA8C;IAC9C,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;IACtE,yCAAyC;IACzC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;CACrD;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,OAAO,CAAA;IACjB,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,wBAAgB,qBAAqB,CACnC,cAAc,EAAE,MAAM,EACtB,SAAS,EAAE,SAAS,GACnB,eAAe,CA0BjB"}
|
package/dist/faucet.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Faucet namespace — protocol-level token distribution for venue users.
|
|
3
|
+
*
|
|
4
|
+
* The treasury wallet is controlled by the Prophecy team.
|
|
5
|
+
* Venues call these methods on behalf of their users — the venue
|
|
6
|
+
* API key authenticates the request, not the end user.
|
|
7
|
+
*/
|
|
8
|
+
import type { VenueAuth } from './auth';
|
|
9
|
+
export interface FaucetEligibility {
|
|
10
|
+
eligible: boolean;
|
|
11
|
+
reason?: string;
|
|
12
|
+
nextClaimAt?: string;
|
|
13
|
+
amount?: string;
|
|
14
|
+
tokenAddress?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface FaucetClaimResult {
|
|
17
|
+
success: boolean;
|
|
18
|
+
error?: string;
|
|
19
|
+
amount?: string;
|
|
20
|
+
txHash?: string;
|
|
21
|
+
nextClaimAt?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface FaucetNamespace {
|
|
24
|
+
/** Check if a wallet is eligible to claim tokens. Public, no auth required. */
|
|
25
|
+
eligibility(wallet: string): Promise<FaucetEligibility>;
|
|
26
|
+
/** Claim tokens for a wallet. Requires venue API key auth. */
|
|
27
|
+
claim(wallet: string): Promise<FaucetClaimResult>;
|
|
28
|
+
}
|
|
29
|
+
export declare function createFaucetNamespace(partnersApiUrl: string, venueId: string, venueAuth: VenueAuth | null): FaucetNamespace;
|
|
30
|
+
//# sourceMappingURL=faucet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"faucet.d.ts","sourceRoot":"","sources":["../src/faucet.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAKvC,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,OAAO,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAID,MAAM,WAAW,eAAe;IAC9B,+EAA+E;IAC/E,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;IACvD,8DAA8D;IAC9D,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;CAClD;AAED,wBAAgB,qBAAqB,CACnC,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,SAAS,GAAG,IAAI,GAC1B,eAAe,CAwBjB"}
|
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal fetch wrapper for SDK API calls.
|
|
3
|
+
* No dependencies — uses global fetch (available in Node 18+, edge runtimes, browsers).
|
|
4
|
+
*/
|
|
5
|
+
export declare class ApiError extends Error {
|
|
6
|
+
readonly status: number;
|
|
7
|
+
readonly body: unknown;
|
|
8
|
+
constructor(status: number, body: unknown);
|
|
9
|
+
}
|
|
10
|
+
export declare function get<T>(baseUrl: string, path: string, params?: Record<string, string | number | undefined>): Promise<T>;
|
|
11
|
+
export declare function post<T>(baseUrl: string, path: string, body: unknown): Promise<T>;
|
|
12
|
+
export declare function authedPost<T>(baseUrl: string, path: string, body: unknown, authToken: string): Promise<T>;
|
|
13
|
+
export declare function authedDelete<T>(baseUrl: string, path: string, authToken: string): Promise<T>;
|
|
14
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,qBAAa,QAAS,SAAQ,KAAK;aAEf,MAAM,EAAE,MAAM;aACd,IAAI,EAAE,OAAO;gBADb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO;CAKhC;AA4BD,wBAAgB,GAAG,CAAC,CAAC,EACnB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,GACnD,OAAO,CAAC,CAAC,CAAC,CAQZ;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAEhF;AAED,wBAAgB,UAAU,CAAC,CAAC,EAC1B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,CAAC,CAAC,CAMZ;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAK5F"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wallet identity linking for cross-venue points aggregation.
|
|
3
|
+
* Calls Partners API identity endpoints.
|
|
4
|
+
*/
|
|
5
|
+
export interface LinkWalletParams {
|
|
6
|
+
wallet: string;
|
|
7
|
+
email: string;
|
|
8
|
+
venueId: string;
|
|
9
|
+
authType: 'social' | 'wallet';
|
|
10
|
+
}
|
|
11
|
+
export interface LinkedWallet {
|
|
12
|
+
wallet_address: string;
|
|
13
|
+
venue_id: string;
|
|
14
|
+
auth_type: string;
|
|
15
|
+
}
|
|
16
|
+
export interface WalletIdentity {
|
|
17
|
+
wallet: string;
|
|
18
|
+
emailHash?: string;
|
|
19
|
+
linkedWallets: LinkedWallet[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Link a wallet to an email for cross-venue points aggregation.
|
|
23
|
+
* Called by the Portal on social login.
|
|
24
|
+
*/
|
|
25
|
+
export declare function linkWalletIdentity(partnersApiUrl: string, params: LinkWalletParams): Promise<{
|
|
26
|
+
linked: boolean;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Get all wallets linked to the same email as the given wallet.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getLinkedWallets(partnersApiUrl: string, wallet: string): Promise<WalletIdentity>;
|
|
32
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAAA;CAC9B;AAED,MAAM,WAAW,YAAY;IAC3B,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,YAAY,EAAE,CAAA;CAC9B;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC,CAM9B;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,cAAc,CAAC,CAEzB"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";var E=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var Y=Object.prototype.hasOwnProperty;var z=(e,n)=>()=>(e&&(n=e(e=0)),n);var S=(e,n)=>{for(var t in n)E(e,t,{get:n[t],enumerable:!0})},J=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of H(n))!Y.call(e,a)&&a!==t&&E(e,a,{get:()=>n[a],enumerable:!(r=K(n,a))||r.enumerable});return e};var G=e=>J(E({},"__esModule",{value:!0}),e);var x={};S(x,{ApiError:()=>d,authedDelete:()=>A,authedPost:()=>g,get:()=>o,post:()=>p});async function y(e,n={}){let t={"Content-Type":"application/json",...n.headers},r=await fetch(e,{method:n.method??"GET",headers:t,body:n.body?JSON.stringify(n.body):void 0});if(!r.ok){let a=await r.json().catch(()=>null);throw new d(r.status,a)}return r.json()}function o(e,n,t){let r=new URL(n,e);if(t)for(let[a,i]of Object.entries(t))i!==void 0&&r.searchParams.set(a,String(i));return y(r)}function p(e,n,t){return y(new URL(n,e),{method:"POST",body:t})}function g(e,n,t,r){return y(new URL(n,e),{method:"POST",body:t,headers:{Authorization:`Bearer ${r}`}})}function A(e,n,t){return y(new URL(n,e),{method:"DELETE",headers:{Authorization:`Bearer ${t}`}})}var d,c=z(()=>{"use strict";d=class extends Error{constructor(t,r){super(`API error ${t}`);this.status=t;this.body=r;this.name="ApiError"}}});var ae={};S(ae,{ApiError:()=>d,createChainClient:()=>v,createEventsApiNamespace:()=>h,createMarketDefinition:()=>$,createProphecyClient:()=>U,getPPLeaderboard:()=>P,getPnLLeaderboard:()=>k,getVolumeLeaderboard:()=>T,marketDefinitionSchema:()=>C,rateMarketDraft:()=>b,signCreateMarketPermit:()=>F,signTradePermit:()=>W});module.exports=G(ae);c();function Z(e){return{prompt:e.prompt,answer_type:e.answerType,source_urls:e.sourceUrls,min_agreement:e.minAgreement,trading_start:e.tradingStart,trading_end:e.tradingEnd,resolution_start:e.resolutionStart,resolution_end:e.resolutionEnd}}function Q(e){return{ratedAt:e.rated_at,finalScore:e.final_score,ratingBand:{rating:e.rating_band.rating,minScore:e.rating_band.min_score,maxScore:e.rating_band.max_score,definition:e.rating_band.definition},criteria:e.criteria.map(n=>({key:n.key,name:n.name,criterionType:n.criterion_type,evaluation:n.evaluation,status:n.status,summary:n.summary,weight:n.weight,score:n.score,weightedScore:n.weighted_score}))}}async function b(e,n){let t=await p(e,"/v0/ratings/markets",Z(n));return Q(t)}var m=require("viem"),X=[{inputs:[{internalType:"uint256",name:"venueId",type:"uint256"},{internalType:"address",name:"user",type:"address"}],name:"getNonce",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"}],f=[{inputs:[{internalType:"uint256",name:"marketId",type:"uint256"},{internalType:"address",name:"user",type:"address"}],name:"getUserPosition",outputs:[{components:[{internalType:"uint256",name:"yes",type:"uint256"},{internalType:"uint256",name:"no",type:"uint256"},{internalType:"bool",name:"claimed",type:"bool"}],internalType:"struct IProphecyCore.SharePosition",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"marketId",type:"uint256"}],name:"getMarketCore",outputs:[{components:[{internalType:"uint256",name:"tradingStartTs",type:"uint256"},{internalType:"uint256",name:"tradingEndTs",type:"uint256"},{internalType:"uint256",name:"resolutionStartTs",type:"uint256"},{internalType:"uint256",name:"resolutionEndTs",type:"uint256"},{internalType:"address",name:"creator",type:"address"},{internalType:"address",name:"resolver",type:"address"},{internalType:"address",name:"stakeToken",type:"address"},{internalType:"bool",name:"resolved",type:"bool"},{internalType:"uint8",name:"outcome",type:"uint8"},{internalType:"uint256",name:"totalYesShares",type:"uint256"},{internalType:"uint256",name:"totalNoShares",type:"uint256"},{internalType:"uint256",name:"totalShares",type:"uint256"},{internalType:"uint256",name:"participantCount",type:"uint256"},{internalType:"uint256",name:"initialLiquidityBase",type:"uint256"},{internalType:"uint256",name:"feeBps",type:"uint256"}],internalType:"struct IProphecyCore.MarketCore",name:"core",type:"tuple"},{internalType:"string",name:"name",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"marketId",type:"uint256"}],name:"getCurrentReserves",outputs:[{internalType:"uint256",name:"yesPool",type:"uint256"},{internalType:"uint256",name:"noPool",type:"uint256"}],stateMutability:"view",type:"function"}],ee=[{inputs:[{internalType:"uint256",name:"marketId",type:"uint256"}],name:"claimSettlement",outputs:[{internalType:"uint256",name:"payout",type:"uint256"}],stateMutability:"nonpayable",type:"function"}];function v(e){let n=(0,m.defineChain)({id:e.chainId,name:`Somnia (${e.chainId})`,nativeCurrency:{name:"STT",symbol:"STT",decimals:18},rpcUrls:{default:{http:[e.rpcUrl]}}}),t=(0,m.createPublicClient)({chain:n,transport:(0,m.http)(e.rpcUrl)});return{async getVenueNonce(r,a){return t.readContract({address:e.venueRegistryAddress,abi:X,functionName:"getNonce",args:[r,a]})},async getMarketCore(r){let[a,i]=await t.readContract({address:e.prophecyCoreAddress,abi:f,functionName:"getMarketCore",args:[r]});return{core:a,name:i}},async getReserves(r){let[a,i]=await t.readContract({address:e.prophecyCoreAddress,abi:f,functionName:"getCurrentReserves",args:[r]});return{yesPool:a,noPool:i}},async getUserPosition(r,a){return await t.readContract({address:e.prophecyCoreAddress,abi:f,functionName:"getUserPosition",args:[r,a]})},async getUserPositions(r,a){if(r.length===0)return[];let i=r.map(l=>({address:e.prophecyCoreAddress,abi:f,functionName:"getUserPosition",args:[l,a]}));return(await t.multicall({contracts:i})).map(l=>l.status!=="success"?null:l.result)},encodeClaimSettlement(r){if(!e.prophecySettlementAddress)throw new Error("prophecySettlementAddress is required in ChainConfig for claim operations");return{to:e.prophecySettlementAddress,data:(0,m.encodeFunctionData)({abi:ee,functionName:"claimSettlement",args:[r]})}}}}function M(e,n){return{venueId:e,getAuthHeader:()=>`Bearer ${n}`}}function R(e={}){let n=e.defaultTtlMs??15e3,t=new Map;return{get(r){if(n===0)return;let a=t.get(r);if(a){if(Date.now()>a.expiresAt){t.delete(r);return}return a.data}},set(r,a,i){let s=i??n;s!==0&&t.set(r,{data:a,expiresAt:Date.now()+s})},invalidate(r){for(let a of t.keys())a.startsWith(r)&&t.delete(a)},clear(){t.clear()}}}function _(e,n){async function t(r,a){let i=new URL(`/v1/events${r}`,e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Authorization:n.getAuthHeader()},body:JSON.stringify(a)});if(!s.ok){let l=await s.json().catch(()=>null),{ApiError:j}=await Promise.resolve().then(()=>(c(),x));throw new j(s.status,l)}return s.json()}return{socialShare:(r,a)=>t("/social-share",{wallet:r,marketId:a}),receiptInspect:(r,a)=>t("/receipt-inspect",{wallet:r,marketId:a}),dailyChallenge:r=>t("/daily-challenge",{wallet:r})}}c();function h(e,n){return{async search(t){let r=new URL("/v0/events",e);if(t?.query&&r.searchParams.set("q",t.query),t?.venue&&r.searchParams.set("venue",t.venue),t?.tag&&r.searchParams.set("tag",t.tag),t?.createdBy&&r.searchParams.set("created_by",t.createdBy),t?.sort&&r.searchParams.set("sort",t.sort),t?.order&&r.searchParams.set("order",t.order),t?.limit&&r.searchParams.set("limit",String(t.limit)),t?.cursor&&r.searchParams.set("cursor",t.cursor),t?.status)for(let s of t.status)r.searchParams.append("status",s);let a=await fetch(r,{headers:{"Content-Type":"application/json"}});if(!a.ok)throw new d(a.status,await a.json().catch(()=>null));let i=await a.json();return{items:i.items,hasMore:i.has_more,nextCursor:i.next_cursor}},async get(t,r){let a=`event:${t}:${r}`,i=n.get(a);if(i)return i;let s=await o(e,`/v0/events/${t}/${r}`);return n.set(a,s),s}}}c();function I(e,n,t){return{async eligibility(r){return o(e,`/v1/faucet/eligibility?wallet=${r.toLowerCase()}&venue=${n}`)},async claim(r){return t?g(e,"/v1/faucet/claim",{wallet:r.toLowerCase()},t.getAuthHeader()):{success:!1,error:"venueId and venueApiKey required for faucet claims"}}}}c();async function P(e,n){return o(e,"/v1/stats/top-traders",{venue:n?.venue,limit:n?.limit})}async function k(e,n){return o(e,"/v0/leaderboard/pnl",{venue:n?.venue,period:n?.period,limit:n?.limit,cursor:n?.cursor})}async function T(e,n){return o(e,"/v0/leaderboard/volume",{venue:n?.venue,period:n?.period,limit:n?.limit,cursor:n?.cursor})}c();function L(e,n){return{async search(t){let r=new URL("/v0/markets",e);if(t?.query&&r.searchParams.set("q",t.query),t?.venue&&r.searchParams.set("venue",t.venue),t?.sort&&r.searchParams.set("sort",t.sort),t?.order&&r.searchParams.set("order",t.order),t?.limit&&r.searchParams.set("limit",String(t.limit)),t?.cursor&&r.searchParams.set("cursor",t.cursor),t?.status)for(let i of t.status)r.searchParams.append("status",i);let a=await fetch(r,{headers:{"Content-Type":"application/json"}});if(!a.ok){let{ApiError:i}=await Promise.resolve().then(()=>(c(),x));throw new i(a.status,await a.json().catch(()=>null))}return a.json()},async get(t,r){let a=`market:${t}:${r}`,i=n.get(a);if(i)return i;let s=await o(e,`/v0/markets/${t}/${r}`);return n.set(a,s),s}}}c();function N(e,n){return{async active(){let t="season:active",r=n.get(t);if(r!==void 0)return r;let a=await o(e,"/v1/seasons/active").catch(()=>null);return n.set(t,a,6e4),a},async config(){let t="season:config",r=n.get(t);if(r!==void 0)return r;let a=await o(e,"/v1/seasons/active/config").catch(()=>null);return n.set(t,a,6e4),a}}}c();function D(e,n){return{async points(t,r){let a=`user:${t}:points:${r?.season??"current"}`,i=n.get(a);if(i)return i;let s=await o(e,`/v1/points/${t}`,r?.season?{season:r.season}:void 0);return n.set(a,s),s},async dashboard(t,r){let a=`user:${t}:dashboard:${r?.venue??"all"}`,i=n.get(a);if(i)return i;let s=await o(e,`/v1/users/${t}/dashboard`,r?.venue?{venue:r.venue}:void 0);return n.set(a,s),s},linkWallet:t=>p(e,"/v1/identity/link",t),linkedWallets:t=>o(e,`/v1/identity/${t}`)}}c();function V(e,n){return{markets:{async list(t,r){let a=`venue:${t}:markets:${r?.status??"all"}`,i=n.get(a);if(i)return i;let s=await o(e,`/v1/venues/${t}/markets`,{status:r?.status});return n.set(a,s),s},async add(t,r,a){let i=await g(e,`/v1/venues/${t}/markets`,{markets:r},a);return n.invalidate(`venue:${t}`),i},async remove(t,r,a,i){let s=await A(e,`/v1/venues/${t}/markets/${r}/${a}`,i);return n.invalidate(`venue:${t}`),s}},async stats(t,r){let a=`venue:${t}:stats:${r??"current"}`,i=n.get(a);if(i)return i;let s=await o(e,`/v1/points/venue/${t}`,r?{season:r}:void 0);return n.set(a,s),s},invalidate:t=>n.invalidate(`venue:${t}`),clearCache:()=>n.invalidate("venue:")}}function U(e){let n=R(e.cache),t=v({chainId:e.chainId,rpcUrl:e.rpcUrl,venueRegistryAddress:e.venueRegistryAddress,prophecyCoreAddress:e.prophecyCoreAddress,prophecySettlementAddress:e.prophecySettlementAddress}),r=e.venueId&&e.venueApiKey?M(e.venueId,e.venueApiKey):null,a={socialShare:()=>Promise.reject(new Error("venueId and venueApiKey required for event reporting")),receiptInspect:()=>Promise.reject(new Error("venueId and venueApiKey required for event reporting")),dailyChallenge:()=>Promise.reject(new Error("venueId and venueApiKey required for event reporting"))};return{chain:t,markets:L(e.dataApiUrl,n),eventsApi:h(e.dataApiUrl,n),venue:V(e.partnersApiUrl,n),user:D(e.partnersApiUrl,n),season:N(e.partnersApiUrl,n),leaderboard:{pp:i=>P(e.partnersApiUrl,i),pnl:i=>k(e.dataApiUrl,i),volume:i=>T(e.dataApiUrl,i)},faucet:I(e.partnersApiUrl,e.venueId??"",r),events:r?_(e.partnersApiUrl,r):a,arbiter:e.arbiterUrl?{rate:i=>b(e.arbiterUrl,i)}:{rate:()=>Promise.reject(new Error("arbiterUrl is required in ProphecyClientConfig to rate markets"))},auth:r}}c();var B=require("ai"),u=require("zod"),C=u.z.object({type:u.z.enum(["ai","creator"]).describe("ai = verifiable from URL, creator = manual resolution"),name:u.z.string().describe("Market title \u2014 frames the specific prediction"),description:u.z.string().describe("What will be extracted / resolution criteria"),tradingStartTs:u.z.string().describe("ISO 8601 \u2014 when trading opens"),tradingEndTs:u.z.string().describe("ISO 8601 \u2014 when trading closes"),resolutionStartTs:u.z.string().describe("ISO 8601 \u2014 when resolution can begin"),resolutionEndTs:u.z.string().describe("ISO 8601 \u2014 resolution deadline"),extractionPrompt:u.z.string().optional().describe("Prompt used to extract the answer from sources"),urls:u.z.array(u.z.string()).optional().describe("Credible source URLs (2-4 recommended)"),options:u.z.array(u.z.string()).optional().describe("Possible outcomes for string extractions"),expectedOutcome:u.z.string().optional().describe("The user's prediction \u2014 inferred from the question"),resultType:u.z.enum(["string","number"]).optional().describe("Type of extraction result")});function te(){return`You are a prediction market configurator. Given a user's question or prediction, create a structured market definition.
|
|
2
|
+
|
|
3
|
+
Today's date (UTC) is: ${new Date().toISOString().split("T")[0]}
|
|
4
|
+
|
|
5
|
+
Determine whether this market can be AI-resolved (outcome verifiable from public URLs) or needs creator resolution (subjective/manual).
|
|
6
|
+
|
|
7
|
+
For AI-resolved markets:
|
|
8
|
+
- Provide 2-4 credible, authoritative source URLs
|
|
9
|
+
- Write a clear extraction prompt for future data extraction
|
|
10
|
+
- Set the expected outcome (the user's prediction) inferred from their question
|
|
11
|
+
- Frame the market name to include the specific prediction (e.g., "England to win Euro 2024", NOT "Winner of Euro 2024")
|
|
12
|
+
- Choose string or number result type based on the outcome
|
|
13
|
+
|
|
14
|
+
For creator-resolved markets:
|
|
15
|
+
- Write a clear market name as a question
|
|
16
|
+
- Provide context and resolution criteria
|
|
17
|
+
|
|
18
|
+
Set appropriate timestamps:
|
|
19
|
+
- tradingStartTs: when trading opens (usually now or soon)
|
|
20
|
+
- tradingEndTs: when trading closes (usually just before the event)
|
|
21
|
+
- resolutionStartTs: when the outcome can be checked (usually when event concludes)
|
|
22
|
+
- resolutionEndTs: deadline for resolution (usually hours/days after event)`}async function $(e){let n=e.systemPrompt??te(),t=e.userTimeZone?`
|
|
23
|
+
User timezone: ${e.userTimeZone}. Interpret relative dates accordingly.`:"",{text:r}=await(0,B.generateText)({model:e.model,system:`${n}
|
|
24
|
+
|
|
25
|
+
Respond ONLY with valid JSON matching this schema. No markdown, no explanation.
|
|
26
|
+
Schema: ${JSON.stringify(C.shape)}`,prompt:`Create a prediction market for: "${e.question}"${t}`});return C.parse(JSON.parse(r))}var w=require("viem/accounts"),q=60,O={name:"VenueRegistry",version:"1"},re={CreateMarketPermit:[{name:"name",type:"string"},{name:"venueId",type:"uint256"},{name:"tradingStartTs",type:"uint256"},{name:"tradingEndTs",type:"uint256"},{name:"resolutionStartTs",type:"uint256"},{name:"resolutionEndTs",type:"uint256"},{name:"stakeToken",type:"address"},{name:"initialLiquidityBase",type:"uint256"},{name:"noMatchOutcome",type:"uint8"},{name:"resolverType",type:"uint8"},{name:"creator",type:"address"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}]},ne={TradePermit:[{name:"marketId",type:"uint256"},{name:"venueId",type:"uint256"},{name:"user",type:"address"},{name:"amount",type:"uint256"},{name:"action",type:"uint8"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}]};async function W(e){let n=(0,w.privateKeyToAccount)(e.operatorPrivateKey),t=BigInt(Math.floor(Date.now()/1e3)+q);return{signature:await n.signTypedData({domain:{...O,chainId:e.chainId,verifyingContract:e.venueRegistryAddress},types:ne,primaryType:"TradePermit",message:{marketId:e.marketId,venueId:e.venueId,user:e.user,amount:e.amount,action:e.action,nonce:e.nonce,deadline:t}}),signer:n.address,deadline:t}}async function F(e){let n=(0,w.privateKeyToAccount)(e.operatorPrivateKey),t=BigInt(Math.floor(Date.now()/1e3)+q);return{signature:await n.signTypedData({domain:{...O,chainId:e.chainId,verifyingContract:e.venueRegistryAddress},types:re,primaryType:"CreateMarketPermit",message:{name:e.name,venueId:e.venueId,tradingStartTs:BigInt(e.tradingStartTs),tradingEndTs:BigInt(e.tradingEndTs),resolutionStartTs:BigInt(e.resolutionStartTs),resolutionEndTs:BigInt(e.resolutionEndTs),stakeToken:e.stakeToken,initialLiquidityBase:e.initialLiquidityBase,noMatchOutcome:e.noMatchOutcome,resolverType:e.resolverType,creator:e.creator,nonce:e.nonce,deadline:t}}),signer:n.address,deadline:t}}0&&(module.exports={ApiError,createChainClient,createEventsApiNamespace,createMarketDefinition,createProphecyClient,getPPLeaderboard,getPnLLeaderboard,getVolumeLeaderboard,marketDefinitionSchema,rateMarketDraft,signCreateMarketPermit,signTradePermit});
|
|
27
|
+
//# sourceMappingURL=index.cjs.map
|