SyncSwap

In this section, we will introduce the SyncSwap SDK interfaces, which provide developers with a convenient and efficient way to interact with the SyncSwap 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 SyncSwap protocol, which can be accessed through the api.protocols.syncswap. prefix.

SwapToken

The following code defines interfaces and functions related to the SyncSwap swap token logic:

Types

  • SwapTokenParams: A type that represents the input parameters for the SyncSwap swap token logic

interface 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;
}
  • SwapTokenFields: A type that represents the fields required for the SyncSwap swap token logic.

  • SwapTokenLogic: An interface that extends the Logic interface and represents the SyncSwap swap token logic. It includes the rid, and fields properties.

Functions

  • getSwapTokenTokenList(chainId: number): An asynchronous function that retrieves the list of tokens supported by the SyncSwap swap token logic on the specified chainId.

  • getSwapTokenQuotation(chainId: number, params: SwapTokenParams): An asynchronous function that retrieves a quotation for swapping assets on the SyncSwap protocol with the specified params object on the specified chainId.

  • newSwapTokenLogic(fields: SwapTokenFields): A function that creates the SyncSwap swap token logic data with the given fields object.

Example Code

Last updated