Skip to content

Commit

Permalink
fix rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
inciner8r committed Apr 11, 2024
1 parent df3903f commit 4d8941a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 29 deletions.
4 changes: 2 additions & 2 deletions pages/addStorefront.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function AddStorefront() {
headline: headline,
description: description,
blockchain: selecteBlockchaine,
network: "testnet",
network: "mainnet",
},
{
headers: {
Expand Down Expand Up @@ -215,7 +215,7 @@ function AddStorefront() {
Add StoreFront Details
</div>
<div className="text-center text-3xl font-bold mt-5">
Enter storefront Details in testnet
Enter storefront Details in mainnet
</div>

<div
Expand Down
8 changes: 4 additions & 4 deletions pages/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function StorefrontDashboard(props) {
if (val) {
setStorefrontData(networkData.filter((sf) => sf.network === "mainnet"));
} else {
setStorefrontData(networkData.filter((sf) => sf.network === "testnet"));
setStorefrontData(networkData.filter((sf) => sf.network === "mainnet"));
}
};
const deployStorefrontGraph = (storefrontData) => {
Expand Down Expand Up @@ -101,7 +101,7 @@ function StorefrontDashboard(props) {
);

setNetwork(
payload?.data?.payload.filter((sf) => sf.network === "testnet")
payload?.data?.payload.filter((sf) => sf.network === "mainnet")
);
}
setLoading(false);
Expand Down Expand Up @@ -198,10 +198,10 @@ function StorefrontDashboard(props) {
</div>
</div>
<div>
{storefrontData[0]?.network === "testnet" && (
{storefrontData[0]?.network === "mainnet" && (
<div className="text-center">
<div className="font-bold text-4xl p-5">
Your storefronts in Testnet
Your storefronts in Mainnet
</div>
</div>
)}
Expand Down
2 changes: 1 addition & 1 deletion pages/webappForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function WebappForm(props) {
{
name: stfName,
id: props.router.query.storefrontId,
network: "mumbai",
network: "polygon",
protocol: "ethereum",
tag: "v1",
headline: stfheadline,
Expand Down
37 changes: 15 additions & 22 deletions utils/web3Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,23 @@ import Web3Modal from "web3modal";
import { ethers } from "ethers";
import WalletConnectProvider from "@walletconnect/web3-provider";

const etherContract=async(contractAddress,abi)=>{
const etherContract = async (contractAddress, abi) => {
const options = new WalletConnectProvider({
rpc: {
137: "https://rpc-mumbai.maticvigil.com/v1/f336dfba703440ee198bf937d5c065b8fe04891c",
137: process.env.NEXT_PUBLIC_POLYGON_MATICVIGIL_RPC,
},
rpcUrl:
"https://rpc-mumbai.maticvigil.com/v1/f336dfba703440ee198bf937d5c065b8fe04891c",

rpcUrl: process.env.NEXT_PUBLIC_POLYGON_MATICVIGIL_RPC,
});
const web3Modal = new Web3Modal({
network: "mumbai",
package: WalletConnectProvider,
options: options,
cacheProvider: true,
});
const connection = await web3Modal.connect();
const provider = new ethers.providers.Web3Provider(connection);
const signer = provider.getSigner();
return new ethers.Contract(
contractAddress,
abi,
signer
);

}
const web3Modal = new Web3Modal({
network: "polygon",
package: WalletConnectProvider,
options: options,
cacheProvider: true,
});
const connection = await web3Modal.connect();
const provider = new ethers.providers.Web3Provider(connection);
const signer = provider.getSigner();
return new ethers.Contract(contractAddress, abi, signer);
};

export default etherContract
export default etherContract;

0 comments on commit 4d8941a

Please sign in to comment.