Skip to content

Commit

Permalink
type
Browse files Browse the repository at this point in the history
  • Loading branch information
Zizzamia committed Aug 10, 2024
1 parent a965b10 commit 282c5b8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/swap/components/SwapProvider.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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;

Expand Down
9 changes: 9 additions & 0 deletions src/swap/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 282c5b8

Please sign in to comment.