How to withdraw
In this section, you'll learn how to request ready-to-use transaction data (bytecode) for withdrawing from a yield position.
Prerequisites
As in the How to Get a Quote section, you can choose either the explicit path or the protocol-agnostic (less explicit) path to get the transaction data.
A) Protocol-Specific Approach (Explicit)
Use this when you want to work with a specific yield protocol.
Request Transaction Data Fetch specific protocol information using:
GET /strategies/:id/bytecode
Required Parameters:
ParameterDescriptionExampleaction
Type of operation
withdraw
chainId
Blockchain network ID
137
(Polygon)protocol
Protocol name
aave
amount
Withdrawal amount
1000000000000000000
(1 ETH with decimals)asset
Asset to withdraw
ETH
wallet
Wallet that owns the position
0x1234567890123456789012345678901234567890
Example Request:
GET /strategies/3341412233111/bytecode?action=withdraw&chainId=137&protocol=aave&amount=1000000000000000000&asset=ETH&wallet=0x1234567890123456789012345678901234567890
Response:
{ "bytecode": [ { "to": "0x794a61358D6845594F94dc1DB02A252b5b4814aD", "value": "0", "data": "0xe8eda9df0000000000000000000000003c499c542cef5e3811e1192ce70d8cc03d5c33590000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000001" } ] }
Our API returns the transaction data as an object containing to
, value
, and data
fields.
B) Protocol-Agnostic Approach (Less Explicit)
Let our system automatically select the optimal protocol for your needs.
Use the Generic Endpoint
GET /yield/:currency
Use the same parameters as above, excluding
protocol
.Example Request:
GET /yield/USD?action=withdraw&chainId=137&amount=1000000000000000000&asset=ETH&wallet=0x1234567890123456789012345678901234567890
Response:
{ "bytecode": [ { "to": "0x794a61358D6845594F94dc1DB02A252b5b4814aD", "value": "0", "data": "0xe8eda9df0000000000000000000000003c499c542cef5e3811e1192ce70d8cc03d5c33590000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000001" } ] }
Our API returns the transaction data as an object containing to
, value
, and data
fields.
Next Steps
After getting the transaction data, you can:
Last updated