oasislabs / oasis.js

🕸A web client for the Oasis platform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mismatch in API between oasis gateway and ethereum provider

omitar opened this issue · comments

So looking at oasis.js and web3 and ethers.js I see slight mismatch in API, which I do not know the reason for, but if there is no strong reason for it, it might confuse users who are familiar with Ethereum.

So in Oasis, you create a wallet and then pass that wallet to gateway constructor and then call all methods on gateway instance to interact with the blockchain.

In Ethereum, you create a wallet, create a provider, and then attach a provider to the wallet, calling all methods on the wallet instance to interact with the blockchain.

I do think that Oasis approach is probably slightly cleaner looking from clean slate, but still not sure if it is worth it?

Disregard. I see that APIs are all around the place between different libraries. Lol.

In case it's useful for future context, this client was originally made for use with the https://github.com/oasislabs/developer-gateway and the choices made with the https://github.com/oasislabs/oasis.js/blob/master/packages/service/src/oasis-gateway.ts#L7 interface reflect that.

We have a client<->server programming model, exposing the client and different gateways that can be used to connect to Services, which speak in terms of RPCs and EventEmitters. Web3 transaction semantics are an implementation detail we try not to expose.

The web3 apis that are provided in the ethereum package were added mostly as a stop gap until the developer-gateway was completed/fully functional (and for the folks that want to interact with web3 directly). Therein we have a half-baked notion of a "Web3Provider"--half baked in the sense that it doesn't conform to the official provider interface--but that is an implementation detail.

In addition, for folks doing "pure ethereum" development on Oasis (i.e. they dont need confidentiality at all), there are great tools out there already like ethers.js that I would reccomend using.