-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeclare.sh
executable file
·56 lines (47 loc) · 1.44 KB
/
declare.sh
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
#!/bin/bash
# Function to display help
display_help() {
echo "Usage: $0 [filename] [output_account_name] [output_keystore_name] [network]"
echo " filename (require): The filename for the StarkNet target"
echo " output_account_name (optional): Account file name. Default is 'account.json'."
echo " output_keystore_name (optional): Keystore file name. Default is 'keystore.json'."
echo " network (optional): The StarkNet network (mainnet|goerli-1|goerli-2). Default is 'goerli-1'."
}
# Check if --help is passed
if [[ "$1" == "--help" ]]; then
display_help
exit 0
fi
# Set default values
filename=""
network="goerli-1"
output="./starkli-wallets/deployer"
output_account_name="account.json"
output_keystore_name="keystore.json"
# Check if parameters are provided and update variables if needed
if [ $# -ge 1 ]; then
if [ -n "$1" ]; then
filename="$1"
else
echo "Error: Filename cannot be an empty string."
exit 1
fi
fi
# Check if filename is provided
if [ -z "$filename" ]; then
echo "Error: Filename not provided."
exit 1
fi
if [ $# -ge 2 ]; then
output_keystore_name=$2
fi
if [ $# -ge 3 ]; then
output_account_name=$3
fi
if [ $# -ge 4 ]; then
network=$4
fi
# Export the variables
export STARKNET_ACCOUNT="$output/$output_account_name"
export STARKNET_KEYSTORE="$output/$output_keystore_name"
starkli declare target/dev/"$filename" --compiler-version=2.1.0 --network="$network"