Skip to content

Commit

Permalink
Add appname in config
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementWalter committed Jul 9, 2023
1 parent fcc3266 commit eb78eb9
Show file tree
Hide file tree
Showing 8 changed files with 280 additions and 57 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/starksheet-webapp/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Starksheet webapp
# Onsheet webapp

This is the starksheet webapp as deployed in
This is the onsheet webapp as deployed for example for Starknet at
[app.starksheet.xyz](app.starksheet.xyz).

## Installation
Expand All @@ -21,7 +21,7 @@ devnet. Depending on your need, it may be enough to target the testnet or even
the mainnet for final testing.

The ENV variable `REACT_APP_NETWORK` is used to select the target network. By
default (not set), it will target the devnet, see
default (not set), it will target the starknet-devnet, see
[Starksheet cairo README](../starksheet-cairo/README.md#deployment).

The app will automatically uses the latest deployments made in
Expand Down
3 changes: 2 additions & 1 deletion packages/starksheet-webapp/src/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { CELL_BORDER_WIDTH, CELL_HEIGHT, N_ROW } from "../../config";
import { AccountContext } from "../../contexts/AccountContext";
import { OnsheetContext } from "../../contexts/OnsheetContext";
import { useChainProvider } from "../../hooks/useChainProvider";
import { chainConfig } from "../../provider/chains";
import GreyCell from "../GreyCell/GreyCell";
import { SheetButton } from "../SheetButton/SheetButton";
import githubLogo from "./github.svg";
Expand All @@ -26,7 +27,7 @@ function Footer({ sx }: FooterProps) {

const addSheetOnClick = async () => {
if (!accountAddress) {
enqueueSnackbar(`Connect your wallet to use Starksheet`, {
enqueueSnackbar(`Connect your wallet to use ${chainConfig.appName}`, {
variant: "info",
});
return;
Expand Down
4 changes: 3 additions & 1 deletion packages/starksheet-webapp/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ function Header() {
const [isOpenWidget, setOpenWidget] = React.useState<boolean>(false);
return (
<Box sx={{ display: "flex" }}>
<GreyCell sx={{ textIndent: "20px", flex: 1 }}>Starksheet</GreyCell>
<GreyCell sx={{ textIndent: "20px", flex: 1 }}>
{chainConfig.appName}
</GreyCell>
<Button
sx={{ marginLeft: `-${CELL_BORDER_WIDTH}px`, width: "191px" }}
onClick={() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { AppStatusContext } from "../../contexts/AppStatusContext";
import { CellValuesContext } from "../../contexts/CellValuesContext";
import { OnsheetContext } from "../../contexts/OnsheetContext";
import { useSheetContract } from "../../hooks/useSheetContract";
import { chainConfig } from "../../provider/chains";
import { Cell, CellData, CellRendered } from "../../types";
import { RC_BOUND } from "../../utils/constants";
import { bn2hex } from "../../utils/hexUtils";
Expand Down Expand Up @@ -189,7 +190,7 @@ const SheetTable = ({ sx }: SheetTableProps) => {
})
.catch((error) => {
error = true;
finalMessage = `Error: Starksheet cannot render sheet at address ${address}
finalMessage = `Error: ${chainConfig.appName} cannot render sheet at address ${address}
<br />
<br />
Double check address or create a new sheet by clicking on the + button`;
Expand Down
9 changes: 9 additions & 0 deletions packages/starksheet-webapp/src/provider/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type SupportedChains =

const chainConfigs: Record<SupportedChains, Omit<ChainConfig, "addresses">> = {
goerli: {
appName: "Evmsheet",
chainId: ChainId.ETHEREUM_TESTNET,
chainType: ChainType.EVM,
explorerBaseUrl: "https://goerli.etherscan.io/address/",
Expand All @@ -24,6 +25,7 @@ const chainConfigs: Record<SupportedChains, Omit<ChainConfig, "addresses">> = {
rpcUrl: `https://goerli.infura.io/v3/${process.env.REACT_APP_INFURA_KEY}`,
},
anvil: {
appName: "Evmsheet",
chainId: ChainId.ANVIL,
chainType: ChainType.EVM,
explorerBaseUrl: "https://goerli.etherscan.io/address/",
Expand All @@ -32,6 +34,7 @@ const chainConfigs: Record<SupportedChains, Omit<ChainConfig, "addresses">> = {
rpcUrl: "http://0.0.0.0:8545",
},
mainnet: {
appName: "Starksheet",
chainId: ChainId.STARKNET_MAINNET,
chainType: ChainType.STARKNET,
explorerBaseUrl: "https://starkscan.co/contract/",
Expand All @@ -40,6 +43,7 @@ const chainConfigs: Record<SupportedChains, Omit<ChainConfig, "addresses">> = {
gateway: "mainnet-alpha",
},
testnet: {
appName: "Starksheet",
chainId: ChainId.STARKNET_TESTNET,
chainType: ChainType.STARKNET,
explorerBaseUrl: "https://testnet.starkscan.co/contract/",
Expand All @@ -48,6 +52,7 @@ const chainConfigs: Record<SupportedChains, Omit<ChainConfig, "addresses">> = {
gateway: "goerli-alpha",
},
testnet2: {
appName: "Starksheet",
chainId: ChainId.STARKNET_TESTNET2,
chainType: ChainType.STARKNET,
explorerBaseUrl: "https://testnet-2.starkscan.co/contract/",
Expand All @@ -56,27 +61,31 @@ const chainConfigs: Record<SupportedChains, Omit<ChainConfig, "addresses">> = {
gateway: "goerli-alpha-2",
},
devnet: {
appName: "Starksheet",
chainId: ChainId.STARKNET_TESTNET,
chainType: ChainType.STARKNET,
explorerBaseUrl: "https://devnet.starkscan.co/contract/",
nftBaseUrl: "",
rpcUrl: "http://127.0.0.1:5050/rpc",
},
katana: {
appName: "Starksheet",
chainId: ChainId.STARKNET_TESTNET,
chainType: ChainType.STARKNET,
explorerBaseUrl: "",
nftBaseUrl: "",
rpcUrl: "http://127.0.0.1:5050",
},
madara: {
appName: "Madsheet",
chainId: ChainId.STARKNET_TESTNET,
chainType: ChainType.STARKNET,
explorerBaseUrl: "",
nftBaseUrl: "",
rpcUrl: "http://127.0.0.1:9944",
},
sharingan: {
appName: "Madsheet",
chainId: ChainId.STARKNET_TESTNET,
chainType: ChainType.STARKNET,
explorerBaseUrl: "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface ChainConfig {
nftBaseUrl: string;
rpcUrl: string;
gateway?: NetworkName;
appName: string;
addresses: {
spreadsheet: string;
multisend?: string;
Expand Down

0 comments on commit eb78eb9

Please sign in to comment.