Skip to main content
In this section, you’ll learn how to request ready-to-use transaction data (bytecode) for depositing into a yield position.
Prerequisites: Make sure you’ve reviewed how to check protocol info first.

Protocol-Specific Approach

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:
ParameterDescriptionExample
actionType of operationlend
amountAmount in token’s smallest unit10000000
walletWallet that will own the position0x1234...
Optional Parameters (same-chain swap):
ParameterDescriptionExample
fromTokenAddressToken address to swap from before depositing (same-chain). When provided, the response includes swap transaction(s) before the deposit bytecode.0xC02aaA39... (WETH)
When fromTokenAddress is provided, the API automatically prepends a swap from fromTokenAddress to the strategy’s underlying asset on the same chain. The amount parameter refers to the amount of fromTokenAddress to swap. The response metadata will have isSameChainSwap: true.
Optional Parameters (cross-chain):
ParameterDescriptionExample
fromChainIdSource chain ID (for cross-chain deposits)1 (Ethereum)
fromTokenAddressSource token address (required if fromChainId)0xA0b86991c... (USDC on ETH)
toTokenAddressDestination token address (for cross-chain)0x2791Bca1f... (USDC on Polygon)
Optional Parameters (response format):
ParameterDescriptionExample
outputResponse format: bytecode (default), userOperation, fireblocks, or instructions (Solana)fireblocks
accountIdFireblocks vault account ID. Required when output=fireblocks12
Example Request (direct deposit):
GET /strategies/aave-usdc-polygon/bytecode?action=lend&amount=10000000&wallet=0x1234...
Example Response:
{
  "feeCharged": "0",
  "metadata": {
    "isCrossChain": false,
    "isSameChainSwap": false,
    "crossChainQuoteId": null
  },
  "bytecode": [
    {
      "to": "0x794a61358D6845594F94dc1DB02A252b5b4814aD",
      "value": "0",
      "data": "0xe8eda9df...",
      "chainId": 137
    }
  ]
}
Example Request (same-chain swap + deposit): If you hold WETH but want to deposit into a USDC strategy, pass fromToken to swap first:
GET /strategies/aave-usdc-polygon/bytecode?action=lend&amount=1000000000000000000&wallet=0x1234...&fromTokenAddress=0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619
Example Response:
{
  "feeCharged": "0",
  "metadata": {
    "isCrossChain": false,
    "isSameChainSwap": true,
    "crossChainQuoteId": null
  },
  "bytecode": [
    {
      "to": "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57",
      "value": "0",
      "data": "0x54e3f31b...",
      "chainId": 137
    },
    {
      "to": "0x794a61358D6845594F94dc1DB02A252b5b4814aD",
      "value": "0",
      "data": "0xe8eda9df...",
      "chainId": 137
    }
  ]
}
crossChainQuoteId is populated when isCrossChain is true and can be used to track cross-chain transaction status.
Example Request (Fireblocks output): If you are using Fireblocks custody, set output=fireblocks and pass your vault accountId. The wallet parameter must be a smart wallet previously provisioned via POST /fireblocks-smart-account (see Fireblocks Integration).
GET /strategies/aave-usdc-polygon/bytecode?action=lend&amount=10000000&wallet=0xSafeAddress&output=fireblocks&accountId=YOUR_VAULT_ACCOUNT_ID
Example Response:
{
  "feeCharged": "0",
  "metadata": {
    "isCrossChain": false,
    "isSameChainSwap": false,
    "crossChainQuoteId": null
  },
  "transactionData": {
    "transactionRequest": {
      "operation": "CONTRACT_CALL",
      "assetId": "MATIC_POLYGON",
      "source": {
        "type": "VAULT_ACCOUNT",
        "id": "YOUR_VAULT_ACCOUNT_ID"
      },
      "destination": {
        "type": "ONE_TIME_ADDRESS",
        "oneTimeAddress": {
          "address": "0xSafeAddress"
        }
      },
      "amount": "0",
      "extraParameters": {
        "contractCallData": "0x6a761202..."
      },
      "note": "lend aave-usdc-polygon",
      "failOnLowFee": true
    }
  }
}
The transactionData.transactionRequest payload can be submitted directly to the Fireblocks Transactions API (POST /v1/transactions) — no further encoding required. The Earn Owner vault must be configured as the signer (see Fireblocks Integration).
To let the system automatically select the best protocol, use GET /yield/ to retrieve ranked recommendations, then pass the chosen strategyId into the Protocol-Specific approach above. See the API Reference for the full yield endpoint schema.

Executing the Transaction

Once you have the bytecode, you can execute it using your wallet provider:
// Example using ethers.js
const { data: result } = await deframe.get('/strategies/aave-usdc-polygon/bytecode', {
  params: { action: 'lend', amount: '10000000', wallet: walletAddress }
})

for (const tx of result.bytecode) {
  await signer.sendTransaction({ to: tx.to, value: tx.value, data: tx.data })
}

console.log('Deposit successful!')

Next Steps

Check Positions

Monitor your open yield positions

Withdraw

Learn how to withdraw from positions