fetch_velora_swap_transaction

Documentation for eth_defi.velora.swap.fetch_velora_swap_transaction function.

fetch_velora_swap_transaction(quote, user_address, slippage_bps=250, api_timeout=datetime.timedelta(seconds=30), partner=None, deadline=None)

Build a Velora swap transaction from a quote.

This calls the Velora /transactions endpoint to build the actual swap transaction calldata that can be executed on Augustus Swapper.

Example:

from eth_defi.velora.quote import fetch_velora_quote
from eth_defi.velora.swap import fetch_velora_swap_transaction

# First get a quote
quote = fetch_velora_quote(
    from_=vault_address,
    buy_token=usdc,
    sell_token=weth,
    amount_in=Decimal("0.1"),
)

# Then build the swap transaction
swap_tx = fetch_velora_swap_transaction(
    quote=quote,
    user_address=vault_address,
    slippage_bps=100,  # 1% slippage
)

# Execute on Augustus Swapper
# tx = web3.eth.send_transaction({
#     "to": swap_tx.to,
#     "data": swap_tx.calldata,
#     "value": swap_tx.value,
# })
Parameters
  • quote (eth_defi.velora.quote.VeloraQuote) – Quote from fetch_velora_quote()

  • user_address (Union[eth_typing.evm.HexAddress, str]) – Address that will execute the swap (the Safe address for vault integration)

  • slippage_bps (int) – Allowed slippage in basis points (e.g., 250 = 2.5%)

  • api_timeout (datetime.timedelta) – API request timeout

  • partner (str | None) – Partner name for analytics tracking

  • deadline (int | None) – UNIX timestamp after which the transaction is invalid

Returns

Swap transaction data ready for execution

Raises

VeloraAPIError – If the API returns an error

Return type

eth_defi.velora.swap.VeloraSwapTransaction