Open mpeterdev opened 1 year ago
@ilblackdragon I noticed you discussing this feature in TG. Wording there suggests the appropriate priority for this is that it is an essential requirement of BWE. Would you agree with that?
I agree on this point, and want to highlight that this is also true for the current VM and patterns of using it within web2 apps (e.g. web2 apps which do not initialize a wallet) .
There are likely to be limitations on the capabilities of components embedded in standard React apps instead of being accessed through a gateway
I agree that this should be a requirement for WE/nearjs.
I would expect something like this:
npm install nearjs
import { Component } from “nearjs”;
… your standard react code …
<Component src=“..” onTxSign={..} />
or … your standard pure JS code …
<script > nearjs.render(document.querySelector(‘#component’), {src: “”, onTxSign: ...}) </script>
There can be a Provider for React that wraps the page to pass whatever context is needed. For example, if there is already near connection object.
Good default for everything and configuration object can solve most of the limitations.
@ilblackdragon @charleslavon thanks 🙌 . To help us refine the criteria for success, could you outline the motivation you expect devs may have for embedding BOS components in Web2 apps?
The goal here would be to enable the creation of hybrid "web 2.5" projects with minimal engineering efforts. Some projects are not interested in decentralizing their entire site but find value in incorporating pieces of it.
For example, if a "defi news" site built w/ React wanted to add a BOS token swap component, they would have to convert their entire site to a BOS gateway or hack together a makeshift solution. Having the option to simply add another npm dependency to an existing project would create a more optimal DX.
Regarding the wallet connection piece @charleslavon & @mpeterdev flagged, perhaps wallet-selector / web3-onboard would be bundled as dependencies of "nearjs" and operate as a "lite" gateway react component.
important for embedding into docs.near.org
should support multiple engine embeds as a later addition
single engine embed may be negligible work for beta delivery
acceptable for BWE to be installable via GitHub, however we will already be setting up NPM publishing for other packages so we might as well publish there as well
This should take the form of an npm package. There are likely to be limitations on the capabilities of components embedded in standard React apps instead of being accessed through a gateway