From 20fa6a0bbdda928adf2177fed470fed0032b6764 Mon Sep 17 00:00:00 2001
From: Matthew Fosse <matt@fosse.co>
Date: Thu, 5 Sep 2024 13:32:06 -0700
Subject: [PATCH] updates [skip ci]

---
 .github/workflows/pr_test_build_android.yml   |  4 +--
 .github/workflows/pr_test_build_linux.yml     | 26 +++++++++++++++++++
 .../com/cakewallet/mweb/CwMwebPlugin.kt       |  2 +-
 scripts/android/build_mwebd.sh                |  1 +
 scripts/ios/build_mwebd.sh                    |  1 +
 5 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/pr_test_build_android.yml b/.github/workflows/pr_test_build_android.yml
index 904802f26..0ff5ef367 100644
--- a/.github/workflows/pr_test_build_android.yml
+++ b/.github/workflows/pr_test_build_android.yml
@@ -112,7 +112,7 @@ jobs:
           # build mwebd:
           cd /opt/android/cake_wallet
           git clone https://github.com/ltcmweb/mwebd
-          git reset --hard 49c42597ce5036fe1065200c3c056d0aba5f1a58
+          git reset --hard 7f31c84eeb2e954f2c5f385b39db3b8e3b6389e3
           cd /opt/android/cake_wallet/mwebd
           gomobile bind -target=android -androidapi 21 .
           mkdir -p /opt/android/cake_wallet/cw_mweb/android/libs/
@@ -120,8 +120,6 @@ jobs:
           cd ..
           rm -rf mwebd
 
-
-
       - name: Generate KeyStore
         run: |
           cd /opt/android/cake_wallet/android/app
diff --git a/.github/workflows/pr_test_build_linux.yml b/.github/workflows/pr_test_build_linux.yml
index 7935dd177..e425cffbc 100644
--- a/.github/workflows/pr_test_build_linux.yml
+++ b/.github/workflows/pr_test_build_linux.yml
@@ -89,6 +89,32 @@ jobs:
           cd /opt/android/cake_wallet
           flutter pub get
 
+      - name: Install go and gomobile
+        run: |
+          # install go > 1.21:
+          wget https://go.dev/dl/go1.22.4.linux-amd64.tar.gz
+          sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.22.4.linux-amd64.tar.gz
+          export PATH=$PATH:/usr/local/go/bin
+          export PATH=$PATH:~/go/bin
+          go install golang.org/x/mobile/cmd/gomobile@latest
+          gomobile init
+
+      - name: Build mwebd
+        run: |
+          # paths are reset after each step, so we need to set them again:
+          export PATH=$PATH:/usr/local/go/bin
+          export PATH=$PATH:~/go/bin
+          # build mwebd:
+          cd /opt/android/cake_wallet
+          git clone https://github.com/ltcmweb/mwebd
+          git reset --hard 7f31c84eeb2e954f2c5f385b39db3b8e3b6389e3
+          cd /opt/android/cake_wallet/mwebd
+          gomobile bind -target=android -androidapi 21 .
+          mkdir -p /opt/android/cake_wallet/cw_mweb/android/libs/
+          mv ./mwebd.aar $_
+          cd ..
+          rm -rf mwebd
+
       - name: Generate localization
         run: |
           cd /opt/android/cake_wallet
diff --git a/cw_mweb/android/src/main/kotlin/com/cakewallet/mweb/CwMwebPlugin.kt b/cw_mweb/android/src/main/kotlin/com/cakewallet/mweb/CwMwebPlugin.kt
index 47f6362e6..396bce589 100644
--- a/cw_mweb/android/src/main/kotlin/com/cakewallet/mweb/CwMwebPlugin.kt
+++ b/cw_mweb/android/src/main/kotlin/com/cakewallet/mweb/CwMwebPlugin.kt
@@ -42,7 +42,7 @@ class CwMwebPlugin: FlutterPlugin, MethodCallHandler {
       val scanSecret: ByteArray = call.argument<ByteArray>("scanSecret") ?: ByteArray(0)
       val spendPub: ByteArray = call.argument<ByteArray>("spendPub") ?: ByteArray(0)
       val index: Int = call.argument<Int>("index") ?: 0
-      val res = Mwebd.addressIndex(scanSecret, spendPub, index.toLong())
+      val res = Mwebd.addressIndex(scanSecret, spendPub, index)
       result.success(res)
     } else {
       result.notImplemented()
diff --git a/scripts/android/build_mwebd.sh b/scripts/android/build_mwebd.sh
index d3a3bf091..269e58d8c 100755
--- a/scripts/android/build_mwebd.sh
+++ b/scripts/android/build_mwebd.sh
@@ -8,6 +8,7 @@ gomobile init
 # build mwebd:
 git clone https://github.com/ltcmweb/mwebd
 cd mwebd
+git reset --hard 7f31c84eeb2e954f2c5f385b39db3b8e3b6389e3
 gomobile bind -target=android -androidapi 21 .
 mkdir -p ../../../cw_mweb/android/libs/
 mv ./mwebd.aar $_
diff --git a/scripts/ios/build_mwebd.sh b/scripts/ios/build_mwebd.sh
index 08dbd7cd0..ae1726f23 100755
--- a/scripts/ios/build_mwebd.sh
+++ b/scripts/ios/build_mwebd.sh
@@ -7,6 +7,7 @@ gomobile init
 # build mwebd:
 git clone https://github.com/ltcmweb/mwebd
 cd mwebd
+git reset --hard 7f31c84eeb2e954f2c5f385b39db3b8e3b6389e3
 gomobile bind -target=ios .
 mv -fn ./Mwebd.xcframework ../../../ios/
 # cleanup: