Skip to content

Commit

Permalink
validate quote
Browse files Browse the repository at this point in the history
  • Loading branch information
alissacrane-cb committed Dec 17, 2024
1 parent 0e306b5 commit 727e826
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/buy/components/Buy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { BuyDropdown } from './BuyDropdown';
import { BuyMessage } from './BuyMessage';
import { BuyProvider, useBuyContext } from './BuyProvider';

export function BuyContent({ className }: { className?: string }) {
function BuyContent({ className }: { className?: string }) {
const { isDropdownOpen, setIsDropdownOpen } = useBuyContext();
const buyContainerRef = useRef<HTMLDivElement>(null);

Expand Down
4 changes: 2 additions & 2 deletions src/buy/components/BuyAmountInput.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isValidAmount } from '../../core/utils/isValidAmount';
import { TextInput } from '../../internal/components/TextInput';
import { cn, pressable } from '../../styles/theme';
import { cn, color } from '../../styles/theme';
import { formatAmount } from '../../swap/utils/formatAmount';
import { TokenChip } from '../../token';
import { useBuyContext } from './BuyProvider';
Expand Down Expand Up @@ -28,7 +28,7 @@ export function BuyAmountInput() {
inputValidator={isValidAmount}
/>
<TokenChip
className={cn(pressable.inverse, 'rounded-md')}
className={cn(color.foreground, 'rounded-md')}
token={to.token}
/>
</div>
Expand Down
10 changes: 5 additions & 5 deletions src/buy/components/BuyProvider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ import { base } from 'wagmi/chains';
import { mock } from 'wagmi/connectors';
import { useSendCalls } from 'wagmi/experimental';
import { useCapabilitiesSafe } from '../../core-react/internal/hooks/useCapabilitiesSafe';
import { buildSwapTransaction } from '../../core/api/buildSwapTransaction';
import { useOnchainKit } from '../../core-react/useOnchainKit';
import { getBuyQuote } from '../utils/getBuyQuote';
import { buildSwapTransaction } from '../../core/api/buildSwapTransaction';
import type { LifecycleStatus, SwapError, SwapUnit } from '../../swap/types';
import { getSwapErrorCode } from '../../swap/utils/getSwapErrorCode';
import {
daiToken,
degenToken,
ethToken,
usdcToken,
} from '../../token/constants';
import type { LifecycleStatus, SwapError, SwapUnit } from '../../swap/types';
import { getSwapErrorCode } from '../../swap/utils/getSwapErrorCode';
import { BuyProvider, useBuyContext } from './BuyProvider';
import { useBuyTokens } from '../hooks/useBuyTokens';
import { getBuyQuote } from '../utils/getBuyQuote';
import { validateQuote } from '../utils/validateQuote';
import { BuyProvider, useBuyContext } from './BuyProvider';

const mockResetFunction = vi.fn();
vi.mock('../hooks/useResetBuyInputs', () => ({
Expand Down
2 changes: 1 addition & 1 deletion src/buy/hooks/useOnrampEventListeners.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { renderHook, act } from '@testing-library/react';
import { act, renderHook } from '@testing-library/react';
import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest';
import { setupOnrampEventListeners } from '../../fund/utils/setupOnrampEventListeners';
import { useOnrampEventListeners } from './useOnrampEventListeners';
Expand Down
10 changes: 5 additions & 5 deletions src/buy/hooks/useOnrampEventListeners.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { EventMetadata } from '@/fund/types';
import type { LifecycleStatus } from '@/swap/types';
import { useEffect, useCallback } from 'react';
import { useCallback, useEffect } from 'react';
import type { TransactionReceipt } from 'viem';
import { setupOnrampEventListeners } from '../../fund/utils/setupOnrampEventListeners';
import { TransactionReceipt } from 'viem';

type UseOnrampLifecycleParams = {
updateLifecycleStatus: (status: LifecycleStatus) => void;
Expand All @@ -25,7 +25,7 @@ export const useOnrampEventListeners = ({
});
}
},
[updateLifecycleStatus],
[maxSlippage, updateLifecycleStatus],
);

const handleOnrampSuccess = useCallback(() => {
Expand All @@ -37,7 +37,7 @@ export const useOnrampEventListeners = ({
maxSlippage,
},
});
}, [updateLifecycleStatus]);
}, [maxSlippage, updateLifecycleStatus]);

const onPopupClose = useCallback(() => {
updateLifecycleStatus({
Expand All @@ -58,7 +58,7 @@ export const useOnrampEventListeners = ({
return () => {
unsubscribe();
};
}, [setupOnrampEventListeners, handleOnrampEvent, handleOnrampSuccess]);
}, [handleOnrampEvent, handleOnrampSuccess]);

return { onPopupClose };
};
2 changes: 1 addition & 1 deletion src/buy/hooks/usePopupMonitor.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { renderHook } from '@testing-library/react';
import { act } from 'react';
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { usePopupMonitor } from './usePopupMonitor';

describe('usePopupMonitor', () => {
Expand Down
8 changes: 4 additions & 4 deletions src/buy/utils/validateQuote.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { type Mock, beforeEach, vi, expect, it, describe } from 'vitest';
import { validateQuote } from './validateQuote';
import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest';
import type { GetSwapQuoteResponse } from '../../core/api/types';
import type { SwapUnit } from '../../swap/types';
import { isSwapError } from '../../swap/utils/isSwapError';
import { SwapUnit } from '../../swap/types';
import { GetSwapQuoteResponse } from '../../core/api/types';
import { validateQuote } from './validateQuote';

vi.mock('../../swap/utils/isSwapError', () => ({
isSwapError: vi.fn(),
Expand Down
2 changes: 1 addition & 1 deletion src/buy/utils/validateQuote.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { GetSwapQuoteResponse } from '@/core/api/types';
import type { SwapUnit, LifecycleStatusUpdate } from '@/swap/types';
import type { LifecycleStatusUpdate, SwapUnit } from '@/swap/types';
import { isSwapError } from '../../swap/utils/isSwapError';

type ValidateQuoteParams = {
Expand Down

0 comments on commit 727e826

Please sign in to comment.