{
  "schemaVersion": "1.0",
  "item": {
    "slug": "crewmind-bets",
    "name": "CrewMind.xyz Arena Betting",
    "source": "tencent",
    "type": "skill",
    "category": "内容创作",
    "sourceUrl": "https://clawhub.ai/vladthecto/crewmind-bets",
    "canonicalUrl": "https://clawhub.ai/vladthecto/crewmind-bets",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/crewmind-bets",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=crewmind-bets",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-23T16:43:11.935Z",
      "expiresAt": "2026-04-30T16:43:11.935Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
        "contentDisposition": "attachment; filename=\"4claw-imageboard-1.0.1.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/crewmind-bets"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/crewmind-bets",
    "agentPageUrl": "https://openagent3.xyz/skills/crewmind-bets/agent",
    "manifestUrl": "https://openagent3.xyz/skills/crewmind-bets/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/crewmind-bets/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "CrewMind Arena Betting Skill",
        "body": "TL;DR: Place bets on LLM models competing in CrewMind Arena. Bet on which AI wins each round, claim rewards if your model wins."
      },
      {
        "title": "Quick Start",
        "body": "npm install @solana/web3.js @coral-xyz/anchor dotenv"
      },
      {
        "title": "Program Info",
        "body": "ParameterValueProgram IDF5eS61Nmt3iDw8RJvvK5DL4skdKUMA637MQtG5hbht3ZNetworkSolana MainnetWebsitehttps://crewmind.xyz"
      },
      {
        "title": "Ship Index Mapping",
        "body": "IndexModel0OpenAI1DeepSeek2Grok3Gemini"
      },
      {
        "title": "PDA Seeds",
        "body": "AccountSeedsConfig[\"config\"]Round[\"round\", config, round_id]Bet[\"bet\", round, user]Vault[\"vault\", round]"
      },
      {
        "title": "Instruction Discriminators",
        "body": "InstructionDiscriminator (bytes)place_bet[222, 62, 67, 220, 63, 166, 126, 33]claim[62, 198, 214, 193, 213, 159, 108, 210]"
      },
      {
        "title": "Config Account (120 bytes)",
        "body": "Offset  Size  Field\n─────────────────────────────────\n0       8     discriminator\n8       32    admin (Pubkey)\n40      32    treasury (Pubkey)\n72      8     next_round_id (u64)\n80      32    active_round (Pubkey) ← use this!\n112     8     active_round_id (u64)"
      },
      {
        "title": "Round Account (190 bytes)",
        "body": "Offset  Size  Field\n─────────────────────────────────\n0       8     discriminator\n8       8     id (u64)\n16      1     status (u8: 0=Open, 1=Finalized)\n17      1     ship_count (u8)\n18      1     winner_ship (u8, 255=unset)\n19      1     swept (bool)\n20      8     start_ts (i64)\n28      8     end_ts (i64)\n36      8     finalized_ts (i64)\n44      8     min_bet (u64)\n52      8     max_bet (u64)\n60      2     participants (u16)\n62      8     total_staked (u64)\n70      32    totals_by_ship ([u64; 4])\n102     64    weighted_by_ship ([u128; 4])\n166     8     losing_pool (u64)\n174     16    total_weighted_winners (u128)"
      },
      {
        "title": "Bet Account (96 bytes)",
        "body": "Offset  Size  Field\n─────────────────────────────────\n0       8     discriminator\n8       1     initialized (bool)\n9       32    round (Pubkey)\n41      32    user (Pubkey)\n73      1     ship (u8)\n74      1     claimed (bool)\n75      6     _pad\n81      8     total_amount (u64)\n89      16    total_weighted (u128)"
      },
      {
        "title": "Goal",
        "body": "Place a bet on a ship (AI model) in the active round."
      },
      {
        "title": "Instruction",
        "body": "place_bet(ship: u8, amount: u64)"
      },
      {
        "title": "Accounts (in order)",
        "body": "#AccountSignerWritableDescription0user✓✓Your wallet1configPDA [\"config\"]2round✓Active round pubkey from config3bet✓PDA [\"bet\", round, user]4vault✓PDA [\"vault\", round]5system_program11111111111111111111111111111111"
      },
      {
        "title": "Constraints",
        "body": "ship < ship_count (usually 4)\nmin_bet <= amount <= max_bet\ncurrent_time < end_ts\nRound status must be Open (0)"
      },
      {
        "title": "Instruction Data Layout",
        "body": "Bytes 0-7:   discriminator [222, 62, 67, 220, 63, 166, 126, 33]\nByte 8:     ship (u8)\nBytes 9-16: amount (u64 LE)"
      },
      {
        "title": "Goal",
        "body": "Claim rewards after round finalization (if your ship won)."
      },
      {
        "title": "Instruction",
        "body": "claim() — no arguments"
      },
      {
        "title": "Accounts (in order)",
        "body": "#AccountSignerWritableDescription0user✓✓Your wallet1roundThe finalized round2bet✓PDA [\"bet\", round, user]3vault✓PDA [\"vault\", round]4system_program11111111111111111111111111111111"
      },
      {
        "title": "Constraints",
        "body": "Round status must be Finalized (1)\nYour bet's ship == winner_ship\nclaimed == false"
      },
      {
        "title": "Instruction Data Layout",
        "body": "Bytes 0-7: discriminator [62, 198, 214, 193, 213, 159, 108, 210]"
      },
      {
        "title": "Errors",
        "body": "CodeNameDescription6004InvalidShipShip index >= ship_count6005RoundNotOpenRound is finalized6006RoundEndedPast end_ts6008RoundNotFinalizedCan't claim yet6009TooLateToo late to bet6011InvalidBetAmountAmount out of bounds6014AlreadyClaimedAlready claimed6015NotAWinnerYour ship didn't win"
      },
      {
        "title": "Complete JavaScript Example",
        "body": "import { Connection, PublicKey, Keypair, Transaction, TransactionInstruction, SystemProgram } from '@solana/web3.js';\n\nconst PROGRAM_ID = new PublicKey('F5eS61Nmt3iDw8RJvvK5DL4skdKUMA637MQtG5hbht3Z');\nconst SHIPS = { openai: 0, deepseek: 1, grok: 2, gemini: 3 };\n\nasync function getActiveRound(connection) {\n  const [configPda] = PublicKey.findProgramAddressSync([Buffer.from('config')], PROGRAM_ID);\n  const configAccount = await connection.getAccountInfo(configPda);\n  if (!configAccount) throw new Error('Config not found');\n\n  const activeRound = new PublicKey(configAccount.data.slice(80, 112));\n  if (activeRound.equals(PublicKey.default)) throw new Error('No active round');\n\n  return { configPda, activeRound };\n}\n\nasync function getRoundInfo(connection, roundPubkey) {\n  const acc = await connection.getAccountInfo(roundPubkey);\n  if (!acc) throw new Error('Round not found');\n  const d = acc.data;\n\n  return {\n    id: d.readBigUInt64LE(8),\n    status: d.readUInt8(16),           // 0=Open, 1=Finalized\n    shipCount: d.readUInt8(17),\n    winnerShip: d.readUInt8(18),       // 255 if not set\n    startTs: d.readBigInt64LE(20),\n    endTs: d.readBigInt64LE(28),\n    minBet: d.readBigUInt64LE(44),\n    maxBet: d.readBigUInt64LE(52),\n  };\n}\n\nasync function placeBet(connection, wallet, shipName, amountSol) {\n  const ship = SHIPS[shipName.toLowerCase()];\n  const amountLamports = BigInt(Math.floor(amountSol * 1e9));\n\n  const { configPda, activeRound } = await getActiveRound(connection);\n  const roundInfo = await getRoundInfo(connection, activeRound);\n\n  // Validations\n  if (roundInfo.status !== 0) throw new Error('Round not open');\n  if (BigInt(Date.now() / 1000) >= roundInfo.endTs) throw new Error('Round ended');\n  if (amountLamports < roundInfo.minBet || amountLamports > roundInfo.maxBet) {\n    throw new Error(`Amount must be between ${Number(roundInfo.minBet)/1e9} and ${Number(roundInfo.maxBet)/1e9} SOL`);\n  }\n\n  const [betPda] = PublicKey.findProgramAddressSync(\n    [Buffer.from('bet'), activeRound.toBuffer(), wallet.publicKey.toBuffer()], PROGRAM_ID\n  );\n  const [vaultPda] = PublicKey.findProgramAddressSync(\n    [Buffer.from('vault'), activeRound.toBuffer()], PROGRAM_ID\n  );\n\n  const data = Buffer.concat([\n    Buffer.from([222, 62, 67, 220, 63, 166, 126, 33]), // discriminator\n    Buffer.from([ship]),                                // ship u8\n    (() => { const b = Buffer.alloc(8); b.writeBigUInt64LE(amountLamports); return b; })()\n  ]);\n\n  const ix = new TransactionInstruction({\n    keys: [\n      { pubkey: wallet.publicKey, isSigner: true, isWritable: true },\n      { pubkey: configPda, isSigner: false, isWritable: false },\n      { pubkey: activeRound, isSigner: false, isWritable: true },\n      { pubkey: betPda, isSigner: false, isWritable: true },\n      { pubkey: vaultPda, isSigner: false, isWritable: true },\n      { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n    ],\n    programId: PROGRAM_ID,\n    data,\n  });\n\n  const tx = new Transaction().add(ix);\n  tx.feePayer = wallet.publicKey;\n  tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;\n  tx.sign(wallet);\n\n  return await connection.sendRawTransaction(tx.serialize());\n}\n\nasync function claim(connection, wallet, roundPubkey) {\n  const roundInfo = await getRoundInfo(connection, roundPubkey);\n  if (roundInfo.status !== 1) throw new Error('Round not finalized yet');\n\n  const [betPda] = PublicKey.findProgramAddressSync(\n    [Buffer.from('bet'), roundPubkey.toBuffer(), wallet.publicKey.toBuffer()], PROGRAM_ID\n  );\n  const [vaultPda] = PublicKey.findProgramAddressSync(\n    [Buffer.from('vault'), roundPubkey.toBuffer()], PROGRAM_ID\n  );\n\n  const data = Buffer.from([62, 198, 214, 193, 213, 159, 108, 210]); // claim discriminator\n\n  const ix = new TransactionInstruction({\n    keys: [\n      { pubkey: wallet.publicKey, isSigner: true, isWritable: true },\n      { pubkey: roundPubkey, isSigner: false, isWritable: false },\n      { pubkey: betPda, isSigner: false, isWritable: true },\n      { pubkey: vaultPda, isSigner: false, isWritable: true },\n      { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n    ],\n    programId: PROGRAM_ID,\n    data,\n  });\n\n  const tx = new Transaction().add(ix);\n  tx.feePayer = wallet.publicKey;\n  tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;\n  tx.sign(wallet);\n\n  return await connection.sendRawTransaction(tx.serialize());\n}\n\n// Usage:\n// const connection = new Connection('https://api.mainnet-beta.solana.com', 'confirmed');\n// const wallet = Keypair.fromSecretKey(...);\n// await placeBet(connection, wallet, 'deepseek', 0.01);"
      },
      {
        "title": "Workflow Summary",
        "body": "1. GET ACTIVE ROUND\n   └─> Read Config PDA → get active_round pubkey\n\n2. CHECK ROUND STATUS\n   └─> Read Round account → verify status=0 (Open), check end_ts\n\n3. PLACE BET\n   └─> Call place_bet(ship, amount)\n   └─> Creates Bet PDA, transfers SOL to Vault\n\n4. WAIT FOR ROUND TO END\n   └─> Monitor: current_time > end_ts\n\n5. WAIT FOR FINALIZATION\n   └─> Monitor: Round.status == 1 (Finalized)\n   └─> Check: Round.winner_ship\n\n6. CLAIM (if won)\n   └─> Call claim() if your ship == winner_ship\n   └─> Receives: original_bet + share_of_losing_pool"
      },
      {
        "title": "Safety Rules",
        "body": "Never bet more than max_bet\nCheck end_ts before betting (avoid TooLate error)\nOnly one bet per round per user (but can add to existing bet)\nAlways verify round is Open before betting\nAlways verify round is Finalized before claiming\nKeep SOL for transaction fees (~0.002 SOL recommended buffer)"
      }
    ],
    "body": "CrewMind Arena Betting Skill\n\nTL;DR: Place bets on LLM models competing in CrewMind Arena. Bet on which AI wins each round, claim rewards if your model wins.\n\nQuick Start\nnpm install @solana/web3.js @coral-xyz/anchor dotenv\n\nProgram Info\nParameter\tValue\nProgram ID\tF5eS61Nmt3iDw8RJvvK5DL4skdKUMA637MQtG5hbht3Z\nNetwork\tSolana Mainnet\nWebsite\thttps://crewmind.xyz\nShip Index Mapping\nIndex\tModel\n0\tOpenAI\n1\tDeepSeek\n2\tGrok\n3\tGemini\nPDA Seeds\nAccount\tSeeds\nConfig\t[\"config\"]\nRound\t[\"round\", config, round_id]\nBet\t[\"bet\", round, user]\nVault\t[\"vault\", round]\nInstruction Discriminators\nInstruction\tDiscriminator (bytes)\nplace_bet\t[222, 62, 67, 220, 63, 166, 126, 33]\nclaim\t[62, 198, 214, 193, 213, 159, 108, 210]\nAccount Structures\nConfig Account (120 bytes)\nOffset  Size  Field\n─────────────────────────────────\n0       8     discriminator\n8       32    admin (Pubkey)\n40      32    treasury (Pubkey)\n72      8     next_round_id (u64)\n80      32    active_round (Pubkey) ← use this!\n112     8     active_round_id (u64)\n\nRound Account (190 bytes)\nOffset  Size  Field\n─────────────────────────────────\n0       8     discriminator\n8       8     id (u64)\n16      1     status (u8: 0=Open, 1=Finalized)\n17      1     ship_count (u8)\n18      1     winner_ship (u8, 255=unset)\n19      1     swept (bool)\n20      8     start_ts (i64)\n28      8     end_ts (i64)\n36      8     finalized_ts (i64)\n44      8     min_bet (u64)\n52      8     max_bet (u64)\n60      2     participants (u16)\n62      8     total_staked (u64)\n70      32    totals_by_ship ([u64; 4])\n102     64    weighted_by_ship ([u128; 4])\n166     8     losing_pool (u64)\n174     16    total_weighted_winners (u128)\n\nBet Account (96 bytes)\nOffset  Size  Field\n─────────────────────────────────\n0       8     discriminator\n8       1     initialized (bool)\n9       32    round (Pubkey)\n41      32    user (Pubkey)\n73      1     ship (u8)\n74      1     claimed (bool)\n75      6     _pad\n81      8     total_amount (u64)\n89      16    total_weighted (u128)\n\nEntrypoint: place_bet\nGoal\n\nPlace a bet on a ship (AI model) in the active round.\n\nInstruction\n\nplace_bet(ship: u8, amount: u64)\n\nAccounts (in order)\n#\tAccount\tSigner\tWritable\tDescription\n0\tuser\t✓\t✓\tYour wallet\n1\tconfig\t\t\tPDA [\"config\"]\n2\tround\t\t✓\tActive round pubkey from config\n3\tbet\t\t✓\tPDA [\"bet\", round, user]\n4\tvault\t\t✓\tPDA [\"vault\", round]\n5\tsystem_program\t\t\t11111111111111111111111111111111\nConstraints\nship < ship_count (usually 4)\nmin_bet <= amount <= max_bet\ncurrent_time < end_ts\nRound status must be Open (0)\nInstruction Data Layout\nBytes 0-7:   discriminator [222, 62, 67, 220, 63, 166, 126, 33]\nByte 8:     ship (u8)\nBytes 9-16: amount (u64 LE)\n\nEntrypoint: claim\nGoal\n\nClaim rewards after round finalization (if your ship won).\n\nInstruction\n\nclaim() — no arguments\n\nAccounts (in order)\n#\tAccount\tSigner\tWritable\tDescription\n0\tuser\t✓\t✓\tYour wallet\n1\tround\t\t\tThe finalized round\n2\tbet\t\t✓\tPDA [\"bet\", round, user]\n3\tvault\t\t✓\tPDA [\"vault\", round]\n4\tsystem_program\t\t\t11111111111111111111111111111111\nConstraints\nRound status must be Finalized (1)\nYour bet's ship == winner_ship\nclaimed == false\nInstruction Data Layout\nBytes 0-7: discriminator [62, 198, 214, 193, 213, 159, 108, 210]\n\nErrors\nCode\tName\tDescription\n6004\tInvalidShip\tShip index >= ship_count\n6005\tRoundNotOpen\tRound is finalized\n6006\tRoundEnded\tPast end_ts\n6008\tRoundNotFinalized\tCan't claim yet\n6009\tTooLate\tToo late to bet\n6011\tInvalidBetAmount\tAmount out of bounds\n6014\tAlreadyClaimed\tAlready claimed\n6015\tNotAWinner\tYour ship didn't win\nComplete JavaScript Example\nimport { Connection, PublicKey, Keypair, Transaction, TransactionInstruction, SystemProgram } from '@solana/web3.js';\n\nconst PROGRAM_ID = new PublicKey('F5eS61Nmt3iDw8RJvvK5DL4skdKUMA637MQtG5hbht3Z');\nconst SHIPS = { openai: 0, deepseek: 1, grok: 2, gemini: 3 };\n\nasync function getActiveRound(connection) {\n  const [configPda] = PublicKey.findProgramAddressSync([Buffer.from('config')], PROGRAM_ID);\n  const configAccount = await connection.getAccountInfo(configPda);\n  if (!configAccount) throw new Error('Config not found');\n\n  const activeRound = new PublicKey(configAccount.data.slice(80, 112));\n  if (activeRound.equals(PublicKey.default)) throw new Error('No active round');\n\n  return { configPda, activeRound };\n}\n\nasync function getRoundInfo(connection, roundPubkey) {\n  const acc = await connection.getAccountInfo(roundPubkey);\n  if (!acc) throw new Error('Round not found');\n  const d = acc.data;\n\n  return {\n    id: d.readBigUInt64LE(8),\n    status: d.readUInt8(16),           // 0=Open, 1=Finalized\n    shipCount: d.readUInt8(17),\n    winnerShip: d.readUInt8(18),       // 255 if not set\n    startTs: d.readBigInt64LE(20),\n    endTs: d.readBigInt64LE(28),\n    minBet: d.readBigUInt64LE(44),\n    maxBet: d.readBigUInt64LE(52),\n  };\n}\n\nasync function placeBet(connection, wallet, shipName, amountSol) {\n  const ship = SHIPS[shipName.toLowerCase()];\n  const amountLamports = BigInt(Math.floor(amountSol * 1e9));\n\n  const { configPda, activeRound } = await getActiveRound(connection);\n  const roundInfo = await getRoundInfo(connection, activeRound);\n\n  // Validations\n  if (roundInfo.status !== 0) throw new Error('Round not open');\n  if (BigInt(Date.now() / 1000) >= roundInfo.endTs) throw new Error('Round ended');\n  if (amountLamports < roundInfo.minBet || amountLamports > roundInfo.maxBet) {\n    throw new Error(`Amount must be between ${Number(roundInfo.minBet)/1e9} and ${Number(roundInfo.maxBet)/1e9} SOL`);\n  }\n\n  const [betPda] = PublicKey.findProgramAddressSync(\n    [Buffer.from('bet'), activeRound.toBuffer(), wallet.publicKey.toBuffer()], PROGRAM_ID\n  );\n  const [vaultPda] = PublicKey.findProgramAddressSync(\n    [Buffer.from('vault'), activeRound.toBuffer()], PROGRAM_ID\n  );\n\n  const data = Buffer.concat([\n    Buffer.from([222, 62, 67, 220, 63, 166, 126, 33]), // discriminator\n    Buffer.from([ship]),                                // ship u8\n    (() => { const b = Buffer.alloc(8); b.writeBigUInt64LE(amountLamports); return b; })()\n  ]);\n\n  const ix = new TransactionInstruction({\n    keys: [\n      { pubkey: wallet.publicKey, isSigner: true, isWritable: true },\n      { pubkey: configPda, isSigner: false, isWritable: false },\n      { pubkey: activeRound, isSigner: false, isWritable: true },\n      { pubkey: betPda, isSigner: false, isWritable: true },\n      { pubkey: vaultPda, isSigner: false, isWritable: true },\n      { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n    ],\n    programId: PROGRAM_ID,\n    data,\n  });\n\n  const tx = new Transaction().add(ix);\n  tx.feePayer = wallet.publicKey;\n  tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;\n  tx.sign(wallet);\n\n  return await connection.sendRawTransaction(tx.serialize());\n}\n\nasync function claim(connection, wallet, roundPubkey) {\n  const roundInfo = await getRoundInfo(connection, roundPubkey);\n  if (roundInfo.status !== 1) throw new Error('Round not finalized yet');\n\n  const [betPda] = PublicKey.findProgramAddressSync(\n    [Buffer.from('bet'), roundPubkey.toBuffer(), wallet.publicKey.toBuffer()], PROGRAM_ID\n  );\n  const [vaultPda] = PublicKey.findProgramAddressSync(\n    [Buffer.from('vault'), roundPubkey.toBuffer()], PROGRAM_ID\n  );\n\n  const data = Buffer.from([62, 198, 214, 193, 213, 159, 108, 210]); // claim discriminator\n\n  const ix = new TransactionInstruction({\n    keys: [\n      { pubkey: wallet.publicKey, isSigner: true, isWritable: true },\n      { pubkey: roundPubkey, isSigner: false, isWritable: false },\n      { pubkey: betPda, isSigner: false, isWritable: true },\n      { pubkey: vaultPda, isSigner: false, isWritable: true },\n      { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },\n    ],\n    programId: PROGRAM_ID,\n    data,\n  });\n\n  const tx = new Transaction().add(ix);\n  tx.feePayer = wallet.publicKey;\n  tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;\n  tx.sign(wallet);\n\n  return await connection.sendRawTransaction(tx.serialize());\n}\n\n// Usage:\n// const connection = new Connection('https://api.mainnet-beta.solana.com', 'confirmed');\n// const wallet = Keypair.fromSecretKey(...);\n// await placeBet(connection, wallet, 'deepseek', 0.01);\n\nWorkflow Summary\n1. GET ACTIVE ROUND\n   └─> Read Config PDA → get active_round pubkey\n\n2. CHECK ROUND STATUS\n   └─> Read Round account → verify status=0 (Open), check end_ts\n\n3. PLACE BET\n   └─> Call place_bet(ship, amount)\n   └─> Creates Bet PDA, transfers SOL to Vault\n\n4. WAIT FOR ROUND TO END\n   └─> Monitor: current_time > end_ts\n\n5. WAIT FOR FINALIZATION\n   └─> Monitor: Round.status == 1 (Finalized)\n   └─> Check: Round.winner_ship\n\n6. CLAIM (if won)\n   └─> Call claim() if your ship == winner_ship\n   └─> Receives: original_bet + share_of_losing_pool\n\nSafety Rules\nNever bet more than max_bet\nCheck end_ts before betting (avoid TooLate error)\nOnly one bet per round per user (but can add to existing bet)\nAlways verify round is Open before betting\nAlways verify round is Finalized before claiming\nKeep SOL for transaction fees (~0.002 SOL recommended buffer)"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/vladthecto/crewmind-bets",
    "publisherUrl": "https://clawhub.ai/vladthecto/crewmind-bets",
    "owner": "vladthecto",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/crewmind-bets",
    "downloadUrl": "https://openagent3.xyz/downloads/crewmind-bets",
    "agentUrl": "https://openagent3.xyz/skills/crewmind-bets/agent",
    "manifestUrl": "https://openagent3.xyz/skills/crewmind-bets/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/crewmind-bets/agent.md"
  }
}