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
9534e195
Commit
9534e195
authored
May 15, 2019
by
mdj33
Committed by
vipwzw
May 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cp system rpc from chain33
parent
2d22e8bc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
15 deletions
+23
-15
.gitignore
.gitignore
+1
-0
Makefile
Makefile
+3
-2
docker-compose.sh
build/docker-compose.sh
+8
-6
test-rpc.sh
plugin/dapp/relay/cmd/test/test-rpc.sh
+11
-7
No files found.
.gitignore
View file @
9534e195
...
...
@@ -23,6 +23,7 @@ build/guodun
build/main.sh
build/main*
build/para.sh
build/system-test-rpc.sh
build/ci
build/autotest/*
!build/autotest/build.sh
...
...
Makefile
View file @
9534e195
...
...
@@ -25,12 +25,12 @@ default: build depends
build
:
@
go build
$(BUILD_FLAGS)
-v
-i
-o
$(APP)
@
go build
-v
-i
-o
$(CLI)
$(SRC_CLI)
@
cp
chain33.toml build/
@
cp
chain33.toml
$(CHAIN33_PATH)
/build/system-test-rpc.sh
build/
build_ci
:
depends
##
Build the binary file for CI
@
go build
-v
-i
-o
$(CLI)
$(SRC_CLI)
@
go build
$(BUILD_FLAGS)
-v
-o
$(APP)
@
cp
chain33.toml build/
@
cp
chain33.toml
$(CHAIN33_PATH)
/build/system-test-rpc.sh
build/
para
:
@
go build
-v
-o
build/
$(NAME)
-ldflags
"-X
$(SRC_CLI)
/buildflags.ParaName=user.p.
$(NAME)
. -X
$(SRC_CLI)
/buildflags.RPCAddr=http://localhost:8901"
$(SRC_CLI)
...
...
@@ -142,6 +142,7 @@ clean: ## Remove previous build
@
rm
-rf
build/logs
@
rm
-rf
build/autotest/autotest
@
rm
-rf
build/ci
@
rm
-rf
build/system-rpc-test.sh
@
rm
-rf
tool
@
go clean
...
...
build/docker-compose.sh
View file @
9534e195
...
...
@@ -333,15 +333,15 @@ function base_config() {
# transfer "${CLI4}"
}
function
base
_test
()
{
function
rpc
_test
()
{
if
[
"
$DAPP
"
==
""
]
;
then
system_test_rpc
"http://
${
1
}
:8801"
dapp_test_rpc
"http://
${
1
}
:8801"
fi
if
[
"
$DAPP
"
==
"paracross"
]
;
then
system_test_rpc
"http://
${
1
}
:8901"
dapp_test_rpc
"http://
${
1
}
:8901"
fi
#
if [ "$DAPP" == "paracross" ]; then
#
system_test_rpc "http://${1}:8901"
#
dapp_test_rpc "http://${1}:8901"
#
fi
}
function
dapp_run
()
{
...
...
@@ -365,9 +365,11 @@ function main() {
### test cases ###
ip
=
$(${
CLI
}
net info | jq
-r
".externalAddr[0:10]"
)
base_test
"
${
ip
}
"
dapp_run
test
"
${
ip
}
"
### rpc test ###
rpc_test
"
${
ip
}
"
### finish ###
check_docker_container
echo
"===============================DAPP=
$DAPP
main end========================================================="
...
...
plugin/dapp/relay/cmd/test/test-rpc.sh
View file @
9534e195
...
...
@@ -2,16 +2,19 @@
# shellcheck disable=SC2128
MAIN_HTTP
=
""
PARA_HTTP
=
""
CASE_ERR
=
""
UNIT_HTTP
=
""
#color
RED
=
'\033[1;31m'
GRE
=
'\033[1;32m'
NOC
=
'\033[0m'
# $2=0 means true, other false
echo_rst
()
{
if
[
"
$2
"
-eq
0
]
;
then
echo
"
$1
ok
"
echo
-e
"
${
GRE
}
$1
ok
${
NOC
}
"
else
echo
"
$1
err
"
echo
-e
"
${
RED
}
$1
fail
${
NOC
}
"
CASE_ERR
=
"err"
fi
...
...
@@ -65,11 +68,12 @@ Chain33_SendToAddress() {
req
=
'"method":"Chain33.SendToAddress", "params":[{"from":"'
"
$from
"
'","to":"'
"
$to
"
'", "amount":'
"
$amount
"
', "note":"test\n"}]'
# echo "#request: $req"
resp
=
$(
curl
-ksd
"{
$req
}"
"
${
MAIN_HTTP
}
"
)
echo
"#response:
$resp
"
#
echo "#response: $resp"
ok
=
$(
jq
'(.error|not) and (.result.hash|length==66)'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
echo_rst
"
$FUNCNAME
"
"
$?
"
# hash=$(jq '(.result.hash)' <<<"$resp")
hash
=
$(
jq
'(.result.hash)'
<<<
"
$resp
"
)
echo
"hash=
$hash
"
# query_tx "$hash"
}
...
...
@@ -97,7 +101,7 @@ sendTx() {
err
=
$(
jq
'(.error)'
<<<
"
$resp
"
)
txhash
=
$(
jq
-r
".result"
<<<
"
$resp
"
)
if
[
"
$err
"
==
null
]
;
then
echo
"tx hash:
$txhash
"
#
echo "tx hash: $txhash"
query_tx
"
$txhash
"
else
echo
"send tx error:
$err
"
...
...
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