Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.deframe.io/llms.txt

Use this file to discover all available pages before exploring further.

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
fromChainId or chainIdInSource chain ID. Use the strategy chain for same-chain swaps. Required when fromTokenAddress is provided.137 (Polygon)
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 with a fromChainId matching the strategy chain, the API automatically prepends a same-chain swap from fromTokenAddress to the strategy’s underlying asset. The amount parameter refers to the amount of fromTokenAddress to swap, and crossChain.isCrossChain remains false.
Optional Parameters (cross-chain):
ParameterDescriptionExample
fromChainId or chainIdInSource chain ID for the funds being bridged before deposit1 (Ethereum)
fromTokenAddressSource token address. Required when fromChainId or chainIdIn is provided. Must be a valid ERC-20 token on the source chain; returns FROM_TOKEN_NOT_SUPPORTED (400) if the address is not a valid ERC-20 contract on the specified chain.0xA0b86991c... (USDC on ETH)
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",
  "chainIdIn": 137,
  "chainIdOut": 137,
  "id": "65f3a1c8e9b2d4f8a7c1d2e3",
  "crossChain": {
    "isCrossChain": false,
    "chainIdIn": 137,
    "chainIdOut": 137
  },
  "quote": 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 fromTokenAddress to swap first:
GET /strategies/aave-usdc-polygon/bytecode?action=lend&amount=1000000000000000000&wallet=0x1234...&fromChainId=137&fromTokenAddress=0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619
Example Response (same-chain swap + deposit):
{
  "feeCharged": "0",
  "chainIdIn": 137,
  "chainIdOut": 137,
  "id": "65f3a1c8e9b2d4f8a7c1d2e3",
  "crossChain": {
    "isCrossChain": false,
    "chainIdIn": 137,
    "chainIdOut": 137
  },
  "quote": null,
  "bytecode": [
    {
      "to": "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57",
      "value": "0",
      "data": "0x54e3f31b...",
      "chainId": 137
    },
    {
      "to": "0x794a61358D6845594F94dc1DB02A252b5b4814aD",
      "value": "0",
      "data": "0xe8eda9df...",
      "chainId": 137
    }
  ]
}
Example Response (cross-chain deposit): When fromChainId differs from the strategy’s chain, the response also includes a quote object describing the bridge selection, the resolved tokens, and the expected/minimum output amount. The crossChain.isCrossChain flag is true.
{
  "feeCharged": "0",
  "chainIdIn": 8453,
  "chainIdOut": 42161,
  "id": "6a04f2f75bf7233c6220b3ca",
  "crossChain": {
    "isCrossChain": true,
    "chainIdIn": 8453,
    "chainIdOut": 42161
  },
  "quote": {
    "bridge": "CCTP",
    "sender": "0x49A54d4d925868475Eb8d2cb2c784481ca755e8A",
    "fromChainId": 8453,
    "fromTokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "toChainId": 42161,
    "toTokenAddress": "0x4F38e7a76b9C32Ab68FBf500E4d52806B15AB93b",
    "inputAmount": { "value": "1000000", "decimals": 6, "humanized": "1.0", "symbol": "USDC" },
    "outputAmount": { "value": "999870", "decimals": 18, "humanized": "0.00000000000099987", "symbol": "KPK-podsUSDCy" },
    "minimumOutputAmount": { "value": "999870", "decimals": 18, "humanized": "0.00000000000099987", "symbol": "KPK-podsUSDCy" },
    "chainIdIn": 8453,
    "chainIdOut": 42161
  },
  "bytecode": [
    { "to": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "value": "0", "data": "0x095ea7b3...", "chainId": "8453" },
    { "to": "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d", "value": "0", "data": "0x8e0250ee...", "chainId": "8453" }
  ]
}
The top-level id is used for execution tracking — store it and pass it to GET /actions/:id to track the cross-chain deposit through completion (see Checking Cross-Chain Deposit Status below).The quote object describes which bridge was selected (bridge), the expected outputAmount, and the worst-case minimumOutputAmount (slippage floor). Display these to the user before they sign.
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",
  "chainIdIn": 137,
  "chainIdOut": 137,
  "id": "65f3a1c8e9b2d4f8a7c1d2e3",
  "crossChain": {
    "isCrossChain": false,
    "chainIdIn": 137,
    "chainIdOut": 137
  },
  "quote": 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!')

Checking Cross-Chain Deposit Status

Cross-chain deposits are asynchronous: the source-chain bridge transaction is signed first, then the bridged funds are delivered and deposited on the destination chain. To track progress to completion, use the id returned in the bytecode response:
GET /actions/:id
Path Parameters:
ParameterDescriptionExample
idThe id returned by GET /strategies/:id/bytecode6a04f2f75bf7233c6220b3ca
Example Request:
GET /actions/6a04f2f75bf7233c6220b3ca
Example Response (deposit in flight):
{
  "id": "6a04f2f75bf7233c6220b3ca",
  "type": "CROSSCHAIN_INVESTMENT_DEPOSIT",
  "status": "PENDING",
  "strategyId": "65a1b2c3d4e5f6a7b8c9d0e1",
  "strategySlug": "aave-usdc-polygon",
  "initialDate": "2026-05-19T14:30:15Z",
  "createdAt": "2026-05-19T14:30:00Z",
  "originAddress": "0x49A54d4d925868475Eb8d2cb2c784481ca755e8A",
  "receiverAddress": "0x49A54d4d925868475Eb8d2cb2c784481ca755e8A",
  "amounts": {
    "assetIn": {
      "token": { "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "symbol": "USDC", "decimals": 6 },
      "chain": { "id": 8453, "name": "base" },
      "amountRaw": "1000000",
      "amountHumanized": "1.0",
      "amountInUSD": "1.00"
    },
    "assetOut": {
      "token": { "address": "0x4F38e7a76b9C32Ab68FBf500E4d52806B15AB93b", "symbol": "KPK-podsUSDCy", "decimals": 18 },
      "chain": { "id": 42161, "name": "arbitrum" },
      "amountRaw": "999870",
      "amountHumanized": "0.00000000000099987",
      "amountInUSD": "1.00"
    }
  },
  "transactions": [
    {
      "chain": "base",
      "txHash": "0xabc...",
      "blockNumber": 19234567,
      "timestamp": "2026-05-19T14:30:15Z",
      "status": "SUCCESS",
      "underlyingAssetFeeValue": "0"
    },
    {
      "chain": "arbitrum",
      "txHash": null,
      "blockNumber": null,
      "timestamp": null,
      "status": "PENDING",
      "underlyingAssetFeeValue": null
    }
  ],
  "finishedAt": null,
  "underlyingAssetFeeValue": "0"
}
Status values:
StatusMeaning
INITIALCreated, awaiting on-chain execution
PENDINGAt least one transaction broadcast; awaiting confirmations
SUCCESSAll steps completed; funds are deposited
FAILEDA step failed
REFUND_REQUIREDBridged funds arrived but the deposit step failed; refund is needed
REFUNDEDRefund completed
EXPIREDQuote expired before execution
Poll this endpoint until status reaches a terminal value (SUCCESS, FAILED, REFUNDED, or EXPIRED). The transactions array lists each on-chain hash as it is confirmed, so you can surface progress to the user as the bridge and the destination-chain deposit complete in sequence.
Same-chain deposits do not need this polling — the deposit completes inline with the user’s signed transaction. The id is still returned for record-keeping and can be queried the same way.

Webhook Notifications

As an alternative to polling, Deframe can push every status transition to a URL you control. The payload is identical to GET /actions/:id, so you can drive the same UI off either source.
Webhook URL configuration is currently provisioned manually — contact the Deframe team to register your webhookURL (and any optional custom headers, e.g. an HMAC signature header). Self-service configuration via the admin panel is coming soon.
Transport:
FieldValue
MethodPOST
URLYour webhookURL
Content-Typeapplication/json
Custom headersAny headers you configure with the team are sent on every request
Body shape:
{
  "messageType": "ACTION_UPDATE",
  "data": { /* same object returned by GET /actions/:id */ }
}
Example payload (cross-chain deposit reaching SUCCESS):
{
  "messageType": "ACTION_UPDATE",
  "data": {
    "id": "6a04f2f75bf7233c6220b3ca",
    "type": "CROSSCHAIN_INVESTMENT_DEPOSIT",
    "status": "SUCCESS",
    "strategyId": "65a1b2c3d4e5f6a7b8c9d0e1",
    "strategySlug": "aave-usdc-polygon",
    "initialDate": "2026-05-19T14:30:15Z",
    "createdAt": "2026-05-19T14:30:00Z",
    "originAddress": "0x49A54d4d925868475Eb8d2cb2c784481ca755e8A",
    "receiverAddress": "0x49A54d4d925868475Eb8d2cb2c784481ca755e8A",
    "amounts": {
      "assetIn": {
        "token": { "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "symbol": "USDC", "decimals": 6 },
        "chain": { "id": 8453, "name": "base" },
        "amountRaw": "1000000",
        "amountHumanized": "1.0",
        "amountInUSD": "1.00"
      },
      "assetOut": {
        "token": { "address": "0x4F38e7a76b9C32Ab68FBf500E4d52806B15AB93b", "symbol": "KPK-podsUSDCy", "decimals": 18 },
        "chain": { "id": 42161, "name": "arbitrum" },
        "amountRaw": "999870",
        "amountHumanized": "0.00000000000099987",
        "amountInUSD": "1.00"
      }
    },
    "transactions": [
      { "chain": "base", "txHash": "0xabc...", "blockNumber": 19234567, "timestamp": "2026-05-19T14:30:15Z", "status": "SUCCESS" },
      { "chain": "arbitrum", "txHash": "0xdef...", "blockNumber": 248123456, "timestamp": "2026-05-19T14:33:02Z", "status": "SUCCESS" }
    ],
    "finishedAt": "2026-05-19T14:33:02Z"
  }
}
Delivery semantics:
  • A request fires for every status change, so you may receive multiple deliveries per deposit (INITIALPENDINGSUCCESS).
  • Deframe expects a 2xx response. Non-2xx responses are recorded but not automatically retried; reconcile with GET /actions/:id if you need at-least-once guarantees.
  • Respond as quickly as possible; do the heavy work asynchronously on your side.

Next Steps

Check Positions

Monitor your open yield positions

Withdraw

Learn how to withdraw from positions