From a315630729ea40445629da9903f000b13e59454c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dan?= Date: Thu, 12 Oct 2023 14:11:02 +0200 Subject: [PATCH 1/2] feat: filter registered subnets internal only --- packages/frontend/src/hooks/useRegisteredSubnets.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend/src/hooks/useRegisteredSubnets.ts b/packages/frontend/src/hooks/useRegisteredSubnets.ts index 672a634..71b8e82 100644 --- a/packages/frontend/src/hooks/useRegisteredSubnets.ts +++ b/packages/frontend/src/hooks/useRegisteredSubnets.ts @@ -66,7 +66,7 @@ export default function useRegisteredSubnets() { values .filter((v) => v.status === 'fulfilled') .map((v) => (v.status === 'fulfilled' ? v.value : undefined)) - .filter((v) => v) + .filter((v) => v && v.name === 'Incal') ) setRegisteredSubnets(subnets as SubnetWithId[]) } From ad9f13b681a079cefeb39c0cf8830be6c9b24e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Dan?= Date: Thu, 12 Oct 2023 14:23:56 +0200 Subject: [PATCH 2/2] test: update useRegisteredSubnets test --- .../frontend/src/hooks/useRegisteredSubnets.test.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/hooks/useRegisteredSubnets.test.ts b/packages/frontend/src/hooks/useRegisteredSubnets.test.ts index c9a8e31..1a1ad2a 100644 --- a/packages/frontend/src/hooks/useRegisteredSubnets.test.ts +++ b/packages/frontend/src/hooks/useRegisteredSubnets.test.ts @@ -21,6 +21,13 @@ const registeredSubnets: { [x: string]: Subnet } = { logoURL: '', name: 'subnetMock', }, + incal: { + chainId: BigNumber.from(2), + currencySymbol: 'TST2', + endpoint: '', + logoURL: '', + name: 'Incal', + }, } const subnetIdsByIndexes = ['subnet1', 'subnet2'] @@ -78,6 +85,8 @@ describe('useRegisteredSubnets', () => { expect(subnetsMock).toHaveBeenCalledWith('subnet1') expect(subnetsMock).toHaveBeenCalledWith('subnet2') expect(result.current.loading).toBe(false) - expect(result.current.registeredSubnets).toStrictEqual(expectedSubnets) + expect(result.current.registeredSubnets).toStrictEqual( + expectedSubnets.filter((s) => s.name === 'Incal') + ) }) })