-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: EtherscanProvider BinanceSmartChain baseURL #1204
Conversation
Looking into this now... Are the API's compatible? I don't see the proxy actions available on the APIs for these services: https://bscscan.com/apis |
there are public rpc urls which are json rpc compatible
https://docs.binance.org/smart-chain/developer/rpc.html
…On Sat 19 Dec 2020 at 23:22 Richard Moore ***@***.***> wrote:
Looking into this now... Are the API's compatible? I don't see the proxy
actions available on the APIs for these services: https://bscscan.com/apis
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1204 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGFVWNJB5F33P36OO7FLXQLSVUKRHANCNFSM4U55I6MA>
.
|
oops i mistook this pr with another
…On Sat 19 Dec 2020 at 23:49 David Phan ***@***.***> wrote:
there are public rpc urls which are json rpc compatible
https://docs.binance.org/smart-chain/developer/rpc.html
On Sat 19 Dec 2020 at 23:22 Richard Moore ***@***.***>
wrote:
> Looking into this now... Are the API's compatible? I don't see the proxy
> actions available on the APIs for these services:
> https://bscscan.com/apis
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#1204 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AGFVWNJB5F33P36OO7FLXQLSVUKRHANCNFSM4U55I6MA>
> .
>
|
In the next minor version bump, I will abstract the URL methods, so this is easier to sub-class for a BscScanProvider to utilize the EtherscanProvider logic. |
Hi, as far as I can see, bscscan is a fork of Etherscan. If you try to use the same endpoints, the response is the same. The only difference I could find is that ethprice is bnbprice https://api.bscscan.com/api?module=stats&action=bnbprice Besides adding the networks to the list, I have found this code that needs to be changed in etherscan-provider.ts: if (this.network.name !== "homestead") { return 0.0; } Should be something like this: if (this.network.name !== "homestead" && this.network.name !== "bsc-mainnet") { return 0.0; } That's all the differences I could find. Thank you, |
Hi @ricmoo , can you check this out please |
Any update on this one? Would be good to be able to interface with the Binance Smart Chain |
you can connect to BSC using ethers by just instantiating a new JsonRpcProvider(
"https://bsc-dataseed1.defibit.io/",
{
chainId: 56,
name: "bsc-mainnet",
}
) |
The changes needed were made in 5.2 to make this easier and I have a local working version. I will get back to it once EIP-1559 is out, as that is a much higher priority feature. I can post a gist later with the implementation if you want to start using it sooner. |
That would be great, thank you! I'd love to be able to connect. If I use JsonRpcProvider, do I need to have the changes from your gist or no? |
Here is the preliminary source (requires ethers 5.2.0 or above): https://gist.github.com/ricmoo/77fe78869118dc41d654eea6696c45bc Try it out and let me know if you have any issues with it. It has only had very minimal testing. Thanks! :) |
…an-supported chains (ethers-io#1204, ethers-io#1473).
…an-supported chains (ethers-io#1204, ethers-io#1473).
Hi Ricmoo, that's great, thank you! I will try it out. |
This should now be available in the BSC ancillary package: https://github.com/ethers-io/ancillary-bsc Try it out and let me know if you run across any problems. Thanks! :) |
Hey @ricmoo, is the I'm on |
If you are using this provider in a wallet for a purpose of resolving some critical info like ENS names, it would be better to use quorum between multiple sources (incase a node is compromised and imagine import { BscscanProvider } from "@ethers-ancillary/bsc";
const provider1 = new BscscanProvider();
import { JsonRpcProvider, FallbackProvider } from '@ethersproject/providers';
const provider2 = new JsonRpcProvider('bsc-node-a.com')
const provider3 = new JsonRpcProvider('bsc-node-b.com')
const provider = new FallbackProvider([provider1, provider2, provider3], 2) // at least two responses should match Docs for FallbackProvider |
@ricmoo What is your take on adding these ones? 🤔