-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.sh
executable file
·54 lines (43 loc) · 1.51 KB
/
deploy.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
#!/usr/bin/env bash
# Source:
# https://raw.githubusercontent.com/stableswap/stable-swap-program/master/scripts/deploy-stable-swap.sh
set -ex
if [ ! -d "./target/deploy" ]; then
./do.sh build
fi
solana_version="1.5.1"
if [[ $2 == "nobuild" ]]; then
echo "Note: Skipping build ------------------------------------------------------------"
else
cargo build-bpf
fi
if ! hash solana 2>/dev/null; then
echo Installing Solana tool suite ...
sh -c "$(curl -sSfL https://release.solana.com/v${solana_version}/install)"
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
fi
keypair="$HOME"/.config/solana/id.json
if [ ! -f "$keypair" ]; then
echo Generating keypair ...
solana-keygen new -o "$keypair" --no-passphrase --silent
fi
CLUSTER_URL=""
if [[ $1 == "localnet" ]]; then
CLUSTER_URL="http://localhost:8899"
elif [[ $1 == "devnet" ]]; then
CLUSTER_URL="https://api.devnet.solana.com"
elif [[ $1 == "testnet" ]]; then
CLUSTER_URL="https://api.testnet.solana.com"
else
echo "Unsupported network: $1"
exit 1
fi
solana config set --url $CLUSTER_URL
sleep 1
# solana airdrop 10
#
VAULT_ID="$(solana program deploy target/deploy/vault.so --output json --program-id 9VxcdZKmmL6xwJWZorYnD29tZte5M29XAiKv3ZEW2AJd| jq .programId -r)"
echo "Cove ProgramID:" $VAULT_ID
echo "Expected: 9VxcdZKmmL6xwJWZorYnD29tZte5M29XAiKv3ZEW2AJd"
jq -n --arg CLUSTER_URL ${CLUSTER_URL} --arg VAULT_ID ${VAULT_ID} \
'{clusterUrl: $CLUSTER_URL, "vaultProgramId": $VAULT_ID}' > last-deploy.json