investing 0.1.63 → 0.1.64
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/LICENSE-PredictOS-MIT +22 -0
- package/NOTICE +10 -0
- package/README.md +139 -8
- package/dist/{archiver-web.es-CHo1JpUb.js → archiver-web.es-B69gABHP.js} +1 -1
- package/dist/{archiver-web.es-CzhDvJfX.cjs → archiver-web.es-fg4bLLZa.cjs} +1 -1
- package/dist/bookmakerAnalysis-Bfo1zUVm.js +1 -0
- package/dist/bookmakerAnalysis-CHn1W8uX.cjs +1 -0
- package/dist/callGrok-D0D7zBHK.js +1 -0
- package/dist/callGrok-DWO719mN.cjs +1 -0
- package/dist/db/index.d.ts +0 -17
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/schema.d.ts +0 -17
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/events-BJOyGWeU.cjs +1 -0
- package/dist/events-OvBb8rgy.js +1 -0
- package/dist/index-D7fsk2gy.js +15 -0
- package/dist/index-_V1Ql5Es.cjs +13 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/polymarket-updown-15-limit-order-bot-DCC8HE9Z.cjs +1 -0
- package/dist/polymarket-updown-15-limit-order-bot-Dv5oGAF4.js +1 -0
- package/dist/predictos/agents/bookmaker-agent.d.ts +8 -0
- package/dist/predictos/agents/bookmaker-agent.d.ts.map +1 -0
- package/dist/predictos/agents/event-analysis-agent.d.ts +8 -0
- package/dist/predictos/agents/event-analysis-agent.d.ts.map +1 -0
- package/dist/predictos/agents/index.d.ts +21 -0
- package/dist/predictos/agents/index.d.ts.map +1 -0
- package/dist/predictos/agents/index.js +1 -0
- package/dist/predictos/agents/index.mjs +1 -0
- package/dist/predictos/agents/mapper-agent.d.ts +17 -0
- package/dist/predictos/agents/mapper-agent.d.ts.map +1 -0
- package/dist/predictos/agents/polyfactual-research.d.ts +47 -0
- package/dist/predictos/agents/polyfactual-research.d.ts.map +1 -0
- package/dist/predictos/agents/polymarket-position-tracker.d.ts +31 -0
- package/dist/predictos/agents/polymarket-position-tracker.d.ts.map +1 -0
- package/dist/predictos/agents/polymarket-put-order.d.ts +88 -0
- package/dist/predictos/agents/polymarket-put-order.d.ts.map +1 -0
- package/dist/predictos/agents/polymarket-updown-15-limit-order-bot.d.ts +92 -0
- package/dist/predictos/agents/polymarket-updown-15-limit-order-bot.d.ts.map +1 -0
- package/dist/predictos/agents/x402-seller.d.ts +34 -0
- package/dist/predictos/agents/x402-seller.d.ts.map +1 -0
- package/dist/predictos/ai/callBlockRun.d.ts +54 -0
- package/dist/predictos/ai/callBlockRun.d.ts.map +1 -0
- package/dist/predictos/ai/callGrok.d.ts +22 -0
- package/dist/predictos/ai/callGrok.d.ts.map +1 -0
- package/dist/predictos/ai/callOpenAI.d.ts +19 -0
- package/dist/predictos/ai/callOpenAI.d.ts.map +1 -0
- package/dist/predictos/ai/http.d.ts +19 -0
- package/dist/predictos/ai/http.d.ts.map +1 -0
- package/dist/predictos/ai/index.d.ts +19 -0
- package/dist/predictos/ai/index.d.ts.map +1 -0
- package/dist/predictos/ai/index.js +1 -0
- package/dist/predictos/ai/index.mjs +1 -0
- package/dist/predictos/ai/prompts/analyzeEventMarkets.d.ts +12 -0
- package/dist/predictos/ai/prompts/analyzeEventMarkets.d.ts.map +1 -0
- package/dist/predictos/ai/prompts/arbitrageAnalysis.d.ts +14 -0
- package/dist/predictos/ai/prompts/arbitrageAnalysis.d.ts.map +1 -0
- package/dist/predictos/ai/prompts/bookmakerAnalysis.d.ts +17 -0
- package/dist/predictos/ai/prompts/bookmakerAnalysis.d.ts.map +1 -0
- package/dist/predictos/ai/prompts/searchQueryGenerator.d.ts +18 -0
- package/dist/predictos/ai/prompts/searchQueryGenerator.d.ts.map +1 -0
- package/dist/predictos/ai/types.d.ts +214 -0
- package/dist/predictos/ai/types.d.ts.map +1 -0
- package/dist/predictos/arbitrage.d.ts +8 -0
- package/dist/predictos/arbitrage.d.ts.map +1 -0
- package/dist/predictos/arbitrage.js +1 -0
- package/dist/predictos/arbitrage.mjs +1 -0
- package/dist/predictos/clients/polyfactual.d.ts +72 -0
- package/dist/predictos/clients/polyfactual.d.ts.map +1 -0
- package/dist/predictos/clients/polymarket.d.ts +283 -0
- package/dist/predictos/clients/polymarket.d.ts.map +1 -0
- package/dist/predictos/clients/x402.d.ts +213 -0
- package/dist/predictos/clients/x402.d.ts.map +1 -0
- package/dist/predictos/data/kalshi.d.ts +66 -0
- package/dist/predictos/data/kalshi.d.ts.map +1 -0
- package/dist/predictos/data/kalshi.js +1 -0
- package/dist/predictos/data/kalshi.mjs +1 -0
- package/dist/predictos/data/polymarket.d.ts +105 -0
- package/dist/predictos/data/polymarket.d.ts.map +1 -0
- package/dist/predictos/data/polymarket.js +1 -0
- package/dist/predictos/data/polymarket.mjs +1 -0
- package/dist/predictos/events.d.ts +9 -0
- package/dist/predictos/events.d.ts.map +1 -0
- package/dist/predictos/index.d.ts +22 -7
- package/dist/predictos/index.d.ts.map +1 -1
- package/dist/predictos/index.js +1 -0
- package/dist/predictos/index.mjs +1 -0
- package/dist/predictos/types.d.ts +408 -0
- package/dist/predictos/types.d.ts.map +1 -0
- package/dist/searchQueryGenerator-DIIs9xw5.js +1 -0
- package/dist/searchQueryGenerator-rCVblXJS.cjs +1 -0
- package/dist/stocks/index.d.ts +1 -0
- package/dist/stocks/index.d.ts.map +1 -1
- package/dist/stocks/quote-cache-service.d.ts +2 -11
- package/dist/stocks/quote-cache-service.d.ts.map +1 -1
- package/dist/stocks/unified-quote-service.d.ts +6 -15
- package/dist/stocks/unified-quote-service.d.ts.map +1 -1
- package/package.json +45 -6
- package/dist/index-CMo-RDDF.js +0 -15
- package/dist/index-CQ7pU1y2.cjs +0 -13
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../searchQueryGenerator-rCVblXJS.cjs"),t=require("../callGrok-DWO719mN.cjs"),r=require("./data/kalshi.js"),s="https://gamma-api.polymarket.com",o=["gpt-5.2","gpt-5.1","gpt-5-nano","gpt-4.1","gpt-4.1-mini"];function a(e){return o.includes(e)||e.startsWith("gpt-")}function n(e,t){return"polymarket"===e?`https://polymarket.com/event/${t}`:`https://kalshi.com/events/${t}`}exports.findArbitrage=async function(o,i={}){const c=Date.now(),{url:l,model:m}=o;if(!l)throw new Error("Missing required parameter: 'url'");if(!m)throw new Error("Missing required parameter: 'model'");const u=function(e){const t=e.toLowerCase();return t.includes("polymarket.com")?"polymarket":t.includes("kalshi.com")?"kalshi":null}(l);if(!u)throw new Error("Invalid URL. Must be a Polymarket or Kalshi market URL.");let p=null;const y="polymarket"===u?"kalshi":"polymarket";if("polymarket"===u){const e=function(e){try{const t=new URL(e).pathname.split("/").filter(e=>e);return"event"===t[0]&&t.length>=2?t[1]:null}catch{return null}}(l);if(!e)throw new Error("Could not extract event slug from Polymarket URL");p=await async function(e){try{const t=`${s}/events/slug/${e}`,r=await fetch(t);if(!r.ok)return console.error("Polymarket event fetch error:",r.status),null;const o=await r.json(),a=[];if(o.markets&&Array.isArray(o.markets))for(const e of o.markets){const t=e.question||e.title||"";let r=50;if(e.outcomePrices)try{const t=JSON.parse(e.outcomePrices);r=100*parseFloat(t[0])}catch{}t&&a.push({title:t,yesPrice:r})}return{eventTitle:o.title||e.replace(/-/g," "),markets:a,source:"polymarket",identifier:o.slug||e}}catch(t){return console.error("Error fetching Polymarket event:",t),null}}(e)}else{const e=function(e){try{const t=new URL(e).pathname.split("/").filter(e=>e);return("markets"===t[0]||"events"===t[0])&&t.length>=2?(t.length>=4?t[t.length-1]:t[1]).toUpperCase():null}catch{return null}}(l);if(!e)throw new Error("Could not extract ticker from Kalshi URL");p=await async function(e,t){try{const s=await r.dflowRequest(`/event/${e}`,{params:{withNestedMarkets:!0},apiKey:t}),o=[];if(s.markets&&Array.isArray(s.markets))for(const e of s.markets){const t=e.yesSubTitle||"";let r=50;if(e.yesBid&&e.yesAsk){r=(parseFloat(e.yesBid)+parseFloat(e.yesAsk))/2*100}else e.yesBid?r=100*parseFloat(e.yesBid):e.yesAsk&&(r=100*parseFloat(e.yesAsk));t&&o.push({title:t,yesPrice:r})}return{eventTitle:s.title||e,markets:o,source:"kalshi",identifier:e}}catch(s){return console.error("Error fetching Kalshi event:",s),null}}(e,i.dflowApiKey)}if(!p||0===p.markets.length)throw new Error(`Could not fetch event data from ${u}. The event may not exist or have no markets.`);const f=await async function(r,s,o,n,i){const{systemPrompt:c,userPrompt:l}=e.searchQueryGeneratorPrompt({title:r,sourcePlatform:s,targetPlatform:o});let m;if(a(n)){const e=await t.callOpenAIResponses(l,c,"text",n,1,{apiKey:i.openaiApiKey}),r=[];for(const t of e.output)if("message"===t.type){const e=t;r.push(...e.content)}m=r.map(e=>e.text).filter(e=>void 0!==e).join("").trim()}else{const e=await t.callGrokResponses(l,c,"text",n,1,void 0,{apiKey:i.xaiApiKey}),r=[];for(const t of e.output)if("message"===t.type){const e=t;r.push(...e.content)}m=r.map(e=>e.text).filter(e=>void 0!==e).join("").trim()}return m.replace(/['"]/g,"").trim().split(/\s+/).slice(0,2).join(" ")}(p.eventTitle,u,y,m,i);let k;if(k="polymarket"===y?await async function(e){try{const t=`${s}/public-search?q=${encodeURIComponent(e)}&events_status=open`,r=await fetch(t);if(!r.ok)return console.error("Polymarket search error:",r.status),[];const o=await r.json(),a=[];if(o.events&&Array.isArray(o.events))for(const e of o.events){const t=e.slug;if(e.markets&&Array.isArray(e.markets))for(const r of e.markets){const e=r.question||r.title||"";let s=50;if(r.outcomePrices)try{const e=JSON.parse(r.outcomePrices);s=100*parseFloat(e[0])}catch{}e&&a.push({title:e,yesPrice:s,identifier:t})}}return a}catch(t){return console.error("Error searching Polymarket:",t),[]}}(f):await async function(e,t){try{const s=await r.dflowRequest("/search",{params:{q:e,event_status:"open",withNestedMarkets:!0},apiKey:t}),o=[];if(s.events&&Array.isArray(s.events))for(const e of s.events){const t=e.ticker;if(e.markets&&Array.isArray(e.markets))for(const r of e.markets){const e=r.yesSubTitle||r.title||"";let s=50;if(r.yesAsk&&r.yesBid){s=(parseFloat(r.yesAsk)+parseFloat(r.yesBid))/2*100}else r.yesAsk?s=100*parseFloat(r.yesAsk):r.yesBid&&(s=100*parseFloat(r.yesBid));e&&o.push({title:e,yesPrice:s,identifier:t})}}return o}catch(s){return console.error("Error searching Kalshi:",s),[]}}(f,i.dflowApiKey),0===k.length){const e={source:u,name:p.eventTitle,identifier:p.identifier,yesPrice:p.markets[0]?.yesPrice||50,noPrice:100-(p.markets[0]?.yesPrice||50),url:n(u,p.identifier),rawData:{eventTitle:p.eventTitle,markets:p.markets}};return{analysis:{isSameMarket:!1,sameMarketConfidence:0,marketComparisonReasoning:`No matching markets found on ${y} for query "${f}"`,polymarketData:"polymarket"===u?e:void 0,kalshiData:"kalshi"===u?e:void 0,arbitrage:{hasArbitrage:!1},summary:`No matching markets found on ${y}. Cannot determine arbitrage opportunity.`,risks:["No matching market found on the other platform"],recommendation:"Try a different event or check if the market exists on both platforms."},model:"none",sourceMarket:u,searchedMarket:y,processingTimeMs:Date.now()-c}}const{analysis:h,modelUsed:d,tokensUsed:g}=await async function(r,s,o,i,c){const l={source:r.source,name:r.eventTitle,identifier:r.identifier,yesPrice:r.markets[0]?.yesPrice||50,noPrice:100-(r.markets[0]?.yesPrice||50),url:n(r.source,r.identifier)};l.rawData={eventTitle:r.eventTitle,markets:r.markets};const{systemPrompt:m,userPrompt:u}=e.arbitrageAnalysisPrompt({sourceMarket:l,searchResults:s,searchPlatform:o});let p,y,f;if(a(i)){const e=await t.callOpenAIResponses(u,m,"json_object",i,3,{apiKey:c.openaiApiKey});y=e.model,f=e.usage?.total_tokens;const r=[];for(const t of e.output)if("message"===t.type){const e=t;r.push(...e.content)}p=r.map(e=>e.text).filter(e=>void 0!==e).join("\n")}else{const e=await t.callGrokResponses(u,m,"json_object",i,3,void 0,{apiKey:c.xaiApiKey});y=e.model,f=e.usage?.total_tokens;const r=[];for(const t of e.output)if("message"===t.type){const e=t;r.push(...e.content)}p=r.map(e=>e.text).filter(e=>void 0!==e).join("\n")}const k=JSON.parse(p);return{analysis:{isSameMarket:k.isSameMarket,sameMarketConfidence:k.sameMarketConfidence,marketComparisonReasoning:k.marketComparisonReasoning,polymarketData:"polymarket"===r.source?l:k.matchedMarket||void 0,kalshiData:"kalshi"===r.source?l:k.matchedMarket||void 0,arbitrage:k.arbitrage,summary:k.summary,risks:k.risks,recommendation:k.recommendation},modelUsed:y,tokensUsed:f}}(p,k,y,m,i);return{analysis:h,model:d,tokensUsed:g,sourceMarket:u,searchedMarket:y,processingTimeMs:Date.now()-c}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as e,a as t}from"../searchQueryGenerator-DIIs9xw5.js";import{a as r,c as s}from"../callGrok-D0D7zBHK.js";import{dflowRequest as o}from"./data/kalshi.mjs";const a="https://gamma-api.polymarket.com",n=["gpt-5.2","gpt-5.1","gpt-5-nano","gpt-4.1","gpt-4.1-mini"];function i(e){return n.includes(e)||e.startsWith("gpt-")}function c(e,t){return"polymarket"===e?`https://polymarket.com/event/${t}`:`https://kalshi.com/events/${t}`}async function l(n,l={}){const m=Date.now(),{url:u,model:p}=n;if(!u)throw new Error("Missing required parameter: 'url'");if(!p)throw new Error("Missing required parameter: 'model'");const y=function(e){const t=e.toLowerCase();return t.includes("polymarket.com")?"polymarket":t.includes("kalshi.com")?"kalshi":null}(u);if(!y)throw new Error("Invalid URL. Must be a Polymarket or Kalshi market URL.");let f=null;const k="polymarket"===y?"kalshi":"polymarket";if("polymarket"===y){const e=function(e){try{const t=new URL(e).pathname.split("/").filter(e=>e);return"event"===t[0]&&t.length>=2?t[1]:null}catch{return null}}(u);if(!e)throw new Error("Could not extract event slug from Polymarket URL");f=await async function(e){try{const t=`${a}/events/slug/${e}`,r=await fetch(t);if(!r.ok)return console.error("Polymarket event fetch error:",r.status),null;const s=await r.json(),o=[];if(s.markets&&Array.isArray(s.markets))for(const e of s.markets){const t=e.question||e.title||"";let r=50;if(e.outcomePrices)try{const t=JSON.parse(e.outcomePrices);r=100*parseFloat(t[0])}catch{}t&&o.push({title:t,yesPrice:r})}return{eventTitle:s.title||e.replace(/-/g," "),markets:o,source:"polymarket",identifier:s.slug||e}}catch(t){return console.error("Error fetching Polymarket event:",t),null}}(e)}else{const e=function(e){try{const t=new URL(e).pathname.split("/").filter(e=>e);return("markets"===t[0]||"events"===t[0])&&t.length>=2?(t.length>=4?t[t.length-1]:t[1]).toUpperCase():null}catch{return null}}(u);if(!e)throw new Error("Could not extract ticker from Kalshi URL");f=await async function(e,t){try{const r=await o(`/event/${e}`,{params:{withNestedMarkets:!0},apiKey:t}),s=[];if(r.markets&&Array.isArray(r.markets))for(const e of r.markets){const t=e.yesSubTitle||"";let r=50;if(e.yesBid&&e.yesAsk){r=(parseFloat(e.yesBid)+parseFloat(e.yesAsk))/2*100}else e.yesBid?r=100*parseFloat(e.yesBid):e.yesAsk&&(r=100*parseFloat(e.yesAsk));t&&s.push({title:t,yesPrice:r})}return{eventTitle:r.title||e,markets:s,source:"kalshi",identifier:e}}catch(r){return console.error("Error fetching Kalshi event:",r),null}}(e,l.dflowApiKey)}if(!f||0===f.markets.length)throw new Error(`Could not fetch event data from ${y}. The event may not exist or have no markets.`);const h=await async function(t,o,a,n,c){const{systemPrompt:l,userPrompt:m}=e({title:t,sourcePlatform:o,targetPlatform:a});let u;if(i(n)){const e=await r(m,l,"text",n,1,{apiKey:c.openaiApiKey}),t=[];for(const r of e.output)if("message"===r.type){const e=r;t.push(...e.content)}u=t.map(e=>e.text).filter(e=>void 0!==e).join("").trim()}else{const e=await s(m,l,"text",n,1,void 0,{apiKey:c.xaiApiKey}),t=[];for(const r of e.output)if("message"===r.type){const e=r;t.push(...e.content)}u=t.map(e=>e.text).filter(e=>void 0!==e).join("").trim()}return u.replace(/['"]/g,"").trim().split(/\s+/).slice(0,2).join(" ")}(f.eventTitle,y,k,p,l);let d;if(d="polymarket"===k?await async function(e){try{const t=`${a}/public-search?q=${encodeURIComponent(e)}&events_status=open`,r=await fetch(t);if(!r.ok)return console.error("Polymarket search error:",r.status),[];const s=await r.json(),o=[];if(s.events&&Array.isArray(s.events))for(const e of s.events){const t=e.slug;if(e.markets&&Array.isArray(e.markets))for(const r of e.markets){const e=r.question||r.title||"";let s=50;if(r.outcomePrices)try{const e=JSON.parse(r.outcomePrices);s=100*parseFloat(e[0])}catch{}e&&o.push({title:e,yesPrice:s,identifier:t})}}return o}catch(t){return console.error("Error searching Polymarket:",t),[]}}(h):await async function(e,t){try{const r=await o("/search",{params:{q:e,event_status:"open",withNestedMarkets:!0},apiKey:t}),s=[];if(r.events&&Array.isArray(r.events))for(const e of r.events){const t=e.ticker;if(e.markets&&Array.isArray(e.markets))for(const r of e.markets){const e=r.yesSubTitle||r.title||"";let o=50;if(r.yesAsk&&r.yesBid){o=(parseFloat(r.yesAsk)+parseFloat(r.yesBid))/2*100}else r.yesAsk?o=100*parseFloat(r.yesAsk):r.yesBid&&(o=100*parseFloat(r.yesBid));e&&s.push({title:e,yesPrice:o,identifier:t})}}return s}catch(r){return console.error("Error searching Kalshi:",r),[]}}(h,l.dflowApiKey),0===d.length){const e={source:y,name:f.eventTitle,identifier:f.identifier,yesPrice:f.markets[0]?.yesPrice||50,noPrice:100-(f.markets[0]?.yesPrice||50),url:c(y,f.identifier),rawData:{eventTitle:f.eventTitle,markets:f.markets}};return{analysis:{isSameMarket:!1,sameMarketConfidence:0,marketComparisonReasoning:`No matching markets found on ${k} for query "${h}"`,polymarketData:"polymarket"===y?e:void 0,kalshiData:"kalshi"===y?e:void 0,arbitrage:{hasArbitrage:!1},summary:`No matching markets found on ${k}. Cannot determine arbitrage opportunity.`,risks:["No matching market found on the other platform"],recommendation:"Try a different event or check if the market exists on both platforms."},model:"none",sourceMarket:y,searchedMarket:k,processingTimeMs:Date.now()-m}}const{analysis:g,modelUsed:v,tokensUsed:w}=await async function(e,o,a,n,l){const m={source:e.source,name:e.eventTitle,identifier:e.identifier,yesPrice:e.markets[0]?.yesPrice||50,noPrice:100-(e.markets[0]?.yesPrice||50),url:c(e.source,e.identifier)};m.rawData={eventTitle:e.eventTitle,markets:e.markets};const{systemPrompt:u,userPrompt:p}=t({sourceMarket:m,searchResults:o,searchPlatform:a});let y,f,k;if(i(n)){const e=await r(p,u,"json_object",n,3,{apiKey:l.openaiApiKey});f=e.model,k=e.usage?.total_tokens;const t=[];for(const r of e.output)if("message"===r.type){const e=r;t.push(...e.content)}y=t.map(e=>e.text).filter(e=>void 0!==e).join("\n")}else{const e=await s(p,u,"json_object",n,3,void 0,{apiKey:l.xaiApiKey});f=e.model,k=e.usage?.total_tokens;const t=[];for(const r of e.output)if("message"===r.type){const e=r;t.push(...e.content)}y=t.map(e=>e.text).filter(e=>void 0!==e).join("\n")}const h=JSON.parse(y);return{analysis:{isSameMarket:h.isSameMarket,sameMarketConfidence:h.sameMarketConfidence,marketComparisonReasoning:h.marketComparisonReasoning,polymarketData:"polymarket"===e.source?m:h.matchedMarket||void 0,kalshiData:"kalshi"===e.source?m:h.matchedMarket||void 0,arbitrage:h.arbitrage,summary:h.summary,risks:h.risks,recommendation:h.recommendation},modelUsed:f,tokensUsed:k}}(f,d,k,p,l);return{analysis:g,model:v,tokensUsed:w,sourceMarket:y,searchedMarket:k,processingTimeMs:Date.now()-m}}export{l as findArbitrage};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Polyfactual Deep Research API client.
|
|
3
|
+
*
|
|
4
|
+
* A client for the Polyfactual Deep Research API that provides research
|
|
5
|
+
* capabilities with citations. Ported from the PredictOS `polyfactual` shared
|
|
6
|
+
* client.
|
|
7
|
+
*
|
|
8
|
+
* API Documentation:
|
|
9
|
+
* - Base URL: https://deep-research-api.thekid-solana.workers.dev/
|
|
10
|
+
* - Rate Limit: 60 requests per minute
|
|
11
|
+
* - Query Limit: 1,000 characters
|
|
12
|
+
* - Default Timeout: 5 minutes
|
|
13
|
+
*
|
|
14
|
+
* The API key is read from `process.env.POLYFACTUAL_API_KEY`.
|
|
15
|
+
*/
|
|
16
|
+
/** Request payload for the `/answer` endpoint. */
|
|
17
|
+
export interface PolyfactualAnswerRequest {
|
|
18
|
+
/** The research query (max 1000 characters) */
|
|
19
|
+
query: string;
|
|
20
|
+
/** Whether to return text output (default: true) */
|
|
21
|
+
text?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/** Success response from the Polyfactual API. */
|
|
24
|
+
export interface PolyfactualSuccessResponse {
|
|
25
|
+
success: true;
|
|
26
|
+
/** The generated answer and metadata */
|
|
27
|
+
data: PolyfactualAnswerData;
|
|
28
|
+
/** ISO 8601 timestamp */
|
|
29
|
+
timestamp: string;
|
|
30
|
+
}
|
|
31
|
+
/** Error response from the Polyfactual API. */
|
|
32
|
+
export interface PolyfactualErrorResponse {
|
|
33
|
+
success: false;
|
|
34
|
+
/** Error message */
|
|
35
|
+
error: string;
|
|
36
|
+
/** ISO 8601 timestamp */
|
|
37
|
+
timestamp: string;
|
|
38
|
+
}
|
|
39
|
+
/** Union type for Polyfactual API responses. */
|
|
40
|
+
export type PolyfactualResponse = PolyfactualSuccessResponse | PolyfactualErrorResponse;
|
|
41
|
+
/** Answer data structure from Polyfactual. */
|
|
42
|
+
export interface PolyfactualAnswerData {
|
|
43
|
+
/** The generated answer text */
|
|
44
|
+
answer?: string;
|
|
45
|
+
/** Citation sources */
|
|
46
|
+
citations?: PolyfactualCitation[];
|
|
47
|
+
/** Additional metadata */
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
}
|
|
50
|
+
/** Citation structure. */
|
|
51
|
+
export interface PolyfactualCitation {
|
|
52
|
+
/** Source URL */
|
|
53
|
+
url?: string;
|
|
54
|
+
/** Source title */
|
|
55
|
+
title?: string;
|
|
56
|
+
/** Snippet from the source */
|
|
57
|
+
snippet?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Check the health status of the Polyfactual API.
|
|
61
|
+
*/
|
|
62
|
+
export declare function checkPolyfactualHealth(): Promise<boolean>;
|
|
63
|
+
/**
|
|
64
|
+
* Generate an answer with citations using the Polyfactual Deep Research API.
|
|
65
|
+
*
|
|
66
|
+
* @param query - The research question (max 1000 characters)
|
|
67
|
+
* @param text - Whether to return text output (default: true)
|
|
68
|
+
* @returns The research response with answer and citations
|
|
69
|
+
* @throws Error if the API key is missing, query is too long, or the request fails
|
|
70
|
+
*/
|
|
71
|
+
export declare function generatePolyfactualAnswer(query: string, text?: boolean): Promise<PolyfactualSuccessResponse>;
|
|
72
|
+
//# sourceMappingURL=polyfactual.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polyfactual.d.ts","sourceRoot":"","sources":["../../../src/predictos/clients/polyfactual.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,kDAAkD;AAClD,MAAM,WAAW,wBAAwB;IACvC,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,iDAAiD;AACjD,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,IAAI,CAAC;IACd,wCAAwC;IACxC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,+CAA+C;AAC/C,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,KAAK,CAAC;IACf,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,gDAAgD;AAChD,MAAM,MAAM,mBAAmB,GAAG,0BAA0B,GAAG,wBAAwB,CAAC;AAExF,8CAA8C;AAC9C,MAAM,WAAW,qBAAqB;IACpC,gCAAgC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uBAAuB;IACvB,SAAS,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAClC,0BAA0B;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,0BAA0B;AAC1B,MAAM,WAAW,mBAAmB;IAClC,iBAAiB;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAgDD;;GAEG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,OAAO,CAAC,CAW/D;AAED;;;;;;;GAOG;AACH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,OAAc,GACnB,OAAO,CAAC,0BAA0B,CAAC,CA0ErC"}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Polymarket CLOB client (ported from the PredictOS `polymarket` shared client).
|
|
3
|
+
*
|
|
4
|
+
* Provides functionality to:
|
|
5
|
+
* - Fetch market data from the Gamma API
|
|
6
|
+
* - Place orders on the Polymarket CLOB using the official
|
|
7
|
+
* `@polymarket/clob-client`
|
|
8
|
+
* - Read positions/activity from the public Data API
|
|
9
|
+
*
|
|
10
|
+
* This is distinct from the Dome-based market-data client in
|
|
11
|
+
* `data/polymarket.ts`: this module is the order-placement / trading-bot client
|
|
12
|
+
* for the 15-minute up/down markets.
|
|
13
|
+
*/
|
|
14
|
+
/** Supported assets for 15-minute up/down markets. */
|
|
15
|
+
export type SupportedAsset = "BTC" | "SOL" | "ETH" | "XRP";
|
|
16
|
+
/** Market data from the Gamma API. */
|
|
17
|
+
export interface PolymarketMarket {
|
|
18
|
+
id: string;
|
|
19
|
+
question: string;
|
|
20
|
+
conditionId: string;
|
|
21
|
+
slug: string;
|
|
22
|
+
title: string;
|
|
23
|
+
description: string;
|
|
24
|
+
outcomes: string;
|
|
25
|
+
outcomePrices: string;
|
|
26
|
+
volume: string;
|
|
27
|
+
volume24hr: number;
|
|
28
|
+
clobTokenIds: string;
|
|
29
|
+
acceptingOrders: boolean;
|
|
30
|
+
active: boolean;
|
|
31
|
+
closed: boolean;
|
|
32
|
+
endDate: string;
|
|
33
|
+
startDate: string;
|
|
34
|
+
}
|
|
35
|
+
/** Parsed token IDs for Up and Down outcomes. */
|
|
36
|
+
export interface TokenIds {
|
|
37
|
+
up: string;
|
|
38
|
+
down: string;
|
|
39
|
+
}
|
|
40
|
+
/** Order side type. */
|
|
41
|
+
export type OrderSideType = "BUY" | "SELL";
|
|
42
|
+
/** Order arguments for creating a new order. */
|
|
43
|
+
export interface OrderArgs {
|
|
44
|
+
tokenId: string;
|
|
45
|
+
price: number;
|
|
46
|
+
size: number;
|
|
47
|
+
side: OrderSideType;
|
|
48
|
+
}
|
|
49
|
+
/** Order response from the CLOB API. */
|
|
50
|
+
export interface OrderResponse {
|
|
51
|
+
success: boolean;
|
|
52
|
+
orderId?: string;
|
|
53
|
+
errorMsg?: string;
|
|
54
|
+
transactionHash?: string;
|
|
55
|
+
status?: string;
|
|
56
|
+
}
|
|
57
|
+
/** Log entry for bot execution. */
|
|
58
|
+
export interface BotLogEntry {
|
|
59
|
+
timestamp: string;
|
|
60
|
+
level: "INFO" | "WARN" | "ERROR" | "SUCCESS";
|
|
61
|
+
message: string;
|
|
62
|
+
details?: Record<string, unknown>;
|
|
63
|
+
}
|
|
64
|
+
/** Polymarket client configuration. */
|
|
65
|
+
export interface PolymarketClientConfig {
|
|
66
|
+
/** Private key for signing orders */
|
|
67
|
+
privateKey: string;
|
|
68
|
+
/** Proxy/funder address (shown under profile pic on Polymarket) */
|
|
69
|
+
proxyAddress: string;
|
|
70
|
+
/** Signature type: 0 = EOA, 1 = Magic/Email, 2 = Browser Wallet */
|
|
71
|
+
signatureType?: number;
|
|
72
|
+
}
|
|
73
|
+
/** Order status from CLOB API. */
|
|
74
|
+
export type OrderStatus = "LIVE" | "MATCHED" | "CANCELLED" | "EXPIRED" | "FILLED" | "PARTIALLY_FILLED";
|
|
75
|
+
/** Open order from CLOB API. */
|
|
76
|
+
export interface OpenOrder {
|
|
77
|
+
id: string;
|
|
78
|
+
market: string;
|
|
79
|
+
asset_id: string;
|
|
80
|
+
side: OrderSideType;
|
|
81
|
+
price: string;
|
|
82
|
+
size_matched: string;
|
|
83
|
+
original_size: string;
|
|
84
|
+
status: OrderStatus;
|
|
85
|
+
created_at: number;
|
|
86
|
+
expiration: number;
|
|
87
|
+
}
|
|
88
|
+
/** Trade/fill from CLOB API. */
|
|
89
|
+
export interface Trade {
|
|
90
|
+
id: string;
|
|
91
|
+
taker_order_id: string;
|
|
92
|
+
market: string;
|
|
93
|
+
asset_id: string;
|
|
94
|
+
side: OrderSideType;
|
|
95
|
+
price: string;
|
|
96
|
+
size: string;
|
|
97
|
+
fee_rate_bps: string;
|
|
98
|
+
status: string;
|
|
99
|
+
match_time: number;
|
|
100
|
+
owner: string;
|
|
101
|
+
transaction_hash?: string;
|
|
102
|
+
}
|
|
103
|
+
/** Position for a single side (YES or NO). */
|
|
104
|
+
export interface SidePosition {
|
|
105
|
+
/** Total shares filled */
|
|
106
|
+
shares: number;
|
|
107
|
+
/** Total cost in USD */
|
|
108
|
+
costUsd: number;
|
|
109
|
+
/** Average price per share */
|
|
110
|
+
avgPrice: number;
|
|
111
|
+
/** Number of orders placed */
|
|
112
|
+
ordersPlaced: number;
|
|
113
|
+
/** Number of orders filled (partially or fully) */
|
|
114
|
+
ordersFilled: number;
|
|
115
|
+
/** Pending shares (orders placed but not filled) */
|
|
116
|
+
pendingShares: number;
|
|
117
|
+
}
|
|
118
|
+
/** Pair position status. */
|
|
119
|
+
export type PairStatus = "PROFIT_LOCKED" | "BREAK_EVEN" | "LOSS_RISK" | "DIRECTIONAL_YES" | "DIRECTIONAL_NO" | "PENDING" | "NO_POSITION";
|
|
120
|
+
/** Combined position for a market. */
|
|
121
|
+
export interface MarketPosition {
|
|
122
|
+
/** Market slug identifier */
|
|
123
|
+
marketSlug: string;
|
|
124
|
+
/** Market title */
|
|
125
|
+
marketTitle?: string;
|
|
126
|
+
/** Token IDs */
|
|
127
|
+
tokenIds: TokenIds;
|
|
128
|
+
/** YES side position */
|
|
129
|
+
yes: SidePosition;
|
|
130
|
+
/** NO side position */
|
|
131
|
+
no: SidePosition;
|
|
132
|
+
/** Combined pair cost (avgYes + avgNo) - only valid when both sides have shares */
|
|
133
|
+
pairCost: number | null;
|
|
134
|
+
/** Position status */
|
|
135
|
+
status: PairStatus;
|
|
136
|
+
/** Minimum shares between YES and NO (determines guaranteed payout) */
|
|
137
|
+
minShares: number;
|
|
138
|
+
/** Guaranteed payout (minShares * $1.00) */
|
|
139
|
+
guaranteedPayout: number;
|
|
140
|
+
/** Total cost for matched pairs */
|
|
141
|
+
totalCost: number;
|
|
142
|
+
/** Guaranteed profit for matched pairs */
|
|
143
|
+
guaranteedProfit: number;
|
|
144
|
+
/** Return percentage for matched pairs */
|
|
145
|
+
returnPercent: number;
|
|
146
|
+
/** Timestamp of last update */
|
|
147
|
+
lastUpdated: string;
|
|
148
|
+
}
|
|
149
|
+
/** Asset slug prefixes for 15-minute up/down markets. */
|
|
150
|
+
export declare const ASSET_SLUG_PREFIXES: Record<SupportedAsset, string>;
|
|
151
|
+
/** Get the market slug for a given asset and timestamp. */
|
|
152
|
+
export declare function buildMarketSlug(asset: SupportedAsset, timestamp: number): string;
|
|
153
|
+
/** Format a Unix timestamp to a short time string (HH:MM:SS UTC). */
|
|
154
|
+
export declare function formatTimeShort(ts: number): string;
|
|
155
|
+
/** Create a log entry with current timestamp. */
|
|
156
|
+
export declare function createLogEntry(level: BotLogEntry["level"], message: string, details?: Record<string, unknown>): BotLogEntry;
|
|
157
|
+
/**
|
|
158
|
+
* Parse token IDs from market data.
|
|
159
|
+
* Returns [upTokenId, downTokenId].
|
|
160
|
+
*/
|
|
161
|
+
export declare function parseTokenIds(clobTokenIdsStr: string): [string, string];
|
|
162
|
+
/**
|
|
163
|
+
* Polymarket Client Class
|
|
164
|
+
*/
|
|
165
|
+
export declare class PolymarketClient {
|
|
166
|
+
private config;
|
|
167
|
+
private logs;
|
|
168
|
+
private clobClient;
|
|
169
|
+
constructor(config: PolymarketClientConfig);
|
|
170
|
+
/**
|
|
171
|
+
* Get collected logs
|
|
172
|
+
*/
|
|
173
|
+
getLogs(): BotLogEntry[];
|
|
174
|
+
/**
|
|
175
|
+
* Clear logs
|
|
176
|
+
*/
|
|
177
|
+
clearLogs(): void;
|
|
178
|
+
/**
|
|
179
|
+
* Add a log entry
|
|
180
|
+
*/
|
|
181
|
+
private log;
|
|
182
|
+
/**
|
|
183
|
+
* Initialize the CLOB client with API credentials
|
|
184
|
+
*/
|
|
185
|
+
private initClobClient;
|
|
186
|
+
/**
|
|
187
|
+
* Fetch market data from Gamma API by slug
|
|
188
|
+
*/
|
|
189
|
+
getMarketBySlug(slug: string): Promise<PolymarketMarket | null>;
|
|
190
|
+
/**
|
|
191
|
+
* Extract Up and Down token IDs from market data
|
|
192
|
+
*/
|
|
193
|
+
extractTokenIds(market: PolymarketMarket): TokenIds;
|
|
194
|
+
/**
|
|
195
|
+
* Place a limit buy order on Polymarket CLOB
|
|
196
|
+
*/
|
|
197
|
+
placeOrder(order: OrderArgs): Promise<OrderResponse>;
|
|
198
|
+
/**
|
|
199
|
+
* Place straddle orders (buy both Up and Down) at a given price
|
|
200
|
+
*/
|
|
201
|
+
placeStraddleOrders(tokenIds: TokenIds, price: number, sizeUsd: number): Promise<{
|
|
202
|
+
up: OrderResponse;
|
|
203
|
+
down: OrderResponse;
|
|
204
|
+
}>;
|
|
205
|
+
/**
|
|
206
|
+
* Calculate ladder rungs with exponential taper allocation
|
|
207
|
+
* Heavy allocation at top (maxPrice), tapering down to minPrice
|
|
208
|
+
* Ensures minimum allocation per rung to guarantee 5+ shares at any price level
|
|
209
|
+
*/
|
|
210
|
+
calculateLadderRungs(totalBankroll: number, maxPrice?: number, minPrice?: number, taperFactor?: number): Array<{
|
|
211
|
+
pricePercent: number;
|
|
212
|
+
priceDecimal: number;
|
|
213
|
+
sizeUsd: number;
|
|
214
|
+
allocationPercent: number;
|
|
215
|
+
}>;
|
|
216
|
+
/**
|
|
217
|
+
* Place ladder orders - straddle orders at multiple price levels with tapered allocation
|
|
218
|
+
*/
|
|
219
|
+
placeLadderOrders(tokenIds: TokenIds, totalBankroll: number, maxPrice?: number, minPrice?: number, taperFactor?: number): Promise<{
|
|
220
|
+
rungs: Array<{
|
|
221
|
+
pricePercent: number;
|
|
222
|
+
priceDecimal: number;
|
|
223
|
+
sizeUsd: number;
|
|
224
|
+
allocationPercent: number;
|
|
225
|
+
}>;
|
|
226
|
+
results: Array<{
|
|
227
|
+
pricePercent: number;
|
|
228
|
+
sizeUsd: number;
|
|
229
|
+
up: OrderResponse;
|
|
230
|
+
down: OrderResponse;
|
|
231
|
+
}>;
|
|
232
|
+
totalOrders: number;
|
|
233
|
+
successfulOrders: number;
|
|
234
|
+
}>;
|
|
235
|
+
/**
|
|
236
|
+
* Get user positions from public Data API
|
|
237
|
+
* No authentication required - uses proxy wallet address
|
|
238
|
+
*/
|
|
239
|
+
getPositions(options?: {
|
|
240
|
+
market?: string;
|
|
241
|
+
}): Promise<Array<{
|
|
242
|
+
asset: string;
|
|
243
|
+
size: number;
|
|
244
|
+
avgPrice: number;
|
|
245
|
+
outcome: string;
|
|
246
|
+
conditionId: string;
|
|
247
|
+
}>>;
|
|
248
|
+
/**
|
|
249
|
+
* Get user activity (trades) from public Data API
|
|
250
|
+
* No authentication required - uses proxy wallet address
|
|
251
|
+
*/
|
|
252
|
+
getActivity(options?: {
|
|
253
|
+
market?: string;
|
|
254
|
+
asset?: string;
|
|
255
|
+
}): Promise<Array<{
|
|
256
|
+
asset: string;
|
|
257
|
+
size: number;
|
|
258
|
+
price: number;
|
|
259
|
+
side: string;
|
|
260
|
+
outcome: string;
|
|
261
|
+
conditionId: string;
|
|
262
|
+
timestamp: number;
|
|
263
|
+
type: string;
|
|
264
|
+
}>>;
|
|
265
|
+
/**
|
|
266
|
+
* Get a specific order by ID
|
|
267
|
+
*/
|
|
268
|
+
getOrder(orderId: string): Promise<OpenOrder | null>;
|
|
269
|
+
/**
|
|
270
|
+
* Determine pair status based on positions
|
|
271
|
+
*/
|
|
272
|
+
private determinePairStatus;
|
|
273
|
+
/**
|
|
274
|
+
* Get position for a specific market using public Data API
|
|
275
|
+
* Uses the positions endpoint which returns size and avgPrice directly
|
|
276
|
+
*/
|
|
277
|
+
getMarketPosition(marketSlug: string, tokenIds: TokenIds, marketTitle?: string): Promise<MarketPosition>;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Create a Polymarket client from environment variables
|
|
281
|
+
*/
|
|
282
|
+
export declare function createClientFromEnv(): PolymarketClient;
|
|
283
|
+
//# sourceMappingURL=polymarket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polymarket.d.ts","sourceRoot":"","sources":["../../../src/predictos/clients/polymarket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH,sDAAsD;AACtD,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAE3D,sCAAsC;AACtC,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,iDAAiD;AACjD,MAAM,W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
/**
|
|
2
|
+
* x402 client (ported from the PredictOS `x402` shared client).
|
|
3
|
+
*
|
|
4
|
+
* Provides functionality to:
|
|
5
|
+
* 1. List sellers from the x402 bazaar
|
|
6
|
+
* 2. Call x402-protected endpoints with automatic payment
|
|
7
|
+
*
|
|
8
|
+
* Supports both EVM (Base) and Solana mainnet networks. Automatically detects
|
|
9
|
+
* the seller's network and uses the correct private key.
|
|
10
|
+
*
|
|
11
|
+
* NOTE: Solana payments require the optional peer dependencies
|
|
12
|
+
* `@solana/web3.js`, `@solana/spl-token`, and `bs58` to be installed by the
|
|
13
|
+
* consumer. They are imported dynamically (via variable specifiers, so they
|
|
14
|
+
* stay out of the static dependency graph) only when a Solana payment is made.
|
|
15
|
+
*/
|
|
16
|
+
/** Payment requirements from a PayAI seller. */
|
|
17
|
+
export interface X402PaymentRequirements {
|
|
18
|
+
/** Asset contract address (e.g., USDC) */
|
|
19
|
+
asset: string;
|
|
20
|
+
/** Description of what's being paid for */
|
|
21
|
+
description?: string;
|
|
22
|
+
/** Extra metadata like token name, version, and feePayer (for Solana) */
|
|
23
|
+
extra?: {
|
|
24
|
+
name?: string;
|
|
25
|
+
version?: string;
|
|
26
|
+
/** Fee payer address (required for Solana payments) */
|
|
27
|
+
feePayer?: string;
|
|
28
|
+
};
|
|
29
|
+
/** Amount required in atomic units (x402 v2 spec field name) */
|
|
30
|
+
amount?: string;
|
|
31
|
+
/** Maximum amount required in atomic units (legacy/alternative field name) */
|
|
32
|
+
maxAmountRequired?: string;
|
|
33
|
+
/** Maximum timeout in seconds */
|
|
34
|
+
maxTimeoutSeconds: number;
|
|
35
|
+
/** MIME type of the output */
|
|
36
|
+
mimeType?: string;
|
|
37
|
+
/** Network identifier (CAIP-2 format, e.g., "eip155:8453" or "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp") */
|
|
38
|
+
network: string;
|
|
39
|
+
/** Input/output schema information */
|
|
40
|
+
outputSchema?: {
|
|
41
|
+
input?: {
|
|
42
|
+
method: string;
|
|
43
|
+
type: string;
|
|
44
|
+
queryParams?: Record<string, {
|
|
45
|
+
type: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
required?: boolean;
|
|
48
|
+
}>;
|
|
49
|
+
bodyParams?: Record<string, {
|
|
50
|
+
type: string;
|
|
51
|
+
description?: string;
|
|
52
|
+
required?: boolean;
|
|
53
|
+
}>;
|
|
54
|
+
};
|
|
55
|
+
output?: Record<string, unknown> | null;
|
|
56
|
+
};
|
|
57
|
+
/** Address to pay to */
|
|
58
|
+
payTo: string;
|
|
59
|
+
/** Resource URL */
|
|
60
|
+
resource: string;
|
|
61
|
+
/** Payment scheme (e.g., "exact") */
|
|
62
|
+
scheme: string;
|
|
63
|
+
}
|
|
64
|
+
/** x402 Bazaar resource (seller). */
|
|
65
|
+
export interface X402BazaarSeller {
|
|
66
|
+
/** List of payment options accepted by this seller */
|
|
67
|
+
accepts: X402PaymentRequirements[];
|
|
68
|
+
/** Last updated timestamp */
|
|
69
|
+
lastUpdated: string;
|
|
70
|
+
/** Additional metadata */
|
|
71
|
+
metadata?: Record<string, unknown>;
|
|
72
|
+
/** Resource URL */
|
|
73
|
+
resource: string;
|
|
74
|
+
/** Protocol type (e.g., "http") */
|
|
75
|
+
type: string;
|
|
76
|
+
/** x402 version */
|
|
77
|
+
x402Version: number;
|
|
78
|
+
}
|
|
79
|
+
/** Response from listing bazaar resources. */
|
|
80
|
+
export interface X402BazaarListResponse {
|
|
81
|
+
/** List of discovered sellers */
|
|
82
|
+
items: X402BazaarSeller[];
|
|
83
|
+
/** Total count of sellers */
|
|
84
|
+
total?: number;
|
|
85
|
+
/** Pagination limit */
|
|
86
|
+
limit?: number;
|
|
87
|
+
/** Pagination offset */
|
|
88
|
+
offset?: number;
|
|
89
|
+
}
|
|
90
|
+
/** Request to call a PayAI seller. */
|
|
91
|
+
export interface X402CallSellerRequest {
|
|
92
|
+
/** The seller's resource URL */
|
|
93
|
+
resourceUrl: string;
|
|
94
|
+
/** Query/input to send to the seller */
|
|
95
|
+
query: string;
|
|
96
|
+
/** Network to use for payment (CAIP-2 format) */
|
|
97
|
+
network: string;
|
|
98
|
+
/** Optional specific method (GET/POST) */
|
|
99
|
+
method?: string;
|
|
100
|
+
}
|
|
101
|
+
/** Response from calling a PayAI seller. */
|
|
102
|
+
export interface X402CallSellerResponse {
|
|
103
|
+
success: boolean;
|
|
104
|
+
data?: unknown;
|
|
105
|
+
error?: string;
|
|
106
|
+
metadata?: {
|
|
107
|
+
requestId: string;
|
|
108
|
+
timestamp: string;
|
|
109
|
+
processingTimeMs: number;
|
|
110
|
+
paymentTxId?: string;
|
|
111
|
+
costUsdc?: string;
|
|
112
|
+
network: string;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/** Simplified seller info for frontend display. */
|
|
116
|
+
export interface X402SellerInfo {
|
|
117
|
+
/** Unique identifier (resource URL) */
|
|
118
|
+
id: string;
|
|
119
|
+
/** Display name extracted from metadata or URL */
|
|
120
|
+
name: string;
|
|
121
|
+
/** Description of the service */
|
|
122
|
+
description?: string;
|
|
123
|
+
/** Resource URL */
|
|
124
|
+
resourceUrl: string;
|
|
125
|
+
/** Price per call in USDC (human readable) */
|
|
126
|
+
priceUsdc: string;
|
|
127
|
+
/** Supported networks */
|
|
128
|
+
networks: string[];
|
|
129
|
+
/** Last updated */
|
|
130
|
+
lastUpdated: string;
|
|
131
|
+
/** Input schema description */
|
|
132
|
+
inputDescription?: string;
|
|
133
|
+
}
|
|
134
|
+
/** API request for listing sellers. */
|
|
135
|
+
export interface ListSellersRequest {
|
|
136
|
+
/** Filter by network */
|
|
137
|
+
network?: string;
|
|
138
|
+
/** Protocol type filter */
|
|
139
|
+
type?: string;
|
|
140
|
+
/** Pagination limit */
|
|
141
|
+
limit?: number;
|
|
142
|
+
/** Pagination offset */
|
|
143
|
+
offset?: number;
|
|
144
|
+
}
|
|
145
|
+
/** API response for listing sellers. */
|
|
146
|
+
export interface ListSellersResponse {
|
|
147
|
+
success: boolean;
|
|
148
|
+
sellers?: X402SellerInfo[];
|
|
149
|
+
error?: string;
|
|
150
|
+
metadata?: {
|
|
151
|
+
requestId: string;
|
|
152
|
+
timestamp: string;
|
|
153
|
+
processingTimeMs: number;
|
|
154
|
+
total: number;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
export declare const NETWORKS: {
|
|
158
|
+
readonly BASE_MAINNET: "eip155:8453";
|
|
159
|
+
readonly BASE: "base";
|
|
160
|
+
readonly SOLANA_MAINNET: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
161
|
+
readonly SOLANA: "solana";
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Check if a network is a Solana network.
|
|
165
|
+
* Handles both CAIP-2 format (solana:...) and legacy format (solana).
|
|
166
|
+
*/
|
|
167
|
+
export declare function isSolanaNetwork(network: string): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Check if a network is an EVM network (Base).
|
|
170
|
+
* Handles both CAIP-2 format (eip155:...) and legacy format (base).
|
|
171
|
+
*/
|
|
172
|
+
export declare function isEvmNetwork(network: string): boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Parse price from atomic units to human-readable USDC.
|
|
175
|
+
*/
|
|
176
|
+
export declare function parseUsdcPrice(atomicUnits: string | undefined, network: string): string;
|
|
177
|
+
/**
|
|
178
|
+
* Transform a bazaar seller to simplified seller info.
|
|
179
|
+
*/
|
|
180
|
+
export declare function transformSellerToInfo(seller: X402BazaarSeller): X402SellerInfo;
|
|
181
|
+
/**
|
|
182
|
+
* List sellers from the x402 bazaar.
|
|
183
|
+
*/
|
|
184
|
+
export declare function listBazaarSellers(options?: {
|
|
185
|
+
network?: string;
|
|
186
|
+
type?: string;
|
|
187
|
+
limit?: number;
|
|
188
|
+
offset?: number;
|
|
189
|
+
}): Promise<X402SellerInfo[]>;
|
|
190
|
+
/**
|
|
191
|
+
* Call an x402-protected endpoint with payment.
|
|
192
|
+
*
|
|
193
|
+
* This implementation:
|
|
194
|
+
* 1. Gets the payment requirements from the resource
|
|
195
|
+
* 2. Detects the seller's network (Solana or EVM)
|
|
196
|
+
* 3. Uses the appropriate private key and signing method
|
|
197
|
+
* 4. Makes the request with X-Payment header
|
|
198
|
+
*/
|
|
199
|
+
export declare function callX402Seller(resourceUrl: string, query: string, preferredNetwork?: string): Promise<{
|
|
200
|
+
success: boolean;
|
|
201
|
+
data?: unknown;
|
|
202
|
+
error?: string;
|
|
203
|
+
paymentInfo?: {
|
|
204
|
+
txId?: string;
|
|
205
|
+
cost?: string;
|
|
206
|
+
network: string;
|
|
207
|
+
};
|
|
208
|
+
}>;
|
|
209
|
+
/**
|
|
210
|
+
* Health check for x402 bazaar discovery.
|
|
211
|
+
*/
|
|
212
|
+
export declare function checkX402Health(): Promise<boolean>;
|
|
213
|
+
//# sourceMappingURL=x402.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"x402.d.ts","sourceRoot":"","sources":["../../../src/predictos/clients/x402.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,gDAAgD;AAChD,MAAM,WAAW,uBAAuB;IACtC,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,uDAAuD;QACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iCAAiC;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2GAA2G;IAC3G,OAAO,EAAE,MAAM,CAAC;IAChB,sCA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