Skip to content
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

Ready to test browser support #10

Open
3 of 5 tasks
coolaj86 opened this issue Sep 1, 2022 · 13 comments
Open
3 of 5 tasks

Ready to test browser support #10

coolaj86 opened this issue Sep 1, 2022 · 13 comments
Labels
documentation Improvements or additions to documentation

Comments

@coolaj86
Copy link
Member

coolaj86 commented Sep 1, 2022

COMMENT with what you're working on

(that way we don't have multiple people doing the same thing and no one doing the other things)

The Task

  1. Create a Hello World project (with its own public repo) with/for one or more of the following bundlers:
    • Script Tags
    • Webpack
    • Vite
    • ESBuild
    • Rollup
  2. Play around with any of the (obviously not CLI) examples in the README.md:
    https://github.com/dashhive/dashsight.js
    (here are a few real Dash addresses and txids in there.
  3. At least one or two of these APIs here:
    https://github.com/dashhive/dashsight.js#api
  4. Also, the (not-yet-documented) websocket API, for which there is already a working example here:
    https://github.com/dashhive/dashsight.js/blob/browser/ws-listen.html
@coolaj86 coolaj86 added the documentation Improvements or additions to documentation label Sep 1, 2022
@jojobyte
Copy link
Contributor

jojobyte commented Sep 1, 2022

Worked on #10 Item 1 Vite

https://github.com/jojobyte/dashsight-vite-test

Currently blocked by error in @root/request/package.json, the fix below resolves it.

    "browser": {
-        "request.js": "browser.js"
+        "./request.js": "./browser.js"
    },

@wmerfalen
Copy link

I will take Webpack

@jojobyte
Copy link
Contributor

jojobyte commented Sep 1, 2022

I think its safe to remove ES Build and probably Rollup? Vite literally is built on top of both. So if vite is working they should be too...

1. Create a Hello World project (with its own public repo) with/for one or more of [the following bundlers](https://npmtrends.com/@swc/core-vs-esbuild-vs-rollup-vs-vite-vs-webpack):
   
   * [ ]  Webpack
   * [ ]   Vite
   * [ ]  ESBuild
   * [ ]  Rollup

@jojobyte
Copy link
Contributor

jojobyte commented Sep 2, 2022

With fix therootcompany/request.js#12 in package.json it gets to this error:

Uncaught (in promise) TypeError: Failed to execute 'text' on 'Response': body stream already read
    at browser.js:149:35
    at async request (browser.js:148:27)
    at async request (browser-request.js:17:14)
    at async Object.insight.getUtxos (insight.js:63:20)
    at async Object.insight.getInstantBalance (insight.js:38:17)

https://github.com/therootcompany/request.js/blob/8217ae1e89b4d703c6d51eb4a77771ae363b3127/browser.js#L148-L150

@coolaj86
Copy link
Member Author

coolaj86 commented Sep 2, 2022

it gets to this error

@jojobyte What "it"? What API call or request?

Obviously the request wasn't parseable JSON - so maybe there's an auth error or a URL needs updated.

Also, apparently the body can't be read as plain text if you've already tried to read it as JSON. Makes me think it may be best to always read it as text and then JSON.parse() as a separate step to avoid this issue...

@coolaj86
Copy link
Member Author

coolaj86 commented Sep 2, 2022

I think it's safe to remove ES Build and probably Rollup? Vite literally is built on top of both.

@jojobyte But most people aren't using Vite. More people use either of those than Vite, right?

So better to have a hello world repo demonstrating how they're used than to expect them to figure it out from however Vite composes its build system (the rollup config could be autogenerated in some code 6 layers deep for all I know).

@jojobyte
Copy link
Contributor

jojobyte commented Sep 2, 2022

it gets to this error

@jojobyte What "it"? What API call or request?

The vite project at https://github.com/jojobyte/dashsight-vite-test/blob/master/src/App.vue#L17-L19

Obviously the request wasn't parseable JSON - so maybe there's an auth error or a URL needs updated.

Also, apparently the body can't be read as plain text if you've already tried to read it as JSON. Makes me think it may be best to always read it as text and then JSON.parse() as a separate step to avoid this issue...

I was expecting the request to fail as I provided the string 'address' to getInstantBalance and not an actual address, however, I was not expecting the parse error.

@jojobyte
Copy link
Contributor

jojobyte commented Sep 3, 2022

I think it's safe to remove ES Build and probably Rollup? Vite literally is built on top of both.

@jojobyte But most people aren't using Vite. More people use either of those than Vite, right?

So better to have a hello world repo demonstrating how they're used than to expect them to figure it out from however Vite composes its build system (the rollup config could be autogenerated in some code 6 layers deep for all I know).

@coolaj86 you make an excellent point. Once that fix (pr therootcompany/request.js/pull/12) for package.json is merged, I think the other example implementations should go more smoothly.

The error in my comment (#10 (comment)) above appears to be specific for invalid addresses. It most certainly should be fixed, but isnt blocking things in the same way as package.json in the request repo.

@wmerfalen
Copy link

I don't have the websocket code yet. Will get to that tomorrow most likely.
https://github.com/wmerfalen/dash-bundler-webpack

@jojobyte
Copy link
Contributor

https://github.com/jojobyte/dashsight-vite-test

This should be testing the getTxs & getInstantBalance for DashSight API's and the DashSight WS Browser API, as well as the CrowdNode API once the PR's are merged.

#11
dashhive/crowdnode.js#39

@coolaj86
Copy link
Member Author

FYI: There's a possible hotfix needed for checking the instance balance:

  • /insight-api-dash/ => /insight-api/

@wmerfalen
Copy link

Here's my demo site:
https://fire.bnull.net/

I would like to claim this now

@jojobyte
Copy link
Contributor

jojobyte commented Oct 2, 2022

Demo Site for Vite:

https://dashsight-vite-example.netlify.app/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Status: No status
Development

No branches or pull requests

3 participants