@@ -51,17 +51,17 @@ fetch_wasm() {
5151 else
5252 echo " ==> Downloading contract WASM from release ${version} ..." >&2
5353 require_cmds gh tar
54- gh release download " $version " --repo near/mpc \
54+ run_cmd gh release download " $version " --repo near/mpc \
5555 --pattern " mpc-contract-v${version} .tar.gz" --dir " $dir " --clobber >&2
56- tar xzf " ${dir} /mpc-contract-v${version} .tar.gz" -C " $dir " >&2
56+ run_cmd tar xzf " ${dir} /mpc-contract-v${version} .tar.gz" -C " $dir " >&2
5757 [[ -f " $wasm " ]] || die " Expected ${wasm} after extracting the tarball."
5858 fi
5959 else
6060 require_cmds cargo git
6161 local root built
6262 root=$( git -C " $SCRIPT_DIR " rev-parse --show-toplevel)
6363 echo " ==> Building the contract from ${root} (local build — not a released artifact)..." >&2
64- ( cd " $root " && cargo near build non-reproducible-wasm --features abi \
64+ ( cd " $root " && run_cmd cargo near build non-reproducible-wasm --features abi \
6565 --profile=release-contract --manifest-path crates/contract/Cargo.toml --locked >&2 )
6666 built=$( find " ${root} /target/near" -maxdepth 1 -name ' *.wasm' -newermt ' -10 minutes' \
6767 | head -1)
@@ -97,19 +97,22 @@ WASM_SIZE=$(wc -c < "$WASM")
9797echo " ==> ${SERIALIZED} ready ($( wc -c < " $SERIALIZED " ) bytes)"
9898
9999PROPOSER=${MEMBER_ACCOUNTS%% * }
100+ PROPOSE_CMD=(near contract call-function as-transaction " $CONTRACT " propose_update
101+ file-args " $SERIALIZED " prepaid-gas ' 100.0 Tgas' attached-deposit " $PROPOSE_DEPOSIT "
102+ sign-as " $PROPOSER " network-config " $NEAR_NET " " $SIGN_WITH " send)
103+
100104echo
101105echo " About to propose the ${VERSION} contract on ${CONTRACT} (${NEAR_NET} )"
102106echo " proposer: ${PROPOSER} , deposit ${PROPOSE_DEPOSIT} "
107+ show_cmd " ${PROPOSE_CMD[@]} "
103108confirm " Send propose_update?" || { echo " Aborted before proposing." ; exit 0; }
104109
105- near contract call-function as-transaction " $CONTRACT " propose_update \
106- file-args " $SERIALIZED " prepaid-gas ' 100.0 Tgas' attached-deposit " $PROPOSE_DEPOSIT " \
107- sign-as " $PROPOSER " network-config " $NEAR_NET " " $SIGN_WITH " send \
110+ " ${PROPOSE_CMD[@]} " \
108111 || die " propose_update failed (an account low on NEAR is the usual cause — top it up)."
109112
110113echo
111114echo " ==> Pending proposals:"
112- near contract call-function as-read-only " $CONTRACT " proposed_updates \
115+ run_cmd near contract call-function as-read-only " $CONTRACT " proposed_updates \
113116 json-args ' {}' network-config " $NEAR_NET " now || true
114117
115118# near-cli's result formatting is not stable enough to parse an id out of, so
@@ -120,14 +123,15 @@ read -rp "UpdateId to vote on: " UPDATE_ID
120123# The vote that reaches threshold deploys + migrates inline, hence 300 Tgas.
121124for account in $MEMBER_ACCOUNTS ; do
122125 echo
126+ vote_cmd=(near contract call-function as-transaction " $CONTRACT " vote_update
127+ json-args " {\" id\" : ${UPDATE_ID} }" prepaid-gas ' 300.0 Tgas' attached-deposit ' 0 NEAR'
128+ sign-as " $account " network-config " $NEAR_NET " " $SIGN_WITH " send)
129+ show_cmd " ${vote_cmd[@]} "
123130 confirm " Vote for update ${UPDATE_ID} as ${account} ?" || { echo " skipped." ; continue ; }
124- near contract call-function as-transaction " $CONTRACT " vote_update \
125- json-args " {\" id\" : ${UPDATE_ID} }" prepaid-gas ' 300.0 Tgas' attached-deposit ' 0 NEAR' \
126- sign-as " $account " network-config " $NEAR_NET " " $SIGN_WITH " send \
127- || echo " vote failed for ${account} ."
131+ " ${vote_cmd[@]} " || echo " vote failed for ${account} ."
128132done
129133
130134echo
131135echo " ==> Contract version (expect ${VERSION} once threshold was reached):"
132- near contract call-function as-read-only " $CONTRACT " version \
136+ run_cmd near contract call-function as-read-only " $CONTRACT " version \
133137 json-args ' {}' network-config " $NEAR_NET " now || true
0 commit comments