Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 2 additions & 26 deletions src/providers/AllowedAppsProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,34 +86,10 @@ const AllowedAppsProvider = ({ children }: { children: React.ReactNode }) => {
return;
}

const appsWithPerps = [
...(data?.map((app: ApiAllowedApp) => app) || []),
// Add perps app locally
{
id: 'perps-local',
appId: 'perps',
type: 'app',
title: 'Perps',
name: 'Perps',
shortDescription: 'Perpetual futures trading on Hyperliquid',
tags: 'trading,derivatives',
} as ApiAllowedApp,
];
setAllowed(appsWithPerps);
setAllowed(data?.map((app: ApiAllowedApp) => app) || []);
} catch (e) {
console.warn('Error calling PillarX apps API', e);
// Set perps app as fallback if API fails
setAllowed([
{
id: 'perps-local',
appId: 'perps',
type: 'app',
title: 'Perps',
name: 'Perps',
shortDescription: 'Perpetual futures trading on Hyperliquid',
tags: 'trading,derivatives',
} as ApiAllowedApp,
]);
setAllowed([]);
}
setIsLoading(false);
})();
Expand Down
12 changes: 1 addition & 11 deletions src/providers/__tests__/AllowedAppsProvider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@ describe('AllowedAppsProvider', () => {
{ appId: 'allowed-app-3' },
];

const perpsAppMock = {
id: 'perps-local',
appId: 'perps',
type: 'app',
title: 'Perps',
name: 'Perps',
shortDescription: 'Perpetual futures trading on Hyperliquid',
tags: 'trading,derivatives',
};

let wrapper: React.FC;

beforeEach(() => {
Expand Down Expand Up @@ -56,7 +46,7 @@ describe('AllowedAppsProvider', () => {
expect(result.current.isLoading).toEqual(false);
});

expect(result.current.allowed).toEqual([...allowedAppsMock, perpsAppMock]);
expect(result.current.allowed).toEqual(allowedAppsMock);
});

afterEach(() => {
Expand Down
Loading