#!/bin/bash
#
# Rebuilds all WASM modules used for testing
#
#   Usage: bash scripts/utils/build_test_wasm_module.bash

set -ex

# This is a test index, keep its assets for now
cargo build -p fuel-indexer-test --release --target wasm32-unknown-unknown
bash scripts/stripper.bash fuel_indexer_test.wasm
cp fuel_indexer_test.wasm target/wasm32-unknown-unknown/release/
rm -fv fuel_indexer_test.wasm

# This is a test index, keep its assets for now
cargo build -p simple-wasm --release --target wasm32-unknown-unknown
bash scripts/stripper.bash simple_wasm.wasm
cp simple_wasm.wasm target/wasm32-unknown-unknown/release/
rm -fv simple_wasm.wasm

cargo build -p fuel_explorer --release --target wasm32-unknown-unknown
bash scripts/stripper.bash fuel_explorer.wasm
cp fuel_explorer.wasm target/wasm32-unknown-unknown/release/
rm -fv fuel_explorer.wasm

cargo build -p hello_world --release --target wasm32-unknown-unknown
bash scripts/stripper.bash hello_world.wasm
cp hello_world.wasm target/wasm32-unknown-unknown/release/
rm -fv hello_world.wasm

cargo build -p greetings_indexer --release --target wasm32-unknown-unknown
bash scripts/stripper.bash greetings_indexer.wasm
cp greetings_indexer.wasm target/wasm32-unknown-unknown/release/
rm -fv greetings_indexer.wasm

set +ex
