Skip to content
This repository was archived by the owner on Aug 19, 2024. It is now read-only.

Fix WASM build error when importing common package#1983

Merged
blukat29 merged 3 commits intoklaytn:devfrom
hackartists:fix/build-js-for-common
Oct 27, 2023
Merged

Fix WASM build error when importing common package#1983
blukat29 merged 3 commits intoklaytn:devfrom
hackartists:fix/build-js-for-common

Conversation

@hackartists
Copy link
Contributor

@hackartists hackartists commented Oct 2, 2023

JS building failure

Some packages fails when building js because no alternatives for js with the below command.

GOOS=js GOARCH=wasm go build

common package

  • IsTty function is not defined when building WASM with the below options
    • Enable js tag to the function using appengine tag.

crypto package

  • signature_cgo.go is excluded in js build.
    • signature_nocgo.go is ported from go-ethereum repo.

- `IsTty` function is not defined when building WASM with the below options

```
GOOS=js GOARCH=wasm go build
```
@CLAassistant
Copy link

CLAassistant commented Oct 2, 2023

CLA assistant check
All committers have signed the CLA.

- `signature_cgo.go` is excepted for js build.
- `signature_nocgo.go` which is derived from `go-ethereum` is ported.
aidan-kwon
aidan-kwon previously approved these changes Oct 3, 2023
Copy link
Member

@aidan-kwon aidan-kwon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long time no see @hackartists :) Thank you for your contribution.
Your request doesn't seem to be harmful to existing code. As you probably know, however, Klaytn has not been tested much in the WASM environment. If you need something more for your project, please share and ask us what you need.

@hackartists
Copy link
Contributor Author

Long time no see @hackartists :) Thank you for your contribution. Your request doesn't seem to be harmful to existing code. As you probably know, however, Klaytn has not been tested much in the WASM environment. If you need something more for your project, please share and ask us what you need.

Yes, I know. Currently, I am developing and managing Incheon Universe homepage(incheon.world) which is developed by Flutter backed by Golang WASM.
And, crypto and common package is the most popular package for execution of transactions.

In fact, abi/bind and client package also are not supported on WASM.

  • abi/bind imports sys/unix package.
  • client seems to use fasthttp which does not support WASM. In fact, net/http package in lower version of Go than 1.21 has some blocking issue on WASM.
    However, these fixes may have a huge impact on the whole code. so I excluded them.

Consequently, @aidan-kwon I aims to provide users with simple browser wallet instead of blockchain wallet. So I need belows.

  • Go SDK for improving performance of browser wallet.
    • It is almost done in my side.
  • I want to import private key to blockchain wallet such like Kaikas and Metamask programmatically.
    • But, unfortunately, Kaikas is not an open source. So I'd like to find a way for us to work together.
  • Next, I also hope that users can setup Kaikas wallet from the seed of browser wallet.
    • It means that it makes the setup of Kaikas very easy.

@aidan-kwon
Copy link
Member

@hackartists I think we need more discussion. I will contact you through another channel soon.

@hyunsooda
Copy link
Contributor

Hi @hackartists,

Instead of modifying terminal_appengine.go, it would be more suitable to include the following build condition in log/test_util.go.

//go:build !js
// +build !js

@blukat29 blukat29 merged commit 4e38d57 into klaytn:dev Oct 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants