-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquickstart.sh
More file actions
executable file
·138 lines (119 loc) · 4.17 KB
/
quickstart.sh
File metadata and controls
executable file
·138 lines (119 loc) · 4.17 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/bin/bash
# Quick Start Script for Move-to-Cairo Transpiler
# This script helps developers quickly test the transpiler
set -e
YELLOW='\033[1;33m'
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${GREEN}================================================${NC}"
echo -e "${GREEN} Move-to-Cairo Transpiler Quick Start${NC}"
echo -e "${GREEN}================================================${NC}"
echo ""
# Function to print colored output
print_step() {
echo -e "${YELLOW}► $1${NC}"
}
print_success() {
echo -e "${GREEN}✓ $1${NC}"
}
print_error() {
echo -e "${RED}✗ $1${NC}"
}
# Check prerequisites
print_step "Checking prerequisites..."
if ! command -v cargo &> /dev/null; then
print_error "Rust is not installed"
echo "Please install Rust from https://rustup.rs/"
exit 1
fi
print_success "Rust is installed"
# Build the project
print_step "Building the transpiler..."
if cargo build --release --quiet 2>/dev/null; then
print_success "Build successful"
else
print_error "Build failed"
echo "Running verbose build to see errors:"
cargo build --release
exit 1
fi
# Create demo directory
DEMO_DIR="demo_output"
print_step "Creating demo directory: $DEMO_DIR"
mkdir -p $DEMO_DIR
print_success "Demo directory created"
# Test transpilation with examples
print_step "Testing transpilation with example contracts..."
echo ""
# Array of example files to test
examples=(
"simple_object.move"
"shared_counter.move"
"nft_collection.move"
)
for example in "${examples[@]}"; do
if [ -f "examples/$example" ]; then
echo -e " Transpiling ${YELLOW}$example${NC}..."
# Run transpiler
if ./target/release/move2cairo transpile "examples/$example" -o "$DEMO_DIR/${example%.move}.cairo" 2>/dev/null; then
print_success " Successfully transpiled $example"
# Show snippet of output
echo " Output preview:"
head -n 10 "$DEMO_DIR/${example%.move}.cairo" | sed 's/^/ /'
echo " ..."
echo ""
else
print_error " Failed to transpile $example"
fi
else
print_error " Example file not found: examples/$example"
fi
done
# Generate runtime library
print_step "Generating runtime library..."
if ./target/release/move2cairo runtime -o "$DEMO_DIR/runtime.cairo" 2>/dev/null; then
print_success "Runtime library generated"
else
print_error "Failed to generate runtime library"
fi
# Create a new contract from template
print_step "Creating new contract from template..."
CONTRACT_NAME="MyToken"
if ./target/release/move2cairo new "$CONTRACT_NAME" -o "$DEMO_DIR" 2>/dev/null; then
print_success "Contract template created: $DEMO_DIR/$CONTRACT_NAME"
else
print_error "Failed to create contract template"
fi
echo ""
echo -e "${GREEN}================================================${NC}"
echo -e "${GREEN} Quick Start Complete!${NC}"
echo -e "${GREEN}================================================${NC}"
echo ""
echo "📁 Output files are in: $DEMO_DIR/"
echo ""
echo "📚 Next steps:"
echo " 1. Review generated Cairo contracts in $DEMO_DIR/"
echo " 2. Install Scarb for Cairo compilation:"
echo " curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh"
echo " 3. Test compilation of generated Cairo code:"
echo " cd $DEMO_DIR && scarb build"
echo " 4. Read the documentation:"
echo " cat README.md"
echo ""
echo "🛠️ Available commands:"
echo " ./target/release/move2cairo --help # Show all commands"
echo " ./target/release/move2cairo transpile <file> # Transpile a Move file"
echo " ./target/release/move2cairo runtime # Generate runtime library"
echo " ./target/release/move2cairo new <name> # Create new contract"
echo ""
echo "📖 Documentation:"
echo " README.md - User guide"
echo " CONTRIBUTING.md - Contribution guide"
echo " IMPLEMENTATION_REVIEW.md - Technical details"
echo " ROADMAP.md - Development roadmap"
echo ""
echo "🐛 Found an issue? Report it at:"
echo " https://github.com/foundation3dao/move-to-cairo/issues"
echo ""
print_success "Happy transpiling! 🚀"