Giter VIP home page Giter VIP logo

web3data-js's People

Contributors

dependabot[bot] avatar joanesespanol avatar taylorjdawson avatar trevorjtclarke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

web3data-js's Issues

Support typescript - publish @types/web3data-js

I was surprised to find that the command npm i --save-dev @types/web3data-js resulted in error message '@types/web3data-js@latest' is not in the npm registry.

Please support typescript - publish @types/web3data-js

Some subscriptions return double array.

Bug:

Some of the subscriptions return double array as data.

Steps to replicate:

w3d.on({eventName: 'market:orders', filters: {"pair":"eth_btc", "exchange":"gdax"}, (data) => {
  console.log(data) // <-- this is a double array!!
})

Calling .on before connect does not error elegantly

Bug:

Calling .on before connect does not error elegantly (and perhaps it should not error).It might be necessary that it saves the subscription then connects after the .connect() method is called.

Steps to replicate:

const w3d = new Web3Data(API_KEY)
w3d.on({eventName: 'block'}, () => {
})
w3d.connect()

This will throw an x is undef error.

Reconnect logic not working with error 1006

Reconnect logic doesn't execute when the websocket gets disconnected due to error 1006. It just gets stuck at Attempting to Reconnect... and it never reconnects. Attached is a screenshot.

Screen Shot 2019-10-02 at 1 36 25 PM

Add subscription message indicating that a subscription was established

Use Case:

  • Users want to know when they successfully subscribe to an event. Let's tell them!

Requirements:

  • Determine if this should be a console.log/info or if it should be a callback or if it should be a state variable?

  • Once a subscription is established use console.info to indicate that the subscription was successfully established.

  • Add tests

Acceptance Criteria:

  • All tests pass

Expose blockchain Id constants in web3data-js as public constants

Use Case:

Users want an easy to use library that is in English (or their native tongue)! So let us do away with these blockchain Ids and add human readable constants for use of use and sanity.

Requirements:

  • Determine best convention for naming and exposing constansts

  • The blockchain Id constants are already defined so just add them to the Web3Data class for ease of use

Acceptance Criteria:

  • blockchain Id constants added to the Web3Data

Ex:

Web3data.BLOCKCHAIN_ID_ETHEREUM_MAINNET
const w3d = new Web3data(API_KEY, {
   blockchainId: Web3data.BLOCKCHAIN_ID_ETHEREUM_MAINNET
})

Error occurs when calling last page of token holders api

There is an error that is caused by a missing null check at onError function

I am calling the web3Data.token.getHolders like this:

      const tokenHolders = await web3Data.token.getHolders(address, {
        page: this.#pageNumber,
        size: this.#pageSize
      });

And then I receive an error:

Stack trace: TypeError: Cannot read property 'data' of undefined
    at onError (C:\work\deep_load_data\node_modules\web3data-js\src\utils.js:72:30)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async AmberdataTokenHoldersIterator.getItems (C:\work\deep_load_data\integrations\amberdata\amberdata.iterator.js:28:28)       
    at async TokenHoldersIterator.getItems (C:\work\deep_load_data\loaders\token-holders\token-holders.iterator.js:24:21)
    at async syncTokenHolders (C:\work\deep_load_data\loaders\token-holders\syncTokenHolders.js:38:27)
    at async syncSingleAddressTokenHolders (C:\work\deep_load_data\loaders\token-holders\syncTokenHolders.js:176:13)

Accept a string as eventname parameter instead of object

Use Case:

Users want to use web3data event listeners like they use other javascript style listeners (standardization!!).

Requirements:

  • Change the .on() method to allow a string for the event name rather than an object

Example:

w3d.on('block', {filters: {number: 7280000}}, () => {})

Make all required query params named parameters in web3data method

Use Case:

  • Users want a library that prevents them from shooting themselves in the foot.

Requirements:

  • Audi API to determine list of endpoints with required query params.

  • Make these named parameters in the method rather than an optional filter.

Acceptance Criteria:

  • ALL required query params are named method params

w3d.eth.getBalance() Needs to return string to match web3js

Users want to have a drop in replacement for web3.js, so let's give it to them!

Requirements: (For developers)

Make this w3d.eth.getBalance() return a string not the whole payload

Acceptance Criteria: (For business & QA)

w3d.eth.getBalance() returns string

Change all blocknumber to id to accept block hash or block number

Use Case:

Users want a library that is up to date with our API! So they want to use a block id instead of number.

Requirements:

  • Change all blocknumber params to block id for consistency

Acceptance Criteria:

  • All blocknumber are now block id

  • Error messages updated

  • tests added

Unable to increase timeout

Question

How can I increase the timeout to allow slow running HTTP requests to complete?

Problem

My call to

web3Data.address.getBalance(walletAddress, { includeTokens: true, includePrice: true, currency: "usd" });

times out often but I can't find a way to increase the time.

Already Tried

I tried setting the axios default timeout to 600000 (10 minutes) but the timeout remained around 30 seconds

axios.defaults.timeout = 600000;
web3Data.address.getBalance(walletAddress, { includeTokens: true, includePrice: true, currency: "usd" });

Suggestion

It looks like axios is being used but there's no way to include override the axios configuration. Is there a way to override the axios configuration? Maybe something like

const options = { axiosRequestConfig: { timeout: 600000 } };
const web3Data = new Web3Data(apiKey, options);

Remove console.logs and use callbacks instead

Use Case:

  • Users want to control the output to their console let us not hijack their stdout!

Requirements:

  • Remove console.logs and use the users callback to communicate

Acceptance Criteria:

  • Uses callback instead of console.logs to communicate

Websocket param validation

Use Case:

Users want a cohesive experience using web3data.js! So let's make that happen by providing param validation.

Requirements:

  • validate event names and parameters for websockets

Error if user doesn't provide required websocket event filter

Use Case:

Users want to know when they are using websockets in correctly. If there is a required filter for an event please make that known to the user so they spend hours sitting and staring at the console waiting for data to show up.

Requirements:

  • If a filter is required then error if the user does not provide this filter.

Add ability to call off without callback

Use Case:

Users want convenience! Yay western world ideologies! In that vein, make it easy to unsubscribe but allowing the user to forgo the inclusion of the callback when calling off.

Requirements:

  • Use the register with the deterministic uuid to locate the event that we want to unsubscribe from

  • Then send unsubscribe to the server

Misuse of bind method - change all `.bind` to `.apply`

Use Case:

Users want code that is compliant with JS standards! Wait who are we kidding JS has no standards! Either way we are misusing bind it should be apply to add the this context to a method.

Requirements:

  • Change all occurrences of .bind to .apply

Acceptance Criteria:

-All tests passing

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.