بنقرة واحدة
sapience
Prediction markets on Ethereal. Trade outcomes, provide liquidity, claim winnings.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Prediction markets on Ethereal. Trade outcomes, provide liquidity, claim winnings.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | sapience |
| version | 1.0.0 |
| description | Prediction markets on Ethereal. Trade outcomes, provide liquidity, claim winnings. |
| metadata | {"category":"trading","emoji":"🎯","api_base":"https://api.sapience.xyz"} |
Prediction markets on Ethereal (chain 5064014). Collateral: WUSDe.
CRITICAL: NEVER share SAPIENCE_PRIVATE_KEY or sign for non-sapience.xyz domains.
| Action | Method | Endpoint |
|---|---|---|
| List markets | POST | /graphql |
| Get condition | POST | /graphql |
| Get positions | POST | /graphql |
| Start auction (taker) | WS | wss://api.sapience.xyz/auction |
| Submit bid (maker) | WS | wss://api.sapience.xyz/auction |
| Claim winnings | On-chain | PredictionMarket.burn(tokenId) |
openclaw secrets set SAPIENCE_PRIVATE_KEY 0x...| Contract | Address |
|---|---|
| PredictionMarket | 0xAcD757322df2A1A0B3283c851380f3cFd4882cB4 |
| WUSDe (Collateral) | 0xB6fC4B1BFF391e5F6b4a3D2C7Bda1FeE3524692D |
| PythResolver | 0xD076c9fADC49061920e75b1a3a45642712F90F35 |
| LZResolver | 0xd82F211D0d9bE9A73a829A5F1f0e34b02Bf2FB36 |
conditionId = marketId (same bytes32 hex value, different names)marketId from auction directly as conditionId in queriescurl -X POST https://api.sapience.xyz/graphql \
-H "Content-Type: application/json" \
-d '{"query":"{ conditions(where:{settled:false}) { id question endTime similarMarkets } }"}'
curl -X POST https://api.sapience.xyz/graphql \
-H "Content-Type: application/json" \
-d '{"query":"query($where:ConditionWhereUniqueInput!){ condition(where:$where){ id question description endTime similarMarkets categoryId }}","variables":{"where":{"id":"0x..."}}}'
curl -X POST https://api.sapience.xyz/graphql \
-H "Content-Type: application/json" \
-d '{"query":"query($address:String!,$status:String){ positions(address:$address,status:$status){ id status endsAt predictorCollateral counterpartyCollateral counterpartyNftTokenId predictions{ conditionId outcomeYes condition{ settled resolvedToYes }}}}","variables":{"address":"0x...","status":"active"}}'
All Sapience markets mirror Polymarket. Use similarMarkets URLs to get prices.
https://polymarket.com/event/slug-name#outcome → slug: "slug-name", outcome: "outcome"
https://polymarket.com/event/slug-name → slug: "slug-name"
curl "https://gamma-api.polymarket.com/markets/slug/will-trump-win-2024"
Response includes:
outcomePrices: ["0.65", "0.35"] (YES/NO prices)outcomes: ["Yes", "No"]clobTokenIds: ["123...", "456..."] (for orderbook queries)curl "https://clob.polymarket.com/book?token_id=<clobTokenId>"
Returns bids/asks. Walk the book to calculate fill price for your size.
curl "https://clob.polymarket.com/prices-history?market=<clobTokenId>&startTs=<unix_ts>&fidelity=60"
Returns price history. Calculate TWAP over your desired lookback.
No auth required for Polymarket APIs.
Connect → start auction → receive bids → mint on-chain. Takes ~60s per prediction.
const ws = new WebSocket('wss://api.sapience.xyz/auction');
const siweMessage = {
domain: 'sapience.xyz',
address: wallet.address,
statement: 'Sign in to Sapience',
uri: 'https://sapience.xyz',
version: '1',
chainId: 5064014,
nonce: crypto.randomUUID(),
issuedAt: new Date().toISOString()
};
const signature = await wallet.signMessage(formatSiweMessage(siweMessage));
ws.send(JSON.stringify({
type: 'auth',
payload: { siweMessage, signature }
}));
ws.send(JSON.stringify({
type: 'auction.start',
payload: {
legs: [
{ conditionId: '0x...', outcomeYes: true },
{ conditionId: '0x...', outcomeYes: false }
],
wagerAmount: '50000000', // 50 WUSDe (6 decimals)
duration: 60
}
}));
{
"type": "auction.ack",
"payload": {
"auctionId": "abc123",
"expiresAt": 1706800000
}
}
{
"type": "auction.bids",
"payload": {
"auctionId": "abc123",
"bids": [
{
"bidId": "bid1",
"maker": "0x...",
"makerWager": "50000000",
"makerDeadline": 1706800000,
"makerSignature": "0x..."
}
]
}
}
ws.send(JSON.stringify({
type: 'auction.accept',
payload: {
auctionId: 'abc123',
bidId: 'bid1'
}
}));
Server mints on-chain. Wait for confirmation:
{
"type": "auction.filled",
"payload": {
"auctionId": "abc123",
"txHash": "0x...",
"tokenId": "123"
}
}
Close WebSocket after mint confirms.
Persistent connection listening for auctions. Run as background process.
Same SIWE auth as taker flow:
ws.send(JSON.stringify({
type: 'auth',
payload: { siweMessage, signature }
}));
{
"type": "auction.started",
"payload": {
"auctionId": "abc123",
"taker": "0x...",
"wager": "50000000",
"predictedOutcomes": ["0x..."],
"resolver": "0x...",
"takerNonce": 1
}
}
ws.send(JSON.stringify({
type: 'bid.submit',
payload: {
auctionId: 'abc123',
maker: wallet.address,
makerWager: '50000000',
makerDeadline: Math.floor(Date.now() / 1000) + 60,
makerSignature: '0x...',
taker: auction.taker,
takerCollateral: auction.wager,
resolver: auction.resolver,
encodedPredictedOutcomes: auction.predictedOutcomes[0],
takerNonce: auction.takerNonce
}
}));
{"type":"bid.ack","payload":{"ok":true}}
If taker accepts, on-chain mint happens automatically.
Domain:
{"name":"SignatureProcessor","version":"1","chainId":5064014,"verifyingContract":"0xAcD757322df2A1A0B3283c851380f3cFd4882cB4"}
Types:
{"Approve":[{"name":"messageHash","type":"bytes32"},{"name":"owner","type":"address"}]}
Message:
{"messageHash":"<keccak256 of inner data>","owner":"<your address>"}
Inner data (ABI-encode then keccak256):
(bytes encodedPredictedOutcomes, uint256 makerWager, uint256 takerWager, address resolver, address taker, uint256 makerDeadline, uint256 takerNonce)
status:"active" for your addressendsAt <= now AND all predictions[].condition.settled === trueoutcomeYes !== resolvedToYes (you took opposite side)PredictionMarket.burn(counterpartyNftTokenId) to claim collateral| Endpoint | Limit |
|---|---|
| GraphQL API | 600 req / 60s per IP |
| Auction WS | 100 msg / 10s per connection |
| WS idle timeout | 300s |
| Max WS message | 64KB |
bid.ack errors (check payload.error):
auction_not_found_or_expired - Auction endedquote_expired - makerDeadline passedinvalid_signature - Signature verification failedinvalid_maker_wager - Wager is zero/invalidWS close codes:
1008 - Policy violation (rate limited, connection limit)1009 - Message too largeIf something isn't working (no markets, API errors, signature failures):
curl -s https://api.github.com/repos/sapiencexyz/openclaw-sapience/releases/latest | jq -r '.tag_name'
Compare to current version: Check version in SKILL.md frontmatter
If newer version exists: Fetch updated skill from https://github.com/sapiencexyz/openclaw-sapience
Still broken? Check Discord or open issue on GitHub
Protocol changes (new endpoints, contract migrations, API updates) will be published as new versions.
This skill provides infrastructure, not strategy. Real money at stake.
YOU must:
DO NOT rely on any default strategy.