Understanding how to generate call data for redemption transactions is essential for developers integrating decentralized finance (DeFi) functionalities into Web3 applications. This guide walks you through the API structure, parameters, response details, and practical implementation steps for generating secure and accurate redemption transaction data using the OKX DeFi API.
Whether you're building a wallet-as-a-service platform or enhancing user interaction with staking products, mastering this process ensures seamless integration and reliable transaction execution across multiple blockchain networks.
👉 Unlock powerful Web3 tools to streamline your DeFi development workflow.
API Overview
The Generate Call Data for Redemption Transactions API provides the necessary call data required to execute a redemption transaction within supported DeFi investment products. This includes staking positions on networks such as SUI and SOL.
By submitting specific user and investment details, developers receive structured transaction data that can be signed and broadcasted on the appropriate blockchain.
Endpoint
POST https://web3.okx.com/api/v5/defi/transaction/redemptionThis endpoint returns serialized call data suitable for on-chain execution, along with metadata needed for verification and integration.
Request Parameters
To successfully generate redemption call data, the following parameters must be included in the request body:
address(String, required)
The user's wallet address initiating the redemption.investmentId(String, required)
Unique identifier of the DeFi investment product being redeemed.userInputList(Array[Struct], required)
List of input token details provided by the user:chainId(String, optional) – Blockchain network ID (defaults to the investment’s native chain).coinAmount(String, required) – Amount of tokens to redeem.tokenAddress(String, optional) – Smart contract address of the token (defaults to the investment's token address).
expectOutputList(Array[Struct], required)
Expected output token information after redemption:chainId(String, optional) – Target blockchain ID.coinAmount(String, required) – Expected amount of output tokens.tokenAddress(String, optional) – Output token contract address.
extra(String, optional)
Additional metadata used for complex redemptions. For staking-based investments like SUI or SOL, this field should include redemption-specific extension data retrieved from prior queries.
Key Use Cases for extra
For staking products such as:
- SUI Staking: Requires extended call data from existing investment records.
- SOL Staking: Similar structure, where historical investment order data informs redemption logic.
You can retrieve the investOrderList field—including redeemExtra values—using the Calculation & Query Info for Redemption API. This ensures accurate reconstruction of redemption paths based on past user activity.
👉 Access comprehensive Web3 APIs to enhance your DeFi application’s capabilities.
Response Structure
Upon successful request processing, the API returns a structured response containing all necessary transaction components:
dataList(Array[Struct])
Contains one or more transaction objects:from(String) – Initiating wallet address (user’s address).to(String) – Target smart contract address for redemption.value(String) – Native token amount sent with the transaction (if applicable; otherwise empty).serializedData(String) – Hex-encoded call data to be executed on-chain.originalData(JSON String) – Raw JSON representation of the transaction for transparency and debugging.callDataType(String) – Type of operation: e.g., "authorization", "subscription", "redemption", "claim".signatureData(String) – Digital signature proving the authenticity of the generated data by OKX.
Verification & Security
To ensure data integrity and prevent tampering, OKX signs all generated call data. You can optionally verify this signature using the following method:
- Extract Signature Components
ParsesignatureDatato obtain the elliptic curve signature values:r,s, and recovery parameterv. Reconstruct Verification Hash
Concatenate the following strings in order:toserializedDataoriginalData
Compute the Keccak-256 hash of the concatenated string.
- Recover Public Key
Using ECDSA recovery with the hash and signature (r,s,v), derive the public key. If it matches OKX’s known signing key, the data is authentic.
This verification step is optional but highly recommended for high-security environments where trustless validation is critical.
Redemption Workflow Example
Let’s walk through a real-world scenario: a user wants to redeem their SUI staking position.
Step 1: Fetch Investment Details
Use the query API to get the user’s investment history and extract redeemExtra from investOrderList.
Step 2: Construct Request
{
"address": "0xabc123...",
"investmentId": "20801",
"userInputList": [
{
"coinAmount": "500",
"tokenAddress": "0xdef456..."
}
],
"expectOutputList": [
{
"coinAmount": "750",
"tokenAddress": "0xghi789..."
}
],
"extra": "{\"redeemExtra\":\"0x...\"}"
}Step 3: Receive and Validate Response
OKX returns:
{
"dataList": [
{
"from": "0xabc123...",
"to": "0xcontract...",
"value": "",
"serializedData": "0xa1b2c3...",
"originalData": "{\"investmentId\":\"20801\",...}",
"callDataType": "redemption",
"signatureData": "0x4b5a..."
}
]
}Step 4: Sign and Broadcast
The client signs the transaction using the user’s private key and broadcasts it via a node or RPC provider.
Frequently Asked Questions (FAQ)
Q: What blockchains are supported for redemption transactions?
A: The API supports multiple chains including Ethereum, BSC, Solana, and SUI. The exact list depends on active DeFi offerings—always check current investment IDs for compatibility.
Q: Is it mandatory to verify the signatureData?
A: No, verification is optional. However, it enhances security by confirming that call data originates from OKX and hasn’t been altered.
Q: Can I redeem partial amounts from a staking position?
A: Yes, most staking products support partial redemptions. Ensure coinAmount reflects the correct proportion and matches backend rules.
Q: What happens if I omit tokenAddress in userInputList?
A: The system defaults to the primary token associated with the investmentId. Only omit if intending to use the default asset.
Q: How do I handle errors during redemption?
A: Check the HTTP status code and error message in the response. Common issues include invalid addresses, insufficient balance, or incorrect chain IDs.
Q: Can this API be used for non-staking DeFi products?
A: Yes, it supports various DeFi instruments including liquidity pool exits and yield vault withdrawals—provided they are listed under supported investment types.
👉 Start building secure, scalable Web3 experiences with trusted infrastructure.
Conclusion
Generating redemption transaction call data via the OKX DeFi API enables developers to offer users a smooth and secure way to exit investments across multiple blockchains. With clear parameter definitions, built-in security signatures, and support for complex staking mechanisms, this API simplifies integration while maintaining high standards of reliability.
By leveraging structured responses and optional verification workflows, your application can ensure both functional accuracy and user trust—key pillars in modern Web3 development.