From 8974538254581bdd7637267e20f454cfe029cca9 Mon Sep 17 00:00:00 2001 From: pierregee Date: Thu, 18 Jul 2024 15:16:03 +0800 Subject: [PATCH 1/5] chore(ui-ux): make ocean endpoint configurable via env --- src/layouts/contexts/WhaleContext.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/layouts/contexts/WhaleContext.tsx b/src/layouts/contexts/WhaleContext.tsx index d461b4c65..fd6979eef 100644 --- a/src/layouts/contexts/WhaleContext.tsx +++ b/src/layouts/contexts/WhaleContext.tsx @@ -33,7 +33,9 @@ export function getWhaleApiClient( ): WhaleApiClient { const network = context.query.network?.toString() ?? getEnvironment().networks[0]; - return newWhaleClient(newOceanOptions(network as EnvironmentNetwork)); + return newWhaleClient( + newOceanOptions(network as EnvironmentNetwork, process.env.OCEAN_ENDPOINT), + ); } export function getWhaleRpcClient( From 3db6dd8200303233f1d1d1ac1d0a678cd97c4af8 Mon Sep 17 00:00:00 2001 From: pierregee Date: Thu, 25 Jul 2024 10:53:30 +0800 Subject: [PATCH 2/5] change all ocean endpointss --- src/layouts/contexts/WhaleContext.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/layouts/contexts/WhaleContext.tsx b/src/layouts/contexts/WhaleContext.tsx index fd6979eef..756b947dd 100644 --- a/src/layouts/contexts/WhaleContext.tsx +++ b/src/layouts/contexts/WhaleContext.tsx @@ -43,7 +43,9 @@ export function getWhaleRpcClient( ): WhaleRpcClient { const network = context.query.network?.toString() ?? getEnvironment().networks[0]; - return newRpcClient(newOceanOptions(network as EnvironmentNetwork)); + return newRpcClient( + newOceanOptions(network as EnvironmentNetwork, process.env.OCEAN_ENDPOINT), + ); } export function newPlaygroundRpcClient( @@ -68,7 +70,7 @@ export function WhaleProvider( const connection = useNetwork().connection; const memo = useMemo(() => { - const options = newOceanOptions(connection); + const options = newOceanOptions(connection, process.env.OCEAN_ENDPOINT); return { api: newWhaleClient(options), rpc: newRpcClient(options), From f7d18196c970f55572e877b6f54a863dfb19d7e3 Mon Sep 17 00:00:00 2001 From: pierregee Date: Thu, 25 Jul 2024 11:31:36 +0800 Subject: [PATCH 3/5] change all ocean endpointss --- src/layouts/contexts/WhaleContext.tsx | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/layouts/contexts/WhaleContext.tsx b/src/layouts/contexts/WhaleContext.tsx index 756b947dd..ac1c52954 100644 --- a/src/layouts/contexts/WhaleContext.tsx +++ b/src/layouts/contexts/WhaleContext.tsx @@ -34,7 +34,10 @@ export function getWhaleApiClient( const network = context.query.network?.toString() ?? getEnvironment().networks[0]; return newWhaleClient( - newOceanOptions(network as EnvironmentNetwork, process.env.OCEAN_ENDPOINT), + newOceanOptions( + network as EnvironmentNetwork, + process.env.OCEAN_CLIENT_ENDPOINT, + ), ); } @@ -44,7 +47,10 @@ export function getWhaleRpcClient( const network = context.query.network?.toString() ?? getEnvironment().networks[0]; return newRpcClient( - newOceanOptions(network as EnvironmentNetwork, process.env.OCEAN_ENDPOINT), + newOceanOptions( + network as EnvironmentNetwork, + process.env.RPC_CLIENT_ENDPOINT, + ), ); } @@ -70,10 +76,18 @@ export function WhaleProvider( const connection = useNetwork().connection; const memo = useMemo(() => { - const options = newOceanOptions(connection, process.env.OCEAN_ENDPOINT); + const oceanClientOptions = newOceanOptions( + connection, + process.env.OCEAN_CLIENT_ENDPOINT, + ); + const rpcClientOptions = newOceanOptions( + connection, + process.env.RPC_CLIENT_ENDPOINT, + ); + return { - api: newWhaleClient(options), - rpc: newRpcClient(options), + api: newWhaleClient(oceanClientOptions), + rpc: newRpcClient(rpcClientOptions), }; }, [connection]); From cd3c5e7d8822cea08a7bbe2d2b5f6037bab58bf1 Mon Sep 17 00:00:00 2001 From: pierregee Date: Thu, 25 Jul 2024 14:25:06 +0800 Subject: [PATCH 4/5] fix naming --- src/layouts/contexts/WhaleContext.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/layouts/contexts/WhaleContext.tsx b/src/layouts/contexts/WhaleContext.tsx index ac1c52954..369712eae 100644 --- a/src/layouts/contexts/WhaleContext.tsx +++ b/src/layouts/contexts/WhaleContext.tsx @@ -36,7 +36,7 @@ export function getWhaleApiClient( return newWhaleClient( newOceanOptions( network as EnvironmentNetwork, - process.env.OCEAN_CLIENT_ENDPOINT, + process.env.NEXT_PUBLIC_API_CLIENT_ENDPOINT, ), ); } @@ -49,7 +49,7 @@ export function getWhaleRpcClient( return newRpcClient( newOceanOptions( network as EnvironmentNetwork, - process.env.RPC_CLIENT_ENDPOINT, + process.env.NEXT_PUBLIC_RPC_CLIENT_ENDPOINT, ), ); } @@ -78,11 +78,11 @@ export function WhaleProvider( const memo = useMemo(() => { const oceanClientOptions = newOceanOptions( connection, - process.env.OCEAN_CLIENT_ENDPOINT, + process.env.NEXT_PUBLIC_API_CLIENT_ENDPOINT, ); const rpcClientOptions = newOceanOptions( connection, - process.env.RPC_CLIENT_ENDPOINT, + process.env.NEXT_PUBLIC_RPC_CLIENT_ENDPOINT, ); return { From 5278f7fd771e5f35113c5a36114d8f166b45e88f Mon Sep 17 00:00:00 2001 From: pierregee Date: Thu, 25 Jul 2024 14:26:10 +0800 Subject: [PATCH 5/5] fix naming --- src/layouts/contexts/WhaleContext.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/layouts/contexts/WhaleContext.tsx b/src/layouts/contexts/WhaleContext.tsx index 369712eae..12f2cac72 100644 --- a/src/layouts/contexts/WhaleContext.tsx +++ b/src/layouts/contexts/WhaleContext.tsx @@ -76,7 +76,7 @@ export function WhaleProvider( const connection = useNetwork().connection; const memo = useMemo(() => { - const oceanClientOptions = newOceanOptions( + const apiClientOptions = newOceanOptions( connection, process.env.NEXT_PUBLIC_API_CLIENT_ENDPOINT, ); @@ -86,7 +86,7 @@ export function WhaleProvider( ); return { - api: newWhaleClient(oceanClientOptions), + api: newWhaleClient(apiClientOptions), rpc: newRpcClient(rpcClientOptions), }; }, [connection]);