I'm building an interaction with some smartcontracts via Javascript and following Uniswap Documentation as well as EtherJs, here is my code:
Gist Github
Via console it shows as the transaction was successful,
Console Logs
But the transaction gets reverted without a clear error message,
Transaction hash
Is there any way to track or find where my code is wrong?, I triple checked paths and all the stuff, as I'm still learning about smartcontracts interaction maybe there's something I'm missing out.
Thanks in advance,
Triple checked:
Smartcontracts addresses
Methods syntaxis (following Uniswap Documentations)
Contract ABIs
Related
Bots are amazing, unless you're Google Analytics
After many months of learning to host my own Discord bot, I finally figured it out! I now have a node server running on my localhost that sends and receives data from my Discord server; it works great. I can do all kinds of the things I want to with my Discord bot.
Given that I work with analytics everyday, one project I want to figure out is how to send data to Google Analytics (specifically GA4) from this node server.
NOTE: I have had success in sending data to my Universal Analytics property. However, as awesome as that was to finally see pageviews coming into, it was equally heartbreaking to recall that Google will be getting rid of Universal Analytics in July of this year.
I have tried the following options:
GET/POST requests to the collect endpoint
This option presented itself as impossible from the get-go. In order to send a request to the collection endpoint, a client_id must be sent along with the request itself. And this client_id is something that must be generated using Google's client id algorithm. So, I can't just make one up.
If you consider this option possible, please let me know why.
Install googleapis npm package
At first, I thought I could just install the googleapis package and be ready to go, but that idea fell on its face immediately too. With this package, I can't send data to GA, I can only read with it.
Find and install a GTM npm package
There are GTM npm packages out there, but I quickly found out that they all require there to be a window object, which is something my node server would not have because it isn't a browser.
How I did this for Universal Analytics
My biggest goal is to do this without using Python, Java, C++ or any other low level languages. Because, that route would require me to learn new languages. Surely it's possible with NodeJS alone... no?
I eventually stumbled upon the idea of actually hosting a webpage as some sort of pseudo-proxy that would send data from the page to GA when accessed by something like a page scraper. It was simple. I created an HTML file that has Google Tag Manager installed on it, and all I had to do was use the puppeteer npm package.
It isn't perfect, but it works and I can use Google Tag Manager to handle and manipulate input, which is wonderful.
Unfortunately, this same method will not work for GA4 because GA4 automatically excludes all identified bot traffic automatically, and there is no way to turn that setting off. It is a very useful feature for GA4, giving it quite a bit more integrity than UA, and I'm not trying to get around that fact, but it is now the Bane of my entire goal.
https://support.google.com/analytics/answer/9888366?hl=en
Where to go from here?
I'm nearly at the end of my wits on figuring this one out. So, either an npm package exists out there that I haven't found yet, or this is a futile project.
Does anyone have any experience in sending data from NodeJS to GA4? (or even GTM?) How did you do it?
...and this client_id is something that must be generated using Google's client id algorithm. So, I can't just make one up...
Why, of course you can. GA4 generates it pretty much the same as UA does. You don't need anything from google to do it.
Besides, instead of mimicking just requests to the collect endpoint, you may just wanna go the MP route right away: https://developers.google.com/analytics/devguides/collection/protocol/ga4 The links #dockeryZ gave, work perfectly fine. Maybe try opening them in incognito, or in a different browser? Maybe you have a plugin blocking analytics urls.
Moreover, you don't really need to reinvent the bicycle. Node already has a few packages to send events to GA4, here's one looking good: https://www.npmjs.com/package/ga4-mp?activeTab=readme
Or you can just use gtag directly to send events. I see a lot of people doing it even on the front-end: https://www.npmjs.com/package/ga-gtag Gtag has a whole api not described in there. Here's more on gtag: https://developers.google.com/tag-platform/gtagjs/reference Note how the library allows you to set the client id there.
The only caveat there is that you'll have to track client ids and session ids manually. Shouldn't be too bad though. Oh, and you will have to redefine the concept of a pageview, I guess. Well, the obvious one is whenever people post in the chan that is different from the previous post in a session. Still, this will have to be defined in the code.
Don't worry about google's bot traffic detection. It's really primitive. Just make sure your useragent doesn't scream "bot" in it. Make something better up.
since the owner just closed my issue on GitHub and the people on the official discord server couldn't help me, I'm trying my luck here.
Since NestJS doesn't have interceptors or anything else for fastify (for file uploads), I wanted to use the fastify-multipart (now #fastify/multipart) package. I registered the middleware the normal way, but I'm using the attachFieldsToBody option, so I can properly use the validation pipeline which I've set to global. I have a very simple setup with a DTO for my post request. If you let the sandbox container run, you'll see the 500 error saying maximum call stack exceeded which happened in the validation pipeline.
GitHub Issue: https://github.com/nestjs/nest/issues/9683
Sandbox: https://codesandbox.io/s/nestjs-fastify-multipart-bug-17m5ls
The multipart middleware works fine (even though someone on Discord thought that was an issue, assuming that I didn't google for it). The only issue is the validation pipeline, but I can't track this down, I'm unsure why it causes an infinite loop. While I'm debugging and looking through the common package source code, if anyone ran into this issue or has an idea for a solution, please let me know.
I am trying to receive a JWT from the DocuSign API using the C# SDK. The method that is used in the sample code from DocuSign is
ApiClient.RequestJWTUserToken(clientID,
impersonatedUserGuid,
authServer,
Encoding.UTF8.GetBytes(privateKey),
expiresInHours);
I have done all the pre-work: Creating the integrator key, Creating the RSA Private Key, obtaining consent. In the sample solution - it works, once I fill in the parameters, I receive a token and am able to execute the rest of the program.
However, in my proof of concept project, I do the exact same procedure and the method is returning null. I have been combing my solution for any differences however I can't seem to find the smoking gun. I created a new integrator key, new RSA key, obtained consent. What is interesting is, as a test, I took my new keys that were failing in my proof of concept project and put them into my sample code app - it worked. The exact same values in each project, one worked and the other failed. I even put the string values in directly into the method, again failed in my proof of concept but worked in the sample application.
I notice the sample app was using a different version of the DLL referenced, I changed my project to that version and it still would not work. Any suggestions I would appreciate.
without seeing your code it's impossible to know how it is different than the sample app. I wonder if you tried the sample code with the new integration key and RSA key you created?
Also, what the other user suggests, take the sample app and modify it so it becomes your code instead of starting from scratch. When you then run into the issue - figure out what was the last thing you change and it probably is the culprit.
Many people claim to have solved this problem in the following examples
https://github.com/nodegit/nodegit/issues/463
Nodegit: How to modify a file and push the changes?
However after testing these solutions out I'm given an error that claims the remote.setCallbacks(...) function is undefined. A quick check at the Nodegit API documentation
http://www.nodegit.org/api/remote/#push
confirms that the remote.setCallbacks(...) function is indeed undefined. I tried this example code found on the Nodegit page
https://github.com/nodegit/nodegit/blob/master/examples/push.js
But this code freezes at the remote.push(...) command. How have people managed to actually push code to a remote repository using Nodegit? Any help on the issue I've found thus far has been a disappointment!
Unfortunately I was shooting myself in the foot all day. The reason the example code found at
https://github.com/nodegit/nodegit/blob/master/examples/push.js
wasn't working was because the remote github repository wasn't created before running the code. I'm guessing execution froze at the remote.push(...) command because the push prompt would make a request for the repository and not get a valid response, at which point it would make another request but still not get a valid response. Over and over again this would continue. The nodegit promise chain needs to establish a connection with the remote repository before it can finish. Unfortunately the Nodegit API documentation lacks explanation for many offered functions. Oh well, the important thing is a solution was reached!
I'm using the "request" module and passing all the correct arguments for the eBay API's FindPopularSearches endpoint and no matter what I do, I keep getting this error:
Getting popular keywords is not enabled on current site.
At first I thought it was a mismatch between the categoryID I had fetched and the siteid I was using. But double-checking that with someone else's code, I was able to conclude that my API call was properly built.
http://open.api.sandbox.ebay.com/shopping?appid=<my-app-id>&callname=FindPopularSearches&siteid=0&responseencoding=JSON&version=847&CategoryID=10159
Shopping API calls such as FPS don't work too well with Sandbox, as you discovered. Since such calls are read-only, eBay recommends simply making them directly to Production.
I tried switching to a production app id, and using the production API and this solved my problem. AFAIK, this call does not seem to function in sandbox mode.
It would have been nice to have written that down in an obvious place in the docs but hey, that's why I'm leaving it here.
So I guess the "site" in the error message means sandbox vs production.