Skip to content

Make it run on browser by using gRPC-web-text #28

Description

@totiz

I see that there's a lot of use case if we make this libra-core works directly on browser, and developer can use the same syntax as libra-core provided right now, so I make https://github.com/kulapio/libra-core that forked from this project and make it works on gRPC-web that some codes derived from https://github.com/bandprotocol/libra-web/ as well.

We make some changes for example.

  1. use grp-web, js-sha3 package.
  2. generate grpc-web protob for JS/TS with this script.
# Generate JavaScript/TypeScript for gRPC-web
protoc \
  --grpc-web_out=import_style=commonjs+dts,mode=grpcwebtext:$GEN_OUT_DIR \
  -I=${PROTO_IMPORT_DIR} \
  ${FILE_PATHS} \
  1. the libra client init with this.
const client = new LibraClient({
    transferProtocol: 'https',
    host: 'ac-libra-testnet.kulap.io',
    port: '443',
    dataProtocol: 'grpc-web-text'
  })
  1. perhaps if we init client directly to ac.testnet.libra.org we can use this config (WIP).
const client = new LibraClient({
    transferProtocol: 'socket',
    host: 'ac.testnet.libra.org',
    port: '80',
    dataProtocol: 'grpc'
  })
// or just default
const client = new LibraClient({ network: LibraNetwork.Testnet });

What do you think for kind of this changes? that I can do a PR for this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions