Skip to content

Commit

Permalink
Show error when code upload fails
Browse files Browse the repository at this point in the history
  • Loading branch information
nenadalm committed Jul 12, 2023
1 parent b302534 commit 638a3aa
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,21 @@ function compile {
}

function upload_code {
local response
response="$(junod --chain-id uni-6 --node https://juno-testnet-rpc.polkachu.com:443 tx wasm store artifacts/juno_farm_hackathon_template.wasm --from "${ADMIN}" --gas-prices 0.075ujunox --gas auto --gas-adjustment 1.1 -o json -y)"

local code
code="$(echo "${response}" | jq -r '.code')"
if [[ "${code}" -ne 0 ]]; then
echo "[ERROR] Uploading code failed:" >&2
echo "${response}" >&2
return 1
fi

local tx_hash
tx_hash="$(junod --chain-id uni-6 --node https://juno-testnet-rpc.polkachu.com:443 tx wasm store artifacts/juno_farm_hackathon_template.wasm --from "${ADMIN}" --gas-prices 0.075ujunox --gas auto --gas-adjustment 1.1 -o json -y | jq '.txhash' -r)"
sleep 10
tx_hash="$(echo "${response}" | jq -r '.txhash')"

sleep 10
junod --chain-id uni-6 --node https://juno-testnet-rpc.polkachu.com:443 query tx "${tx_hash}" -o json | jq '.logs[0].events[] | select(.type=="store_code") | .attributes[] | select(.key=="code_id") | .value' -r
}

Expand Down

0 comments on commit 638a3aa

Please sign in to comment.