web3data / web3data-js Goto Github PK
View Code? Open in Web Editor NEWWeb3Data.js - The easiest way to interact with multiple blockchains from a single library.
Home Page: https://web3data.github.io/web3data-js/
License: Apache License 2.0
Web3Data.js - The easiest way to interact with multiple blockchains from a single library.
Home Page: https://web3data.github.io/web3data-js/
License: Apache License 2.0
Users want to know if they are bounds issues when using a method that get's a specific index of a piece of data. Like transaction index.
getTransactionFromBlock
& getUncle
(any others that require index) throw 'Index out of bounds error'Users want a library that is up to date with our API! So they want to use a block id instead of number.
All blocknumber are now block id
Error messages updated
tests added
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.
Currently there is no way to check what version is available for CDN based distribution:
https://unpkg.com/web3data-js/dist/web3data.min.js
The version of each built file should be added along the methods as a way to check package version.
Syntax Idea:
const version = Web3Data.version
console.log(version) // 0.7.3
Some of the subscriptions return double array as data.
w3d.on({eventName: 'market:orders', filters: {"pair":"eth_btc", "exchange":"gdax"}, (data) => {
console.log(data) // <-- this is a double array!!
})
How can I increase the timeout to allow slow running HTTP requests to complete?
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.
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" });
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);
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.
const w3d = new Web3Data(API_KEY)
w3d.on({eventName: 'block'}, () => {
})
w3d.connect()
This will throw an x is undef error.
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.
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
Ex:
Web3data.BLOCKCHAIN_ID_ETHEREUM_MAINNET
const w3d = new Web3data(API_KEY, {
blockchainId: Web3data.BLOCKCHAIN_ID_ETHEREUM_MAINNET
})
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.
Use the register with the deterministic uuid to locate the event that we want to unsubscribe from
Then send unsubscribe to the server
Websockets running ok during the last 3 months until today.
All websockets querys obtains a Js error: web3data.min.js:1 Uncaught RangeError: Maximum call stack size exceeded.
This error is also in example test index.html.
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
Be consistent, be be consistent! ๐
throwIf()
throwIf()
Users want a cohesive experience using web3data.js! So let's make that happen by providing param validation.
Users want to use web3data event listeners like they use other javascript style listeners (standardization!!).
.on()
method to allow a string for the event name rather than an objectExample:
w3d.on('block', {filters: {number: 7280000}}, () => {})
Audi API to determine list of endpoints with required query params.
Make these named parameters in the method rather than an optional filter.
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)
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
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.
.bind
to .apply
-All tests passing
Make this w3d.eth.getBalance() return a string not the whole payload
w3d.eth.getBalance() returns string
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.