forked from Haroldwonder/SwiftRemit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
63 lines (53 loc) · 1.72 KB
/
setup.sh
File metadata and controls
63 lines (53 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# SwiftRemit Setup Script
# This script installs all prerequisites and builds the contract
set -e
echo "🚀 SwiftRemit Setup Script"
echo "=========================="
echo ""
# Check if Rust is installed
if ! command -v rustc &> /dev/null; then
echo "❌ Rust is not installed"
echo "📦 Installing Rust..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
echo "✅ Rust installed successfully"
else
echo "✅ Rust is already installed ($(rustc --version))"
fi
# Add wasm32 target
echo ""
echo "📦 Adding wasm32-unknown-unknown target..."
rustup target add wasm32-unknown-unknown
echo "✅ wasm32 target added"
# Check if Soroban CLI is installed
echo ""
if ! command -v soroban &> /dev/null; then
echo "📦 Installing Soroban CLI..."
cargo install --locked soroban-cli --features opt
echo "✅ Soroban CLI installed successfully"
else
echo "✅ Soroban CLI is already installed ($(soroban --version))"
fi
# Configure testnet
echo ""
echo "🌐 Configuring Stellar testnet..."
soroban network add --global testnet \
--rpc-url https://soroban-testnet.stellar.org:443 \
--network-passphrase "Test SDF Network ; September 2015" 2>/dev/null || echo "Testnet already configured"
echo "✅ Testnet configured"
# Build the contract
echo ""
echo "🔨 Building contract..."
cargo build --target wasm32-unknown-unknown --release
# Optimize the contract
echo ""
echo "⚡ Optimizing contract..."
soroban contract optimize --wasm target/wasm32-unknown-unknown/release/swiftremit.wasm
echo ""
echo "✅ Setup complete!"
echo ""
echo "📝 Next steps:"
echo "1. Run tests: cargo test"
echo "2. Deploy to testnet: See DEPLOYMENT.md for instructions"
echo ""