local req='"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"closeGame", "payload":{"gameId": "'"${gameId}"'","secret":"'"${secret}"'","result":1}}]'
local req='"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"closeGame", "payload":{"gameId": "'"${gameId}"'","secret":"'"${secret}"'","result":1}}]'
echo"#request: $req"
echo"#request: $req"
resp=$(curl -ksd"{$req}""${MAIN_HTTP}")
resp=$(curl -ksd"{$req}""${MAIN_HTTP}")
echo"#response: $resp"
echo"#response: $resp"
rawTx=$(echo"${resp}" | jq -r".result")
rawTx=$(echo"${resp}" | jq -r".result")
if["$rawTx"=="null"];then
if["$rawTx"=="null"];then
echo_rst "CloseGame createRawTx" 1
echo_rst "CloseGame createRawTx" 1
fi
fi
signRawTx "${rawTx}""${ACCOUNT_A}"
signRawTx "${rawTx}""${ACCOUNT_A}"
echo_rst "CloseGame signRawTx""$?"
echo_rst "CloseGame signRawTx""$?"
sendSignedTx
sendSignedTx
echo_rst "CloseGame sendSignedTx""$?"
echo_rst "CloseGame sendSignedTx""$?"
close_txHash="${txHash}"
close_txHash="${txHash}"
query_tx "${txHash}"
query_tx "${txHash}"
echo_rst "CloseGame query_tx""$?"
echo_rst "CloseGame query_tx""$?"
}
}
function CancleGameTx(){
function CancleGameTx(){
local gameId=$1
local gameId=$1
local req='"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"cancelGame", "payload":{"gameId": "'"${gameId}"'"}}]'
local req='"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"cancelGame", "payload":{"gameId": "'"${gameId}"'"}}]'
echo"#request: $req"
echo"#request: $req"
resp=$(curl -ksd"{$req}""${MAIN_HTTP}")
resp=$(curl -ksd"{$req}""${MAIN_HTTP}")
echo"#response: $resp"
echo"#response: $resp"
rawTx=$(echo"${resp}" | jq -r".result")
rawTx=$(echo"${resp}" | jq -r".result")
if["$rawTx"=="null"];then
if["$rawTx"=="null"];then
echo_rst "CancleGame createRawTx" 1
echo_rst "CancleGame createRawTx" 1
fi
fi
signRawTx "${rawTx}""${ACCOUNT_A}"
signRawTx "${rawTx}""${ACCOUNT_A}"
echo_rst "CancleGame signRawTx""$?"
echo_rst "CancleGame signRawTx""$?"
sendSignedTx
sendSignedTx
echo_rst "CancleGame sendSignedTx""$?"
echo_rst "CancleGame sendSignedTx""$?"
close_txHash="${txHash}"
close_txHash="${txHash}"
query_tx "${txHash}"
query_tx "${txHash}"
echo_rst "CancleGame query_tx""$?"
echo_rst "CancleGame query_tx""$?"
}
}
function QueryGameByStatus(){
function QueryGameByStatus(){
local status=$1
local status=$1
local req='"method":"Chain33.Query","params":[{"execer":"'"${EXECTOR}"'","funcName":"QueryGameListByStatusAndAddr","payload":{"status":"${status}","address":""}}]'
local req='"method":"Chain33.Query","params":[{"execer":"'"${EXECTOR}"'","funcName":"QueryGameListByStatusAndAddr","payload":{"status":"${status}","address":""}}]'
echo"#request: $req"
echo"#request: $req"
resp=$(curl -ksd"{$req}""${MAIN_HTTP}")
resp=$(curl -ksd"{$req}""${MAIN_HTTP}")
echo"#response: $resp"
echo"#response: $resp"
GAMES=$(echo"${resp}" | jq -r".result.games")
GAMES=$(echo"${resp}" | jq -r".result.games")
echo"${GAMES}"
echo"${GAMES}"
echo_rst "$FUNCNAME""$?"
echo_rst "$FUNCNAME""$?"
}
}
function QueryGameByGameId(){
function QueryGameByGameId(){
local gameId=$1
local gameId=$1
local status=$2
local status=$2
local req='"method":"Chain33.Query","params":[{"execer":"'"${EXECTOR}"'","funcName":"QueryGameById","payload":{"gameId":"'"${gameId}"'"}}]'
local req='"method":"Chain33.Query","params":[{"execer":"'"${EXECTOR}"'","funcName":"QueryGameById","payload":{"gameId":"'"${gameId}"'"}}]'