From b4153daac96445a5e9e4b43790f94df585751737 Mon Sep 17 00:00:00 2001
From: Jono Wenger <jono@elixxir.io>
Date: Wed, 17 Aug 2022 11:20:24 -0700
Subject: [PATCH] Fix wasm_exec.js and update README

---
 README.md                | 7 +++++--
 main.go                  | 4 +++-
 test/assets/wasm_exec.js | 2 +-
 test/server/main.go      | 2 +-
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index 56c5fce1..84a3e484 100644
--- a/README.md
+++ b/README.md
@@ -38,9 +38,12 @@ directory. Then run the server
 
 ```shell
 $ GOOS=js GOARCH=wasm go build -o test/assets/xxdk.wasm
-$ go run test/server/main.go
+$ cd test/server/
+$ go run main.go
 ```
 
+Navigate to http://localhost:9090 to see the web page.
+
 ## `wasm_exec.js`
 
 `wasm_exec.js` is provided by Go and is used to import the WebAssembly module in
@@ -62,7 +65,7 @@ global.Go = class {
             go: {
                 // ...
                 // func Throw(exception string, message string)
-                'gitlab.com/elixxir/client/wasm.Throw': (sp) => {
+                'gitlab.com/elixxir/xxdk-wasm/wasm.Throw': (sp) => {
                     const exception = loadString(sp + 8)
                     const message = loadString(sp + 24)
                     throw globalThis[exception](message)
diff --git a/main.go b/main.go
index ccbe089a..9f337d87 100644
--- a/main.go
+++ b/main.go
@@ -11,13 +11,15 @@ package main
 
 import (
 	"fmt"
+	"gitlab.com/elixxir/client/bindings"
 	"gitlab.com/elixxir/xxdk-wasm/wasm"
 	"os"
 	"syscall/js"
 )
 
 func main() {
-	fmt.Println("Go Web Assembly")
+	fmt.Println("Starting xxDK WebAssembly bindings.")
+	fmt.Printf("Client version %s\n", bindings.GetVersion())
 
 	// wasm/backup.go
 	js.Global().Set("NewCmixFromBackup", js.FuncOf(wasm.NewCmixFromBackup))
diff --git a/test/assets/wasm_exec.js b/test/assets/wasm_exec.js
index d723701f..b3783862 100644
--- a/test/assets/wasm_exec.js
+++ b/test/assets/wasm_exec.js
@@ -503,7 +503,7 @@
 					},
 
 					// func Throw(exception string, message string)
-					'gitlab.com/elixxir/client/wasm.Throw': (sp) => {
+					'gitlab.com/elixxir/xxdk-wasm/wasm.Throw': (sp) => {
 						const exception = loadString(sp + 8)
 						const message = loadString(sp + 24)
 						throw globalThis[exception](message)
diff --git a/test/server/main.go b/test/server/main.go
index d1f9722b..510ea0fe 100644
--- a/test/server/main.go
+++ b/test/server/main.go
@@ -7,7 +7,7 @@ import (
 
 func main() {
 	port := "9090"
-	root := "test/assets"
+	root := "../assets"
 	fmt.Printf("Starting server on port %s from %s\n", port, root)
 
 	err := http.ListenAndServe(":"+port, http.FileServer(http.Dir(root)))
-- 
GitLab