ModuleSDK
Modules
getSwapOrderData

getSwapOrderData

Get the data for the swap order to use when creating a new scheduled order.

Usage

const data = getSwapOrderData({
  recurringOrder: {
    buyToken: {
      token_address: "0x123...",
      decimals: 18,
    },
    sellToken: {
      token_address: "0x123...",
      decimals: 18,
    },
    amount: 1000000,
    orderType: "buy",
  },
});

Parameters

recurringOrder.buyToken

  • Type: { token_address: Address, decimals: number }

The token to buy.

recurringOrder.sellToken

  • Type: { token_address: Address, decimals: number }

The token to sell.

recurringOrder.amount

  • Type: number

The amount of the token to buy or sell.

recurringOrder.orderType

  • Type: 'buy' | 'sell'

Whether the order is a buy or sell order.

recurringOrder.priceLimit (optional)

  • Type: string

The price limit for the order.

recurringOrder.maxGasPrice (optional)

  • Type: string

The maximum gas price for the order.

recurringOrder.expirationDate (optional)

  • Type: string

The expiration date for the order.

Returns

data

The encoded data for the scheduled order.