-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·72 lines (60 loc) · 1.64 KB
/
run.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
echo "Running caddy"
caddy=$(lsof -t -i:8555)
if [ -z "$caddy" ]; then
echo "caddy not running"
sudo caddy start
else
echo "caddy already running"
fi
echo "Setting up containers"
dfx stop
# Find process IDs listening on port 4943 (dfx)
dfx=$(lsof -t -i:4943)
# Check if any PIDs were found
if [ -z "$dfx" ]; then
echo "dfx not running"
else
# Kill the processes
kill $dfx && echo "Terminating running dfx instance."
sleep 3
fi
echo "Running SIWE"
dfx start --clean --background
dfx canister create --all
dfx deploy evm_rpc
read -r -d '' SIWE_PROVIDER_ARGS << EOM
(
record {
domain = "127.0.0.1";
uri = "http://127.0.0.1:5173";
salt = "my-secret-salt";
chain_id = opt 1;
scheme = opt "http";
statement = opt "Login to the app";
sign_in_expires_in = opt 300000000000;
session_expires_in = opt 604800000000000;
targets = opt vec {
"$(dfx canister id ic_siwe_provider)";
"$(dfx canister id harmonize_backend)";
};
}
)
EOM
dfx deploy ic_siwe_provider --argument "${SIWE_PROVIDER_ARGS}"
current_dfx_user=$(dfx identity get-principal)
read -r -d '' HARMONIZE_ARGS << EOM
record {
environment = "local";
initial_owner = principal "${current_dfx_user}";
ecdsa_key_id = record {
name = "dfx_test_key";
curve = variant { secp256k1 };
};
networks = vec {};
}
EOM
dfx deploy --argument "${HARMONIZE_ARGS}" -m reinstall harmonize_backend
echo "Sleeping while canister is being initialized"
sleep 5
dfx canister call harmonize_backend get_ethereum_address | tr -d '()"' > harmonize-canister-address.txt