diff --git a/src/buy/components/Buy.test.tsx b/src/buy/components/Buy.test.tsx
index ebe8c93e11..ba3606f6da 100644
--- a/src/buy/components/Buy.test.tsx
+++ b/src/buy/components/Buy.test.tsx
@@ -1,5 +1,6 @@
import { fireEvent, render, screen } from '@testing-library/react';
import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest';
+import { useOnchainKit } from '../../core-react/useOnchainKit';
import { degenToken } from '../../token/constants';
import { useOutsideClick } from '../../ui/react/internal/hooks/useOutsideClick';
import { Buy } from './Buy';
@@ -24,6 +25,10 @@ vi.mock('../../ui/react/internal/hooks/useOutsideClick', () => ({
useOutsideClick: vi.fn(),
}));
+vi.mock('../../core-react/useOnchainKit', () => ({
+ useOnchainKit: vi.fn(),
+}));
+
type useOutsideClickType = ReturnType<
typeof vi.fn<
(
@@ -61,11 +66,15 @@ describe('Buy', () => {
},
);
+ (useOnchainKit as Mock).mockReturnValue({
+ projectId: 'mock-project-id',
+ });
+
vi.clearAllMocks();
});
it('renders the Buy component', () => {
- render();
+ render();
expect(screen.getByText('Buy')).toBeInTheDocument();
expect(screen.getByText('DEGEN')).toBeInTheDocument();
@@ -88,7 +97,7 @@ describe('Buy', () => {
},
});
- render();
+ render();
expect(screen.getByTestId('mock-BuyDropdown')).toBeDefined();
mockOutsideClickCallback({} as MouseEvent);
@@ -113,7 +122,7 @@ describe('Buy', () => {
},
});
- render();
+ render();
expect(screen.getByTestId('mock-BuyDropdown')).toBeDefined();
fireEvent.click(screen.getByTestId('mock-BuyDropdown'));
@@ -121,7 +130,7 @@ describe('Buy', () => {
});
it('should not trigger click handler when dropdown is closed', () => {
- render();
+ render();
expect(screen.queryByTestId('mock-BuyDropdown')).not.toBeInTheDocument();
});
});
diff --git a/src/buy/components/BuyProvider.test.tsx b/src/buy/components/BuyProvider.test.tsx
index 37b3c41994..a6a4e68804 100644
--- a/src/buy/components/BuyProvider.test.tsx
+++ b/src/buy/components/BuyProvider.test.tsx
@@ -9,6 +9,7 @@ import {
import React, { act, useCallback, useEffect } from 'react';
import type { TransactionReceipt } from 'viem';
import {
+ type Mock,
afterEach,
beforeEach,
describe,
@@ -30,6 +31,7 @@ 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 {
daiToken,
@@ -62,6 +64,10 @@ vi.mock('../../swap/utils/processSwapTransaction', () => ({
processSwapTransaction: vi.fn(),
}));
+vi.mock('../../core-react/useOnchainKit', () => ({
+ useOnchainKit: vi.fn(),
+}));
+
// vi.mock('../../swap/utils/isSwapError', () => ({
// isSwapError: vi.fn(),
// }));
@@ -165,6 +171,12 @@ const renderWithProviders = ({
}) => {
const config = { maxSlippage: 10 };
const mockExperimental = { useAggregator: true };
+ (useOnchainKit as Mock).mockReturnValue({
+ projectId: 'mock-project-id',
+ config: {
+ paymaster: undefined,
+ },
+ });
return render(
@@ -266,6 +278,12 @@ const TestSwapComponent = () => {
describe('useBuyContext', () => {
beforeEach(async () => {
+ (useOnchainKit as Mock).mockReturnValue({
+ projectId: 'mock-project-id',
+ config: {
+ paymaster: undefined,
+ },
+ });
vi.resetAllMocks();
(useAccount as ReturnType).mockReturnValue({
address: '0x123',
@@ -278,6 +296,7 @@ describe('useBuyContext', () => {
(useSwitchChain as ReturnType).mockReturnValue({
switchChainAsync: mockSwitchChain,
});
+
await act(async () => {
renderWithProviders({ Component: () => null });
});
@@ -332,6 +351,12 @@ describe('BuyProvider', () => {
switchChainAsync: mockSwitchChain,
});
(useCapabilitiesSafe as ReturnType).mockReturnValue({});
+ (useOnchainKit as Mock).mockReturnValue({
+ projectId: 'mock-project-id',
+ config: {
+ paymaster: undefined,
+ },
+ });
});
it('should reset inputs when setLifecycleStatus is called with success', async () => {
@@ -705,7 +730,7 @@ describe('BuyProvider', () => {
expect(result.current.lifecycleStatus).toEqual({
statusName: 'error',
statusData: expect.objectContaining({
- code: 'TmSPc01',
+ code: 'TmBPc02',
error: JSON.stringify(mockError),
message: '',
}),
@@ -773,7 +798,7 @@ describe('BuyProvider', () => {
expect(
screen.getByTestId('context-value-lifecycleStatus-statusData-code')
.textContent,
- ).toBe('TmSPc02');
+ ).toBe('TmBPc03');
});
});
@@ -790,7 +815,7 @@ describe('BuyProvider', () => {
expect(
screen.getByTestId('context-value-lifecycleStatus-statusData-code')
.textContent,
- ).toBe('TmSPc02');
+ ).toBe('TmBPc03');
});
});
diff --git a/src/buy/components/BuyProvider.tsx b/src/buy/components/BuyProvider.tsx
index f6ef2418c4..c479facc21 100644
--- a/src/buy/components/BuyProvider.tsx
+++ b/src/buy/components/BuyProvider.tsx
@@ -56,6 +56,7 @@ export function BuyProvider({
}: BuyProviderReact) {
const {
config: { paymaster } = { paymaster: undefined },
+ projectId,
} = useOnchainKit();
const { address, chainId } = useAccount();
const { switchChainAsync } = useSwitchChain();
@@ -89,7 +90,6 @@ export function BuyProvider({
// Refreshes balances and inputs post-swap
const resetInputs = useResetBuyInputs({ fromETH, fromUSDC, from, to });
- const { projectId } = useOnchainKit();
if (!projectId) {
throw new Error(
'Buy: Project ID is required, please set the projectId in the OnchainKitProvider',
diff --git a/src/internal/svg/appleSvg.tsx b/src/internal/svg/appleSvg.tsx
index 34da7a1b14..3126142a29 100644
--- a/src/internal/svg/appleSvg.tsx
+++ b/src/internal/svg/appleSvg.tsx
@@ -6,7 +6,7 @@ export const appleSvg = (
id="Artwork"
data-testid="appleSvg"
>
- Apple Pay
+ Apple Pay Onramp
- Debit Card
+ Debit Card Onramp
diff --git a/src/internal/svg/coinbaseLogoSvg.tsx b/src/internal/svg/coinbaseLogoSvg.tsx
index 3d6a7e48a8..0ae2a6b268 100644
--- a/src/internal/svg/coinbaseLogoSvg.tsx
+++ b/src/internal/svg/coinbaseLogoSvg.tsx
@@ -10,7 +10,7 @@ export const coinbaseLogoSvg = (
className={cn(icon.foreground)}
data-testid="coinbaseLogoSvg"
>
- Coinbase Pay
+ Coinbase Pay Onramp