Categories
Cryptocurrency Ethereum Mastering Development

the best way to monitor my own account transactions in openethereum

Please I want to know if I subscribe to pendingTransactions with web3 will it monitor and send notifications of accounts pending Transactions only or all pending transactions on Ethereum network. my project requires users to create Ethereum address now I need to monitor incoming transaction of each user address to complete their services var Web3 […]

Categories
Mastering Development

NodeJs IF Statement in AWS Lambda using MySQL database

I am trying to pass an IF statement (IF data exists in table, [true] update data, [false] insert data) in NodeJS for either of the following queries: var mysql = require(‘mysql’); var config = require(‘./config.json’); var pool = mysql.createPool({ host : config.dbhost, user : config.dbuser, password : config.dbpassword, database : config.dbname }); exports.handler = (event, […]

Categories
Cryptocurrency Ethereum Mastering Development

Ethereum Error: Provider does not support subscriptions: HDWalletProvider

I am making a flash loan request using web3 , truffle and keep getting the error in an event listener: The current provider doesn’t support subscriptions: HDWalletProvider. I am using the code below to connect to get emitted events in a smart contract: const web3 = new Web3(); const eventProvider = new Web3.providers.WebsocketProvider(wss); eventProvider.on(‘error’, e […]

Categories
Mastering Development

Why do I get code 404 from paypal when trying to read past transactions

I am trying to read my past transactions. I have already done that with the curl tool, but I can’t get it working in nodeJS. I am trying this with the request api. Getting the token from paypal works just fine. Just can’t figure out to do this curl -v -X GET https://api.paypal.com/v1/reporting/transactions?start_date=2020-05-20T01:01:01-00:00&end_date=2020-06-19T01:01:01-00:00 \ -H […]

Categories
Mastering Development

what does var name = ()() do? [duplicate]

I encountered the code like below. return new Promise(function (resolve, reject) { if (!message) return reject(new Error(‘Requires message request to send’)); message = (0, _getURLJWT)(message); ….. ….. var enc = (0, _encryptMessage)(plaintext, pubEncKey); }, function (error, res, body) { …. …. }); }); I do not understand the two expressions in the code: message = […]

Categories
Mastering Development

Postman works but not react redux action (axios.post request)

Something really weird is going on. I am building an API using Cloud Functions. Basically the Cloud Function makes a request to the server and retrieves a token. This is the code exports.Klarna = functions.https.onRequest((req, res) => { // const app = express(); // app.use(cors({ origin: true })); res.set(‘Access-Control-Allow-Origin’, ‘*’); const url = “https://api.playground.klarna.com/payments/v1/sessions”; const […]

Categories
Mastering Development

PUT API request returning JSON body error

Im trying to update a distribution list by sending a put request, when I run this code and test it in postman by giving it a JSON body I get this error in my node.js terminal stating SyntaxError: Unexpected end of JSON input … any idea what I should change? My PUT API request app.put(“/api/Dls/Add/:groupId” […]

Categories
Mastering Development

Auth0: Is it possible to set roles from NextJS API Routes?

I made a NextJS app using https://github.com/auth0/nextjs-auth0 I made a role called “Cool Person”. I created an API Route at /api/upgrade with the following code: import request from “request” export default async (req, res) => { var options = { method: ‘POST’, url: `https://${process.env.domain}/api/v2/users/${myUserID}/roles`, headers: { ‘content-type’: ‘application/json’, authorization: `Bearer ${process.env.mgmtApiToken}`, // I got this […]

Categories
Mastering Development

How to connect MongoDB server via SSH Tunnel with NodeJS Cluster (multiple worker)

I am implementing cluster in my NodeJS so maximize the performance. The problem comes when I connect to MongoDB via SSH, the first connection by worker to MongoDB server via SSH is success but when the the rest of worker trying to connect to MongoDB will encounter error {“errno”:”EADDRINUSE”,”code”:”EADDRINUSE”,”syscall”:”bind”,”address”:”127.0.0.1″,”port”:27017} where i believe the port is […]

Categories
Cryptocurrency Ethereum Mastering Development

Call ethereum smart contract function using web3js 1.2.6

I am trying to call a smart contract but i am getting error : The function eth_sendTransaction does not exist. I think it is because of transaction not signed , but how can i sign the transaction when i am calling .send() method. Please tell me what am i doing wrong here? My smart contract […]