Unverified Commit 6fae0e58 authored by vipwzw's avatar vipwzw Committed by GitHub

Merge pull request #474 from jpeng-go/master

添加pokerbull和retrieve两个dapp的rpc-test用例
parents fc85b560 cd078a6e
#!/usr/bin/env bash
RAW_TX_HASH=""
CASE_ERR=""
#color
RED='\033[1;31m'
GRE='\033[1;32m'
NOC='\033[0m'
echo_rst() {
if [ "$2" -eq 0 ]; then
echo -e "${GRE}$1 ok${NOC}"
elif [ "$2" -eq 2 ]; then
echo -e "${GRE}$1 not support${NOC}"
CASE_ERR="err"
echo $CASE_ERR
else
echo -e "${RED}$1 fail${NOC}"
CASE_ERR="err"
echo $CASE_ERR
fi
}
chain33_BlockWait() {
local MAIN_HTTP=$2
local req='"method":"Chain33.GetLastHeader","params":[]'
cur_height=$(curl -ksd "{$req}" "${MAIN_HTTP}" | jq ".result.height")
expect=$((cur_height + ${1}))
local count=0
while true; do
new_height=$(curl -ksd "{$req}" "${MAIN_HTTP}" | jq ".result.height")
if [ "${new_height}" -ge "${expect}" ]; then
break
fi
count=$((count + 1))
sleep 1
done
echo "wait new block $count s, cur height=$expect,old=$cur_height"
}
chain33_QueryTx() {
local MAIN_HTTP=$2
chain33_BlockWait 1 "$MAIN_HTTP"
local txhash="$1"
local req='"method":"Chain33.QueryTransaction","params":[{"hash":"'"$txhash"'"}]'
local times=10
while true; do
ret=$(curl -ksd "{$req}" "${MAIN_HTTP}" | jq -r ".result.tx.hash")
if [ "${ret}" != "${1}" ]; then
chain33_BlockWait 1 "$MAIN_HTTP"
times=$((times - 1))
if [ $times -le 0 ]; then
echo "====query tx=$1 failed"
curl -ksd "{$req}" "${MAIN_HTTP}"
exit 1
fi
else
RAW_TX_HASH=$txhash
echo "====query tx=$RAW_TX_HASH success"
break
fi
done
}
chain33_SendTx() {
local signedTx=$1
local MAIN_HTTP=$2
req='"method":"Chain33.SendTransaction","params":[{"token":"BTY","data":"'"$signedTx"'"}]'
resp=$(curl -ksd "{$req}" "${MAIN_HTTP}")
err=$(jq '(.error)' <<<"$resp")
txhash=$(jq -r ".result" <<<"$resp")
if [ "$err" == null ]; then
chain33_QueryTx "$txhash" "$MAIN_HTTP"
else
echo "send tx error:$err"
fi
}
chain33_SendToAddress() {
local from="$1"
local to="$2"
local amount=$3
local MAIN_HTTP=$4
local req='"method":"Chain33.SendToAddress", "params":[{"from":"'"$from"'","to":"'"$to"'", "amount":'"$amount"', "note":"test\n"}]'
resp=$(curl -ksd "{$req}" "${MAIN_HTTP}")
ok=$(jq '(.error|not) and (.result.hash|length==66)' <<<"$resp")
[ "$ok" == true ]
hash=$(jq -r ".result.hash" <<<"$resp")
chain33_QueryTx "$hash" "$MAIN_HTTP"
}
chain33_ImportPrivkey() {
local pri="$1"
local acc="$2"
local label="$3"
local MAIN_HTTP=$4
local req='"method":"Chain33.ImportPrivkey", "params":[{"privkey":"'"$pri"'", "label":"'"$label"'"}]'
resp=$(curl -ksd "{$req}" "$MAIN_HTTP")
ok=$(jq '(.error|not) and (.result.label=="'"$label"'") and (.result.acc.addr == "'"$acc"'")' <<<"$resp")
[ "$ok" == true ]
}
chain33_SignRawTx() {
local txHex="$1"
local priKey="$2"
local MAIN_HTTP=$3
local req='"method":"Chain33.SignRawTx","params":[{"privkey":"'"$priKey"'","txHex":"'"$txHex"'","expire":"120s"}]'
signedTx=$(curl -ksd "{$req}" "${MAIN_HTTP}" | jq -r ".result")
if [ "$signedTx" != null ]; then
chain33_SendTx "$signedTx" "${MAIN_HTTP}"
else
echo "signedTx null error"
fi
}
...@@ -2,11 +2,13 @@ ...@@ -2,11 +2,13 @@
# shellcheck disable=SC2128 # shellcheck disable=SC2128
RPC_TESTFILE=test-rpc.sh RPC_TESTFILE=test-rpc.sh
DAPP_TEST_COMMON=dapp-test-common.sh
function dapp_test_rpc() { function dapp_test_rpc() {
local ip=$1 local ip=$1
echo "============ # dapp rpc test begin =============" echo "============ # dapp rpc test begin ============="
if [ -d dapptest ]; then if [ -d dapptest ]; then
cp $DAPP_TEST_COMMON dapptest/
cd dapptest || return cd dapptest || return
dir=$(find . -maxdepth 1 -type d ! -name dapptest ! -name . | sed 's/^\.\///') dir=$(find . -maxdepth 1 -type d ! -name dapptest ! -name . | sed 's/^\.\///')
for app in $dir; do for app in $dir; do
......
...@@ -99,6 +99,9 @@ function base_init() { ...@@ -99,6 +99,9 @@ function base_init() {
sed -i $sedfix 's/^nodeGroupFrozenCoins=.*/nodeGroupFrozenCoins=20/g' chain33.toml sed -i $sedfix 's/^nodeGroupFrozenCoins=.*/nodeGroupFrozenCoins=20/g' chain33.toml
# ticket
sed -i $sedfix 's/^ticketPrice =.*/ticketPrice = 10000/g' chain33.toml
} }
function start() { function start() {
...@@ -143,7 +146,7 @@ function start() { ...@@ -143,7 +146,7 @@ function start() {
${CLI} block hash -t 0 ${CLI} block hash -t 0
res=$(${CLI} block hash -t 0 | jq -r ".hash") res=$(${CLI} block hash -t 0 | jq -r ".hash")
#in case changes result in genesis change #in case changes result in genesis change
if [ "${res}" != "0xa87972dfc3510cb934cb987bcb88036f7a1ffd7dc069cb9a5f0af179895fd2e8" ]; then if [ "${res}" != "0x67c58d6ba9175313f0468ae4e0ddec946549af7748037c2fdd5d54298afd20b6" ]; then
echo "genesis hash error!" echo "genesis hash error!"
exit 1 exit 1
fi fi
...@@ -203,6 +206,7 @@ function miner() { ...@@ -203,6 +206,7 @@ function miner() {
fi fi
sleep 1 sleep 1
echo "=========== # close auto mining =============" echo "=========== # close auto mining ============="
result=$(${1} wallet auto_mine -f 0 | jq ".isok") result=$(${1} wallet auto_mine -f 0 | jq ".isok")
if [ "${result}" = "false" ]; then if [ "${result}" = "false" ]; then
...@@ -331,6 +335,30 @@ function transfer() { ...@@ -331,6 +335,30 @@ function transfer() {
block_wait "${1}" 1 block_wait "${1}" 1
} }
function dapp_test_address() {
echo "=========== # import private key dapptest1 mining ============="
result=$(${1} account import_key -k 56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138 -l dapptest1 | jq ".label")
echo "${result}"
if [ -z "${result}" ]; then
exit 1
fi
sleep 1
echo "=========== # import private key dapptest2 mining ============="
result=$(${1} account import_key -k 2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989 -l dapptest2 | jq ".label")
echo "${result}"
if [ -z "${result}" ]; then
exit 1
fi
sleep 1
hash=$(${1} send coins transfer -a 1500 -n transfer -t 1PUiGcbsccfxW3zuvHXZBJfznziph5miAo -k 2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989)
echo "${hash}"
block_wait "${1}" 1
}
function base_config() { function base_config() {
# sync # sync
transfer "${CLI}" transfer "${CLI}"
...@@ -340,10 +368,12 @@ function base_config() { ...@@ -340,10 +368,12 @@ function base_config() {
function rpc_test() { function rpc_test() {
if [ "$DAPP" == "" ]; then if [ "$DAPP" == "" ]; then
system_test_rpc "http://${1}:8801" system_test_rpc "http://${1}:8801"
dapp_test_address "${CLI}"
dapp_test_rpc "http://${1}:8801" dapp_test_rpc "http://${1}:8801"
fi fi
if [ "$DAPP" == "paracross" ]; then if [ "$DAPP" == "paracross" ]; then
system_test_rpc "http://${1}:8901" system_test_rpc "http://${1}:8901"
dapp_test_address "${CLI}"
dapp_test_rpc "http://${1}:8901" dapp_test_rpc "http://${1}:8901"
fi fi
......
...@@ -244,7 +244,7 @@ function run_testcases() { ...@@ -244,7 +244,7 @@ function run_testcases() {
blackwhite_BlackwhiteTimeoutDoneTx "$gID" blackwhite_BlackwhiteTimeoutDoneTx "$gID"
#查询部分 #查询部分
block_wait 1 block_wait 3
blackwhite_GetBlackwhiteRoundInfo "$gID" blackwhite_GetBlackwhiteRoundInfo "$gID"
blackwhite_GetBlackwhiteByStatusAndAddr "$gID" "${gameAddr1}" blackwhite_GetBlackwhiteByStatusAndAddr "$gID" "${gameAddr1}"
blackwhite_GetBlackwhiteloopResult "$gID" blackwhite_GetBlackwhiteloopResult "$gID"
......
File mode changed from 100644 to 100755
...@@ -23,48 +23,34 @@ echo_rst() { ...@@ -23,48 +23,34 @@ echo_rst() {
lottery_addCreator_unsignedTx="0a066d616e616765123c0a3a0a0f6c6f74746572792d63726561746f721222313271796f6361794e46374c7636433971573461767873324537553431664b5366761a0361646420a08d0630c788b8f7ccbadbc0703a223151344e687572654a784b4e4266373164323642394a336642516f5163666d657a32" lottery_addCreator_unsignedTx="0a066d616e616765123c0a3a0a0f6c6f74746572792d63726561746f721222313271796f6361794e46374c7636433971573461767873324537553431664b5366761a0361646420a08d0630c788b8f7ccbadbc0703a223151344e687572654a784b4e4266373164323642394a336642516f5163666d657a32"
lottery_addCreator_unsignedTx_para="0a12757365722e702e706172612e6d616e616765123c0a3a0a0f6c6f74746572792d63726561746f721222313271796f6361794e46374c7636433971573461767873324537553431664b5366761a0361646420a08d0630a8bba1b887e7dade2b3a22314469484633317577783977356a6a733571514269474a6b4e686e71656564763157" lottery_addCreator_unsignedTx_para="0a12757365722e702e706172612e6d616e616765123c0a3a0a0f6c6f74746572792d63726561746f721222313271796f6361794e46374c7636433971573461767873324537553431664b5366761a0361646420a08d0630a8bba1b887e7dade2b3a22314469484633317577783977356a6a733571514269474a6b4e686e71656564763157"
lottery_creator_addr="12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv" lottery_creator_addr="12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
lottery_creator_priv="0x4257d8692ef7fe13c68b65d6a52f03933db2fa5ce8faf210b5b8b80c721ced01"
gID="" gID=""
gResp="" gResp=""
glAddr=""
gameAddr1=""
gameAddr2=""
gameAddr3=""
lottExecAddr="" lottExecAddr=""
luckyNumber=""
purNum=30 purNum=30
drawNum=40 drawNum=40
opRatio=5 opRatio=5
devRatio=5 devRatio=5
luckyNumber=""
init() { init() {
ispara=$(echo '"'"${MAIN_HTTP}"'"' | jq '.|contains("8901")') ispara=$(echo '"'"${MAIN_HTTP}"'"' | jq '.|contains("8901")')
echo "ispara=$ispara" echo "ispara=$ispara"
if [[ $ispara == true ]]; then if [[ $ispara == true ]]; then
lottExecAddr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"user.p.para.lottery"}]}' ${MAIN_HTTP} | jq -r ".result") lottExecAddr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"user.p.para.lottery"}]}' ${MAIN_HTTP} | jq -r ".result")
chain33_SendTransaction "${lottery_addCreator_unsignedTx_para}" "${lottery_creator_addr}" chain33_SendTransaction "${lottery_addCreator_unsignedTx_para}" "${lottery_creator_priv}"
else else
lottExecAddr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"lottery"}]}' ${MAIN_HTTP} | jq -r ".result") lottExecAddr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"lottery"}]}' ${MAIN_HTTP} | jq -r ".result")
chain33_SendTransaction "${lottery_addCreator_unsignedTx}" "${lottery_creator_addr}" chain33_SendTransaction "${lottery_addCreator_unsignedTx}" "${lottery_creator_priv}"
fi fi
echo "lottExecAddr=$lottExecAddr" echo "lottExecAddr=$lottExecAddr"
} }
chain33_NewAccount() {
label=$1
result=$(curl -ksd '{"method":"Chain33.NewAccount","params":[{"label":"'"$label"'"}]}' -H 'content-type:text/plain;' ${MAIN_HTTP} | jq -r ".result.acc.addr")
[[ $result != "" ]]
rst=$?
echo_rst "$FUNCNAME" "$rst"
glAddr=$result
echo "$glAddr"
}
function block_wait() { function block_wait() {
if [[ $# -lt 1 ]]; then if [[ $# -lt 1 ]]; then
echo "wrong block_wait params" echo "wrong block_wait params"
...@@ -142,10 +128,12 @@ chain33_SendToAddress() { ...@@ -142,10 +128,12 @@ chain33_SendToAddress() {
chain33_SendTransaction() { chain33_SendTransaction() {
rawTx=$1 rawTx=$1
addr=$2 priv=$2
#签名交易 #签名交易
resp=$(curl -ksd '{"method":"Chain33.SignRawTx","params":[{"addr":"'"$addr"'","txHex":"'"$rawTx"'","expire":"120s","fee":10000000,"index":0}]}' -H 'content-type:text/plain;' ${MAIN_HTTP}) set -x
resp=$(curl -ksd '{"method":"Chain33.SignRawTx","params":[{"privkey":"'"$priv"'","txHex":"'"$rawTx"'","expire":"120s","fee":10000000,"index":0}]}' -H 'content-type:text/plain;' ${MAIN_HTTP})
ok=$(echo "${resp}" | jq -r ".error") ok=$(echo "${resp}" | jq -r ".error")
set +x
[[ $ok == null ]] [[ $ok == null ]]
rst=$? rst=$?
echo_rst "chain33_SignRawTx" "$rst" echo_rst "chain33_SignRawTx" "$rst"
...@@ -166,7 +154,7 @@ chain33_SendTransaction() { ...@@ -166,7 +154,7 @@ chain33_SendTransaction() {
lottery_LotteryCreate() { lottery_LotteryCreate() {
#创建交易 #创建交易
addr=$1 priv=$1
set -x set -x
resp=$(curl -ksd '{"method":"Chain33.CreateTransaction","params":[{"execer":"lottery","actionName":"LotteryCreate", resp=$(curl -ksd '{"method":"Chain33.CreateTransaction","params":[{"execer":"lottery","actionName":"LotteryCreate",
"payload":{"purBlockNum":'"$purNum"',"drawBlockNum":'"$drawNum"', "opRewardRatio":'"$opRatio"',"devRewardRatio":'"$devRatio"',"fee":1000000}}]}' -H 'content-type:text/plain;' ${MAIN_HTTP}) "payload":{"purBlockNum":'"$purNum"',"drawBlockNum":'"$drawNum"', "opRewardRatio":'"$opRatio"',"devRewardRatio":'"$devRatio"',"fee":1000000}}]}' -H 'content-type:text/plain;' ${MAIN_HTTP})
...@@ -177,14 +165,14 @@ lottery_LotteryCreate() { ...@@ -177,14 +165,14 @@ lottery_LotteryCreate() {
echo_rst "$FUNCNAME" "$rst" echo_rst "$FUNCNAME" "$rst"
#发送交易 #发送交易
rawTx=$(echo "${resp}" | jq -r ".result") rawTx=$(echo "${resp}" | jq -r ".result")
chain33_SendTransaction "${rawTx}" "${addr}" chain33_SendTransaction "${rawTx}" "${priv}"
gID="${gResp}" gID="${gResp}"
echo "gameID $gID" echo "gameID $gID"
} }
lottery_LotteryBuy() { lottery_LotteryBuy() {
#创建交易 #创建交易
addr=$1 priv=$1
amount=$2 amount=$2
number=$3 number=$3
way=$4 way=$4
...@@ -198,12 +186,12 @@ lottery_LotteryBuy() { ...@@ -198,12 +186,12 @@ lottery_LotteryBuy() {
echo_rst "$FUNCNAME" "$rst" echo_rst "$FUNCNAME" "$rst"
#发送交易 #发送交易
rawTx=$(echo "${resp}" | jq -r ".result") rawTx=$(echo "${resp}" | jq -r ".result")
chain33_SendTransaction "${rawTx}" "${addr}" chain33_SendTransaction "${rawTx}" "${priv}"
} }
lottery_LotteryDraw() { lottery_LotteryDraw() {
#创建交易 #创建交易
addr=$1 priv=$1
set -x set -x
resp=$(curl -ksd '{"method":"Chain33.CreateTransaction","params":[{"execer":"lottery","actionName":"LotteryDraw", resp=$(curl -ksd '{"method":"Chain33.CreateTransaction","params":[{"execer":"lottery","actionName":"LotteryDraw",
"payload":{"lotteryId":"'"$gID"'","fee":1000000}}]}' -H 'content-type:text/plain;' ${MAIN_HTTP}) "payload":{"lotteryId":"'"$gID"'","fee":1000000}}]}' -H 'content-type:text/plain;' ${MAIN_HTTP})
...@@ -214,12 +202,12 @@ lottery_LotteryDraw() { ...@@ -214,12 +202,12 @@ lottery_LotteryDraw() {
echo_rst "$FUNCNAME" "$rst" echo_rst "$FUNCNAME" "$rst"
#发送交易 #发送交易
rawTx=$(echo "${resp}" | jq -r ".result") rawTx=$(echo "${resp}" | jq -r ".result")
chain33_SendTransaction "${rawTx}" "${addr}" chain33_SendTransaction "${rawTx}" "${priv}"
} }
lottery_LotteryClose() { lottery_LotteryClose() {
#创建交易 #创建交易
addr=$1 priv=$1
set -x set -x
resp=$(curl -ksd '{"method":"Chain33.CreateTransaction","params":[{"execer":"lottery","actionName":"LotteryClose", resp=$(curl -ksd '{"method":"Chain33.CreateTransaction","params":[{"execer":"lottery","actionName":"LotteryClose",
"payload":{"lotteryId":"'"$gID"'","fee":1000000}}]}' -H 'content-type:text/plain;' ${MAIN_HTTP}) "payload":{"lotteryId":"'"$gID"'","fee":1000000}}]}' -H 'content-type:text/plain;' ${MAIN_HTTP})
...@@ -230,7 +218,7 @@ lottery_LotteryClose() { ...@@ -230,7 +218,7 @@ lottery_LotteryClose() {
echo_rst "$FUNCNAME" "$rst" echo_rst "$FUNCNAME" "$rst"
#发送交易 #发送交易
rawTx=$(echo "${resp}" | jq -r ".result") rawTx=$(echo "${resp}" | jq -r ".result")
chain33_SendTransaction "${rawTx}" "${addr}" chain33_SendTransaction "${rawTx}" "${priv}"
} }
lottery_GetLotteryNormalInfo() { lottery_GetLotteryNormalInfo() {
...@@ -377,27 +365,20 @@ lottery_GetLotteryRoundGainInfo() { ...@@ -377,27 +365,20 @@ lottery_GetLotteryRoundGainInfo() {
} }
function run_testcases() { function run_testcases() {
#先创建账户地址 #账户地址
chain33_NewAccount "lottery111" gameAddr1="1PUiGcbsccfxW3zuvHXZBJfznziph5miAo"
gameAddr1="${glAddr}" gamePriv1="0x56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138"
chain33_NewAccount "lottery222" gameAddr2="1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX"
gameAddr2="${glAddr}" gamePriv2="0x2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989"
chain33_NewAccount "lottery333" #该账户需要转账
gameAddr3="${glAddr}" gameAddr3="12HKLEn6g4FH39yUbHh4EVJWcFo5CXg22d"
gamePriv3="0x9d4f8ab11361be596468b265cb66946c87873d4a119713fd0c3d8302eae0a8e4"
#给每个账户分别转帐
origAddr="14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
#主链中相应账户需要转帐 #主链中相应账户需要转帐
M_HTTP=${MAIN_HTTP//8901/8801} M_HTTP=${MAIN_HTTP//8901/8801}
chain33_SendToAddress "${origAddr}" "${gameAddr1}" 300000000 "${M_HTTP}" chain33_SendToAddress "${gameAddr1}" "${gameAddr3}" 300000000 "${M_HTTP}"
chain33_SendToAddress "${origAddr}" "${gameAddr2}" 300000000 "${M_HTTP}"
chain33_SendToAddress "${origAddr}" "${gameAddr3}" 300000000 "${M_HTTP}"
#平行链相应账户需要转帐 #平行链相应账户需要转帐
chain33_SendToAddress "${origAddr}" "${gameAddr1}" 300000000 "${MAIN_HTTP}" chain33_SendToAddress "${gameAddr1}" "${gameAddr3}" 300000000 "${MAIN_HTTP}"
chain33_SendToAddress "${origAddr}" "${gameAddr2}" 300000000 "${MAIN_HTTP}"
chain33_SendToAddress "${origAddr}" "${gameAddr3}" 300000000 "${MAIN_HTTP}"
#给游戏合约中转帐 #给游戏合约中转帐
chain33_SendToAddress "${gameAddr1}" "${lottExecAddr}" 200000000 "${MAIN_HTTP}" chain33_SendToAddress "${gameAddr1}" "${lottExecAddr}" 200000000 "${MAIN_HTTP}"
...@@ -405,14 +386,14 @@ function run_testcases() { ...@@ -405,14 +386,14 @@ function run_testcases() {
chain33_SendToAddress "${gameAddr3}" "${lottExecAddr}" 200000000 "${MAIN_HTTP}" chain33_SendToAddress "${gameAddr3}" "${lottExecAddr}" 200000000 "${MAIN_HTTP}"
#创建游戏 #创建游戏
lottery_LotteryCreate "${lottery_creator_addr}" lottery_LotteryCreate "${lottery_creator_priv}"
lottery_GetLotteryNormalInfo "$gID" "${lottery_creator_addr}" lottery_GetLotteryNormalInfo "$gID" "${lottery_creator_addr}"
lottery_GetLotteryCurrentInfo "$gID" 1 0 lottery_GetLotteryCurrentInfo "$gID" 1 0
#第一次投注 #第一次投注
lottery_LotteryBuy "${gameAddr1}" 1 12345 1 lottery_LotteryBuy "${gamePriv1}" 1 12345 1
lottery_LotteryBuy "${gameAddr2}" 1 66666 2 lottery_LotteryBuy "${gamePriv2}" 1 66666 2
lottery_LotteryBuy "${gameAddr3}" 1 56789 5 lottery_LotteryBuy "${gamePriv3}" 1 56789 5
#查询 #查询
lottery_GetLotteryCurrentInfo "$gID" 2 3 lottery_GetLotteryCurrentInfo "$gID" 2 3
lottery_GetLotteryPurchaseAddr "$gID" 3 lottery_GetLotteryPurchaseAddr "$gID" 3
...@@ -420,8 +401,8 @@ function run_testcases() { ...@@ -420,8 +401,8 @@ function run_testcases() {
lottery_GetLotteryBuyRoundInfo "$gID" "${gameAddr2}" 1 1 "66666" lottery_GetLotteryBuyRoundInfo "$gID" "${gameAddr2}" 1 1 "66666"
#第二次投注 #第二次投注
lottery_LotteryBuy "${gameAddr1}" 1 12321 1 lottery_LotteryBuy "${gamePriv1}" 1 12321 1
lottery_LotteryBuy "${gameAddr3}" 1 78987 5 lottery_LotteryBuy "${gamePriv3}" 1 78987 5
#查询 #查询
lottery_GetLotteryCurrentInfo "$gID" 2 5 lottery_GetLotteryCurrentInfo "$gID" 2 5
lottery_GetLotteryPurchaseAddr "$gID" 3 lottery_GetLotteryPurchaseAddr "$gID" 3
...@@ -430,7 +411,7 @@ function run_testcases() { ...@@ -430,7 +411,7 @@ function run_testcases() {
#游戏开奖 #游戏开奖
block_wait ${drawNum} "${M_HTTP}" block_wait ${drawNum} "${M_HTTP}"
lottery_LotteryDraw "${lottery_creator_addr}" lottery_LotteryDraw "${lottery_creator_priv}"
lottery_GetLotteryCurrentInfo "$gID" 3 0 lottery_GetLotteryCurrentInfo "$gID" 3 0
#游戏查询 #游戏查询
...@@ -442,7 +423,7 @@ function run_testcases() { ...@@ -442,7 +423,7 @@ function run_testcases() {
lottery_GetLotteryRoundGainInfo "$gID" "${gameAddr3}" 1 2 lottery_GetLotteryRoundGainInfo "$gID" "${gameAddr3}" 1 2
#关闭游戏 #关闭游戏
lottery_LotteryClose "${lottery_creator_addr}" lottery_LotteryClose "${lottery_creator_priv}"
lottery_GetLotteryCurrentInfo "$gID" 4 0 lottery_GetLotteryCurrentInfo "$gID" 4 0
} }
......
...@@ -61,6 +61,10 @@ function para_set_wallet() { ...@@ -61,6 +61,10 @@ function para_set_wallet() {
para_import_key "${PARA_CLI}" "0x4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01" "test" para_import_key "${PARA_CLI}" "0x4257D8692EF7FE13C68B65D6A52F03933DB2FA5CE8FAF210B5B8B80C721CED01" "test"
#1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY #1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY
para_import_key "${PARA_CLI}" "0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588" "relay" para_import_key "${PARA_CLI}" "0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588" "relay"
#1PUiGcbsccfxW3zuvHXZBJfznziph5miAo
para_import_key "${PARA_CLI}" "0x56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138" "dapptest1"
#1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX
para_import_key "${PARA_CLI}" "0x2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989" "dapptest2"
#super node behalf test #super node behalf test
#1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj #1Ka7EPFRqs3v9yreXG6qA4RQbNmbPJCZPj
...@@ -117,6 +121,8 @@ function para_transfer() { ...@@ -117,6 +121,8 @@ function para_transfer() {
#relay rpc test #relay rpc test
para_transfer2account "12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv" para_transfer2account "12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
para_transfer2account "1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY" para_transfer2account "1E5saiXVb9mW8wcWUUZjsHJPZs5GmdzuSY"
para_transfer2account "1PUiGcbsccfxW3zuvHXZBJfznziph5miAo"
para_transfer2account "1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX"
block_wait "${CLI}" 2 block_wait "${CLI}" 2
echo "=========== # main chain send to paracross =============" echo "=========== # main chain send to paracross ============="
......
all:
chmod +x ./build.sh
./build.sh $(OUT) $(FLAG)
#!/bin/sh
strpwd=$(pwd)
strcmd=${strpwd##*dapp/}
strapp=${strcmd%/cmd*}
OUT_DIR="${1}/$strapp"
#FLAG=$2
mkdir -p "${OUT_DIR}"
cp ./build/* "${OUT_DIR}"
OUT_TESTDIR="${1}/dapptest/$strapp"
mkdir -p "${OUT_TESTDIR}"
cp ./build/test-rpc.sh "${OUT_TESTDIR}"
#!/usr/bin/env bash
# shellcheck disable=SC2128
set -e
set -o pipefail
MAIN_HTTP=""
GAME_ID=""
# shellcheck source=/dev/null
source ../dapp-test-common.sh
pokerbull_PlayRawTx() {
echo "========== # pokerbull play tx begin =========="
tx=$(curl -ksd '{"method":"Chain33.CreateTransaction","params":[{"execer":"pokerbull","actionName":"Play","payload":{"gameId":"pokerbull-abc", "value":"1000000000", "round":1}}]}' ${MAIN_HTTP} | jq -r ".result")
data=$(curl -ksd '{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]}' ${MAIN_HTTP} | jq -r ".result.txs[0]")
ok=$(jq '(.execer != "")' <<<"$data")
[ "$ok" == true ]
echo_rst "$FUNCNAME" "$?"
chain33_SignRawTx "$tx" "56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138" ${MAIN_HTTP}
echo "========== # pokerbull play tx end =========="
chain33_BlockWait 1 ${MAIN_HTTP}
}
pokerbull_QuitRawTx() {
echo "========== # pokerbull quit tx begin =========="
tx=$(curl -ksd '{"method":"Chain33.CreateTransaction","params":[{"execer":"pokerbull","actionName":"Quit","payload":{"gameId":"'$GAME_ID'"}}]}' ${MAIN_HTTP} | jq -r ".result")
data=$(curl -ksd '{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]}' ${MAIN_HTTP} | jq -r ".result.txs[0]")
ok=$(jq '(.execer != "")' <<<"$data")
[ "$ok" == true ]
echo_rst "$FUNCNAME" "$?"
chain33_SignRawTx "$tx" "56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138" ${MAIN_HTTP}
echo "========== # pokerbull quit tx end =========="
chain33_BlockWait 1 "${MAIN_HTTP}"
}
pokerbull_ContinueRawTx() {
echo "========== # pokerbull continue tx begin =========="
tx=$(curl -ksd '{"method":"Chain33.CreateTransaction","params":[{"execer":"pokerbull","actionName":"Continue","payload":{"gameId":"'$GAME_ID'"}}]}' ${MAIN_HTTP} | jq -r ".result")
data=$(curl -ksd '{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]}' ${MAIN_HTTP} | jq -r ".result.txs[0]")
ok=$(jq '(.execer != "")' <<<"$data")
[ "$ok" == true ]
echo_rst "$FUNCNAME" "$?"
chain33_SignRawTx "$tx" "2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989" ${MAIN_HTTP}
echo "========== # pokerbull continue tx end =========="
chain33_BlockWait 1 "${MAIN_HTTP}"
}
pokerbull_StartRawTx() {
echo "========== # pokerbull start tx begin =========="
tx=$(curl -ksd '{"method":"Chain33.CreateTransaction","params":[{"execer":"pokerbull","actionName":"Start","payload":{"value":"1000000000", "playerNum":"2"}}]}' ${MAIN_HTTP} | jq -r ".result")
data=$(curl -ksd '{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]}' ${MAIN_HTTP} | jq -r ".result.txs[0]")
ok=$(jq '(.execer != "")' <<<"$data")
[ "$ok" == true ]
echo_rst "$FUNCNAME" "$?"
chain33_SignRawTx "$tx" "56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138" ${MAIN_HTTP}
GAME_ID=$RAW_TX_HASH
echo "========== # pokerbull start tx end =========="
chain33_BlockWait 1 "${MAIN_HTTP}"
}
pokerbull_QueryResult() {
echo "========== # pokerbull query result begin =========="
local req='"method":"Chain33.Query","params":[{"execer":"pokerbull","funcName":"QueryGameByID","payload":{"gameId":"'$GAME_ID'"}}]'
data=$(curl -ksd "{$req}" ${MAIN_HTTP} | jq -r ".result")
ok=$(jq '(.game.gameId == "$GAME_ID")' <<<"$data")
[ "$ok" == true ]
echo_rst "$FUNCNAME" "$?"
data=$(curl -ksd '{"method":"Chain33.Query","params":[{"execer":"pokerbull","funcName":"QueryGameByAddr","payload":{"addr":"1PUiGcbsccfxW3zuvHXZBJfznziph5miAo"}}]}' ${MAIN_HTTP} | jq -r ".result")
[ "$data" != null ]
echo_rst "$FUNCNAME" "$?"
data=$(curl -ksd '{"method":"Chain33.Query","params":[{"execer":"pokerbull","funcName":"QueryGameByStatus","payload":{"status":"3"}}]}' ${MAIN_HTTP} | jq -r ".result")
[ "$data" != null ]
echo_rst "$FUNCNAME" "$?"
echo "========== # pokerbull query result end =========="
}
init() {
ispara=$(echo '"'"${MAIN_HTTP}"'"' | jq '.|contains("8901")')
echo "ipara=$ispara"
if [ "$ispara" == true ]; then
pokerbull_addr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"user.p.para.pokerbull"}]}' ${MAIN_HTTP} | jq -r ".result")
else
pokerbull_addr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"pokerbull"}]}' ${MAIN_HTTP} | jq -r ".result")
fi
local from="1PUiGcbsccfxW3zuvHXZBJfznziph5miAo"
chain33_SendToAddress "$from" "$pokerbull_addr" 10000000000 ${MAIN_HTTP}
from="1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX"
chain33_SendToAddress "$from" "$pokerbull_addr" 10000000000 ${MAIN_HTTP}
chain33_BlockWait 1 "${MAIN_HTTP}"
}
function run_test() {
pokerbull_StartRawTx
pokerbull_ContinueRawTx
pokerbull_QuitRawTx
pokerbull_PlayRawTx
pokerbull_QueryResult
}
function main() {
MAIN_HTTP="$1"
echo "=========== # pokerbull rpc test ============="
echo "ip=$MAIN_HTTP"
init
run_test
if [ -n "$CASE_ERR" ]; then
echo -e "${RED}=============Pokerbull Rpc Test Fail=============${NOC}"
exit 1
else
echo -e "${GRE}=============Pokerbull Rpc Test Pass==============${NOC}"
fi
}
main "$1"
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
package commands package cmd
import ( import (
"fmt" "fmt"
......
...@@ -6,7 +6,7 @@ package pokerbull ...@@ -6,7 +6,7 @@ package pokerbull
import ( import (
"github.com/33cn/chain33/pluginmgr" "github.com/33cn/chain33/pluginmgr"
"github.com/33cn/plugin/plugin/dapp/pokerbull/commands" "github.com/33cn/plugin/plugin/dapp/pokerbull/cmd"
"github.com/33cn/plugin/plugin/dapp/pokerbull/executor" "github.com/33cn/plugin/plugin/dapp/pokerbull/executor"
"github.com/33cn/plugin/plugin/dapp/pokerbull/types" "github.com/33cn/plugin/plugin/dapp/pokerbull/types"
) )
...@@ -16,6 +16,6 @@ func init() { ...@@ -16,6 +16,6 @@ func init() {
Name: types.PokerBullX, Name: types.PokerBullX,
ExecName: executor.GetName(), ExecName: executor.GetName(),
Exec: executor.Init, Exec: executor.Init,
Cmd: commands.PokerBullCmd, Cmd: cmd.PokerBullCmd,
}) })
} }
all:
chmod +x ./build.sh
./build.sh $(OUT) $(FLAG)
\ No newline at end of file
#!/bin/sh
strpwd=$(pwd)
strcmd=${strpwd##*dapp/}
strapp=${strcmd%/cmd*}
OUT_DIR="${1}/$strapp"
#FLAG=$2
mkdir -p "${OUT_DIR}"
cp ./build/* "${OUT_DIR}"
OUT_TESTDIR="${1}/dapptest/$strapp"
mkdir -p "${OUT_TESTDIR}"
cp ./build/test-rpc.sh "${OUT_TESTDIR}"
#!/usr/bin/env bash
# shellcheck disable=SC2128
set -e
set -o pipefail
MAIN_HTTP=""
# shellcheck source=/dev/null
source ../dapp-test-common.sh
retrieve_Backup() {
echo "========== # retrieve backup begin =========="
local req='"method":"retrieve.CreateRawRetrieveBackupTx","params":[{"backupAddr":"1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX","defaultAddr":"1PUiGcbsccfxW3zuvHXZBJfznziph5miAo","delayPeriod": 61}]'
tx=$(curl -ksd "{$req}" ${MAIN_HTTP} | jq -r ".result")
local reqDecode='"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]'
data=$(curl -ksd "{$reqDecode}" ${MAIN_HTTP} | jq -r ".result.txs[0]")
ok=$(jq '(.execer != "")' <<<"$data")
[ "$ok" == true ]
echo_rst "$FUNCNAME" "$?"
chain33_SignRawTx "$tx" "56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138" ${MAIN_HTTP}
echo "========== # retrieve backup end =========="
chain33_BlockWait 1 "${MAIN_HTTP}"
}
retrieve_Prepare() {
echo "========== # retrieve prepare begin =========="
local req='"method":"retrieve.CreateRawRetrievePrepareTx","params":[{"backupAddr":"1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX","defaultAddr":"1PUiGcbsccfxW3zuvHXZBJfznziph5miAo"}]'
tx=$(curl -ksd "{$req}" ${MAIN_HTTP} | jq -r ".result")
local reqDecode='"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]'
data=$(curl -ksd "{$reqDecode}" ${MAIN_HTTP} | jq -r ".result.txs[0]")
ok=$(jq '(.execer != "")' <<<"$data")
[ "$ok" == true ]
echo_rst "$FUNCNAME" "$?"
chain33_SignRawTx "$tx" "2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989" ${MAIN_HTTP}
echo "========== # retrieve prepare end =========="
chain33_BlockWait 1 "${MAIN_HTTP}"
}
retrieve_Perform() {
echo "========== # retrieve perform begin =========="
local req='"method":"retrieve.CreateRawRetrievePerformTx","params":[{"backupAddr":"1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX","defaultAddr":"1PUiGcbsccfxW3zuvHXZBJfznziph5miAo"}]'
tx=$(curl -ksd "{$req}" ${MAIN_HTTP} | jq -r ".result")
local reqDecode='"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]'
data=$(curl -ksd "{$reqDecode}" ${MAIN_HTTP} | jq -r ".result.txs[0]")
ok=$(jq '(.execer != "")' <<<"$data")
[ "$ok" == true ]
echo_rst "$FUNCNAME" "$?"
chain33_SignRawTx "$tx" "2116459C0EC8ED01AA0EEAE35CAC5C96F94473F7816F114873291217303F6989" ${MAIN_HTTP}
echo "========== # retrieve perform end =========="
chain33_BlockWait 1 "${MAIN_HTTP}"
}
retrieve_Cancel() {
echo "========== # retrieve cancel begin =========="
local req='"method":"retrieve.CreateRawRetrieveCancelTx","params":[{"backupAddr":"1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX","defaultAddr":"1PUiGcbsccfxW3zuvHXZBJfznziph5miAo"}]'
tx=$(curl -ksd "{$req}" ${MAIN_HTTP} | jq -r ".result")
local reqDecode='"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'"$tx"'"}]'
data=$(curl -ksd "{$reqDecode}" ${MAIN_HTTP} | jq -r ".result.txs[0]")
ok=$(jq '(.execer != "")' <<<"$data")
[ "$ok" == true ]
echo_rst "$FUNCNAME" "$?"
chain33_SignRawTx "$tx" "56942AD84CCF4788ED6DACBC005A1D0C4F91B63BCF0C99A02BE03C8DEAE71138" ${MAIN_HTTP}
echo "========== # retrieve cancel end =========="
chain33_BlockWait 1 "${MAIN_HTTP}"
}
retrieve_QueryResult() {
echo "========== # retrieve query result begin =========="
local status=$1
local req='"method":"Chain33.Query","params":[{"execer":"retrieve","funcName":"GetRetrieveInfo","payload":{"backupAddress":"1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX", "defaultAddress":"1PUiGcbsccfxW3zuvHXZBJfznziph5miAo"}}]'
data=$(curl -ksd "{$req}" ${MAIN_HTTP} | jq -r ".result")
ok=$(jq '(.status == '"$status"')' <<<"$data")
[ "$ok" == true ]
echo_rst "$FUNCNAME" "$?"
echo "========== # retrieve query result end =========="
}
init() {
ispara=$(echo '"'"${MAIN_HTTP}"'"' | jq '.|contains("8901")')
echo "ipara=$ispara"
if [ "$ispara" == true ]; then
retrieve_addr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"user.p.para.retrieve"}]}' ${MAIN_HTTP} | jq -r ".result")
else
retrieve_addr=$(curl -ksd '{"method":"Chain33.ConvertExectoAddr","params":[{"execname":"retrieve"}]}' ${MAIN_HTTP} | jq -r ".result")
fi
local from="1PUiGcbsccfxW3zuvHXZBJfznziph5miAo"
chain33_SendToAddress "$from" "$retrieve_addr" 1000000000 ${MAIN_HTTP}
from="1EDnnePAZN48aC2hiTDzhkczfF39g1pZZX"
chain33_SendToAddress "$from" "$retrieve_addr" 1000000000 ${MAIN_HTTP}
chain33_BlockWait 1 "${MAIN_HTTP}"
}
function run_test() {
retrieve_Backup
retrieve_QueryResult 1
retrieve_Prepare
retrieve_QueryResult 2
retrieve_Cancel
retrieve_QueryResult 4
retrieve_Backup
retrieve_QueryResult 1
retrieve_Prepare
retrieve_QueryResult 2
sleep 61
retrieve_Perform
retrieve_QueryResult 3
}
function main() {
MAIN_HTTP="$1"
echo "=========== # retrieve rpc test ============="
echo "ip=$MAIN_HTTP"
init
run_test
if [ -n "$CASE_ERR" ]; then
echo -e "${RED}=============retrieve Rpc Test Fail=============${NOC}"
exit 1
else
echo -e "${GRE}=============retrieve Rpc Test Pass==============${NOC}"
fi
}
main "$1"
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
package commands package cmd
import ( import (
"fmt" "fmt"
......
...@@ -6,7 +6,7 @@ package retrieve ...@@ -6,7 +6,7 @@ package retrieve
import ( import (
"github.com/33cn/chain33/pluginmgr" "github.com/33cn/chain33/pluginmgr"
"github.com/33cn/plugin/plugin/dapp/retrieve/commands" "github.com/33cn/plugin/plugin/dapp/retrieve/cmd"
"github.com/33cn/plugin/plugin/dapp/retrieve/executor" "github.com/33cn/plugin/plugin/dapp/retrieve/executor"
"github.com/33cn/plugin/plugin/dapp/retrieve/rpc" "github.com/33cn/plugin/plugin/dapp/retrieve/rpc"
"github.com/33cn/plugin/plugin/dapp/retrieve/types" "github.com/33cn/plugin/plugin/dapp/retrieve/types"
...@@ -17,7 +17,7 @@ func init() { ...@@ -17,7 +17,7 @@ func init() {
Name: types.RetrieveX, Name: types.RetrieveX,
ExecName: executor.GetName(), ExecName: executor.GetName(),
Exec: executor.Init, Exec: executor.Init,
Cmd: commands.RetrieveCmd, Cmd: cmd.RetrieveCmd,
RPC: rpc.Init, RPC: rpc.Init,
}) })
} }
...@@ -16,7 +16,7 @@ func (c *channelClient) Backup(ctx context.Context, v *rt.BackupRetrieve) (*type ...@@ -16,7 +16,7 @@ func (c *channelClient) Backup(ctx context.Context, v *rt.BackupRetrieve) (*type
Ty: rt.RetrieveActionBackup, Ty: rt.RetrieveActionBackup,
Value: &rt.RetrieveAction_Backup{Backup: v}, Value: &rt.RetrieveAction_Backup{Backup: v},
} }
tx, err := types.CreateFormatTx(string(rt.ExecerRetrieve), types.Encode(backup)) tx, err := types.CreateFormatTx(types.ExecName(rt.RetrieveX), types.Encode(backup))
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -29,7 +29,7 @@ func (c *channelClient) Prepare(ctx context.Context, v *rt.PrepareRetrieve) (*ty ...@@ -29,7 +29,7 @@ func (c *channelClient) Prepare(ctx context.Context, v *rt.PrepareRetrieve) (*ty
Ty: rt.RetrieveActionPrepare, Ty: rt.RetrieveActionPrepare,
Value: &rt.RetrieveAction_Prepare{Prepare: v}, Value: &rt.RetrieveAction_Prepare{Prepare: v},
} }
tx, err := types.CreateFormatTx(string(rt.ExecerRetrieve), types.Encode(prepare)) tx, err := types.CreateFormatTx(types.ExecName(rt.RetrieveX), types.Encode(prepare))
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -43,7 +43,7 @@ func (c *channelClient) Perform(ctx context.Context, v *rt.PerformRetrieve) (*ty ...@@ -43,7 +43,7 @@ func (c *channelClient) Perform(ctx context.Context, v *rt.PerformRetrieve) (*ty
Ty: rt.RetrieveActionPerform, Ty: rt.RetrieveActionPerform,
Value: &rt.RetrieveAction_Perform{Perform: v}, Value: &rt.RetrieveAction_Perform{Perform: v},
} }
tx, err := types.CreateFormatTx(string(rt.ExecerRetrieve), types.Encode(perform)) tx, err := types.CreateFormatTx(types.ExecName(rt.RetrieveX), types.Encode(perform))
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -56,7 +56,7 @@ func (c *channelClient) Cancel(ctx context.Context, v *rt.CancelRetrieve) (*type ...@@ -56,7 +56,7 @@ func (c *channelClient) Cancel(ctx context.Context, v *rt.CancelRetrieve) (*type
Ty: rt.RetrieveActionCancel, Ty: rt.RetrieveActionCancel,
Value: &rt.RetrieveAction_Cancel{Cancel: v}, Value: &rt.RetrieveAction_Cancel{Cancel: v},
} }
tx, err := types.CreateFormatTx(string(rt.ExecerRetrieve), types.Encode(cancel)) tx, err := types.CreateFormatTx(types.ExecName(rt.RetrieveX), types.Encode(cancel))
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
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