Generating Redemption Transaction Call Data: A Comprehensive Guide

ยท

Overview

This API provides the necessary call data for executing redemption transactions in DeFi protocols. It enables users to securely and efficiently redeem their investments through wallet-as-a-service solutions.

API Endpoint

POST https://web3.okx.com/api/v5/defi/transaction/redemption

Request Parameters

ParameterDescriptionTypeRequiredData Type
addressWallet addressBodyYesString
investmentIdInvestment product IDBodyYesString
userInputListToken input detailsBodyYesArray[Struct]
>chainIdBlockchain ID (default: investment network)BodyNoString
>coinAmountRedemption amountBodyYesString
>tokenAddressToken contract address (default: investment token)BodyNoString
expectOutputListExpected output detailsBodyYesArray[Struct]
>chainIdBlockchain IDBodyNoString
>coinAmountExpected output amountBodyYesString
>tokenAddressOutput token contract addressBodyNoString
extraAdditional metadata (see notes)BodyNoString

Response Parameters

ParameterDescriptionData Type
dataListCall data informationArray[Struct]
>fromSender addressString
>toRecipient contract addressString
>valueTransfer amount (native token)String
>serializedDataCall data payloadString
>originalDataRaw transaction dataJSON String
>callDataTypeOperation type (authorization, subscription, redemption, claim)String
>signatureDataVerification signatureString

Important Notes

  1. Extra Parameter Usage:

  2. Signature Verification:

    • Derive r, s, v from signatureData
    • Create verification hash from to + serializedData + originalData
    • Recover public key for validation

๐Ÿ‘‰ Learn more about secure DeFi transactions

Redemption Process Example

Request Example

{
  "address": "0x123...abc",
  "investmentId": "DEFI-001",
  "userInputList": [
    {
      "coinAmount": "100",
      "tokenAddress": "0x456...def"
    }
  ],
  "expectOutputList": [
    {
      "coinAmount": "95",
      "tokenAddress": "0x789...ghi"
    }
  ]
}

Response Example

{
  "dataList": [
    {
      "from": "0x123...abc",
      "to": "0xDEF...456",
      "value": "",
      "serializedData": "0xabcdef...",
      "originalData": {...},
      "callDataType": "redemption",
      "signatureData": "0x123456..."
    }
  ]
}

FAQs

What is redemption call data?

Redemption call data contains the encoded transaction instructions needed to execute an investment withdrawal from a DeFi protocol. It includes all necessary parameters for the blockchain transaction.

How do I verify the call data signature?

The signature can be verified by:

  1. Extracting signature components (r, s, v)
  2. Creating message hash from transaction details
  3. Recovering the signer's public key

๐Ÿ‘‰ Explore advanced DeFi API features

What information do I need to provide for redemption?

You'll need:

Can I redeem partial investments?

Yes, most protocols support partial redemptions. Specify your desired redemption amount in the coinAmount parameter.

How long do redemptions typically take?

Processing times vary by blockchain network and protocol rules. Ethereum transactions usually take 15 seconds to several minutes, while other chains may process faster.

Best Practices for Secure Redemptions

  1. Always verify call data signatures
  2. Double-check contract addresses
  3. Confirm expected output amounts
  4. Review gas fee estimates
  5. Monitor transaction status

This comprehensive guide covers all aspects of generating and executing redemption transactions through Web3 APIs. For more detailed implementation examples or specific protocol documentation, consult the official API references.