Skip to content

Commit

Permalink
chore(ui-ux): make ocean endpoint configurable via env (#1938)
Browse files Browse the repository at this point in the history
* chore(ui-ux): make ocean endpoint configurable via env

* change all ocean endpointss

* change all ocean endpointss

* fix naming

* fix naming
  • Loading branch information
Pierre Gee authored Sep 11, 2024
1 parent a84a3e6 commit b618a70
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions src/layouts/contexts/WhaleContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,25 @@ 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.NEXT_PUBLIC_API_CLIENT_ENDPOINT,
),
);
}

export function getWhaleRpcClient(
context: GetServerSidePropsContext,
): WhaleRpcClient {
const network =
context.query.network?.toString() ?? getEnvironment().networks[0];
return newRpcClient(newOceanOptions(network as EnvironmentNetwork));
return newRpcClient(
newOceanOptions(
network as EnvironmentNetwork,
process.env.NEXT_PUBLIC_RPC_CLIENT_ENDPOINT,
),
);
}

export function newPlaygroundRpcClient(
Expand All @@ -66,10 +76,18 @@ export function WhaleProvider(
const connection = useNetwork().connection;

const memo = useMemo(() => {
const options = newOceanOptions(connection);
const apiClientOptions = newOceanOptions(
connection,
process.env.NEXT_PUBLIC_API_CLIENT_ENDPOINT,
);
const rpcClientOptions = newOceanOptions(
connection,
process.env.NEXT_PUBLIC_RPC_CLIENT_ENDPOINT,
);

return {
api: newWhaleClient(options),
rpc: newRpcClient(options),
api: newWhaleClient(apiClientOptions),
rpc: newRpcClient(rpcClientOptions),
};
}, [connection]);

Expand Down

0 comments on commit b618a70

Please sign in to comment.