Generate call data for transaction authorization#
Description: This API provides you with call data for various authorizations before making a transaction.
Requset URL#
POST https://www.okx.com/api/v5/defi/transaction/authorization
Request parameter#
Parameter name | Description | Location | Required | Data type |
---|---|---|---|---|
address | User wallet address | Request body | Yes | String |
investmentId | Investment ID | Request body | Yes | String |
type | Transaction type (e.g., 3: Subscription authorization; 4: Redemption authorization; 5: Claim authorization) | Request body | Yes | int |
userInputList | User input token information | Request body | Yes | Array[Struct] |
> chainId | Blockchain ID | Request body | No | String |
> coinAmount | Subscription amount | Request body | Yes | String |
> tokenAddress | Smart contract address of the subscription token | Request body | No | String |
expectOutputList | User expected profit information | Request body | No | Array[Struct] |
> chainId | Blockchain ID | Request body | No | String |
> coinAmount | Subscription amount | Request body | No | String |
> tokenAddress | Smart contract address of the subscription token | Request body | No | String |
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 |
Request example#
shell
curl --location 'https://www.okx.com/api/v5/defi/transaction/authorization' \
--header 'OK-ACCESS-KEY: 9c****77' \
--header 'OK-ACCESS-PASSPHRASE: p****d' \
--header 'Content-Type: application/json' \
--data '{
"address": "0x7f****da",
"userInputList": [
{
"chainId": 56,
"coinAmount": "10",
"tokenAddress": "0x526a913a7a4518aa2abc3dcd3c46a9c73f40f94a"
}
],
"investmentId": "6925",
"type": 3
}'
Response example#
200
{
"code": 0,
"msg": "",
"data": {
"dataList": [
{
"from": "0x7f****da",
"to": "0x52****4a",
"value": "0x0",
"serializedData": "0x095ea7b30000000000000000000000002c34a2fb1d0b4f55de51e1d0bdefaddce6b7cdd60000000000000000000000000000000000000000000000008ac7230489e80000",
"originalDataClass": "OriginalDataApprove",
"originalData": "{\"methodDefine\":\"approve(address,uint256)\",\"methodId\":\"0x095ea7b3\",\"methodType\":\"METHOD_ID\",\"params\":{\"params\":[\"0x2c34a2fb1d0b4f55de51e1d0bdefaddce6b7cdd6\",\"10000000000000000000\"]},\"useAdapter\":false}",
"signatureData": "1bca0efbd1c809de94cdd8c924329c7ac79a4d346742de61925e8494f2c84c446bd3cf42b56d690c85ff513beadf46cd18f4e3e74845a92c48451584615f749d1c"
}
]
}
}