Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
43695c65
Commit
43695c65
authored
May 24, 2019
by
pengjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add rpc-test debug info
parent
9e60b908
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
7 deletions
+27
-7
test-rpc.sh
plugin/dapp/pokerbull/cmd/build/test-rpc.sh
+10
-0
test-rpc.sh
plugin/dapp/retrieve/cmd/build/test-rpc.sh
+17
-7
No files found.
plugin/dapp/pokerbull/cmd/build/test-rpc.sh
View file @
43695c65
...
@@ -64,6 +64,7 @@ function query_tx() {
...
@@ -64,6 +64,7 @@ function query_tx() {
}
}
pokerbull_PlayRawTx
()
{
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"
)
tx
=
$(
curl
-ksd
'{"method":"Chain33.CreateTransaction","params":[{"execer":"pokerbull","actionName":"Play","payload":{"gameId":"pokerbull-abc", "value":"1000000000", "round":1}}]}'
${
MAIN_HTTP
}
| jq
-r
".result"
)
PLAY_TX
=
$tx
PLAY_TX
=
$tx
...
@@ -74,9 +75,11 @@ pokerbull_PlayRawTx() {
...
@@ -74,9 +75,11 @@ pokerbull_PlayRawTx() {
echo_rst
"
$FUNCNAME
"
"
$?
"
echo_rst
"
$FUNCNAME
"
"
$?
"
signrawtx
"
$tx
"
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
"play"
signrawtx
"
$tx
"
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
"play"
echo
"========== # pokerbull play tx end =========="
}
}
pokerbull_QuitRawTx
()
{
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"
)
tx
=
$(
curl
-ksd
'{"method":"Chain33.CreateTransaction","params":[{"execer":"pokerbull","actionName":"Quit","payload":{"gameId":"'
$GAME_ID
'"}}]}'
${
MAIN_HTTP
}
| jq
-r
".result"
)
QUIT_TX
=
$tx
QUIT_TX
=
$tx
...
@@ -87,9 +90,11 @@ pokerbull_QuitRawTx() {
...
@@ -87,9 +90,11 @@ pokerbull_QuitRawTx() {
echo_rst
"
$FUNCNAME
"
"
$?
"
echo_rst
"
$FUNCNAME
"
"
$?
"
signrawtx
"
$tx
"
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
"quit"
signrawtx
"
$tx
"
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
"quit"
echo
"========== # pokerbull quit tx end =========="
}
}
pokerbull_ContinueRawTx
()
{
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"
)
tx
=
$(
curl
-ksd
'{"method":"Chain33.CreateTransaction","params":[{"execer":"pokerbull","actionName":"Continue","payload":{"gameId":"'
$GAME_ID
'"}}]}'
${
MAIN_HTTP
}
| jq
-r
".result"
)
CONTINUE_TX
=
$tx
CONTINUE_TX
=
$tx
...
@@ -100,9 +105,11 @@ pokerbull_ContinueRawTx() {
...
@@ -100,9 +105,11 @@ pokerbull_ContinueRawTx() {
echo_rst
"
$FUNCNAME
"
"
$?
"
echo_rst
"
$FUNCNAME
"
"
$?
"
signrawtx
"
$tx
"
"0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588"
"continue"
signrawtx
"
$tx
"
"0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588"
"continue"
echo
"========== # pokerbull continue tx end =========="
}
}
pokerbull_StartRawTx
()
{
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"
)
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]"
)
data
=
$(
curl
-ksd
'{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'
"
$tx
"
'"}]}'
${
MAIN_HTTP
}
| jq
-r
".result.txs[0]"
)
...
@@ -112,9 +119,11 @@ pokerbull_StartRawTx() {
...
@@ -112,9 +119,11 @@ pokerbull_StartRawTx() {
echo_rst
"
$FUNCNAME
"
"
$?
"
echo_rst
"
$FUNCNAME
"
"
$?
"
signrawtx
"
$tx
"
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
"start"
signrawtx
"
$tx
"
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
"start"
echo
"========== # pokerbull start tx end =========="
}
}
pokerbull_QueryResult
()
{
pokerbull_QueryResult
()
{
echo
"========== # pokerbull query result begin =========="
data
=
$(
curl
-ksd
'{"method":"Chain33.Query","params":[{"execer":"pokerbull","funcName":"QueryGameByID","payload":{"gameId":"'
$GAME_ID
'"}}]}'
${
MAIN_HTTP
}
| jq
-r
".result"
)
data
=
$(
curl
-ksd
'{"method":"Chain33.Query","params":[{"execer":"pokerbull","funcName":"QueryGameByID","payload":{"gameId":"'
$GAME_ID
'"}}]}'
${
MAIN_HTTP
}
| jq
-r
".result"
)
ok
=
$(
jq
'(.game.gameId == "'
$GAME_ID
'")'
<<<
"
$data
"
)
ok
=
$(
jq
'(.game.gameId == "'
$GAME_ID
'")'
<<<
"
$data
"
)
...
@@ -128,6 +137,7 @@ pokerbull_QueryResult() {
...
@@ -128,6 +137,7 @@ pokerbull_QueryResult() {
data
=
$(
curl
-ksd
'{"method":"Chain33.Query","params":[{"execer":"pokerbull","funcName":"QueryGameByStatus","payload":{"status":"3"}}]}'
${
MAIN_HTTP
}
| jq
-r
".result"
)
data
=
$(
curl
-ksd
'{"method":"Chain33.Query","params":[{"execer":"pokerbull","funcName":"QueryGameByStatus","payload":{"status":"3"}}]}'
${
MAIN_HTTP
}
| jq
-r
".result"
)
[
"
$data
"
!=
null
]
[
"
$data
"
!=
null
]
echo_rst
"
$FUNCNAME
"
"
$?
"
echo_rst
"
$FUNCNAME
"
"
$?
"
echo
"========== # pokerbull query result end =========="
}
}
chain33_ImportPrivkey
()
{
chain33_ImportPrivkey
()
{
...
...
plugin/dapp/retrieve/cmd/build/test-rpc.sh
View file @
43695c65
...
@@ -63,6 +63,7 @@ function query_tx() {
...
@@ -63,6 +63,7 @@ function query_tx() {
}
}
retrieve_Backup
()
{
retrieve_Backup
()
{
echo
"========== # retrieve backup begin =========="
tx
=
$(
curl
-ksd
'{"method":"retrieve.CreateRawRetrieveBackupTx","params":[{"backupAddr":"'
$1
'","defaultAddr":"'
$2
'","delayPeriod":'
$3
'}]}'
${
MAIN_HTTP
}
| jq
-r
".result"
)
tx
=
$(
curl
-ksd
'{"method":"retrieve.CreateRawRetrieveBackupTx","params":[{"backupAddr":"'
$1
'","defaultAddr":"'
$2
'","delayPeriod":'
$3
'}]}'
${
MAIN_HTTP
}
| jq
-r
".result"
)
data
=
$(
curl
-ksd
'{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'
"
$tx
"
'"}]}'
${
MAIN_HTTP
}
| jq
-r
".result.txs[0]"
)
data
=
$(
curl
-ksd
'{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'
"
$tx
"
'"}]}'
${
MAIN_HTTP
}
| jq
-r
".result.txs[0]"
)
...
@@ -72,9 +73,11 @@ retrieve_Backup() {
...
@@ -72,9 +73,11 @@ retrieve_Backup() {
echo_rst
"
$FUNCNAME
"
"
$?
"
echo_rst
"
$FUNCNAME
"
"
$?
"
signrawtx
"
$tx
"
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
signrawtx
"
$tx
"
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
echo
"========== # retrieve backup end =========="
}
}
retrieve_Prepare
()
{
retrieve_Prepare
()
{
echo
"========== # retrieve prepare begin =========="
tx
=
$(
curl
-ksd
'{"method":"retrieve.CreateRawRetrievePrepareTx","params":[{"backupAddr":"'
$1
'","defaultAddr":"'
$2
'"}]}'
${
MAIN_HTTP
}
| jq
-r
".result"
)
tx
=
$(
curl
-ksd
'{"method":"retrieve.CreateRawRetrievePrepareTx","params":[{"backupAddr":"'
$1
'","defaultAddr":"'
$2
'"}]}'
${
MAIN_HTTP
}
| jq
-r
".result"
)
data
=
$(
curl
-ksd
'{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'
"
$tx
"
'"}]}'
${
MAIN_HTTP
}
| jq
-r
".result.txs[0]"
)
data
=
$(
curl
-ksd
'{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'
"
$tx
"
'"}]}'
${
MAIN_HTTP
}
| jq
-r
".result.txs[0]"
)
...
@@ -84,9 +87,11 @@ retrieve_Prepare() {
...
@@ -84,9 +87,11 @@ retrieve_Prepare() {
echo_rst
"
$FUNCNAME
"
"
$?
"
echo_rst
"
$FUNCNAME
"
"
$?
"
signrawtx
"
$tx
"
"0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588"
signrawtx
"
$tx
"
"0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588"
echo
"========== # retrieve prepare end =========="
}
}
retrieve_Perform
()
{
retrieve_Perform
()
{
echo
"========== # retrieve perform begin =========="
tx
=
$(
curl
-ksd
'{"method":"retrieve.CreateRawRetrievePerformTx","params":[{"backupAddr":"'
$1
'","defaultAddr":"'
$2
'"}]}'
${
MAIN_HTTP
}
| jq
-r
".result"
)
tx
=
$(
curl
-ksd
'{"method":"retrieve.CreateRawRetrievePerformTx","params":[{"backupAddr":"'
$1
'","defaultAddr":"'
$2
'"}]}'
${
MAIN_HTTP
}
| jq
-r
".result"
)
data
=
$(
curl
-ksd
'{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'
"
$tx
"
'"}]}'
${
MAIN_HTTP
}
| jq
-r
".result.txs[0]"
)
data
=
$(
curl
-ksd
'{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'
"
$tx
"
'"}]}'
${
MAIN_HTTP
}
| jq
-r
".result.txs[0]"
)
...
@@ -96,9 +101,11 @@ retrieve_Perform() {
...
@@ -96,9 +101,11 @@ retrieve_Perform() {
echo_rst
"
$FUNCNAME
"
"
$?
"
echo_rst
"
$FUNCNAME
"
"
$?
"
signrawtx
"
$tx
"
"0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588"
signrawtx
"
$tx
"
"0x9c451df9e5cb05b88b28729aeaaeb3169a2414097401fcb4c79c1971df734588"
echo
"========== # retrieve perform end =========="
}
}
retrieve_Cancel
()
{
retrieve_Cancel
()
{
echo
"========== # retrieve cancel begin =========="
tx
=
$(
curl
-ksd
'{"method":"retrieve.CreateRawRetrieveCancelTx","params":[{"backupAddr":"'
$1
'","defaultAddr":"'
$2
'"}]}'
${
MAIN_HTTP
}
| jq
-r
".result"
)
tx
=
$(
curl
-ksd
'{"method":"retrieve.CreateRawRetrieveCancelTx","params":[{"backupAddr":"'
$1
'","defaultAddr":"'
$2
'"}]}'
${
MAIN_HTTP
}
| jq
-r
".result"
)
data
=
$(
curl
-ksd
'{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'
"
$tx
"
'"}]}'
${
MAIN_HTTP
}
| jq
-r
".result.txs[0]"
)
data
=
$(
curl
-ksd
'{"method":"Chain33.DecodeRawTransaction","params":[{"txHex":"'
"
$tx
"
'"}]}'
${
MAIN_HTTP
}
| jq
-r
".result.txs[0]"
)
...
@@ -108,14 +115,17 @@ retrieve_Cancel() {
...
@@ -108,14 +115,17 @@ retrieve_Cancel() {
echo_rst
"
$FUNCNAME
"
"
$?
"
echo_rst
"
$FUNCNAME
"
"
$?
"
signrawtx
"
$tx
"
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
signrawtx
"
$tx
"
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
echo
"========== # retrieve cancel end =========="
}
}
retrieve_QueryResult
()
{
retrieve_QueryResult
()
{
echo
"========== # retrieve query result begin =========="
data
=
$(
curl
-ksd
'{"method":"Chain33.Query","params":[{"execer":"retrieve","funcName":"GetRetrieveInfo","payload":{"backupAddress":"'
$1
'", "defaultAddress":"'
$2
'"}}]}'
${
MAIN_HTTP
}
| jq
-r
".result"
)
data
=
$(
curl
-ksd
'{"method":"Chain33.Query","params":[{"execer":"retrieve","funcName":"GetRetrieveInfo","payload":{"backupAddress":"'
$1
'", "defaultAddress":"'
$2
'"}}]}'
${
MAIN_HTTP
}
| jq
-r
".result"
)
ok
=
$(
jq
'(.status == '
$3
')'
<<<
"
$data
"
)
ok
=
$(
jq
'(.status == '
$3
')'
<<<
"
$data
"
)
[
"
$ok
"
==
true
]
[
"
$ok
"
==
true
]
echo_rst
"
$FUNCNAME
"
"
$?
"
echo_rst
"
$FUNCNAME
"
"
$?
"
echo
"========== # retrieve query result end =========="
}
}
chain33_ImportPrivkey
()
{
chain33_ImportPrivkey
()
{
...
@@ -136,9 +146,9 @@ signrawtx() {
...
@@ -136,9 +146,9 @@ signrawtx() {
priKey
=
"
$2
"
priKey
=
"
$2
"
type
=
"
$3
"
type
=
"
$3
"
local
req
=
'"method":"Chain33.SignRawTx","params":[{"privkey":"'
"
$priKey
"
'","txHex":"'
"
$txHex
"
'","expire":"120s"}]'
local
req
=
'"method":"Chain33.SignRawTx","params":[{"privkey":"'
"
$priKey
"
'","txHex":"'
"
$txHex
"
'","expire":"120s"}]'
#
echo "#request SignRawTx: $req"
echo
"#request SignRawTx:
$req
"
signedTx
=
$(
curl
-ksd
"{
$req
}"
${
MAIN_HTTP
}
| jq
-r
".result"
)
signedTx
=
$(
curl
-ksd
"{
$req
}"
${
MAIN_HTTP
}
| jq
-r
".result"
)
#
echo "signedTx=$signedTx"
echo
"signedTx=
$signedTx
"
if
[
"
$signedTx
"
!=
null
]
;
then
if
[
"
$signedTx
"
!=
null
]
;
then
sendTx
"
$signedTx
"
sendTx
"
$signedTx
"
else
else
...
@@ -149,13 +159,13 @@ signrawtx() {
...
@@ -149,13 +159,13 @@ signrawtx() {
sendTx
()
{
sendTx
()
{
signedTx
=
$1
signedTx
=
$1
local
req
=
'"method":"Chain33.SendTransaction","params":[{"token":"BTY","data":"'
"
$signedTx
"
'"}]'
local
req
=
'"method":"Chain33.SendTransaction","params":[{"token":"BTY","data":"'
"
$signedTx
"
'"}]'
#
echo "#request sendTx: $req"
echo
"#request sendTx:
$req
"
# curl -ksd "{$req}" ${MAIN_HTTP}
# curl -ksd "{$req}" ${MAIN_HTTP}
resp
=
$(
curl
-ksd
"{
$req
}"
${
MAIN_HTTP
})
resp
=
$(
curl
-ksd
"{
$req
}"
${
MAIN_HTTP
})
err
=
$(
jq
'(.error)'
<<<
"
$resp
"
)
err
=
$(
jq
'(.error)'
<<<
"
$resp
"
)
txhash
=
$(
jq
-r
".result"
<<<
"
$resp
"
)
txhash
=
$(
jq
-r
".result"
<<<
"
$resp
"
)
if
[
"
$err
"
==
null
]
;
then
if
[
"
$err
"
==
null
]
;
then
#
echo "tx hash: $txhash"
echo
"tx hash:
$txhash
"
query_tx
"
$txhash
"
query_tx
"
$txhash
"
else
else
echo
"send tx error:
$err
"
echo
"send tx error:
$err
"
...
@@ -168,15 +178,15 @@ Chain33_SendToAddress() {
...
@@ -168,15 +178,15 @@ Chain33_SendToAddress() {
local
to
=
"
$2
"
local
to
=
"
$2
"
local
amount
=
$3
local
amount
=
$3
local
req
=
'"method":"Chain33.SendToAddress", "params":[{"from":"'
"
$from
"
'","to":"'
"
$to
"
'", "amount":'
"
$amount
"
', "note":"test\n"}]'
local
req
=
'"method":"Chain33.SendToAddress", "params":[{"from":"'
"
$from
"
'","to":"'
"
$to
"
'", "amount":'
"
$amount
"
', "note":"test\n"}]'
#
echo "#request: $req"
echo
"#request:
$req
"
resp
=
$(
curl
-ksd
"{
$req
}"
"
${
MAIN_HTTP
}
"
)
resp
=
$(
curl
-ksd
"{
$req
}"
"
${
MAIN_HTTP
}
"
)
#
echo "#response: $resp"
echo
"#response:
$resp
"
ok
=
$(
jq
'(.error|not) and (.result.hash|length==66)'
<<<
"
$resp
"
)
ok
=
$(
jq
'(.error|not) and (.result.hash|length==66)'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
[
"
$ok
"
==
true
]
echo_rst
"
$FUNCNAME
"
"
$?
"
echo_rst
"
$FUNCNAME
"
"
$?
"
hash
=
$(
jq
'(.result.hash)'
<<<
"
$resp
"
)
hash
=
$(
jq
'(.result.hash)'
<<<
"
$resp
"
)
echo
"hash=
$hash
"
echo
"hash=
$hash
"
#
query_tx "$hash"
query_tx
"
$hash
"
}
}
init
()
{
init
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment