Code Monkey home page Code Monkey logo

faucet's People

Contributors

festelo avatar ltfschoen avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

faucet's Issues

TypeError: Cannot read property 'number' of null

After a few moments running the server of my faucet repository, I get the following error, and it occurs on the following line of code, so it has been commented out https://github.com/DataHighway-DHX/faucet/blob/master/helpers/contract.js#L24. That line of code isn't required for the faucet anyway. Potential solution here: MetaMask/web3-provider-engine#313.
Note: This error still happens after commenting out the getBlock code. Since @trufflesuite/web3-provider-engine is a fork of MetaMask/web3-provider-engine I can't create an issue, so might have to switch to ethers.js

/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/@trufflesuite/web3-provider-engine/index.js:219 number: ethUtil.toBuffer(jsonBlock.number), ^ TypeError: Cannot read property 'number' of null at toBufferBlock (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/@trufflesuite/web3-provider-engine/index.js:219:50) at /Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/@trufflesuite/web3-provider-engine/index.js:60:27 at /Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/@trufflesuite/web3-provider-engine/index.js:136:12 at /Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/@trufflesuite/web3-provider-engine/index.js:199:9 at /Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/async/internal/once.js:12:16 at replenish (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/async/internal/eachOfLimit.js:61:25) at /Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/async/internal/eachOfLimit.js:71:9 at eachLimit (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/async/eachLimit.js:43:36) at /Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/async/internal/doLimit.js:9:16 at end (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/@trufflesuite/web3-provider-engine/index.js:176:5) at /Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/@trufflesuite/web3-provider-engine/subproviders/provider.js:19:5 at XMLHttpRequest.request.onreadystatechange (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/web3-providers-http/src/index.js:96:13) at XMLHttpRequestEventTarget.dispatchEvent (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/xhr2-cookies/xml-http-request-event-target.ts:44:13) at XMLHttpRequest._setReadyState (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/xhr2-cookies/xml-http-request.ts:219:8) at XMLHttpRequest._onHttpResponseEnd (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/xhr2-cookies/xml-http-request.ts:345:8) at IncomingMessage.<anonymous> (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/xhr2-cookies/xml-http-request.ts:311:39)`

DRR: TypeError: this._rpcCore.state.queryStorageAt is not a function

When I try to request DHX from the faucet, I get the following error:

[0] Checking DHX token account balance of requestor
[0] Middleware to check Harbour DHX balance of requestors DataHighway address
[0] 2020-06-29T02:08:41.820Z app Balance of 0 and a nonce of 0
[0] Checking DHX token account balance of faucet
[0] Middleware to check Harbour DHX balance of faucet DataHighway address
[0] 2020-06-29T02:08:42.136Z app Balance of faucet is 999999999999998425105 and a nonce of 1
[0] 2020-06-29T02:08:42.136Z app Recipient:  5FurfdYAvwunMgCmxj7J1FKdjqETXdcBtnXVYv8cJPgb4bF9
[0] 2020-06-29T02:08:42.136Z app Sending DataHighway Harbour DHX. Please wait...
[0] 2020-06-29 04:08:42             DRR: TypeError: this._rpcCore.state.queryStorageAt is not a function
[0]     at /Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/@polkadot/api/base/Decorate.js:445:228
[0]     at Array.map (<anonymous>)
[0]     at SwitchMapSubscriber.project (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/@polkadot/api/base/Decorate.js:445:190)
[0]     at SwitchMapSubscriber._next (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/operators/switchMap.ts:123:21)
[0]     at SwitchMapSubscriber.Subscriber.next (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/Subscriber.ts:99:12)
[0]     at MapSubscriber._next (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/operators/map.ts:89:22)
[0]     at MapSubscriber.Subscriber.next (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/Subscriber.ts:99:12)
[0]     at DefaultIfEmptySubscriber._next (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/operators/defaultIfEmpty.ts:75:22)
[0]     at DefaultIfEmptySubscriber.Subscriber.next (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/Subscriber.ts:99:12)
[0]     at TakeLastSubscriber._complete (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/operators/takeLast.ts:108:21)
[0]     at TakeLastSubscriber.Subscriber.complete (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/Subscriber.ts:126:12)
[0]     at ScanSubscriber.Subscriber._complete (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/Subscriber.ts:148:22)
[0]     at ScanSubscriber.Subscriber.complete (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/Subscriber.ts:126:12)
[0]     at TapSubscriber._complete (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/operators/tap.ts:145:29)
[0]     at TapSubscriber.Subscriber.complete (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/Subscriber.ts:126:12)
[0]     at SwitchMapSubscriber.Subscriber._complete (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/Subscriber.ts:148:22)

TypeError: Cannot read property 'query' of null

Error in production, we need to try to reconnect if we're disconnected

2020-06-29T23:54:58.073501+00:00 app[web.1]: 2020-06-29 23:54:58          API-WS: disconnected from wss://testnet-harbour.datahighway.com code: '1006' reason: 'Connection dropped by remote peer.'
2020-06-29T23:55:33.423180+00:00 app[web.1]: Checking DHX token account balance of requestor
2020-06-29T23:55:33.423624+00:00 app[web.1]: 2020-06-29T23:55:33.423Z app Middleware to check Harbour DHX balance of requestors DataHighway address
2020-06-29T23:55:33.431034+00:00 app[web.1]: Error checking balance of Harbour DHX with middleware:  TypeError: Cannot read property 'query' of null
2020-06-29T23:55:33.431036+00:00 app[web.1]: at getBalanceDhx (/app/helpers/contractDhx.js:49:19)
2020-06-29T23:55:33.431036+00:00 app[web.1]: at Object.checkBalanceRequestorDhx (/app/middleware/contractDhx.js:9:30)
2020-06-29T23:55:33.431037+00:00 app[web.1]: at /app/server.js:99:33
2020-06-29T23:55:33.431037+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2020-06-29T23:55:33.431038+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/route.js:137:13)
2020-06-29T23:55:33.431038+00:00 app[web.1]: at Route.dispatch (/app/node_modules/express/lib/router/route.js:112:3)
2020-06-29T23:55:33.431038+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2020-06-29T23:55:33.431039+00:00 app[web.1]: at /app/node_modules/express/lib/router/index.js:281:22
2020-06-29T23:55:33.431039+00:00 app[web.1]: at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
2020-06-29T23:55:33.431039+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/index.js:275:10)
2020-06-29T23:55:33.431040+00:00 app[web.1]: at urlencodedParser (/app/node_modules/body-parser/lib/types/urlencoded.js:91:7)
2020-06-29T23:55:33.431040+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2020-06-29T23:55:33.431040+00:00 app[web.1]: at trim_prefix (/app/node_modules/express/lib/router/index.js:317:13)
2020-06-29T23:55:33.431041+00:00 app[web.1]: at /app/node_modules/express/lib/router/index.js:284:7
2020-06-29T23:55:33.431041+00:00 app[web.1]: at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
2020-06-29T23:55:33.431041+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/index.js:275:10)
2020-06-30T00:36:09.445817+00:00 heroku[web.1]: Idling
2020-06-30T00:36:09.449067+00:00 heroku[web.1]: State changed from up to down
2020-06-30T00:36:11.412452+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2020-06-30T00:36:11.640167+00:00 heroku[web.1]: Process exited with status 1
2020-06-30T02:07:57.274584+00:00 heroku[web.1]: Unidling
2020-06-30T02:07:57.288702+00:00 heroku[web.1]: State changed from down to starting
2020-06-30T02:08:09.370865+00:00 heroku[web.1]: Starting process with command `yarn start`
2020-06-30T02:08:12.235038+00:00 app[web.1]: yarn run v1.22.4
2020-06-30T02:08:12.281847+00:00 app[web.1]: $ DEBUG=app node server.js
2020-06-30T02:08:13.602839+00:00 app[web.1]: Keccak bindings are not compiled. Pure JS implementation will be used.
2020-06-30T02:08:14.490998+00:00 app[web.1]: Listening on port 25223
2020-06-30T02:08:14.495115+00:00 app[web.1]: (node:33) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received undefined
2020-06-30T02:08:14.495117+00:00 app[web.1]: at validateString (internal/validators.js:121:11)
2020-06-30T02:08:14.495119+00:00 app[web.1]: at Url.parse (url.js:159:3)
2020-06-30T02:08:14.495119+00:00 app[web.1]: at urlParse (url.js:154:13)
2020-06-30T02:08:14.495120+00:00 app[web.1]: at new Request (/app/node_modules/node-fetch/lib/request.js:27:16)
2020-06-30T02:08:14.495120+00:00 app[web.1]: at /app/node_modules/node-fetch/index.js:51:17
2020-06-30T02:08:14.495122+00:00 app[web.1]: at new Promise (<anonymous>)
2020-06-30T02:08:14.495122+00:00 app[web.1]: at new Fetch (/app/node_modules/node-fetch/index.js:49:9)
2020-06-30T02:08:14.495122+00:00 app[web.1]: at Fetch (/app/node_modules/node-fetch/index.js:37:10)
2020-06-30T02:08:14.495123+00:00 app[web.1]: at module.exports (/app/node_modules/isomorphic-fetch/fetch-npm-node.js:8:19)
2020-06-30T02:08:14.495124+00:00 app[web.1]: at getCustomTypesDhx (/app/helpers/contractDhx.js:13:26)
2020-06-30T02:08:14.495124+00:00 app[web.1]: at Object.init (/app/helpers/contractDhx.js:40:20)
2020-06-30T02:08:14.495124+00:00 app[web.1]: at Object.<anonymous> (/app/helpers/contractDhx.js:95:9)
2020-06-30T02:08:14.495125+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1200:30)
2020-06-30T02:08:14.495126+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
2020-06-30T02:08:14.495126+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:1049:32)
2020-06-30T02:08:14.495126+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:937:14)
2020-06-30T02:08:14.495127+00:00 app[web.1]: (Use `node --trace-warnings ...` to show where the warning was created)
2020-06-30T02:08:14.495230+00:00 app[web.1]: (node:33) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
2020-06-30T02:08:14.495328+00:00 app[web.1]: (node:33) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

UnhandledPromiseRejectionWarning: Error: You must provide the json interface of the contract when instantiating a contract object.

When trying to use @truffle/contract

(node:85047) UnhandledPromiseRejectionWarning: Error: You must provide the json interface of the contract when instantiating a contract object.
    at Contract (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/web3-eth-contract/src/index.js:70:15)
    at new Contract (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/@truffle/interface-adapter/node_modules/web3-eth/src/index.js:149:22)
    at TruffleContract.Contract (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/@truffle/contract/lib/contract/index.js:23:26)
    at new TruffleContract (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/@truffle/contract/lib/contract/constructorMethods.js:205:23)
    at Function.at (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/@truffle/contract/lib/contract/constructorMethods.js:75:12)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:85047) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:85047) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Integrate DataHighway transaction hash into block explorer

After we provide the user with the transaction hash https://github.com/DataHighway-DHX/faucet/blob/master/helpers/contractDhx.js#L90, show them how to use it in a block explorer like polkascan.io (they said they don't havre sufficient resources to list any chain other than Polkadot and Kusama) or subscan.io (requested listing end June 2020 and awaiting response)

We already have that link for browsing Ethereum transactions on etherscan.io

Unable to submit multiple requests for DHX tokens from faucet in a row

[0] 2020-06-30 01:24:33        RPC-CORE: submitExtrinsic(extrinsic: Extrinsic): Hash:: 1014: Priority is too low: (3000141 vs 3000141): The transaction has too low priorit
[0] 2020-06-29T23:24:33.793Z app Error: submitExtrinsic(extrinsic: Extrinsic): Hash:: 1014: Priority is too low: (3000141 vs 3000141): The transaction has too low priorit
[0]     at CatchSubscriber.selector (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/@polkadot/rpc-core/index.js:186:38)
[0]     at CatchSubscriber.error (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/operators/catchError.ts:132:23)
[0]     at MapSubscriber.Subscriber._error (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/Subscriber.ts:143:22)
[0]     at MapSubscriber.Subscriber.error (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/Subscriber.ts:113:12)
[0]     at SwitchMapSubscriber.OuterSubscriber.notifyError (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/OuterSubscriber.ts:17:22)
[0]     at InnerSubscriber._error (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/InnerSubscriber.ts:21:17)
[0]     at InnerSubscriber.Subscriber.error (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/Subscriber.ts:113:12)
[0]     at CombineLatestSubscriber.OuterSubscriber.notifyError (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/OuterSubscriber.ts:17:22)
[0]     at InnerSubscriber._error (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/InnerSubscriber.ts:21:17)
[0]     at InnerSubscriber.Subscriber.error (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/Subscriber.ts:113:12)
[0]     at /Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/rxjs/src/internal/util/subscribeToPromise.ts:12:30
[0]     at processTicksAndRejections (internal/process/task_queues.js:97:5)

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client

When the API tries to respond to the front-end fetch get request at this line of code where it does res.send https://github.com/DataHighway-DHX/faucet/blob/master/server.js#L77, it returns 404 (Not Found) and shows "Not Found" in the UI, and shows the following error, even though it successfully transfers the tokens:

[0] 2020-06-28T14:03:40.788Z app Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
[0]     at ServerResponse.setHeader (_http_outgoing.js:533:11)
[0]     at ServerResponse.header (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/express/lib/response.js:771:10)
[0]     at ServerResponse.send (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/express/lib/response.js:170:12)
[0]     at ServerResponse.json (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/express/lib/response.js:267:15)
[0]     at ServerResponse.send (/Users/ls/code/src/DataHighway-com/faucet-mining/node_modules/express/lib/response.js:158:21)
[0]     at /Users/ls/code/src/DataHighway-com/faucet-mining/server.js:77:11
[0]     at processTicksAndRejections (internal/process/task_queues.js:97:5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.