Use SendArcade
The Use SendArcade
tool, part of AgentiPy, allows users to interact with the Sendarcade platform (https://rps.sendarcade.fun
), specifically to play a game of Rock Paper Scissors. The game involves staking an amount of SOL and making a choice ("rock", "paper", or "scissors"). The interaction is handled through a series of API calls to Sendarcade, which provides transaction details that are then signed and submitted to the Solana blockchain.
Functionality
This tool is implemented in the SendArcadeManager
class. It interacts directly with the Sendarcade API.
Key Methods:
rock_paper_scissor(agent: SolanaAgentKit, amount: float, choice: str) -> str
:Initiates a Rock Paper Scissors game.
Parameters:
agent
: TheSolanaAgentKit
instance (provides wallet and connection).amount
: The amount of SOL to stake on the game.choice
: The player's choice ("rock", "paper", or "scissors").
Makes a POST request to the Sendarcade API (
/api/actions/bot
) with the game parameters.If the API returns a transaction, it's signed by the agent's wallet and sent to the Solana network.
After confirmation, it calls the
outcome
method to get the game result.Returns a game result message (e.g., "You lost...") or a transaction signature if a claim is needed.
outcome(agent: SolanaAgentKit, sig: str, href: str) -> str
:(Internal helper, called by
rock_paper_scissor
) Retrieves the outcome of the game using a transactionsig
(signature) and an APIhref
(path) provided by the previous step.If the game was won and a prize can be claimed, it calls
won
.Returns an outcome message.
won(agent: SolanaAgentKit, href: str) -> str
:(Internal helper) Handles the transaction process if the player won and needs to claim a prize. Uses an API
href
for claiming.If a claim transaction is provided by the API, it's signed and sent.
May call
post_win
for a final step.Returns a success/failure message for the claim.
post_win(agent: SolanaAgentKit, href: str) -> str
:(Internal helper) Finalizes the prize claim process using an API
href
.Returns a confirmation message.
Important Considerations:
Direct API Interaction & On-Chain: This tool interacts directly with the Sendarcade API to get transaction details, which are then signed by the agent's wallet and submitted to the Solana blockchain. These are on-chain financial transactions (staking SOL).
Gaming Risk: Playing games on such platforms involves the risk of losing the staked amount.
API Reliance: The entire game flow and outcome processing depend on the Sendarcade API's responses and availability.
Source Code
You can find the source code for this tool on GitHub: https://github.com/niceberginc/agentipy/blob/main/agentipy/tools/use_sendarcade.py
Last updated