OpenOcean V2
In this section, we will introduce the OpenOcean V2 SDK interfaces, which provide developers with a convenient and efficient way to interact with the OpenOcean V2 protocol. These interfaces are related to swap token and are designed to be used easily and flexibly.
The following section will introduce the interfaces related to the OpenOcean V2 protocol, which can be accessed through the api.protocols.openoceanv2. prefix.
SwapToken
The following code defines interfaces and functions related to the OpenOcean V2 swap token logic:
Types
SwapTokenParams: A type that represents the input parameters for the OpenOcean V2 swap token logic
type SwapTokenParams =
| {
input: {
token: {
chainId: number;
address: string;
decimals: number;
symbol: string;
name: string;
};
amount: string;
};
tokenOut: {
chainId: number;
address: string;
decimals: number;
symbol: string;
name: string;
};
slippage?: number;
disableDexIds?: string;
}SwapTokenFields: A type that represents the fields required for the OpenOcean V2 swap token logic.
SwapTokenLogic: An interface that extends the
Logicinterface and represents the OpenOcean V2 swap token logic. It includes therid, andfieldsproperties.
Functions
getSwapTokenTokenList(chainId: number): An asynchronous function that retrieves the list of tokens supported by the OpenOcean V2 swap token logic on the specified
chainId.getSwapTokenQuotation(chainId: number, params: SwapTokenParams): An asynchronous function that retrieves a quotation for swapping assets on the OpenOcean V2 protocol with the specified
paramsobject on the specifiedchainId.newSwapTokenLogic(fields: SwapTokenFields): A function that creates the OpenOcean V2 swap token logic data with the given
fieldsobject.
Last updated