Giter VIP home page Giter VIP logo

ergo-sdk-js's People

Contributors

deniskv avatar jenkijo avatar oskin1 avatar ridel1e avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ergo-sdk-js's Issues

Fix issue of using the package as an ESM module

If we try to use this package as an ESM module in Node (without any build tool), we get errors like this:

SyntaxError: Named export 'Explorer' not found. The requested module '@ergolabs/ergo-sdk' is a CommonJS module, which may not support all module.exports as named exports.

This happens because the type or exports field is missing in package.json. Currently used module field in package.json is neither supported, nor the support is planned in Node. It was a proposal which was introduced by some bundlers like esbuild, but Node introduced a more powerful exports field.

Note that if this package is meant to be used only as an ESM module, adding a "type": "module" will suffice.

Better type for `Registers`

It seems that Registers type is not narrow enough:

export type Registers = {[key: string]: HexString}

The user may provide any string value as key, which is not correct.

It can be fixed easily with a mapped type:

- export type Registers = {[key: string]: HexString} 
+ export type Registers = {[Key in RegisterId]: HexString} 

Better type for `Registers`

It seems that Registers type is not narrow enough:

export type Registers = {[key: string]: HexString}

The user may provide any string value as key, which is not correct.

It can be fixed easily with a mapped type:

- export type Registers = {[key: string]: HexString} 
+ export type Registers = {[Key in RegisterId]: HexString} 

Update Readme to mention workaround needed for CRA and wasm.

I initially gave his a try by throwing together a quick create-react-app and adding the ergo-sdk-js dependency, without realising there is a workaround required for using web assembly with create-react-app.

It took me a while to work out why, I found the answer by looking at the readme of the ergo-lib-wasm-browser readme.

It would be good to add the same comment about the required workaround to this repositories readme. What do you think?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.