feat(scripting): connect give_item to wallet rewards, add [E] Interact prompt and toast feedback
checkpoint / checkpoint (push) Failing after 6m2s

This commit is contained in:
2026-09-18 01:04:36 +00:00
parent 370395f1b6
commit f93e99f042
3 changed files with 144 additions and 1 deletions
+35
View File
@@ -76,3 +76,38 @@ async def get_wallet_transactions(
limit=limit,
offset=offset,
)
class RewardRequest(BaseModel):
amount: int = Field(..., gt=0, le=10000, description="Amount of Buffalo Chips to reward")
reason: str | None = Field(default="in_game_reward", description="Reward source or reason")
class RewardResponse(BaseModel):
success: bool
amount: int
new_balance: int
@router.post("/reward", response_model=RewardResponse)
async def reward_chips(
payload: RewardRequest,
current_user: CurrentUser,
db: DbDep,
):
"""Credit in-game Buffalo Chips reward directly to the player's wallet."""
wallet, tx = await wallet_service.credit(
db,
user_id=current_user.id,
amount=payload.amount,
tx_type=TransactionType.admin_adjustment,
reference_type="gameplay_reward",
reference_id=payload.reason or "in_game_reward",
metadata={"reason": payload.reason or "in_game_reward"},
)
return RewardResponse(
success=True,
amount=payload.amount,
new_balance=wallet.balance,
)