get-available-rewards
Query and retrieve all available rewards for a specific address on the MantraChain blockchain using the MCP server. Requires the network name for accurate results.
Instructions
Get all available rewards for an address
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | No | Address to query for available rewards | |
| networkName | Yes | Name of the network to use - must first check what networks are available through the mantrachain-mcp server by accessing the networks resource `networks://all` before you pass this arguments |
Implementation Reference
- src/tools/staking.ts:131-147 (registration)MCP tool registration for 'get-available-rewards', including Zod input schema (address optional, networkName required) and inline handler that initializes MantraClient and fetches rewards.server.tool( "get-available-rewards", "Get all available rewards for an address", { address: z.string().optional().describe("Address to query for available rewards"), networkName: z.string().refine(val => Object.keys(networks).includes(val), { message: "Must be a valid network name" }).describe("Name of the network to use - must first check what networks are available by accessing the networks resource `networks://all` before you pass this arguments. Defaults to `mantra-dukong-1` testnet."), }, async ({ address, networkName }) => { await mantraClient.initialize(networkName); const rewards = await mantraClient.getAvailableRewards(address); return { content: [{type: "text", text: JSON.stringify(convertBigIntToString(rewards))}], }; } );
- src/services/staking-service.ts:56-64 (handler)Core handler logic in StakingService: queries delegation total rewards using the distribution extension on queryClient.async getAvailableRewards(address?: string) { try { const delegatorAddress = address || this.address; const response = await this.queryClient.distribution.delegationTotalRewards(delegatorAddress); return response; } catch (error) { throw new Error(`Failed to fetch available rewards: ${error instanceof Error ? error.message : String(error)}`); } }
- src/mantra-client.ts:161-166 (helper)MantraClient wrapper method that delegates getAvailableRewards call to the underlying StakingService.async getAvailableRewards(address?: string) { if (!this.stakingService) { throw new Error('Client not initialized. Call initialize() first.'); } return this.stakingService.getAvailableRewards(address); }