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

MEP 19/01/2024 #469

Merged
merged 2 commits into from
Jan 19, 2024
Merged
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
10 changes: 6 additions & 4 deletions app/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import React, { useMemo } from "react";
import { WebWalletConnector } from "starknetkit/webwallet";
import { goerli, mainnet } from "@starknet-react/chains";
import { Chain, goerli, mainnet } from "@starknet-react/chains";
import {
Connector,
StarknetConfig,
alchemyProvider,
argent,
braavos,
jsonRpcProvider,
} from "@starknet-react/core";
import { StarknetIdJsProvider } from "@context/StarknetIdJsProvider";
import { ThemeProvider, createTheme } from "@mui/material";
Expand All @@ -18,8 +18,10 @@ import { getCurrentNetwork } from "@utils/network";
export function Providers({ children }: { children: React.ReactNode }) {
const network = getCurrentNetwork();
const chains = [network === "TESTNET" ? goerli : mainnet];
const provider = alchemyProvider({
apiKey: process.env.NEXT_PUBLIC_ALCHEMY_KEY as string,
const provider = jsonRpcProvider({
rpc: (_chain: Chain) => ({
nodeUrl: process.env.NEXT_PUBLIC_RPC_URL as string,
}),
});

const connectors = useMemo(
Expand Down
2 changes: 1 addition & 1 deletion app/quest-boost/claim/[boostId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default function Page({ params }: BoostQuestPageProps) {
let formattedSign: Signature = ["", ""];
try {
if (!boost?.id || !address) return formattedSign;
const res = await getQuestBoostClaimParams(boost.id);
const res = await getQuestBoostClaimParams(boost.id, address);
formattedSign = [res?.r, res?.s];
return formattedSign;
} catch (err) {
Expand Down
18 changes: 10 additions & 8 deletions context/StarknetIdJsProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,22 @@ export const StarknetIdJsProvider = ({ children }: { children: ReactNode }) => {
return network === "TESTNET" ? true : false;
}, []);

const provider = useMemo(() => {
return new Provider({
rpc: {
nodeUrl: process.env.NEXT_PUBLIC_RPC_URL,
},
});
}, []);

const starknetIdNavigator = useMemo(() => {
return new StarknetIdNavigator(
new Provider({
rpc: {
nodeUrl: `https://starknet-${
isTestnet ? "goerli" : "mainnet"
}.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_ALCHEMY_KEY}`,
},
}),
provider,
isTestnet
? constants.StarknetChainId.SN_GOERLI
: constants.StarknetChainId.SN_MAIN
);
}, []);
}, [provider]);

const contextValues = useMemo(() => {
return {
Expand Down
4 changes: 2 additions & 2 deletions services/apiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ export const getQuestParticipants = async (id: number) => {
}
};

export const getQuestBoostClaimParams = async (id: number) => {
export const getQuestBoostClaimParams = async (id: number, addr: string) => {
try {
const response = await fetch(
`${baseurl}/boost/get_claim_params?boost_id=${id}`
`${baseurl}/boost/get_claim_params?boost_id=${id}&addr=${addr}`
);
return await response.json();
} catch (err) {
Expand Down