Compare commits
2 Commits
7ce1f05f52
...
cf3d999a2e
| Author | SHA1 | Date | |
|---|---|---|---|
| cf3d999a2e | |||
| 8176bf500f |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
.env
|
.env
|
||||||
|
*.sol
|
||||||
/node_modules/
|
/node_modules/
|
||||||
|
|
||||||
# React Router
|
# React Router
|
||||||
|
|||||||
@ -35,4 +35,3 @@ export default function About() {
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// ...existing code...
|
|
||||||
1271
app/Components/Contracts/ClearNet.json
Normal file
1271
app/Components/Contracts/ClearNet.json
Normal file
File diff suppressed because it is too large
Load Diff
28
app/Components/Contracts/Connections.tsx
Normal file
28
app/Components/Contracts/Connections.tsx
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import { Web3 } from 'web3';
|
||||||
|
import clearNetJson from './ClearNet.json';
|
||||||
|
|
||||||
|
const clearNetABI = (clearNetJson as any).abi ?? clearNetJson;
|
||||||
|
const clearNetAddress = "0xf04cbb756045b276ea962ea98d938a0ed8101f51";
|
||||||
|
|
||||||
|
export const getActiveNodes = async (provider: any) => {
|
||||||
|
const web3 = new Web3(provider);
|
||||||
|
const contract = new web3.eth.Contract(clearNetABI, clearNetAddress);
|
||||||
|
const activeNodes = await contract.methods.getActiveNodes().call();
|
||||||
|
return activeNodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function registerNode(provider: any,account: string) {
|
||||||
|
const web3 = new Web3(provider);
|
||||||
|
const contract = new web3.eth.Contract(clearNetABI, clearNetAddress);
|
||||||
|
const gasPrice = await web3.eth.getGasPrice();
|
||||||
|
const gasLimit = 300000;
|
||||||
|
const tx = await contract.methods.registerNode("57.158.82.48", 51820, 1000000000000000000n).send({
|
||||||
|
from: account,
|
||||||
|
gas: String(gasLimit),
|
||||||
|
gasPrice: String(gasPrice),
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(tx);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -4,7 +4,6 @@ import AppBar from '@mui/material/AppBar';
|
|||||||
import Box from '@mui/material/Box';
|
import Box from '@mui/material/Box';
|
||||||
import Toolbar from '@mui/material/Toolbar';
|
import Toolbar from '@mui/material/Toolbar';
|
||||||
import Button from "@mui/material/Button";
|
import Button from "@mui/material/Button";
|
||||||
import AccountCircleIcon from "@mui/icons-material/AccountCircle";
|
|
||||||
import LoginIcon from "@mui/icons-material/Login";
|
import LoginIcon from "@mui/icons-material/Login";
|
||||||
import { Typography, Menu, MenuItem, IconButton, Avatar, Tooltip } from "@mui/material";
|
import { Typography, Menu, MenuItem, IconButton, Avatar, Tooltip } from "@mui/material";
|
||||||
import useAuth from "~/hooks/useAuth";
|
import useAuth from "~/hooks/useAuth";
|
||||||
|
|||||||
837
package-lock.json
generated
837
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -20,7 +20,8 @@
|
|||||||
"isbot": "^5.1.31",
|
"isbot": "^5.1.31",
|
||||||
"react": "^19.1.1",
|
"react": "^19.1.1",
|
||||||
"react-dom": "^19.1.1",
|
"react-dom": "^19.1.1",
|
||||||
"react-router": "^7.9.2"
|
"react-router": "^7.9.2",
|
||||||
|
"web3": "^4.16.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-router/dev": "^7.9.2",
|
"@react-router/dev": "^7.9.2",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user