Symbiosis API Client documentation

Add your content using reStructuredText syntax. See the reStructuredText documentation for details.

class symbiosis_api_client.HttpxRequestClient(*args, **kwargs)

Bases: object

close()

Close the HTTP client.

get_calc_token_price(payload: TokenPriceRequestSchema) TokenPriceResponseSchema

Returns the price of the token in USD.

To get chain’s carrier token price, leave address empty.

get_chains() ChainsResponseSchema

Returns the chains available for swapping.

get_direct_routes() DirectRoutesResponse

Returns the direct routes for all tokens.

get_fees() FeesResponseSchema

Returns the current fees for all tokens.

get_stucked(payload: StuckedRequestSchema) StuckedResponseSchema

Returns a list of stuck cross-chain operations associated with the specified address.

get_swap_chains()

Returns the swap chains for supported blockchain networks.

get_swap_configs()

Returns the swap configurations for supported blockchain networks.

get_swap_durations() SwapDurationsResponseSchema

Returns estimated cross-chain swap execution times for supported blockchain networks. The duration is measured in seconds and is based on historical data.

get_swap_limits() SwapLimitsResponseSchema

Returns the minimum and maximum allowed swap amounts for supported blockchain networks.

get_swap_tiers()

Returns the swap tiers for supported blockchain networks.

get_tokens() TokensResponseSchema

Returns the tokens available for swapping.

get_transaction(payload: Tx12) TxResponseSchema

Returns the operation by its transaction hash.

health_check(raise_exception: bool = False) bool
post_batch_tx(payload: BatchTxRequestSchema) BatchTxResponseSchema

Returns the status of multiple cross-chain operations in a single request.

Works the same way as /v1/tx, but accepts an array of { chainId, transactionHash } pairs to check the status of several operations at once.

post_revert(payload: RevertRequestSchema) RevertResponseSchema

Returns calldata required to revert a stuck cross-chain operation.

Data includes: swapping, bridging, zapping, interchain communicating. If a cross-operation gets stuck, Symbiosis automatically reverts such swaps.

Parameters:

payload – The payload containing the revert details.

Returns:

The response from the Symbiosis Finance API.

post_swap(payload: SwapRequestSchema) SwapResponseSchema

Performs a cross-chain swap using the Symbiosis Finance API.

Parameters:

payload – The payload containing the swap details.

Returns:

The response from the Symbiosis Finance API.

post_zapping(payload: ZappingExactInRequestSchema) ZappingExactInResponseSchema

Returns calldata to execute a cross-chain zap operation.

A cross-chain zap combines a cross-chain swap from the source token to the destination token with a subsequent deposit of the destination token into a liquidity pool managed by Symbiosis or a third-party DeFi protocol.

Parameters:

payload – The payload containing the zap details.

Returns:

The response from the Symbiosis Finance API.

class symbiosis_api_client.SymbiosisApiClient(base_url: str | None = None, httpx_client: Client | None = None)

Bases: object

Symbiosis API client for interacting with the Symbiosis API.

property chain_names: list[str]

Return a list of chain names.

property chains: list[ChainsResponseSchemaItem]
close() None

Close the HTTP client.

create_swap(chain_from: str, token_from: str, chain_to: str, token_to: str, amount: float, sender: str, recipient: str, slippage: int = 200, raise_exception: bool = False) SwapResponseSchema | None

Create a swap request.

property fees: list[FeesResponseItem]
get_txn_status(chain_name: str, txn_hash: str) TxResponseSchema | None
property routes: list[DirectRoutesResponseItem]
property swap_chains: list[int]

Return a list of chain IDs.

property swap_configs: list[SwapConfigsResponseItem]
property swap_durations: list[SwapDurationsResponseSchemaItem]
property swap_limits: list[SwapLimitsResponseSchemaItem]
property swap_tiers: list[SwapDiscountTiersResponseSchemaItem]
property tokens: list[TokensResponseSchemaItem]