Loading...
Loading...
Use when the agent needs to create a new prediction basket on-chain via vara-wallet. Do not use for betting, querying, or settlement.
npx skill4agent add adityaakr/polybaskets basket-createvara-walletvara-wallet config set network mainnetvara-wallet config set network mainnet
BASKET_MARKET="0x702395d43248eaa5f1fd4d9eadadc75b0fb1c7c5ae9ea20bf31375fd4358f403"
_PB="${POLYBASKETS_SKILLS_DIR:-skills}"
IDL="$_PB/idl/polymarket-mirror.idl"vara-wallet wallet list
vara-wallet balanceorder=volume24hr&ascending=falseend_date_max# Fetch high-volume markets ending within 48 hours (fastest resolution)
# end_date_min=now filters out markets that already ended (closed=false does NOT filter these!)
curl -s "https://gamma-api.polymarket.com/markets?closed=false&order=volume24hr&ascending=false&end_date_min=$(date -u +%Y-%m-%dT%H:%M:%SZ)&end_date_max=$(date -u -v+48H +%Y-%m-%dT%H:%M:%SZ)&limit=20"
# On Linux use: date -u -d '+48 hours' +%Y-%m-%dT%H:%M:%SZ
# Or fetch all active markets sorted by volume (still filter out ended ones!)
curl -s "https://gamma-api.polymarket.com/markets?closed=false&order=volume24hr&ascending=false&end_date_min=$(date -u +%Y-%m-%dT%H:%M:%SZ)&limit=20"closed=falseendDateend_date_minendDate > now# Show market id, question, YES/NO prices, and hours remaining
curl -s "https://gamma-api.polymarket.com/markets?closed=false&order=volume24hr&ascending=false&end_date_min=$(date -u +%Y-%m-%dT%H:%M:%SZ)&limit=20" \
| jq '[.[] | {id, question, yes: (.outcomePrices | fromjson | .[0]), no: (.outcomePrices | fromjson | .[1]), endDate, liquidity}]'outcomePrices"[\"0.52\", \"0.48\"]"["0.52", "0.48"].outcomePrices | fromjson | .[0]json.loads(m['outcomePrices'])[0]JSON.parse(m.outcomePrices)[0]m['outcomePrices'][0][poly_market_id"540816"conditionIdidslugslugidcurl -s "https://gamma-api.polymarket.com/markets/540816"vara-wallet call $BASKET_MARKET BasketMarket/IsVaraEnabled --args '[]' --idl $IDL"Bet"| Rule | Constraint |
|---|---|
| Name | Non-empty, max 48 characters |
| Description | Max 256 characters |
| Items | 1 to 10 items |
| Weights | All |
| No duplicates | Same |
| poly_market_id | Max 128 characters |
| poly_slug | Max 128 characters |
| asset_kind | |
CreateBasket(name: str, description: str, items: vec BasketItem, asset_kind: BasketAssetKind) -> u64BasketItem{
"poly_market_id": "540816",
"poly_slug": "will-btc-hit-100k",
"weight_bps": 5000,
"selected_outcome": "YES"
}poly_market_idid"540816"weight_bpsvara-wallet --account agent call $BASKET_MARKET BasketMarket/CreateBasket --voucher $VOUCHER_ID \
--args '[
"AI Regulation Bundle",
"Outcomes related to AI policy",
[
{
"poly_market_id": "540816",
"poly_slug": "ai-regulation-2025",
"weight_bps": 4000,
"selected_outcome": "YES"
},
{
"poly_market_id": "540817",
"poly_slug": "openai-ipo-2025",
"weight_bps": 3500,
"selected_outcome": "YES"
},
{
"poly_market_id": "540818",
"poly_slug": "eu-ai-act-enforcement",
"weight_bps": 2500,
"selected_outcome": "NO"
}
],
"Bet"
]' \
--idl $IDLu64RESULT=$(vara-wallet --account agent call $BASKET_MARKET BasketMarket/CreateBasket --voucher $VOUCHER_ID \
--args '[...]' --idl $IDL)
BASKET_ID=$(echo $RESULT | jq -r '.result // .ok // .')
echo "Created basket: $BASKET_ID"vara-wallet call $BASKET_MARKET BasketMarket/GetBasket --args "[$BASKET_ID]" --idl $IDL../basket-bet/SKILL.md| Error | Cause | Fix |
|---|---|---|
| Weights don't sum to 100% | Adjust weight_bps so they sum to 10000 (= 100%) |
| Empty items array | Add at least 1 item |
| More than 10 items | Remove items |
| Same market+outcome twice | Remove duplicate |
| VARA mode off | Use |
| Name > 48 chars | Shorten name |
../references/error-codes.md