pybitcash / bitcash

BitCash: Python Bitcoin Cash Library (fork of ofek's Bit)
https://bitcash.dev
MIT License
97 stars 39 forks source link

Remove bitcore #102

Closed nicolaiskye closed 3 years ago

nicolaiskye commented 3 years ago

This PR removes the deprecated Bitcore API as a possible endpoint.

It also now allows the library user to specify their own BitcoinDotCom based API endpoints via environmental variables.

A library user may set a single endpoint by using: BITCOINCOM_API_MAINNET=https://rest.yourwebsitehere.com/v2/

Or they may choose to set up multiple endpoints by using:

BITCOINCOM_API_MAINNET_1=https://rest.firstwebsite.com/v2/
BITCOINCOM_API_MAINNET_2=https://rest.bch.anotherone.org/v2/
BITCOINCOM_API_MAINNET_3=https://rest.manychoices.cash/v2/

This change will keep looking for additional APIs in the environmental variables until it cannot find the next number (.._MAINNET_4 in the above example, as it was not set).

Please note it is not currently possible to set both the 'single' API endpoint and 'multiple' API endpoints (using the _1, _2, etc numbers) at the same time.

You can also replace 'MAINNET' with any supported network, and the same effect will be had on both the single and multiple endpoint options.

Lastly, this PR puts in place a basic framework for extending Bitcash to use alternative REST APIs in the future. Once additional APIs are added, the environment variable checker will use the new APIs name to instantiate endpoints for that API. Using Insomnia as an example, the following would be a valid environmental variable: INSOMNIA_API_TESTNET=https://trest.apihosting.com/v2/

More information about adding additional endpoints can be included in a future PR, but is out of the scope for this current PR.

ghost commented 3 years ago

I see that tests were passing and now they're not. Why is that?

nicolaiskye commented 3 years ago

I see that tests were passing and now they're not. Why is that?

CodeFactor was complaining about some "TODO"s in comments, but @merc1er set it to ignore them for now. For whatever reason it seems to still show the red checkmark on here though, but if you click through to CodeFactor's actual site, it doesn't show them anymore. Not sure if there's a way to get it to manually re-run and show a green mark. Maybe @merc1er knows

ghost commented 3 years ago

I see that tests were passing and now they're not. Why is that?

CodeFactor was complaining about some "TODO"s in comments, but @merc1er set it to ignore them for now. For whatever reason it seems to still show the red checkmark on here though, but if you click through to CodeFactor's actual site, it doesn't show them anymore. Not sure if there's a way to get it to manually re-run and show a green mark. Maybe @merc1er knows

That makes sense. Thank you! Would be nice if we had CI running our own tests here.

merc1er commented 3 years ago

Would be nice if we had CI running our own tests here.

I am working on a PR replacing Travis with GitHub actions.

merc1er commented 3 years ago

Not sure if there's a way to get it to manually re-run and show a green mark. Maybe @merc1er knows

It usually switches to green checkmark automatically, but it is buggy sometimes and still shows the red cross.