Commit 2555a509 authored by yingqiumin@126.com's avatar yingqiumin@126.com

improve rpc test

parent 344c2dee
......@@ -3,8 +3,7 @@
RAW_TX_HASH=""
LAST_BLOCK_HASH=""
CASE_ERR=""
HTTP_RESP=""
RAW_RESP=""
RETURN_RESP=""
#color
RED='\033[1;31m'
......@@ -27,21 +26,21 @@ echo_rst() {
http_req() {
# echo "request="$1" MAIN_HTTP="$2" js="$3" FUNCNAME="$4" response="$5""
# echo "#$4 request: $1"
HTTP_RESP=$(curl -ksd "$1" "$2")
RAW_RESP=$(jq -r "$5" <<<"$HTTP_RESP")
# echo "#response: $HTTP_RESP" "$RAW_RESP"
ok=$(echo "$HTTP_RESP" | jq -r "$3")
local body=$(curl -ksd "$1" "$2")
RETURN_RESP=$(jq -r "$5" <<<"$body")
echo "#response: $body" "$RETURN_RESP"
ok=$(echo "$body" | jq -r "$3")
[ "$ok" == true ]
rst=$?
echo_rst "$4" "$rst" "$HTTP_RESP"
echo_rst "$4" "$rst" "$body"
}
chain33_DecodeRawTransactionTx() {
# txHex="$1" priKey="$2" MAIN_HTTP="$3" FUNCNAME="$4"
req='{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$1"'"}]}'
http_req "$req" $3 '(.result.txs[0].execer != "")' "$4"
chain33_SignRawTx "$1" "$2" $3
chain33_BlockWait 1 $3
http_req "$req" "$3" '(.result.txs[0].execer != "")' "$4"
chain33_SignRawTx "$1" "$2" "$3"
chain33_BlockWait 1 "$3"
}
chain33_BlockWait() {
......
......@@ -33,7 +33,7 @@ chain33_NewAccount() {
label=$1
req='{"method":"Chain33.NewAccount","params":[{"label":"'"$label"'"}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result.acc.addr|length > 0)' "$FUNCNAME" ".result.acc.addr"
glAddr=$RAW_RESP
glAddr=$RETURN_RESP
}
chain33_SendTransaction() {
......@@ -42,14 +42,14 @@ chain33_SendTransaction() {
#签名交易
req='{"method":"Chain33.SignRawTx","params":[{"addr":"'"$addr"'","txHex":"'"$rawTx"'","expire":"120s","fee":10000000,"index":0}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not)' "Chain33.SignRawTx" ".result"
signTx=$RAW_RESP
signTx=$RETURN_RESP
req='{"method":"Chain33.SendTransaction","params":[{"data":"'"$signTx"'"}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not)' "$FUNCNAME" ".result"
gResp=$RAW_RESP
gResp=$RETURN_RESP
#返回交易
chain33_QueryTx "$RAW_RESP" "${MAIN_HTTP}"
chain33_QueryTx "$RETURN_RESP" "${MAIN_HTTP}"
}
blackwhite_BlackwhiteCreateTx() {
......@@ -58,7 +58,7 @@ blackwhite_BlackwhiteCreateTx() {
req='{"method":"blackwhite.BlackwhiteCreateTx","params":[{"PlayAmount":100000000,"PlayerCount":3,"GameName":"hello","Timeout":600,"Fee":1000000}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not)' "$FUNCNAME" ".result"
#发送交易
chain33_SendTransaction "$RAW_RESP" "${addr}"
chain33_SendTransaction "$RETURN_RESP" "${addr}"
gID="${gResp}"
}
......@@ -71,7 +71,7 @@ blackwhite_BlackwhitePlayTx() {
http_req "$req" ${MAIN_HTTP} '(.error|not)' "$FUNCNAME" ".result"
#发送交易
chain33_SendTransaction "$RAW_RESP" "${addr}"
chain33_SendTransaction "$RETURN_RESP" "${addr}"
}
blackwhite_BlackwhiteShowTx() {
......@@ -79,7 +79,7 @@ blackwhite_BlackwhiteShowTx() {
sec=$2
req='{"method":"blackwhite.BlackwhiteShowTx","params":[{"gameID":"'"$gID"'","secret":"'"$sec"'","Fee":1000000}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not)' "$FUNCNAME" ".result"
chain33_SendTransaction "$RAW_RESP" "${addr}"
chain33_SendTransaction "$RETURN_RESP" "${addr}"
}
blackwhite_BlackwhiteTimeoutDoneTx() {
......
......@@ -19,8 +19,7 @@ source ../dapp-test-common.sh
function chain33_GetExecAddr() {
#获取GAME合约地址
req='{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"'"$1"'"}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
GAME_ADDR=$RAW_RESP
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result != null)' "$FUNCNAME"
}
function CreateGameTx() {
......@@ -28,7 +27,7 @@ function CreateGameTx() {
local hash_value=$2
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"createGame", "payload":{"amount": '"${amount}"',"hashType":"sha256","hashValue":"'"${hash_value}"'"}}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignRawTx "${RAW_RESP}" "${PRIVA_A}" "${MAIN_HTTP}"
chain33_SignRawTx "${RETURN_RESP}" "${PRIVA_A}" "${MAIN_HTTP}"
GAME_ID=$RAW_TX_HASH
echo_rst "CreateGame query_tx" "$?"
......@@ -38,7 +37,7 @@ function MatchGameTx() {
local gameId=$1
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"matchGame", "payload":{"gameId": "'"${gameId}"'","guess":2}}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result != null)' "MatchGame createRawTx" ".result"
chain33_SignRawTx "${RAW_RESP}" "${PRIVA_B}" "${MAIN_HTTP}"
chain33_SignRawTx "${RETURN_RESP}" "${PRIVA_B}" "${MAIN_HTTP}"
echo_rst "MatchGame query_tx" "$?"
}
......@@ -48,7 +47,7 @@ function CloseGameTx() {
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"closeGame", "payload":{"gameId": "'"${gameId}"'","secret":"'"${secret}"'","result":1}}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result != null)' "CloseGame createRawTx" ".result"
chain33_SignRawTx "${RAW_RESP}" "${PRIVA_A}" "${MAIN_HTTP}"
chain33_SignRawTx "${RETURN_RESP}" "${PRIVA_A}" "${MAIN_HTTP}"
echo_rst "CloseGame query_tx" "$?"
}
......@@ -57,7 +56,7 @@ function CancleGameTx() {
local req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'"${EXECTOR}"'", "actionName":"cancelGame", "payload":{"gameId": "'"${gameId}"'"}}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result != null)' "CancleGame createRawTx" ".result"
chain33_SignRawTx "${RAW_RESP}" "${PRIVA_A}" "${MAIN_HTTP}"
chain33_SignRawTx "${RETURN_RESP}" "${PRIVA_A}" "${MAIN_HTTP}"
echo_rst "CancleGame query_tx" "$?"
}
......
......@@ -43,21 +43,21 @@ function configJSCreator() {
req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'${manager_name}'","actionName":"Modify","payload":{"key":"js-creator","op":"add","value":"'${beneficiary}'"}}]}'
resok='(.error|not) and (.result != null)'
http_req "$req" ${MAIN_HTTP} "$resok" "$FUNCNAME" ".result"
chain33_SignRawTx "$RAW_RESP" "${super_manager}" "${MAIN_HTTP}"
chain33_SignRawTx "$RETURN_RESP" "${super_manager}" "${MAIN_HTTP}"
}
function createJSContract() {
req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'${exec_name}'","actionName":"Create","payload":{"name":"'${game}'","code":"'${jsCode}'"}}]}'
resok='(.error|not) and (.result != null)'
http_req "$req" ${MAIN_HTTP} "$resok" "$FUNCNAME" ".result"
chain33_SignRawTx "$RAW_RESP" "${beneficiary_key}" "${MAIN_HTTP}"
chain33_SignRawTx "$RETURN_RESP" "${beneficiary_key}" "${MAIN_HTTP}"
}
function callJS() {
req='{"method":"Chain33.CreateTransaction","params":[{"execer":"'${user_game}'","actionName":"Call","payload":{"name":"'${game}'","funcname":"hello","args":"{}"}}]}'
resok='(.error|not) and (.result != null)'
http_req "$req" ${MAIN_HTTP} "$resok" "$FUNCNAME" ".result"
chain33_SignRawTx "$RAW_RESP" "${beneficiary_key}" "${MAIN_HTTP}"
chain33_SignRawTx "$RETURN_RESP" "${beneficiary_key}" "${MAIN_HTTP}"
}
function queryJS() {
......
......@@ -78,7 +78,7 @@ lottery_LotteryCreate() {
http_req "$req" ${MAIN_HTTP} '(.error|not)' "$FUNCNAME" ".result"
#发送交易
chain33_SignRawTx "${RAW_RESP}" "${priv}" ${MAIN_HTTP}
chain33_SignRawTx "${RETURN_RESP}" "${priv}" ${MAIN_HTTP}
gID="${RAW_TX_HASH}"
echo "gameID $gID"
......@@ -94,7 +94,7 @@ lottery_LotteryBuy() {
http_req "$req" ${MAIN_HTTP} '(.error|not)' "$FUNCNAME" ".result"
#发送交易
chain33_SignRawTx "${RAW_RESP}" "${priv}" ${MAIN_HTTP}
chain33_SignRawTx "${RETURN_RESP}" "${priv}" ${MAIN_HTTP}
}
lottery_LotteryDraw() {
......@@ -103,7 +103,7 @@ lottery_LotteryDraw() {
req='{"method":"Chain33.CreateTransaction","params":[{"execer":"lottery","actionName":"LotteryDraw","payload":{"lotteryId":"'"$gID"'","fee":1000000}}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not)' "$FUNCNAME" ".result"
#发送交易
chain33_SignRawTx "${RAW_RESP}" "${priv}" ${MAIN_HTTP}
chain33_SignRawTx "${RETURN_RESP}" "${priv}" ${MAIN_HTTP}
}
lottery_LotteryClose() {
......@@ -112,7 +112,7 @@ lottery_LotteryClose() {
req='{"method":"Chain33.CreateTransaction","params":[{"execer":"lottery","actionName":"LotteryClose","payload":{"lotteryId":"'"$gID"'","fee":1000000}}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not)' "$FUNCNAME" ".result"
#发送交易
chain33_SignRawTx "${RAW_RESP}" "${priv}" ${MAIN_HTTP}
chain33_SignRawTx "${RETURN_RESP}" "${priv}" ${MAIN_HTTP}
}
lottery_GetLotteryNormalInfo() {
......@@ -132,7 +132,7 @@ lottery_GetLotteryCurrentInfo() {
http_req "$req" ${MAIN_HTTP} "$resok" "$FUNCNAME" ".result.luckyNumber"
if [[ $status == 3 ]]; then
luckyNumber=$RAW_RESP
luckyNumber=$RETURN_RESP
echo -e "######\\n luckyNumber is $luckyNumber \\n######"
fi
echo "end"
......
......@@ -74,6 +74,7 @@ function multisig_AccCreateTx() {
#查看创建的多重签名地址是否ok
data=$(curl -ksd '{"method":"Chain33.Query","params":[{"execer":"multisig","funcName":"MultiSigAccCount","payload":{}}]}' ${MAIN_HTTP} | jq -r ".result.data")
echo "$data"
#获取创建的多重签名地址
multisigAccAddr=$(curl -ksd '{"method":"Chain33.Query","params":[{"execer":"multisig","funcName":"MultiSigAccounts","payload":{"start":"0","end":"0"}}]}' ${MAIN_HTTP} | jq -r ".result.address[0]")
......
......@@ -25,7 +25,7 @@ oracle_AddPublisher() {
oracle_publish_transaction() {
req='{"method":"Chain33.CreateTransaction","params":[{"execer":"oracle","actionName":"EventPublish","payload":{"type":"football", "subType":"Premier League","time":1747814996,"content":"test","introduction":"test"}}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignRawTx "$RAW_RESP" "${oracle_publisher_key}" "${MAIN_HTTP}"
chain33_SignRawTx "$RETURN_RESP" "${oracle_publisher_key}" "${MAIN_HTTP}"
eventId="${txhash}"
echo "eventId $eventId"
}
......@@ -34,28 +34,28 @@ oracle_prePublishResult_transaction() {
event_id=$1
req='{"method":"Chain33.CreateTransaction","params":[{"execer":"oracle","actionName":"ResultPrePublish","payload":{"eventID":"'"$event_id"'", "source":"sina sport","result":"0:1"}}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignRawTx "$RAW_RESP" "${oracle_publisher_key}" "${MAIN_HTTP}"
chain33_SignRawTx "$RETURN_RESP" "${oracle_publisher_key}" "${MAIN_HTTP}"
}
oracle_eventAbort_transaction() {
event_id=$1
req='{"method":"Chain33.CreateTransaction","params":[{"execer":"oracle","actionName":"EventAbort","payload":{"eventID":"'"$event_id"'"}}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignRawTx "$RAW_RESP" "${oracle_publisher_key}" "${MAIN_HTTP}"
chain33_SignRawTx "$RETURN_RESP" "${oracle_publisher_key}" "${MAIN_HTTP}"
}
oracle_resultAbort_transaction() {
event_id=$1
req='{"method":"Chain33.CreateTransaction","params":[{"execer":"oracle","actionName":"ResultAbort","payload":{"eventID":"'"$event_id"'"}}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignRawTx "$RAW_RESP" "${oracle_publisher_key}" "${MAIN_HTTP}"
chain33_SignRawTx "$RETURN_RESP" "${oracle_publisher_key}" "${MAIN_HTTP}"
}
oracle_publishResult_transaction() {
event_id=$1
req='{"method":"Chain33.CreateTransaction","params":[{"execer":"oracle","actionName":"ResultPublish","payload":{"eventID":"'"$event_id"'", "source":"sina sport","result":"1:1"}}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignRawTx "$RAW_RESP" "${oracle_publisher_key}" "${MAIN_HTTP}"
chain33_SignRawTx "$RETURN_RESP" "${oracle_publisher_key}" "${MAIN_HTTP}"
}
oracle_QueryOraclesByID() {
......
......@@ -12,15 +12,6 @@ paracross_GetBlock2MainInfo() {
http_req '{"method":"paracross.GetBlock2MainInfo","params":[{"start":1,"end":3}]}' ${UNIT_HTTP} "(.result.items[1].height == 2)" "$FUNCNAME"
}
function paracross_SignAndSend() {
local signedTx
local sendedTx
signedTx=$(curl -ksd '{"method":"Chain33.SignRawTx","params":[{"expire":"120s","fee":'"$1"',"privkey":"'"$2"'","txHex":"'"$3"'"}]}' ${UNIT_HTTP} | jq -r ".result")
sendedTx=$(curl -ksd '{"method":"Chain33.SendTransaction","params":[{"data":"'"$signedTx"'"}]}' ${UNIT_HTTP} | jq -r ".result")
echo "sendedTx:$sendedTx"
}
function paracross_QueryParaBalance() {
local req
local resp
......@@ -208,9 +199,6 @@ function paracross_ListTitles() {
}
function paracross_GetHeight() {
local resp
local ok
if [ "$IS_PARA" == "true" ]; then
http_req '{"method":"paracross.GetHeight","params":[]}' ${UNIT_HTTP} '(.error|not) and (.result| [has("consensHeight"),true])' "$FUNCNAME"
fi
......
......@@ -9,19 +9,19 @@ MAIN_HTTP=""
relay_CreateRawRelaySaveBTCHeadTx() {
local req='{"method":"relay.CreateRawRelaySaveBTCHeadTx","params":[{"hash":"5e7d9c599cd040ec2ba53f4dee28028710be8c135e779f65c56feadaae34c3f2","height":10,"version":536870912,"merkleRoot":"ab91cd4160e1379c337eee6b7a4bdbb7399d70268d86045aba150743c00c90b6","time":1530862108,"nonce":0,"bits":545259519,"previousHash":"604efe53975ab06cad8748fd703ad5bc960e8b752b2aae98f0f871a4a05abfc7","isReset":true}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignRawTx "$RAW_RESP" "0x22968d29c6de695381a8719ef7bf00e2edb6cce500bb59a4fc73c41887610962" "${MAIN_HTTP}"
chain33_SignRawTx "$RETURN_RESP" "0x22968d29c6de695381a8719ef7bf00e2edb6cce500bb59a4fc73c41887610962" "${MAIN_HTTP}"
}
relay_CreateRawRelaySaveBTCHeadTx_11() {
local req='{"method":"relay.CreateRawRelaySaveBTCHeadTx","params":[{"hash":"7b7a4a9b49db5a1162be515d380cd186e98c2bf0bb90f1145485d7c43343fc7c","height":11,"version":536870912,"merkleRoot":"cfa9b66696aea63b7266ffaa1cb4b96c8dd6959eaabf2eb14173f4adaa551f6f","time":1530862108,"nonce":1,"bits":545259519,"previousHash":"5e7d9c599cd040ec2ba53f4dee28028710be8c135e779f65c56feadaae34c3f2","isReset":false}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignRawTx "$RAW_RESP" "0x22968d29c6de695381a8719ef7bf00e2edb6cce500bb59a4fc73c41887610962" "${MAIN_HTTP}"
chain33_SignRawTx "$RETURN_RESP" "0x22968d29c6de695381a8719ef7bf00e2edb6cce500bb59a4fc73c41887610962" "${MAIN_HTTP}"
}
relay_CreateRawRelayOrderTx() {
local req='{"method":"relay.CreateRawRelayOrderTx","params":[{"operation":0,"coin":"BTC","amount":299000000,"addr":"1Am9UTGfdnxabvcywYG2hvzr6qK8T3oUZT","btyAmount":1000000000,"coinWaits":6}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignRawTx "$RAW_RESP" "0x22968d29c6de695381a8719ef7bf00e2edb6cce500bb59a4fc73c41887610962" "${MAIN_HTTP}"
chain33_SignRawTx "$RETURN_RESP" "0x22968d29c6de695381a8719ef7bf00e2edb6cce500bb59a4fc73c41887610962" "${MAIN_HTTP}"
}
relay_CreateRawRelayAcceptTx() {
......@@ -36,7 +36,7 @@ relay_CreateRawRelayAcceptTx() {
local req='{"method":"relay.CreateRawRelayAcceptTx","params":[{"orderId":"'"$id"'","coinAddr":"1Am9UTGfdnxabvcywYG2hvzr6qK8T3oUZT"}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignRawTx "$RAW_RESP" "0xec9162ea5fc2f473ab8240619a0a0f495ba9e9e5d4d9c434b8794a68280236c4" "${MAIN_HTTP}"
chain33_SignRawTx "$RETURN_RESP" "0xec9162ea5fc2f473ab8240619a0a0f495ba9e9e5d4d9c434b8794a68280236c4" "${MAIN_HTTP}"
}
relay_CreateRawRelayRevokeTx() {
......@@ -51,7 +51,7 @@ relay_CreateRawRelayRevokeTx() {
local req='{"method":"relay.CreateRawRelayRevokeTx","params":[{"orderId":"'"$id"'","target":0,"action":1}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignRawTx "$RAW_RESP" "0x22968d29c6de695381a8719ef7bf00e2edb6cce500bb59a4fc73c41887610962" "${MAIN_HTTP}"
chain33_SignRawTx "$RETURN_RESP" "0x22968d29c6de695381a8719ef7bf00e2edb6cce500bb59a4fc73c41887610962" "${MAIN_HTTP}"
}
relay_CreateRawRelayConfirmTx() {
......@@ -66,7 +66,7 @@ relay_CreateRawRelayConfirmTx() {
local req='{"method":"relay.CreateRawRelayConfirmTx","params":[{"orderId":"'"$id"'","rawTx":"6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4"}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignRawTx "$RAW_RESP" "0xec9162ea5fc2f473ab8240619a0a0f495ba9e9e5d4d9c434b8794a68280236c4" "${MAIN_HTTP}"
chain33_SignRawTx "$RETURN_RESP" "0xec9162ea5fc2f473ab8240619a0a0f495ba9e9e5d4d9c434b8794a68280236c4" "${MAIN_HTTP}"
}
query_GetRelayOrderByStatus() {
......
......@@ -19,7 +19,7 @@ ticket_CreateBindMiner() {
amount=$4
req='{"method":"ticket.CreateBindMiner","params":[{"bindAddr":"'"$minerAddr"'", "originAddr":"'"$returnAddr"'", "amount":'"$amount"', "checkBalance":true}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not)' "$FUNCNAME" ".result.txHex"
chain33_SignRawTx "$RAW_RESP" "${returnPriv}" ${MAIN_HTTP}
chain33_SignRawTx "$RETURN_RESP" "${returnPriv}" ${MAIN_HTTP}
}
ticket_SetAutoMining() {
......@@ -33,6 +33,7 @@ ticket_GetTicketCount() {
}
ticket_CloseTickets() {
addr=$1
req='{"method":"ticket.CloseTickets","params":[{"minerAddress":"'"$addr"'"}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not)' "$FUNCNAME"
}
......@@ -54,10 +55,10 @@ ticket_TicketList() {
resok='(.error|not) and (.result.tickets | length > 0) and (.result.tickets[0].minerAddress == "'"$minerAddr"'") and (.result.tickets[0].returnAddress == "'"$returnAddr"'") and (.result.tickets[0].status == '"$status"')'
http_req "$req" ${MAIN_HTTP} "$resok" "$FUNCNAME"
ticket0=$(echo "${HTTP_RESP}" | jq -r ".result.tickets[0]")
# echo -e "######\\n ticket[0] is $ticket0) \\n######"
ticketId=$(echo "${HTTP_RESP}" | jq -r ".result.tickets[0].ticketId")
# echo -e "######\\n ticketId is $ticketId \\n######"
ticket0=$(echo "${RETURN_RESP}" | jq -r ".result.tickets[0]")
echo -e "######\\n ticket[0] is $ticket0) \\n######"
ticketId=$(echo "${RETURN_RESP}" | jq -r ".result.tickets[0].ticketId")
echo -e "######\\n ticketId is $ticketId \\n######"
}
ticket_MinerAddress() {
......
......@@ -12,7 +12,7 @@ superManager="0xc34b5d9d44ac7b754806f761d3d4d2c4fe5214f6b074c19f069c4f5c2a29c8cc
tokenSymbol="ABCDE"
token_addr=""
execName="token"
txHash=""
#txHash=""
#color
#RED='\033[1;31m'
......
......@@ -75,7 +75,7 @@ function trade_createSellTx() {
function trade_getSellOrder() {
req='{"method":"Chain33.Query","params":[{"execer":"'"${tradeExecName}"'","funcName":"GetOnesSellOrder","payload":{"addr": "'"${tradeAddr}"'","token":["'"${tokenSymbol}"'"]}}]}'
http_req "$req" ${MAIN_HTTP} '(.error | not)' "$FUNCNAME"
sellID=$(echo "${RAW_RESP}" | jq -r ".result.orders[0].sellID" | awk -F '-' '{print $4}')
sellID=$(echo "${RETURN_RESP}" | jq -r ".result.orders[0].sellID" | awk -F '-' '{print $4}')
}
function trade_createBuyTx() {
......
......@@ -75,7 +75,7 @@ function init() {
function CreateRawUnfreezeCreate() {
req='{"jsonrpc": "2.0", "method" : "unfreeze.CreateRawUnfreezeCreate" , "params":[{"startTime":10000,"assetExec":"coins","assetSymbol":"'$symbol'","totalCount":400000000,"beneficiary":"'$beneficiary'","means":"FixAmount","fixAmount": {"period":10,"amount":1000000}}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignRawTx "$RAW_RESP" "$owner_key" "${MAIN_HTTP}"
chain33_SignRawTx "$RETURN_RESP" "$owner_key" "${MAIN_HTTP}"
query_unfreezeID
}
......@@ -83,13 +83,13 @@ function CreateRawUnfreezeWithdraw() {
sleep 10
req='{"method":"unfreeze.CreateRawUnfreezeWithdraw","params":[{"unfreezeID":"'${uid}'"}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignRawTx "$RAW_RESP" "${beneficiary_key}" "${MAIN_HTTP}"
chain33_SignRawTx "$RETURN_RESP" "${beneficiary_key}" "${MAIN_HTTP}"
}
function CreateRawUnfreezeTerminate() {
req='{"method":"unfreeze.CreateRawUnfreezeTerminate","params":[{"unfreezeID":"'${uid}'"}]}'
http_req "$req" ${MAIN_HTTP} '(.error|not) and (.result != null)' "$FUNCNAME" ".result"
chain33_SignRawTx "$RAW_RESP" "$owner_key" "${MAIN_HTTP}"
chain33_SignRawTx "$RETURN_RESP" "$owner_key" "${MAIN_HTTP}"
chain33_BlockWait 2 "${MAIN_HTTP}"
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment