diff --git a/src/swap/components/SwapProvider.tsx b/src/swap/components/SwapProvider.tsx index c339ebc68d..a067d6fae9 100644 --- a/src/swap/components/SwapProvider.tsx +++ b/src/swap/components/SwapProvider.tsx @@ -1,12 +1,17 @@ import { createContext, useCallback, useContext, useState } from 'react'; -import type { Address, TransactionReceipt } from 'viem'; +import type { TransactionReceipt } from 'viem'; import { type BaseError, useConfig, useSendTransaction } from 'wagmi'; import { useValue } from '../../internal/hooks/useValue'; import { formatTokenAmount } from '../../internal/utils/formatTokenAmount'; import type { Token } from '../../token'; import { USER_REJECTED_ERROR_CODE } from '../constants'; import { useFromTo } from '../hooks/useFromTo'; -import type { SwapContextType, SwapError, SwapErrorState } from '../types'; +import type { + SwapContextType, + SwapError, + SwapErrorState, + SwapProviderReact, +} from '../types'; import { buildSwapTransaction } from '../utils/buildSwapTransaction'; import { getSwapQuote } from '../utils/getSwapQuote'; import { isSwapError } from '../utils/isSwapError'; @@ -28,14 +33,7 @@ export function SwapProvider({ address, children, experimental, -}: { - address: Address; - children: React.ReactNode; - experimental: { - useAggregator: boolean; // Whether to use a DEX aggregator. (default: true) - maxSlippage?: number; // Maximum acceptable slippage for a swap. (default: 10) This is as a percent, not basis points - }; -}) { +}: SwapProviderReact) { // Feature flags const { useAggregator } = experimental; diff --git a/src/swap/types.ts b/src/swap/types.ts index 6ecafa8204..d8d94da87b 100644 --- a/src/swap/types.ts +++ b/src/swap/types.ts @@ -196,6 +196,15 @@ export type SwapParams = { to: Token; }; +export type SwapProviderReact = { + address: Address; + children: React.ReactNode; + experimental: { + useAggregator: boolean; // Whether to use a DEX aggregator. (default: true) + maxSlippage?: number; // Maximum acceptable slippage for a swap. (default: 10) This is as a percent, not basis points + }; +}; + /** * Note: exported as public Type */