Generate redemption transaction call data#
Description: This API provides the call data for a redemption transaction.
Request URL#
POST https://www.okx.com/api/v5/defi/transaction/redemption
Request parameters#
Parameter name | Description | Parameter type | Required | Data type |
---|---|---|---|---|
address | User wallet address | Request body | Yes | String |
investmentId | Investment product ID | Request body | Yes | String |
userInputList | User input token information | Request body | Yes | Array[Struct] |
>chainId | Blockchain ID (Default: Investment product network) | Request body | No | String |
>coinAmount | Subscription quantity | Request body | Yes | String |
>tokenAddress | Smart contract address of the subscription token (Default: Investment product token address) | Request body | No | String |
expectOutputList | User expected profit information | Request body | Yes | Array[Struct] |
>chainId | Blockchain ID | Request body | No | String |
>coinAmount | Subscription quantity | Request body | Yes | String |
>tokenAddress | Smart contract address of the subscription token | Request body | No | String |
extra | See remarks for details | Request body | No | String |
Remarks:#
Usage of extra redeemCalldataExtInfo
- SUI Staking: SUI staking investment
- SOL Staking: SOL staking investment
Here provides the investOrderList field, which represents each user’s subscription. The investOrderList.redeemExtra field represents the data required for the call data Extra.
{"extra": "{\"redeemCalldataExtInfo\":[{\"unstakeIndex\":\"0xbc5118e65240dd5702218b37fd8d965d6eb4400474f34b6fe4a8f7805fc09405\"}]}"}
Response parameters#
Parameter name | Description | Data type |
---|---|---|
dataList | call data information | Array[Struct] |
>from | From (user address) | String |
>to | To (target contract address) | String |
>value | Transfer amount (native token quantity, default is an empty string) | String |
>serializedData | call data | String |
>originalData | Original data (JSON) | JSON String |
>callDataType | Operation type (authorization, subscription, redemption, claim) | String |
>signatureData | Signed call data information, can be used to verify data generated by OKX | String |
Remarks:#
Signature verification method:
- Calculate r, s, v using the signatureData signature information.
- Calculate the verification hash by concatenating the string formed by to + serializedData + originalData.
- Perform public key recovery verification. The client can choose whether to perform signature verification. If the verification is successful, it indicates that the data was signed by OKX.
Redemption example#
Request example#
shell
curl --location 'https://www.okx.com/api/v5/defi/transaction/redemption' \
--header 'OK-ACCESS-KEY: 9c****77' \
--header 'OK-ACCESS-PASSPHRASE: p****d' \
--header 'Content-Type: application/json' \
--data '{
"address": "0x7f****da",
"investmentId": "21033",
"userInputList": [
{
"chainId": 1,
"coinAmount": "1",
"tokenAddress": "0x6b175474e89094c44da98b954eedeac495271d0f"
}
],
"extra": "{\"redeemAll\":1}"
}'
Response example#
200
{
"code": 0,
"msg": "",
"data": {
"dataList": [
{
"callDataType": "WITHDRAW",
"from": "0x7f****da",
"to": "0x83****ea",
"value": "0x0",
"serializedData": "0xba0876520000000000000000000000000000000000000000000000000cbb507c8eb3879f0000000000000000000000007f429edeff8afc7bb3a2cf7db832fc86f6fa99da0000000000000000000000007f429edeff8afc7bb3a2cf7db832fc86f6fa99da",
"originalData": "{\"callDataType\":\"WITHDRAW\",\"methodDefine\":\"redeem(uint256,address,address)\",\"methodId\":\"0xba087652\",\"methodType\":\"METHOD_ID\",\"params\":{\"params\":[\"917415445000325023\",\"0x7f429edeff8afc7bb3a2cf7db832fc86f6fa99da\",\"0x7f429edeff8afc7bb3a2cf7db832fc86f6fa99da\"]},\"useAdapter\":false}",
"signatureData": "e6beeb6f9df6ecb7eb7791e57226f9eca1d7c3efa869172bb5021b9c827ad21b46e3dc4566608af727555e0a47aa90cf261331f4e1691b0201aa0b8a00ea685b1b"
}
]
}
}