Generate Call Data for Reward Withdrawal Transactions

·

In the rapidly evolving world of decentralized finance (DeFi), seamless integration between wallets and blockchain protocols is essential for delivering smooth user experiences. One crucial functionality in this ecosystem is the ability to programmatically generate call data for reward withdrawal transactions. This empowers developers and wallet providers to enable users to claim their staking rewards, liquidity mining incentives, or protocol distributions without manually interacting with dApps.

This guide dives into the DeFi API endpoint that generates call data for claiming reward transactions — a core component of Web3 infrastructure designed for scalability, security, and ease of integration.

Understanding the Reward Withdrawal Transaction API

The Generate Call Data for Reward Withdrawal Transactions API provides developers with the necessary calldata to construct and sign transactions that withdraw earned rewards from supported DeFi protocols. Instead of requiring users to navigate multiple interfaces, this endpoint streamlines the process by returning ready-to-use transaction parameters.

By integrating this API, platforms can offer automated reward collection, boosting user engagement and reducing friction in yield optimization strategies.

👉 Discover how to integrate powerful Web3 transaction tools directly into your application

Endpoint Details

This secure RESTful endpoint accepts structured JSON input containing wallet and investment details, then returns encoded transaction data that can be signed and broadcasted on-chain.

Required Request Parameters

To generate valid call data, the following parameters must be included in the request body:

Core Wallet & Investment Info

ParameterTypeRequiredDescription
addressStringYesUser's wallet address
investmentIdStringYesUnique identifier for the investment product

These fields identify who is claiming and from which position the rewards are being withdrawn.

User Input Token List (userInputList)

An array of structured objects specifying token details used in the transaction context:

This list helps define the environment and assets related to the claim operation.

Expected Output List (expectOutputList)

Another structured array defining expected return values:

Used for validation and front-end display purposes.

Optional: Extra Configuration (extra)

A flexible string field encoding additional instructions using key-value pairs in JSON format. Supported keys include:

claimIndex (Number)

Specifies which reward instance to claim. Fetchable via the Unstake List API. Relevant when:

analysisPlatformId (Number)

Used to claim all pending rewards across an entire platform. Supported platforms include:
Compound, Aave V2/V3, WePiggy, Venus, BENQI, Radiant, Geist Finance, Tender, SonneFinance, Clearpool.

This enables bulk reward collection for complex multi-position portfolios.

Response Structure

Upon successful request, the API returns a structured response with complete transaction call data.

Key Response Fields

Verifying Data Authenticity

To ensure trust and security, clients can verify the origin of the call data:

  1. Extract r, s, and v values from signatureData.
  2. Concatenate: to + serializedData + originalData.
  3. Compute the verification hash and recover the public key.
  4. Confirm it matches OKX’s signing key.

This optional step enhances security, especially in high-value or automated systems.

Practical Use Case: Automating Staking Rewards

Imagine a wallet app that allows users to stake ETH via Lido and AVAX via BENQI. Instead of visiting each protocol’s interface, users can:

Developers can schedule auto-compounding flows or batch claims to reduce gas costs — all powered by this API.

👉 Build smarter DeFi experiences with reliable transaction generation tools

Frequently Asked Questions (FAQ)

Q: Which DeFi protocols support automated reward claiming through this API?
A: Currently supported protocols include Ankr, Benqi, Stader, Lido, Compound, Aave V2/V3, Venus, Radiant, Geist Finance, and others. Support continues to expand as new integrations go live.

Q: Can I claim overdue rewards using this endpoint?
A: Yes — but only for certain protocols like BENQI. Set claimOverdue = true in the extra parameter to allow collection of expired rewards, which may differ in token type from standard payouts.

Q: Is it mandatory to verify the signatureData?
A: No — verification is optional but strongly recommended for applications handling large volumes or high-value transactions to prevent tampering.

Q: What happens if I send an invalid claimIndex?
A: The API will return an error indicating invalid or non-existent reward index. Always fetch active claims first using the Position Query or Unstake List APIs.

Q: Can I use this API to claim rewards across multiple chains at once?
A: Each request is chain-specific. You’ll need to make separate calls per blockchain, using the appropriate chainId in both input and output lists.

Q: Does this API execute the transaction on-chain?
A: No — it only generates the unsigned transaction data. Your application must handle signing (via wallet SDK) and broadcasting to the network.

Core Keywords

With growing demand for frictionless yield management, APIs like this are becoming foundational tools for next-generation Web3 applications. Whether building a custodial wallet, yield aggregator, or institutional DeFi gateway, leveraging standardized endpoints ensures reliability and faster time-to-market.

👉 Unlock advanced DeFi capabilities with secure, scalable Web3 APIs