Skip to main content
The FusionSDK class provides high-level functionality for working with 1inch Fusion Mode. It handles order creation, submission, querying, and management.

Constructor

Creates a new instance of the FusionSDK.
const sdk = new FusionSDK(config)
config
FusionSDKConfigParams
required
Configuration object for the SDK
config.url
string
required
API endpoint URL (e.g., https://api.1inch.dev/fusion)
config.network
NetworkEnum
required
Network to operate on (e.g., NetworkEnum.ETHEREUM)
config.authKey
string
Authentication key for API access
config.blockchainProvider
BlockchainProviderConnector
Custom blockchain provider for signing transactions
config.httpProvider
HttpProviderConnector
Custom HTTP provider (defaults to axios)

Methods

getActiveOrders

Retrieves a paginated list of active orders from the Fusion API.
const orders = await sdk.getActiveOrders({ page: 1, limit: 10 })
params
ActiveOrdersRequestParams
Pagination parameters
params.page
number
Page number (default: 1)
params.limit
number
Number of items per page (default: 2, min: 1, max: 500)
ActiveOrdersResponse
PaginationOutput<ActiveOrder>
Paginated list of active orders with metadata

getOrdersByMaker

Retrieves orders created by a specific maker address.
const orders = await sdk.getOrdersByMaker({
  address: '0xfa80cd9b3becc0b4403b0f421384724f2810775f',
  page: 1,
  limit: 10
})
params
OrdersByMakerParams
required
Query parameters
params.address
string
required
Maker’s wallet address
params.page
number
Page number (default: 1)
params.limit
number
Number of items per page (default: 2, min: 1, max: 500)
OrdersByMakerResponse
PaginationOutput<OrderFillsByMakerOutput>
Paginated list of orders by maker with fill information

getQuote

Retrieves a quote for a token swap with default presets.
const quote = await sdk.getQuote({
  fromTokenAddress: '0x6b175474e89094c44da98b954eedeac495271d0f',
  toTokenAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
  amount: '1000000000000000000000'
})
params
QuoteParams
required
Quote parameters
params.fromTokenAddress
string
required
Source token contract address
params.toTokenAddress
string
required
Destination token contract address
params.amount
string
required
Amount to swap (in token’s smallest unit)
params.walletAddress
string
Wallet address (defaults to zero address)
params.permit
string
EIP-2612 permit call data for gasless approval
params.enableEstimate
boolean
Enable gas estimation
params.source
string
Source identifier for analytics
params.isPermit2
boolean
Use Permit2 for approvals
params.integratorFee
IntegratorFeeRequest
Integrator fee configuration
params.slippage
number
Slippage tolerance in percent (1-50)
Quote
Quote
Quote details including pricing, presets, and settlement information

getQuoteWithCustomPreset

Retrieves a quote with custom auction parameters.
const quote = await sdk.getQuoteWithCustomPreset(
  {
    fromTokenAddress: '0x6b175474e89094c44da98b954eedeac495271d0f',
    toTokenAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
    amount: '1000000000000000000000'
  },
  {
    customPreset: {
      auctionDuration: 180,
      auctionStartAmount: '100000',
      auctionEndAmount: '50000',
      points: [
        { toTokenAmount: '90000', delay: 20 },
        { toTokenAmount: '70000', delay: 40 }
      ]
    }
  }
)
params
QuoteParams
required
Quote parameters (same as getQuote)
body
QuoteCustomPresetParams
required
Custom preset configuration
body.customPreset
CustomPreset
required
Custom auction preset
body.customPreset.auctionDuration
number
required
Auction duration in seconds
body.customPreset.auctionStartAmount
string
required
Starting amount for auction
body.customPreset.auctionEndAmount
string
required
Ending amount for auction
body.customPreset.points
CustomPresetPoint[]
Custom auction curve points
Quote
Quote
Quote details with custom preset applied

placeOrder

Creates and submits a Fusion order in a single operation.
const orderInfo = await sdk.placeOrder({
  fromTokenAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
  toTokenAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
  amount: '50000000000000000',
  walletAddress: makerAddress
})
params
OrderParams
required
Order parameters
params.fromTokenAddress
string
required
Source token contract address
params.toTokenAddress
string
required
Destination token contract address
params.amount
string
required
Amount to swap (in token’s smallest unit)
params.walletAddress
string
required
Maker’s wallet address
params.permit
string
EIP-2612 permit call data
params.receiver
string
Recipient address (defaults to maker address)
params.preset
PresetEnum
Auction preset: fast, medium, or slow
params.nonce
bigint
Unique nonce for batch cancellation
params.source
string
Source identifier for analytics
params.isPermit2
boolean
Use Permit2 for approvals
params.customPreset
CustomPreset
Custom auction parameters
params.orderExpirationDelay
bigint
Order expiration delay after auction ends
params.allowPartialFills
boolean
Allow partial order fills (default: true)
params.allowMultipleFills
boolean
Allow multiple fills (default: true)
params.integratorFee
IntegratorFeeRequest
Integrator fee configuration
params.slippage
number
Slippage tolerance in percent
OrderInfo
OrderInfo
Information about the created and submitted order
order
LimitOrderV4Struct
The order structure
signature
string
Order signature
quoteId
string
Quote identifier
orderHash
string
Order hash
extension
string
Order extension data

createOrder

Creates a Fusion order without submitting it (for manual submission).
const { order, hash, quoteId } = await sdk.createOrder({
  fromTokenAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
  toTokenAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
  amount: '50000000000000000',
  walletAddress: makerAddress
})
params
OrderParams
required
Order parameters (same as placeOrder)
PreparedOrder
PreparedOrder
Prepared order ready for signing and submission
order
FusionOrder
The FusionOrder instance
hash
string
Order hash
quoteId
string
Quote identifier
nativeOrderFactory
Address
Native order factory address (if applicable)

submitOrder

Submits a previously created order to the relayer. Note: For orders from native assets, use submitNativeOrder instead.
const orderInfo = await sdk.submitOrder(order, quoteId)
order
FusionOrder
required
The FusionOrder instance to submit
quoteId
string
required
Quote identifier from order creation
OrderInfo
OrderInfo
Information about the submitted order

submitNativeOrder

Submits an order from native assets (e.g., ETH) to the relayer. Note: Orders from native assets must also be submitted on-chain via NativeOrdersFactory.create.
const orderInfo = await sdk.submitNativeOrder(order, maker, quoteId)
order
FusionOrder
required
The FusionOrder instance to submit
maker
Address
required
Maker’s address
quoteId
string
required
Quote identifier from order creation
OrderInfo
OrderInfo
Information about the submitted native order

getOrderStatus

Retrieves the current status of an order.
const status = await sdk.getOrderStatus(orderHash)
orderHash
string
required
The order hash to query
OrderStatusResponse
OrderStatusResponse
Detailed order status information
status
OrderStatus
Current order status (pending, filled, cancelled, etc.)
order
LimitOrderV4Struct
The order structure
extension
string
Order extension data
fills
Fill[]
Array of fill transactions
cancelTx
string | null
Cancellation transaction hash (if cancelled)
createdAt
string
Order creation timestamp

buildCancelOrderCallData

Builds the call data for cancelling an order.
const callData = await sdk.buildCancelOrderCallData(orderHash)
orderHash
string
required
The order hash to cancel
callData
string
Encoded call data for the cancel transaction

Example

import { FusionSDK, NetworkEnum } from '@1inch/fusion-sdk'

// Initialize SDK
const sdk = new FusionSDK({
  url: 'https://api.1inch.dev/fusion',
  network: NetworkEnum.ETHEREUM,
  authKey: 'your-auth-key'
})

// Get a quote
const quote = await sdk.getQuote({
  fromTokenAddress: '0x6b175474e89094c44da98b954eedeac495271d0f',
  toTokenAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
  amount: '1000000000000000000000'
})

// Get active orders
const orders = await sdk.getActiveOrders({ page: 1, limit: 10 })