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