Skip to content

Commit 74405da

Browse files
committed
fix(rpc): add as network variable NEVM_RPC_URL
1 parent 642d86c commit 74405da

File tree

7 files changed

+24
-16
lines changed

7 files changed

+24
-16
lines changed

api/services/admin-transfer/handle-freeze-burn.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const handleFreezeBurn = async (
1919
res: NextApiResponse
2020
) => {
2121
await dbConnect();
22-
const web3 = new Web3("https://rpc.syscoin.org");
22+
const web3 = new Web3(process.env.NEVM_RPC_URL!);
2323

2424
const { address } = req.session.user!;
2525

api/services/admin-transfer/handle-submit-proofs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const handleSubmitProofs = async (
1919
res: NextApiResponse
2020
) => {
2121
await dbConnect();
22-
const web3 = new Web3("https://rpc.syscoin.org");
22+
const web3 = new Web3(process.env.NEVM_RPC_URL!);
2323

2424
const { address } = req.session.user!;
2525

components/Bridge/hooks/useMintSysx.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@ import { utils } from "syscoinjs-lib";
44
import { useSyscoin } from "../context/Syscoin";
55
import { usePaliWalletV2 } from "@contexts/PaliWallet/usePaliWallet";
66

7-
// Component
8-
9-
// const freezeBurnConfirmationLog = transfer.logs.find(
10-
// (log) => log.status === "confirm-freeze-burn-sys"
11-
// );
12-
// if (!freezeBurnConfirmationLog) {
13-
// return;
14-
// }
15-
// const receipt = freezeBurnConfirmationLog.payload.data as TransactionReceipt;
16-
177
export const useMintSysx = (transfer: ITransfer) => {
188
const syscoinInstance = useSyscoin();
199
const { sendTransaction } = usePaliWalletV2();

components/Bridge/hooks/useRpcs.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { useQuery } from "react-query";
2+
3+
type RpcApiResponse = {
4+
nevmRpc: string;
5+
};
6+
7+
export const useRpc = () => {
8+
return useQuery<RpcApiResponse>(["rpc"], () => {
9+
return fetch("/api/rpc").then(
10+
(res) => res.json() as Promise<RpcApiResponse>
11+
);
12+
});
13+
};

contexts/Transfer/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ export const NEVMNetwork = {
99
symbol: "SYS",
1010
decimals: 18,
1111
},
12-
rpcUrls: ["https://rpc.syscoin.org"],
12+
rpcUrls: [process.env.NEVM_RPC_URL!],
1313
blockExplorerUrls: ["https://explorer.syscoin.org/"],
1414
};

pages/api/rpc.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { NextApiRequest, NextApiResponse } from "next";
2+
3+
function handler(req: NextApiRequest, res: NextApiResponse) {
4+
return res.status(200).json({ nevmRpcUrl: process.env.NEVM_RPC_URL });
5+
}
6+
7+
export default handler;

utils/get-web3.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import Web3 from "web3";
22

3-
const web3 = new Web3(
4-
new Web3.providers.HttpProvider("https://rpc.syscoin.org")
5-
);
3+
const web3 = new Web3(new Web3.providers.HttpProvider(process.env.NEVM_RPC_URL!));
64

75
export default web3;

0 commit comments

Comments
 (0)