Skip to content

Instantly share code, notes, and snippets.

@PaulRBerg
Last active April 29, 2025 09:46
Show Gist options
  • Save PaulRBerg/8d2113ba3329bdbcce42698da0df62ed to your computer and use it in GitHub Desktop.
Save PaulRBerg/8d2113ba3329bdbcce42698da0df62ed to your computer and use it in GitHub Desktop.
import { useMemo } from "react";
import type { Sablier } from "@sablier/deployments";
import { generateDeploymentTable } from "../../helpers";
import GFMContent from "../atoms/GFMContent";
interface DeploymentTableProps {
deployment: Sablier.Deployment;
protocol: Sablier.Protocol;
version: Sablier.Version;
}
export default function DeploymentTable({ deployment, protocol, version }: DeploymentTableProps) {
const table = useMemo(() => {
return generateDeploymentTable(deployment, protocol, version);
}, [deployment, protocol, version]);
return <GFMContent content={table} />;
}
import { useMemo } from "react";
import type { Sablier } from "@sablier/deployments";
import { getChain, getChainName, getRelease } from "@sablier/deployments";
import GFMContent from "../atoms/GFMContent";
import DeploymentTable from "../molecules/DeploymentTable";
interface DeploymentTablesProps {
protocol: Sablier.Protocol;
type: "mainnets" | "testnets";
version: Sablier.Version;
}
export default function DeploymentTables({ protocol, type, version }: DeploymentTablesProps) {
const release = useMemo(() => getRelease(protocol, version), [protocol, version]);
const filteredDeployments = useMemo(() => {
const release = getRelease(protocol, version);
if (!release) {
return [];
}
const shouldLookForTestnets = type === "testnets";
return release.deployments.filter((deployment) => {
const chain: Sablier.Chain = getChain(deployment.chainId);
return chain.isTestnet === shouldLookForTestnets;
});
}, [protocol, version, type]);
if (!release) {
return null;
}
return filteredDeployments.map((deployment) => {
const chainName = getChainName(deployment.chainId);
return (
<div key={deployment.chainId}>
<GFMContent content={`### ${chainName}\n\n`} />
<DeploymentTable deployment={deployment} protocol={protocol} version={version} />
</div>
);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment