lendborrow

Borrow

Initiates a borrowing transaction for a specified amount of tokens from supported lending markets (Aave V2/V3, Compound V2/V3), allowing configuration of asset, amount, interest rate mode, on-behalf-of address, and gas parameters for an optimized borrowing process.

💡 Compute Unit Value: 225 (Fixed)

post/defi/v1/lendborrow/borrow

Request

  • Base URL
    https://svc.blockdaemon.com
  • URL
    https://svc.blockdaemon.com/defi/v1/lendborrow/borrow
  • Auth
    API key in header X-API-Key

Request body

lendborrowId'1000' | '1003' | '1005' | '1200' | '1208' | '1203' | '1204' | '1205' | '1206' | '1207' | '1100' | '1300' | '1302' | '1400' | '1401' | '1402' | '1403' | '1404'

The unique ID to specify the lending and borrowing protocol for routing relevant queries or transactions.

assetstring required

The token address of the asset to borrow.

amountstring required

Number of tokens, specified in the token's smallest denomination (base units). Do not send human-readable decimal values. Examples: 1 WETH (18 decimals) = "1000000000000000000"; 1 USDC (6 decimals) = "1000000".

interestRateModestring required

Interest mode as per Aave. Use 0 for static and 1 for variable.

onBehalfOfstring required

Public address of the user on whose behalf the borrow action will be executed.

fromstring required

Blockchain address of the sender. For EVM chains, use a checksummed hex address (e.g., 0xABCDEF...). This address must hold sufficient balance and will sign the transaction.

gasstring

Maximum number of gas units to allocate for the transaction, as an integer string (e.g., '200000'). If omitted, gas is estimated automatically. Note: this is gas units, not wei or gwei.

gasPrioritystring

Specifies the priority level for gas fees (e.g., 'low', 'medium', or 'high'), which influences the transaction speed and cost.

enableFeeboolean

Flag to include a basis points fee transaction alongside the main transaction when set to true.

batchOption'EIP-5792' | 'EIP-7702'

Transaction batching standard to use. Supported values: 'EIP-5792' (wallet-level batching via wallet_sendCalls) or 'EIP-7702' (EOA code delegation via batcherContract). Requires batcherContract when using EIP-7702.

batcherContractstring

The EOA address of the batcher that will be used to execute the transaction when using EIP-7702 batching. If not provided, the default batcher contract for the chain will be used.

simulateboolean

When true, dry-runs the transaction batch via eth_simulateV1 and returns a simulate field with status and error on each transaction.

marketstring

Asset market, such as USDC or WETH. Defaults to USDC if not provided.

marketIdstring required

Specifies the market Id of any market in Morpho.

tostring required

Blockchain address of the recipient. For EVM chains, use a checksummed hex address (e.g., 0xABCDEF...).

Example request

{
  "lendborrowId": "1000",
  "asset": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
  "amount": "1000000000000000000",
  "interestRateMode": "1",
  "onBehalfOf": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "from": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "gas": "100000",
  "gasPriority": "low",
  "enableFee": false,
  "batchOption": "EIP-5792",
  "batcherContract": "0x9c933f9d2efd76ce25b0d3dde84d3f94e78a50ca",
  "simulate": false,
  "market": "USDC",
  "marketId": "0x3b3769cfca57be2eaed03fcc5299c25691b77781a1e124e7a8d520eb9a7eabb5",
  "to": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402"
}

Response

Successful response

statusnumber

Numeric status code indicating success or failure of the API call

msgstring

Human-readable message describing the API result or error

Example response

{
  "status": 200,
  "msg": "success",
  "data": {
    "chainId": "1",
    "from": "0x829bFB482331b9Dc2BEcb5483ecA79c0578c3A45",
    "to": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2",
    "value": "0",
    "gas": "408298",
    "estimationCheck": true,
    "data": "0xa415bcad00000000000000000000000065afadd39029741b3b8f0756952c74678c9cec93000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000829bfb482331b9dc2becb5483eca79c0578c3a45",
    "referenceId": "4fab595487904774a12c2555d9ba02a1"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.