@prophecy-dev/sdk 0.1.2 → 0.1.4
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.cjs +48 -23
- package/dist/index.cjs.map +3 -3
- package/dist/index.js +45 -20
- package/dist/index.js.map +3 -3
- package/dist/market-prompts.d.ts +13 -0
- package/dist/market-prompts.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var oe=Object.defineProperty;var ce=(e,t)=>()=>(e&&(t=e(e=0)),t);var ue=(e,t)=>{for(var r in t)oe(e,r,{get:t[r],enumerable:!0})};var I={};ue(I,{ApiError:()=>m,authedDelete:()=>A,authedPost:()=>g,get:()=>o,post:()=>p});async function f(e,t={}){let r={"Content-Type":"application/json",...t.headers},n=await fetch(e,{method:t.method??"GET",headers:r,body:t.body?JSON.stringify(t.body):void 0});if(!n.ok){let i=await n.json().catch(()=>null);throw new m(n.status,i)}return n.json()}function o(e,t,r){let n=new URL(t,e);if(r)for(let[i,a]of Object.entries(r))a!==void 0&&n.searchParams.set(i,String(a));return f(n)}function p(e,t,r){return f(new URL(t,e),{method:"POST",body:r})}function g(e,t,r,n){return f(new URL(t,e),{method:"POST",body:r,headers:{Authorization:`Bearer ${n}`}})}function A(e,t,r){return f(new URL(t,e),{method:"DELETE",headers:{Authorization:`Bearer ${r}`}})}var m,u=ce(()=>{"use strict";m=class extends Error{constructor(r,n){super(`API error ${r}`);this.status=r;this.body=n;this.name="ApiError"}}});u();function q(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 le(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(t=>({key:t.key,name:t.name,criterionType:t.criterion_type,evaluation:t.evaluation,status:t.status,summary:t.summary,weight:t.weight,score:t.score,weightedScore:t.weighted_score}))}}async function R(e,t){return p(e,"/v1/arbiter/preview",q(t))}async function x(e,t){let r=await p(e,"/v1/arbiter/preview",q(t));return le(r)}async function k(e,t,r){return o(e,`/v1/arbiter/events/${t}/${r}`)}function _(e={}){let t=e.defaultTtlMs??15e3,r=new Map;return{get(n){if(t===0)return;let i=r.get(n);if(i){if(Date.now()>i.expiresAt){r.delete(n);return}return i.data}},set(n,i,a){let s=a??t;s!==0&&r.set(n,{data:i,expiresAt:Date.now()+s})},invalidate(n){for(let i of r.keys())i.startsWith(n)&&r.delete(i)},clear(){r.clear()}}}import{createPublicClient as de,defineChain as me,encodeFunctionData as pe,http as ge}from"viem";var he=[{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"}],b=[{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"}],ye=[{inputs:[{internalType:"uint256",name:"marketId",type:"uint256"}],name:"claimSettlement",outputs:[{internalType:"uint256",name:"payout",type:"uint256"}],stateMutability:"nonpayable",type:"function"}];function C(e){let t=me({id:e.chainId,name:`Somnia (${e.chainId})`,nativeCurrency:{name:"STT",symbol:"STT",decimals:18},rpcUrls:{default:{http:[e.rpcUrl]}}}),r=de({chain:t,transport:ge(e.rpcUrl)});return{async getVenueNonce(n,i){return r.readContract({address:e.venueRegistryAddress,abi:he,functionName:"getNonce",args:[n,i]})},async getMarketCore(n){let[i,a]=await r.readContract({address:e.prophecyCoreAddress,abi:b,functionName:"getMarketCore",args:[n]});return{core:i,name:a}},async getReserves(n){let[i,a]=await r.readContract({address:e.prophecyCoreAddress,abi:b,functionName:"getCurrentReserves",args:[n]});return{yesPool:i,noPool:a}},async getUserPosition(n,i){return await r.readContract({address:e.prophecyCoreAddress,abi:b,functionName:"getUserPosition",args:[n,i]})},async getUserPositions(n,i){if(n.length===0)return[];let a=n.map(l=>({address:e.prophecyCoreAddress,abi:b,functionName:"getUserPosition",args:[l,i]}));return(await r.multicall({contracts:a})).map(l=>l.status!=="success"?null:l.result)},encodeClaimSettlement(n){if(!e.prophecySettlementAddress)throw new Error("prophecySettlementAddress is required in ChainConfig for claim operations");return{to:e.prophecySettlementAddress,data:pe({abi:ye,functionName:"claimSettlement",args:[n]})}}}}function H(e,t){return{venueId:e,getAuthHeader:()=>`Bearer ${t}`}}function W(e,t){async function r(n,i){let a=new URL(`/v1/events${n}`,e),s=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json",Authorization:t.getAuthHeader()},body:JSON.stringify(i)});if(!s.ok){let l=await s.json().catch(()=>null),{ApiError:se}=await Promise.resolve().then(()=>(u(),I));throw new se(s.status,l)}return s.json()}return{socialShare:(n,i)=>r("/social-share",{wallet:n,marketId:i}),receiptInspect:(n,i)=>r("/receipt-inspect",{wallet:n,marketId:i}),dailyChallenge:n=>r("/daily-challenge",{wallet:n})}}u();function N(e,t){return{async search(r){let n=new URL("/v0/events",e);if(r?.q&&n.searchParams.set("q",r.q),r?.venue&&n.searchParams.set("venue",r.venue),r?.tag&&n.searchParams.set("tag",r.tag),r?.created_by&&n.searchParams.set("created_by",r.created_by),r?.sort&&n.searchParams.set("sort",r.sort),r?.order&&n.searchParams.set("order",r.order),r?.limit&&n.searchParams.set("limit",String(r.limit)),r?.cursor&&n.searchParams.set("cursor",r.cursor),r?.status)for(let s of r.status)n.searchParams.append("status",s);let i=await fetch(n,{headers:{"Content-Type":"application/json"}});if(!i.ok)throw new m(i.status,await i.json().catch(()=>null));let a=await i.json();return{items:a.items,hasMore:a.has_more,nextCursor:a.next_cursor}},async get(r,n){let i=`event:${r}:${n}`,a=t.get(i);if(a)return a;let s=await o(e,`/v0/events/${r}/${n}`);return t.set(i,s),s}}}u();function G(e,t,r){return{async eligibility(n){return o(e,`/v1/faucet/eligibility?wallet=${n.toLowerCase()}&venue=${t}`)},async claim(n){return r?g(e,"/v1/faucet/claim",{wallet:n.toLowerCase()},r.getAuthHeader()):{success:!1,error:"venueId and venueApiKey required for faucet claims"}}}}u();async function S(e,t){return o(e,"/v1/stats/top-traders",{venue:t?.venue,limit:t?.limit})}async function O(e,t){return o(e,"/v0/leaderboard/pnl",{venue:t?.venue,period:t?.period,limit:t?.limit,cursor:t?.cursor})}async function L(e,t){return o(e,"/v0/leaderboard/volume",{venue:t?.venue,period:t?.period,limit:t?.limit,cursor:t?.cursor})}u();function j(e,t){return{async search(r){let n=new URL("/v0/markets",e);if(r?.q&&n.searchParams.set("q",r.q),r?.venue&&n.searchParams.set("venue",r.venue),r?.sort&&n.searchParams.set("sort",r.sort),r?.order&&n.searchParams.set("order",r.order),r?.limit&&n.searchParams.set("limit",String(r.limit)),r?.cursor&&n.searchParams.set("cursor",r.cursor),r?.status)for(let a of r.status)n.searchParams.append("status",a);let i=await fetch(n,{headers:{"Content-Type":"application/json"}});if(!i.ok){let{ApiError:a}=await Promise.resolve().then(()=>(u(),I));throw new a(i.status,await i.json().catch(()=>null))}return i.json()},async get(r,n){let i=`market:${r}:${n}`,a=t.get(i);if(a)return a;let s=await o(e,`/v0/markets/${r}/${n}`);return t.set(i,s),s}}}u();function K(e,t){return{async active(){let r="season:active",n=t.get(r);if(n!==void 0)return n;let i=await o(e,"/v1/seasons/active").catch(()=>null);return t.set(r,i,6e4),i},async config(){let r="season:config",n=t.get(r);if(n!==void 0)return n;let i=await o(e,"/v1/seasons/active/config").catch(()=>null);return t.set(r,i,6e4),i}}}u();function J(e,t){return{async points(r,n){let i=`user:${r}:points:${n?.season??"current"}`,a=t.get(i);if(a)return a;let s=await o(e,`/v1/points/${r}`,n?.season?{season:n.season}:void 0);return t.set(i,s),s},async dashboard(r,n){let i=`user:${r}:dashboard:${n?.venue??"all"}`,a=t.get(i);if(a)return a;let s=await o(e,`/v1/users/${r}/dashboard`,n?.venue?{venue:n.venue}:void 0);return t.set(i,s),s},linkWallet:r=>p(e,"/v1/identity/link",r),linkedWallets:r=>o(e,`/v1/identity/${r}`)}}u();function X(e,t){return{markets:{async list(r,n){let i=`venue:${r}:markets:${n?.status??"all"}`,a=t.get(i);if(a)return a;let s=await o(e,`/v1/venues/${r}/markets`,{status:n?.status});return t.set(i,s),s},async add(r,n,i){let a=await g(e,`/v1/venues/${r}/markets`,{markets:n},i);return t.invalidate(`venue:${r}`),a},async remove(r,n,i,a){let s=await A(e,`/v1/venues/${r}/markets/${n}/${i}`,a);return t.invalidate(`venue:${r}`),s}},async stats(r,n){let i=`venue:${r}:stats:${n??"current"}`,a=t.get(i);if(a)return a;let s=await o(e,`/v1/points/venue/${r}`,n?{season:n}:void 0);return t.set(i,s),s},invalidate:r=>t.invalidate(`venue:${r}`),clearCache:()=>t.invalidate("venue:")}}function fe(e){let t=_(e.cache),r=C({chainId:e.chainId,rpcUrl:e.rpcUrl,venueRegistryAddress:e.venueRegistryAddress,prophecyCoreAddress:e.prophecyCoreAddress,prophecySettlementAddress:e.prophecySettlementAddress}),n=e.venueId&&e.venueApiKey?H(e.venueId,e.venueApiKey):null,i={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:r,markets:j(e.dataApiUrl,t),eventsApi:N(e.dataApiUrl,t),venue:X(e.partnersApiUrl,t),user:J(e.partnersApiUrl,t),season:K(e.partnersApiUrl,t),leaderboard:{pp:a=>S(e.partnersApiUrl,a),pnl:a=>O(e.dataApiUrl,a),volume:a=>L(e.dataApiUrl,a)},faucet:G(e.partnersApiUrl,e.venueId??"",n),events:n?W(e.partnersApiUrl,n):i,arbiter:{rate:a=>x(e.partnersApiUrl,a),preview:a=>R(e.partnersApiUrl,a),eventRating:(a,s)=>k(e.partnersApiUrl,a,s)},auth:n}}u();import{generateText as be}from"ai";import{z as c}from"zod";var U=c.object({type:c.enum(["ai","creator"]).describe("ai = verifiable from URL, creator = manual resolution"),name:c.string().describe("Market title \u2014 frames the specific prediction"),description:c.string().describe("What will be extracted / resolution criteria"),tradingStartTs:c.string().describe("ISO 8601 \u2014 when trading opens"),tradingEndTs:c.string().describe("ISO 8601 \u2014 when trading closes"),resolutionStartTs:c.string().describe("ISO 8601 \u2014 when resolution can begin"),resolutionEndTs:c.string().describe("ISO 8601 \u2014 resolution deadline"),extractionPrompt:c.string().optional().describe("Prompt used to extract the answer from sources"),urls:c.array(c.string()).optional().describe("Credible source URLs (2-4 recommended)"),options:c.array(c.string()).optional().describe("Possible outcomes for string extractions"),expectedOutcome:c.string().optional().describe("The user's prediction \u2014 inferred from the question"),resultType:c.enum(["string","number"]).optional().describe("Type of extraction result")});function ve(){return`You are a prediction market configurator. Given a user's question or prediction, create a structured market definition.
|
|
1
|
+
var se=Object.defineProperty;var ce=(e,t)=>()=>(e&&(t=e(e=0)),t);var ue=(e,t)=>{for(var r in t)se(e,r,{get:t[r],enumerable:!0})};var P={};ue(P,{ApiError:()=>m,authedDelete:()=>I,authedPost:()=>g,get:()=>s,post:()=>p});async function f(e,t={}){let r={"Content-Type":"application/json",...t.headers},n=await fetch(e,{method:t.method??"GET",headers:r,body:t.body?JSON.stringify(t.body):void 0});if(!n.ok){let a=await n.json().catch(()=>null);throw new m(n.status,a)}return n.json()}function s(e,t,r){let n=new URL(t,e);if(r)for(let[a,i]of Object.entries(r))i!==void 0&&n.searchParams.set(a,String(i));return f(n)}function p(e,t,r){return f(new URL(t,e),{method:"POST",body:r})}function g(e,t,r,n){return f(new URL(t,e),{method:"POST",body:r,headers:{Authorization:`Bearer ${n}`}})}function I(e,t,r){return f(new URL(t,e),{method:"DELETE",headers:{Authorization:`Bearer ${r}`}})}var m,u=ce(()=>{"use strict";m=class extends Error{constructor(r,n){super(`API error ${r}`);this.status=r;this.body=n;this.name="ApiError"}}});u();function q(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 le(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(t=>({key:t.key,name:t.name,criterionType:t.criterion_type,evaluation:t.evaluation,status:t.status,summary:t.summary,weight:t.weight,score:t.score,weightedScore:t.weighted_score}))}}async function R(e,t){return p(e,"/v1/arbiter/preview",q(t))}async function k(e,t){let r=await p(e,"/v1/arbiter/preview",q(t));return le(r)}async function x(e,t,r){return s(e,`/v1/arbiter/events/${t}/${r}`)}function C(e={}){let t=e.defaultTtlMs??15e3,r=new Map;return{get(n){if(t===0)return;let a=r.get(n);if(a){if(Date.now()>a.expiresAt){r.delete(n);return}return a.data}},set(n,a,i){let o=i??t;o!==0&&r.set(n,{data:a,expiresAt:Date.now()+o})},invalidate(n){for(let a of r.keys())a.startsWith(n)&&r.delete(a)},clear(){r.clear()}}}import{createPublicClient as de,defineChain as me,encodeFunctionData as pe,http as ge}from"viem";var he=[{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"}],b=[{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"}],ye=[{inputs:[{internalType:"uint256",name:"marketId",type:"uint256"}],name:"claimSettlement",outputs:[{internalType:"uint256",name:"payout",type:"uint256"}],stateMutability:"nonpayable",type:"function"}];function _(e){let t=me({id:e.chainId,name:`Somnia (${e.chainId})`,nativeCurrency:{name:"STT",symbol:"STT",decimals:18},rpcUrls:{default:{http:[e.rpcUrl]}}}),r=de({chain:t,transport:ge(e.rpcUrl)});return{async getVenueNonce(n,a){return r.readContract({address:e.venueRegistryAddress,abi:he,functionName:"getNonce",args:[n,a]})},async getMarketCore(n){let[a,i]=await r.readContract({address:e.prophecyCoreAddress,abi:b,functionName:"getMarketCore",args:[n]});return{core:a,name:i}},async getReserves(n){let[a,i]=await r.readContract({address:e.prophecyCoreAddress,abi:b,functionName:"getCurrentReserves",args:[n]});return{yesPool:a,noPool:i}},async getUserPosition(n,a){return await r.readContract({address:e.prophecyCoreAddress,abi:b,functionName:"getUserPosition",args:[n,a]})},async getUserPositions(n,a){if(n.length===0)return[];let i=n.map(l=>({address:e.prophecyCoreAddress,abi:b,functionName:"getUserPosition",args:[l,a]}));return(await r.multicall({contracts:i})).map(l=>l.status!=="success"?null:l.result)},encodeClaimSettlement(n){if(!e.prophecySettlementAddress)throw new Error("prophecySettlementAddress is required in ChainConfig for claim operations");return{to:e.prophecySettlementAddress,data:pe({abi:ye,functionName:"claimSettlement",args:[n]})}}}}function W(e,t){return{venueId:e,getAuthHeader:()=>`Bearer ${t}`}}function H(e,t){async function r(n,a){let i=new URL(`/v1/events${n}`,e),o=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Authorization:t.getAuthHeader()},body:JSON.stringify(a)});if(!o.ok){let l=await o.json().catch(()=>null),{ApiError:oe}=await Promise.resolve().then(()=>(u(),P));throw new oe(o.status,l)}return o.json()}return{socialShare:(n,a)=>r("/social-share",{wallet:n,marketId:a}),receiptInspect:(n,a)=>r("/receipt-inspect",{wallet:n,marketId:a}),dailyChallenge:n=>r("/daily-challenge",{wallet:n})}}u();function N(e,t){return{async search(r){let n=new URL("/v0/events",e);if(r?.q&&n.searchParams.set("q",r.q),r?.venue&&n.searchParams.set("venue",r.venue),r?.tag&&n.searchParams.set("tag",r.tag),r?.created_by&&n.searchParams.set("created_by",r.created_by),r?.sort&&n.searchParams.set("sort",r.sort),r?.order&&n.searchParams.set("order",r.order),r?.limit&&n.searchParams.set("limit",String(r.limit)),r?.cursor&&n.searchParams.set("cursor",r.cursor),r?.status)for(let o of r.status)n.searchParams.append("status",o);let a=await fetch(n,{headers:{"Content-Type":"application/json"}});if(!a.ok)throw new m(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(r,n){let a=`event:${r}:${n}`,i=t.get(a);if(i)return i;let o=await s(e,`/v0/events/${r}/${n}`);return t.set(a,o),o}}}u();function G(e,t,r){return{async eligibility(n){return s(e,`/v1/faucet/eligibility?wallet=${n.toLowerCase()}&venue=${t}`)},async claim(n){return r?g(e,"/v1/faucet/claim",{wallet:n.toLowerCase()},r.getAuthHeader()):{success:!1,error:"venueId and venueApiKey required for faucet claims"}}}}u();async function O(e,t){return s(e,"/v1/stats/top-traders",{venue:t?.venue,limit:t?.limit})}async function S(e,t){return s(e,"/v0/leaderboard/pnl",{venue:t?.venue,period:t?.period,limit:t?.limit,cursor:t?.cursor})}async function L(e,t){return s(e,"/v0/leaderboard/volume",{venue:t?.venue,period:t?.period,limit:t?.limit,cursor:t?.cursor})}u();function j(e,t){return{async search(r){let n=new URL("/v0/markets",e);if(r?.q&&n.searchParams.set("q",r.q),r?.venue&&n.searchParams.set("venue",r.venue),r?.sort&&n.searchParams.set("sort",r.sort),r?.order&&n.searchParams.set("order",r.order),r?.limit&&n.searchParams.set("limit",String(r.limit)),r?.cursor&&n.searchParams.set("cursor",r.cursor),r?.status)for(let i of r.status)n.searchParams.append("status",i);let a=await fetch(n,{headers:{"Content-Type":"application/json"}});if(!a.ok){let{ApiError:i}=await Promise.resolve().then(()=>(u(),P));throw new i(a.status,await a.json().catch(()=>null))}return a.json()},async get(r,n){let a=`market:${r}:${n}`,i=t.get(a);if(i)return i;let o=await s(e,`/v0/markets/${r}/${n}`);return t.set(a,o),o}}}u();function K(e,t){return{async active(){let r="season:active",n=t.get(r);if(n!==void 0)return n;let a=await s(e,"/v1/seasons/active").catch(()=>null);return t.set(r,a,6e4),a},async config(){let r="season:config",n=t.get(r);if(n!==void 0)return n;let a=await s(e,"/v1/seasons/active/config").catch(()=>null);return t.set(r,a,6e4),a}}}u();function J(e,t){return{async points(r,n){let a=`user:${r}:points:${n?.season??"current"}`,i=t.get(a);if(i)return i;let o=await s(e,`/v1/points/${r}`,n?.season?{season:n.season}:void 0);return t.set(a,o),o},async dashboard(r,n){let a=`user:${r}:dashboard:${n?.venue??"all"}`,i=t.get(a);if(i)return i;let o=await s(e,`/v1/users/${r}/dashboard`,n?.venue?{venue:n.venue}:void 0);return t.set(a,o),o},linkWallet:r=>p(e,"/v1/identity/link",r),linkedWallets:r=>s(e,`/v1/identity/${r}`)}}u();function X(e,t){return{markets:{async list(r,n){let a=`venue:${r}:markets:${n?.status??"all"}`,i=t.get(a);if(i)return i;let o=await s(e,`/v1/venues/${r}/markets`,{status:n?.status});return t.set(a,o),o},async add(r,n,a){let i=await g(e,`/v1/venues/${r}/markets`,{markets:n},a);return t.invalidate(`venue:${r}`),i},async remove(r,n,a,i){let o=await I(e,`/v1/venues/${r}/markets/${n}/${a}`,i);return t.invalidate(`venue:${r}`),o}},async stats(r,n){let a=`venue:${r}:stats:${n??"current"}`,i=t.get(a);if(i)return i;let o=await s(e,`/v1/points/venue/${r}`,n?{season:n}:void 0);return t.set(a,o),o},invalidate:r=>t.invalidate(`venue:${r}`),clearCache:()=>t.invalidate("venue:")}}function fe(e){let t=C(e.cache),r=_({chainId:e.chainId,rpcUrl:e.rpcUrl,venueRegistryAddress:e.venueRegistryAddress,prophecyCoreAddress:e.prophecyCoreAddress,prophecySettlementAddress:e.prophecySettlementAddress}),n=e.venueId&&e.venueApiKey?W(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:r,markets:j(e.dataApiUrl,t),eventsApi:N(e.dataApiUrl,t),venue:X(e.partnersApiUrl,t),user:J(e.partnersApiUrl,t),season:K(e.partnersApiUrl,t),leaderboard:{pp:i=>O(e.partnersApiUrl,i),pnl:i=>S(e.dataApiUrl,i),volume:i=>L(e.dataApiUrl,i)},faucet:G(e.partnersApiUrl,e.venueId??"",n),events:n?H(e.partnersApiUrl,n):a,arbiter:{rate:i=>k(e.partnersApiUrl,i),preview:i=>R(e.partnersApiUrl,i),eventRating:(i,o)=>x(e.partnersApiUrl,i,o)},auth:n}}u();import{generateText as be}from"ai";import{z as c}from"zod";var U=c.object({type:c.enum(["ai","creator"]).describe("ai = verifiable from URL, creator = manual resolution"),name:c.string().describe("Market title \u2014 frames the specific prediction"),description:c.string().describe("What will be extracted / resolution criteria"),tradingStartTs:c.string().describe("ISO 8601 \u2014 when trading opens"),tradingEndTs:c.string().describe("ISO 8601 \u2014 when trading closes"),resolutionStartTs:c.string().describe("ISO 8601 \u2014 when resolution can begin"),resolutionEndTs:c.string().describe("ISO 8601 \u2014 resolution deadline"),extractionPrompt:c.string().optional().describe("Prompt used to extract the answer from sources"),urls:c.array(c.string()).optional().describe("Credible source URLs (2-4 recommended)"),options:c.array(c.string()).optional().describe("Possible outcomes for string extractions"),expectedOutcome:c.string().optional().describe("The user's prediction \u2014 inferred from the question"),resultType:c.enum(["string","number"]).optional().describe("Type of extraction result")});function ve(){return`You are a prediction market configurator. Given a user's question or prediction, create a structured market definition.
|
|
2
2
|
|
|
3
3
|
Today's date (UTC) is: ${new Date().toISOString().split("T")[0]}
|
|
4
4
|
|
|
@@ -23,9 +23,25 @@ Set appropriate timestamps:
|
|
|
23
23
|
User timezone: ${e.userTimeZone}. Interpret relative dates accordingly.`:"",{text:n}=await be({model:e.model,system:`${t}
|
|
24
24
|
|
|
25
25
|
Respond ONLY with valid JSON matching this schema. No markdown, no explanation.
|
|
26
|
-
Schema: ${JSON.stringify(U.shape)}`,prompt:`Create a prediction market for: "${e.question}"${r}`});return U.parse(JSON.parse(n))}var h=["crypto","sport","pop_culture","technology","politics","science","entertainment"],v="politics",w=["country","person","company","team","crypto","topic"],Te=6,
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
Schema: ${JSON.stringify(U.shape)}`,prompt:`Create a prediction market for: "${e.question}"${r}`});return U.parse(JSON.parse(n))}var h=["crypto","sport","pop_culture","technology","politics","science","entertainment"],v="politics",w=["country","person","company","team","crypto","topic"],Te=6,Ee=4,Ae=.85,y=168,D=1,M=720,B=.05,$=.95,F=.02,Y=.95,Ie="100",Pe=60,Re=1,ke=5e3,d=["x.com","twitter.com","charts.spotify.com","xtracker.polymarket.com","www.youtube.com","youtube.com","www.espncricinfo.com","espncricinfo.com","liquipedia.net","www.dotabuff.com","dotabuff.com","www.premierleague.com","premierleague.com","gol.gg","www.gol.gg"],T={crypto:"1-4h",sport:"4-12h",news:"18-24h",politics:"18-24h"},z={"9-10":"massive global interest (Super Bowl, elections)","7-8":"mainstream (top-20 crypto, major sports leagues, significant news)","5-6":"niche interest","1-4":"very low interest"},Q={"9-10":"URL always contains the answer (CoinGecko, ESPN scoreboard)","7-8":"URL very likely has the answer (major news, official standings)","4-6":"uncertain (general news, social media)","1-3":"unlikely to have a clear answer"},Z={explicit:{min:.9,max:1,label:"URL explicitly states the outcome"},strong:{min:.5,max:.8,label:"Strong but indirect evidence"},tangential:{min:.1,max:.4,label:"Tangentially related content"},none:{min:0,max:.1,label:"No relevant information \u2014 UNKNOWN"}},E=.6,ee={frontrunner:{min:.1,max:.3},midfield:{min:.02,max:.08},backmarker:{min:.002,max:.02}},xe={categories:h,defaultCategory:v,entityTypes:w,viralityThreshold:6,resolutionConfidenceThreshold:4,similarityThreshold:.85,defaultDurationHours:168,minDurationHours:1,maxDurationHours:720,minBinaryProbability:.05,maxBinaryProbability:.95,minOptionProbability:.02,maxOptionProbability:.95,defaultLiquidity:"100",defaultTradingStartBufferSeconds:60,defaultResolutionHours:1,activeMarketCap:5e3,bannedDomains:d,durationHints:T,lowConfidenceOverride:E};function te(){return new Date().toUTCString()}function Ce(){return new Date().toISOString().slice(0,10)}function V(e){return`BANNED RESOLUTION DOMAINS (JS-rendered/auth-walled): ${e.join(", ")}. Use alternatives or set confidence \u2264 2.`}function re(e){return e.join("|")}function _e(e){let t={categories:h,defaultDurationHours:168,bannedDomains:d,includeResolutionMeta:!1,stalenessMode:"strict",requireCompleteOptions:!1,includeContentGuidelines:!1,...e},r=te(),n=t.includeResolutionMeta?`
|
|
27
|
+
"resolution_url_confidence": 7,
|
|
28
|
+
"is_already_decided": false,
|
|
29
|
+
"already_decided_reason": "",`:"",a=t.requireCompleteOptions?`- For multi-option markets (e.g., "Who will win?"), include ALL plausible options \u2014 do NOT truncate to a short list. Always include an "Other" option as the last choice.
|
|
30
|
+
- For multi-option markets, use web search to verify the options are CURRENT participants.`:'- For multi-option markets (e.g. "who will win"), use web search to verify the options are CURRENT participants. Always include an "Other" option as the last choice.',i=t.stalenessMode==="lenient"?`Staleness detection:
|
|
31
|
+
- ONLY set "is_already_decided": true if you have CONCRETE EVIDENCE that the event has ALREADY OCCURRED or the result is ALREADY KNOWN as of ${r}.
|
|
32
|
+
- Common stale patterns: awards already given, matches already played, deadlines already passed.
|
|
33
|
+
- If you cannot find information about an event, that does NOT mean it already happened. The user may be creating a market about something niche, internal, or not yet public. When in doubt, set "is_already_decided": false.`:`Staleness detection \u2014 CRITICAL:
|
|
34
|
+
- If the event has ALREADY OCCURRED or the result is ALREADY KNOWN as of ${r}, set "is_already_decided": true and explain in "already_decided_reason".
|
|
35
|
+
- Common stale patterns: awards already given, matches already played, nominations already announced, elections already held, records already broken, deadlines already passed.
|
|
36
|
+
- If unsure whether an event has happened, err on the side of caution and mark it as decided with a reason.
|
|
37
|
+
- Only create markets for events that are genuinely upcoming or currently unresolved.`,o=t.includeContentGuidelines?`
|
|
38
|
+
Content guidelines:
|
|
39
|
+
- No markets about violence, hate speech, self-harm, or illegal activity
|
|
40
|
+
- No markets that could manipulate real-world outcomes
|
|
41
|
+
- Markets should be verifiable using publicly available information`:"";return`You are a prediction market designer for Prophecy, a blockchain-based prediction market platform. Given a user's natural language prompt, generate a complete, well-structured prediction market.
|
|
42
|
+
|
|
43
|
+
CURRENT DATE/TIME: ${r}
|
|
44
|
+
Use this to assess whether events have already occurred or deadlines have passed.
|
|
29
45
|
|
|
30
46
|
Return ONLY valid JSON (no markdown, no code fences) with this exact structure:
|
|
31
47
|
{
|
|
@@ -38,38 +54,47 @@ Return ONLY valid JSON (no markdown, no code fences) with this exact structure:
|
|
|
38
54
|
"category": "${re(t.categories)}",
|
|
39
55
|
"subcategory": "a more specific subcategory",
|
|
40
56
|
"tags": ["relevant", "tags", "for", "discovery"],
|
|
41
|
-
"trading_end_time": "ISO 8601 UTC timestamp when trading should close",
|
|
42
|
-
"suggested_duration_hours":
|
|
43
|
-
"source_references": ["https://relevant-source.com/specific-page"]
|
|
57
|
+
"trading_end_time": "REQUIRED \u2014 ISO 8601 UTC timestamp when trading should close (e.g. 2026-04-22T00:00:00Z)",
|
|
58
|
+
"suggested_duration_hours": "ONLY if no specific date \u2014 hours until trading closes (1-720)",
|
|
59
|
+
"source_references": ["https://relevant-source.com/specific-page"],${n}
|
|
44
60
|
"news_context": [{"title": "Article headline", "url": "https://source.com/article", "source": "Publication Name"}]
|
|
45
61
|
}
|
|
46
62
|
|
|
47
63
|
News context (news_context field):
|
|
48
64
|
- Include 2-4 real, relevant news articles that provide background context for this market.
|
|
49
65
|
- Each entry needs: "title" (article headline), "url" (full URL to the article), "source" (publication name).
|
|
50
|
-
- Only include articles you found via web search \u2014 do NOT fabricate URLs.
|
|
66
|
+
- Prefer recent articles from reputable sources. Only include articles you found via web search \u2014 do NOT fabricate URLs.
|
|
67
|
+
- If you cannot find relevant articles, return an empty array [].
|
|
51
68
|
|
|
52
69
|
Rules:
|
|
53
70
|
- The question must be specific, unambiguous, and have a clear resolution date or condition
|
|
54
71
|
- CRITICAL: The event MUST be in the future. Use web search to verify the current state of events.
|
|
55
72
|
- If the user says "next X", search to find what the ACTUAL next upcoming X is \u2014 do NOT rely on your training data for schedules, fixtures, or dates.
|
|
56
73
|
- If a specific event has ALREADY HAPPENED (results exist), do NOT create a market for it. Find the next upcoming instance instead.
|
|
57
|
-
- Example: if user says "next F1 race winner" and the Australian GP already happened, find the actual next race on the calendar.
|
|
58
74
|
- If the user specifies custom options (not yes/no), use those options instead
|
|
59
|
-
|
|
75
|
+
${a}
|
|
60
76
|
- expected_result should be one of the options
|
|
61
|
-
-
|
|
62
|
-
-
|
|
77
|
+
- CRITICAL \u2014 TRADING END TIME: You MUST always set trading_end_time to an ISO 8601 UTC timestamp. Calculate this from the user's prompt:
|
|
78
|
+
- If the user mentions a date (e.g. "before April 22"), use that date: "2026-04-22T00:00:00Z"
|
|
79
|
+
- If the user mentions a timeframe (e.g. "this week"), calculate the end of that period
|
|
80
|
+
- If no date is mentioned, calculate from now + a reasonable duration for the event type
|
|
81
|
+
- The trading_end_time must ALWAYS be set. Do NOT leave it as the example string.
|
|
82
|
+
- suggested_duration_hours: Backup field. Set this to the number of hours between now and trading_end_time. If you set trading_end_time correctly, this field is derived from it.
|
|
63
83
|
- source_references should be real, relevant websites that could help verify the outcome \u2014 use FULL URLs to specific pages, not just domains
|
|
84
|
+
- source_references[0] is the URL the AI resolution agent will actually VISIT to determine the outcome. It must be a FULL URL to a specific page containing the relevant data.
|
|
64
85
|
- Do NOT guess URL path segments you are unsure about (e.g., race numbers, event IDs). Use stable hub/event pages instead.
|
|
65
|
-
-
|
|
86
|
+
- If you cannot find a reliable, specific URL, use a Google News search URL as fallback: https://news.google.com/search?q=relevant+search+terms
|
|
87
|
+
- The prompt field is what the AI resolver will see when resolving the market \u2014 make it a clear, answerable question with instructions on what data to check
|
|
66
88
|
- Keep descriptions concise but informative
|
|
67
89
|
- Tags should be lowercase, relevant keywords
|
|
68
90
|
${t.urlGuidance?`
|
|
69
91
|
${t.urlGuidance}`:""}
|
|
92
|
+
|
|
93
|
+
${i}
|
|
94
|
+
${o}
|
|
70
95
|
${t.extraInstructions?`
|
|
71
96
|
${t.extraInstructions}`:""}
|
|
72
|
-
${V(t.bannedDomains)}`}function Ne(e){let t={categories:h,durationHints:T,bannedDomains:d,...e},r=Object.entries(t.durationHints).map(([n,
|
|
97
|
+
${V(t.bannedDomains)}`}function Ne(e){let t={categories:h,durationHints:T,bannedDomains:d,...e},r=Object.entries(t.durationHints).map(([n,a])=>`${n} ${a}`).join(", ");return`You are a prediction market designer for Prophecy, a blockchain-based prediction market platform. Reframe market candidates as SHORT-DURATION prediction markets with clear, near-term resolution.
|
|
73
98
|
|
|
74
99
|
MARKET FORMAT:
|
|
75
100
|
|
|
@@ -102,8 +127,8 @@ QUESTION NAMING \u2014 be SPECIFIC:
|
|
|
102
127
|
Always include teams/competitors + competition, price thresholds + timeframe, specific event/award names, who + what + when. A reader must understand the question without additional context.
|
|
103
128
|
|
|
104
129
|
SCORING:
|
|
105
|
-
- virality_score (1-10): ${Object.entries(z).map(([n,
|
|
106
|
-
- resolution_url_confidence (1-10): ${Object.entries(Q).map(([n,
|
|
130
|
+
- virality_score (1-10): ${Object.entries(z).map(([n,a])=>`${n} ${a}`).join(", ")}.
|
|
131
|
+
- resolution_url_confidence (1-10): ${Object.entries(Q).map(([n,a])=>`${n} ${a}`).join(", ")}.
|
|
107
132
|
|
|
108
133
|
SOURCE-SPECIFIC RULES:
|
|
109
134
|
- Crypto: Use CoinGecko coin pages, confidence 9-10, duration 1-6h.
|
|
@@ -115,7 +140,7 @@ ${V(t.bannedDomains)}
|
|
|
115
140
|
|
|
116
141
|
source_references[0] is the URL the AI resolver visits. Must be a FULL URL to a specific page with relevant data. The "prompt" field tells the resolver exactly what to look for on that page.
|
|
117
142
|
${t.extraInstructions?`
|
|
118
|
-
${t.extraInstructions}`:""}`}function
|
|
143
|
+
${t.extraInstructions}`:""}`}function Oe(e){let t={minOptions:4,maxOptions:10,...e};return`You are a prediction market analyst. Given a list of market candidate headlines, identify groups of candidates that are about the SAME underlying event or competition and should be combined into a single multi-outcome market instead of separate binary yes/no markets.
|
|
119
144
|
|
|
120
145
|
Examples of candidates that should be grouped:
|
|
121
146
|
- "Will Naomi Osaka win the 2026 WTA Miami Open?" + "Will Aryna Sabalenka win the 2026 WTA Miami Open?" \u2192 "Who will win the 2026 WTA Miami Open?" with all realistic contenders
|
|
@@ -138,7 +163,7 @@ Return ONLY valid JSON (no markdown, no code fences):
|
|
|
138
163
|
|
|
139
164
|
If no candidates should be grouped, return: { "groups": [] }
|
|
140
165
|
${t.extraInstructions?`
|
|
141
|
-
${t.extraInstructions}`:""}`}function
|
|
166
|
+
${t.extraInstructions}`:""}`}function Se(e){let t={confidenceTiers:Z,lowConfidenceOverride:E,...e},r=t.confidenceTiers;return`You are evaluating whether a prediction market resolved correctly. You will be given the market question, resolution criteria, and content from a resolution URL. Your job is to determine the outcome based SOLELY on evidence found in the URL content.
|
|
142
167
|
|
|
143
168
|
EVIDENCE RULES:
|
|
144
169
|
- Your ONLY source of truth is the provided URL content. Nothing else.
|
|
@@ -179,7 +204,7 @@ ONLY select from candidate event ids. Return ONLY raw JSON:
|
|
|
179
204
|
${t.extraInstructions?`
|
|
180
205
|
${t.extraInstructions}`:""}`}function Ue(e){let t={calibration:ee,...e},r=t.calibration;return`You are a world-class probability estimation expert with deep domain knowledge. Given a group of mutually exclusive outcomes, estimate realistic probabilities that each will occur. Your probabilities MUST sum to exactly 1.0.
|
|
181
206
|
|
|
182
|
-
Current date: ${
|
|
207
|
+
Current date: ${Ce()}
|
|
183
208
|
|
|
184
209
|
CALIBRATION RULES \u2014 critical for realistic odds:
|
|
185
210
|
- Frontrunners/favorites should get MUCH higher probabilities than underdogs
|
|
@@ -257,5 +282,5 @@ Source-specific URL guidance:
|
|
|
257
282
|
${V(t.bannedDomains)}
|
|
258
283
|
If the only resolution URL for a market would be a banned domain, either find an alternative or set resolution_url_confidence to 2 or below.
|
|
259
284
|
${t.extraGuidance?`
|
|
260
|
-
${t.extraGuidance}`:""}`}function
|
|
285
|
+
${t.extraGuidance}`:""}`}function A(e,t){let r=t?.min??1,n=t?.max??720,a=t?.fallback??168,i=typeof e=="number"&&Number.isFinite(e)?e:a;return Math.min(n,Math.max(r,i))}function $e(e,t){let r=t?.min??.05,n=t?.max??.95;return Math.min(n,Math.max(r,e))}function Fe(e,t){let r=t?.min??.02,n=t?.max??.95,a=e.map(o=>Math.min(n,Math.max(r,o))),i=a.reduce((o,l)=>o+l,0);return i===0?e.map(()=>1/e.length):a.map(o=>o/i)}function Ye(e){try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function Ve(e,t){let r=new Set(t??d);try{let n=new URL(e).hostname;return r.has(n)||r.has(n.replace(/^www\./,""))}catch{return!1}}function qe(e){let t=e.replace(/[?!.,;:'"]/g,"").split(/\s+/).slice(0,10).join("+");return`https://news.google.com/search?q=${encodeURIComponent(t)}`}function We(e){let t=e.trim();if(t.includes("```")){let i=t.match(/```(?:json)?\s*([\s\S]*?)```/);i?.[1]&&(t=i[1].trim())}if(!t.startsWith("{")){let i=t.indexOf("{");i!==-1&&(t=t.slice(i))}if(t.includes("}")){let i=t.lastIndexOf("}");t=t.slice(0,i+1)}t=t.replace(/"(?:[^"\\]|\\.)*"/g,i=>i.replace(/\n/g,"\\n").replace(/\r/g,"\\r")),t=t.replace(/,\s*([}\]])/g,"$1");let r;try{r=JSON.parse(t)}catch{throw new Error("Failed to parse LLM response as JSON. Please try again.")}let n=r;if(typeof n.question!="string"||!n.question)throw new Error("Generated market is missing a question");if(!Array.isArray(n.options)||n.options.length<2)throw new Error("Generated market must have at least 2 options");let a;if(typeof n.trading_end_time=="string"&&n.trading_end_time){let i=new Date(n.trading_end_time),o=Date.now();!Number.isNaN(i.getTime())&&i.getTime()>o?a=A((i.getTime()-o)/36e5):a=A(n.suggested_duration_hours)}else a=A(n.suggested_duration_hours);return{question:n.question,description:n.description||"",resolution_criteria:n.resolution_criteria||"",prompt:n.prompt||n.question,options:n.options,expected_result:n.expected_result||n.options[0]||"",category:n.category||v,subcategory:n.subcategory||"",tags:Array.isArray(n.tags)?n.tags:[],suggested_duration_hours:a,source_references:Array.isArray(n.source_references)?n.source_references:[],_raw:n}}import{privateKeyToAccount as ne}from"viem/accounts";var ae=60,ie={name:"VenueRegistry",version:"1"},He={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"}]},Ge={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 je(e){let t=ne(e.operatorPrivateKey),r=BigInt(Math.floor(Date.now()/1e3)+ae);return{signature:await t.signTypedData({domain:{...ie,chainId:e.chainId,verifyingContract:e.venueRegistryAddress},types:Ge,primaryType:"TradePermit",message:{marketId:e.marketId,venueId:e.venueId,user:e.user,amount:e.amount,action:e.action,nonce:e.nonce,deadline:r}}),signer:t.address,deadline:r}}async function Ke(e){let t=ne(e.operatorPrivateKey),r=BigInt(Math.floor(Date.now()/1e3)+ae);return{signature:await t.signTypedData({domain:{...ie,chainId:e.chainId,verifyingContract:e.venueRegistryAddress},types:He,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:r}}),signer:t.address,deadline:r}}export{ke as ACTIVE_MARKET_CAP,m as ApiError,d as BANNED_DOMAINS,h as CATEGORIES,v as DEFAULT_CATEGORY,y as DEFAULT_DURATION_HOURS,Ie as DEFAULT_LIQUIDITY,Re as DEFAULT_RESOLUTION_HOURS,Pe as DEFAULT_TRADING_START_BUFFER_SECONDS,T as DURATION_HINTS,w as ENTITY_TYPES,E as LOW_CONFIDENCE_OVERRIDE,xe as MARKET_DEFAULTS,$ as MAX_BINARY_PROBABILITY,M as MAX_DURATION_HOURS,Y as MAX_OPTION_PROBABILITY,B as MIN_BINARY_PROBABILITY,D as MIN_DURATION_HOURS,F as MIN_OPTION_PROBABILITY,Ee as RESOLUTION_CONFIDENCE_THRESHOLD,Ae as SIMILARITY_THRESHOLD,Te as VIRALITY_THRESHOLD,Le as buildCarouselPrompt,De as buildEntityExtractionPrompt,Oe as buildGroupingPrompt,_e as buildMarketGenerationPrompt,Me as buildNewsContextPrompt,Ue as buildProbabilityEstimationPrompt,Ne as buildReframePrompt,Se as buildResolutionEvalPrompt,Be as buildUrlGuidanceBlock,$e as clampBinaryProbability,A as clampDuration,C as createCache,_ as createChainClient,N as createEventsApiNamespace,we as createMarketDefinition,fe as createProphecyClient,x as getEventRating,O as getPPLeaderboard,S as getPnLLeaderboard,L as getVolumeLeaderboard,qe as googleNewsFallbackUrl,Ve as isBannedDomain,Ye as isValidUrl,U as marketDefinitionSchema,Fe as normalizeOptionProbabilities,We as parseLlmMarketJson,R as previewRating,k as rateMarketDraft,Ke as signCreateMarketPermit,je as signTradePermit};
|
|
261
286
|
//# sourceMappingURL=index.js.map
|