Don't compute a nonce when creating arbitrary transactions. Instead this can be done by calling POST /arbitrary/compute, or more ideally by the client, such as the UI.

This commit is contained in:
CalDescent
2021-12-03 17:33:07 +00:00
parent d6746362a4
commit f87df53791
2 changed files with 82 additions and 2 deletions

View File

@@ -78,8 +78,14 @@ if [[ "${method}" == "POST" ]]; then
echo "Error: no transaction data returned"; exit
fi
echo "Computing nonce..."
computed_tx_data=$(curl --silent --insecure -X POST "http://${host}:${port}/arbitrary/compute" -H "Content-Type: application/json" -d "${tx_data}")
if [[ "${computed_tx_data}" == *"error"* || "${computed_tx_data}" == *"ERROR"* ]]; then
echo "${computed_tx_data}"; exit
fi
echo "Signing..."
signed_tx_data=$(curl --silent --insecure -X POST "http://${host}:${port}/transactions/sign" -H "Content-Type: application/json" -d "{\"privateKey\":\"${QORTAL_PRIVKEY}\",\"transactionBytes\":\"${tx_data}\"}")
signed_tx_data=$(curl --silent --insecure -X POST "http://${host}:${port}/transactions/sign" -H "Content-Type: application/json" -d "{\"privateKey\":\"${QORTAL_PRIVKEY}\",\"transactionBytes\":\"${computed_tx_data}\"}")
if [[ "${signed_tx_data}" == *"error"* || "${signed_tx_data}" == *"ERROR"* ]]; then
echo "${signed_tx_data}"; exit
fi