-
Notifications
You must be signed in to change notification settings - Fork 1
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 rinkeby which is not used anymore #24
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Require express and create an instance of it | ||
const axios = require("axios"); | ||
const express = require("express"); | ||
const web3 = require("web3"); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const app = express(); | ||
|
||
// on the request to root (localhost:3000/) | ||
app.get("/testInfura", async function(req, res) { | ||
let bodyData = `{ | ||
"jsonrpc": "2.0", | ||
"id": 1, | ||
"method": "eth_call", | ||
"params": [ | ||
{ | ||
"data": "0x06fdde03", | ||
"to": "0x46174d7A2Db240F9aF3Dc84d08E634F3AE586919" | ||
}, | ||
"latest" | ||
] | ||
}`; | ||
let result = await axios.post(`https://rinkeby.infura.io/v3/5b55ff0d83f7488bb0146a63fb49389c`, bodyData); | ||
console.log(result); | ||
res.send("<b>My</b> check console log for result"); | ||
}); | ||
|
||
// On localhost:3000/welcome | ||
app.get("/testWeb3", async function(req, res) { | ||
const contractJson = JSON.parse(fs.readFileSync(path.resolve("src/server/contracts/build/Forestoken.json"), "utf8")); | ||
|
||
const web3Client = new web3(new web3.providers.HttpProvider(`https://sepolia.infura.io/v3/5b55ff0d83f7488bb0146a63fb49389c`)); | ||
|
||
const contract = new web3Client.eth.Contract(contractJson.abi, "0x46174d7A2Db240F9aF3Dc84d08E634F3AE586919",{ | ||
from: "0xb08fc792b476f2c493F407863A4d3B7DeAC9332D" | ||
}); | ||
|
||
const result = await contract.methods.name().call(); | ||
console.log(result); | ||
res.send("<b>Hello</b> welcome to my http server made with express"); | ||
}); | ||
|
||
// Change the 404 message modifing the middleware | ||
app.use(function(req, res, next) { | ||
res.status(404).send("Sorry, that route doesn't exist. Have a nice day :)"); | ||
}); | ||
|
||
// start the server in the port 3000 ! | ||
app.listen(3001, function() { | ||
console.log("Example app listening on port 3001."); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"exclude": ["node_modules", | ||
"src/test", "dist", "**/*spec.ts"] | ||
"src/test", "dist", "**/*spec.ts"], | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Esto arregla un problema mío que me saltaba con un bug que tiene node-fetch. (node-fetch/node-fetch#784)
Algo de CONNECTION ERROR no se que, y por detrás debugeando muuucho encontre otro error escondido que es exactamente el que está en el issue) googleando un toque varios fix este me funcionó.
A todo esto Node-fetch lo solucionó ya. Pero no tenemos esa versión bajada (Y no podemos subirla porque es una dependencia que usa web3, no nosotros directamente)