Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: display starkName #34

Open
wants to merge 2 commits into
base: testnet
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NEXT_PUBLIC_IS_TESTNET=false
NEXT_PUBLIC_RPC_URL=https://rpc.starknet.id
5 changes: 1 addition & 4 deletions components/UI/modalWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { useAccount, useTransactions } from "@starknet-react/core";
import { ContentCopy } from "@mui/icons-material";
import CopiedIcon from "./iconsComponents/icons/copiedIcon";
import ClickableAction from "./iconsComponents/clickableAction";
import { CommonTransactionReceiptResponse } from "starknet";
import CloseIcon from "./iconsComponents/icons/closeIcon";
import ArgentIcon from "./iconsComponents/icons/argentIcon";
import theme from "../../styles/theme";
Expand Down Expand Up @@ -133,9 +132,7 @@ const ModalWallet: FunctionComponent<ModalWalletProps> = ({
)}
</a>
<div>
{tx.status === "success" &&
tx.data &&
(tx.data as CommonTransactionReceiptResponse).status}
{tx.isSuccess && tx.status && tx.status}
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion components/UI/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const Navbar: FunctionComponent = () => {

provider.getChainId().then((chainId) => {
const isWrongNetwork =
(chainId === constants.StarknetChainId.SN_GOERLI &&
(chainId === constants.StarknetChainId.SN_SEPOLIA &&
network === "mainnet") ||
(chainId === constants.StarknetChainId.SN_MAIN &&
network === "testnet");
Expand Down
26 changes: 13 additions & 13 deletions context/StarknetIdJsProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { FunctionComponent } from "react";
import { createContext, useMemo } from "react";
import { Provider, constants } from "starknet";
"use client";

import React, { FunctionComponent, createContext, useMemo } from "react";
import { RpcProvider, constants } from "starknet";
import { StarknetIdNavigator } from "starknetid.js";

type StarknetIdJsConfig = {
Expand All @@ -14,21 +15,20 @@ export const StarknetIdJsContext = createContext<StarknetIdJsConfig>({
export const StarknetIdJsProvider: FunctionComponent<Context> = ({
children,
}) => {
const provider = useMemo(() => {
return new RpcProvider({
nodeUrl: process.env.NEXT_PUBLIC_RPC_URL!,
});
}, []);

const starknetIdNavigator = useMemo(() => {
return new StarknetIdNavigator(
new Provider({
sequencer: {
network:
process.env.NEXT_PUBLIC_IS_TESTNET === "true"
? constants.NetworkName.SN_GOERLI
: constants.NetworkName.SN_MAIN,
},
}),
provider,
process.env.NEXT_PUBLIC_IS_TESTNET === "true"
? constants.StarknetChainId.SN_GOERLI
? constants.StarknetChainId.SN_SEPOLIA
: constants.StarknetChainId.SN_MAIN
);
}, []);
}, [provider]);

const contextValues = useMemo(() => {
return {
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
"react-apexcharts": "^1.4.0",
"react-dom": "^18.2.0",
"react-icons": "^4.4.0",
"react-loader-spinner": "^5.2.0",
"starknet": "5.14.1",
"starknetid.js": "^1.5.3",
"react-loader-spinner": "^6.1.6",
"starknet": "^6.11.0",
"starknetid.js": "^4.0.1",
"twitter-api-sdk": "^1.2.1"
},
"devDependencies": {
Expand All @@ -64,5 +64,6 @@
"tailwindcss": "^3.1.8",
"ts-jest": "^29.0.3",
"typescript": "^4.7.4"
}
},
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}