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
f6e7b46b
Commit
f6e7b46b
authored
Jun 04, 2019
by
张振华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
8687a4d2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
dapp-test-common.sh
build/dapp-test-common.sh
+28
-1
test-rpc.sh
plugin/dapp/guess/cmd/build/test-rpc.sh
+0
-0
No files found.
build/dapp-test-common.sh
View file @
f6e7b46b
...
...
@@ -106,7 +106,7 @@ chain33_ImportPrivkey() {
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
=
$(
jq
'(
((.error|not) and (.result.label=="'
"
$label
"
'") and (.result.acc.addr == "'
"
$acc
"
'")) or (.error=="ErrPrivkeyExist")
)'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
}
...
...
@@ -125,3 +125,29 @@ chain33_SignRawTx() {
echo
"signedTx null error"
fi
}
chain33_QueryBalance
()
{
local
addr
=
$1
local
MAIN_HTTP
=
$2
req
=
'"method":"Chain33.GetAllExecBalance","params":[{"addr":"'
"
${
addr
}
"
'"}]'
#echo "#request: $req"
resp
=
$(
curl
-ksd
"{
$req
}"
"
${
MAIN_HTTP
}
"
)
echo
"#response:
$resp
"
ok
=
$(
jq
'(.error|not) and (.result != "")'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
echo
"
$resp
"
| jq
-r
".result"
}
chain33_QueryExecBalance
()
{
local
addr
=
$1
local exec
=
$2
local
MAIN_HTTP
=
$3
req
=
'{"method":"Chain33.GetBalance", "params":[{"addresses" : ["'
"
${
addr
}
"
'"], "execer" : "'
"
${
exec
}
"
'"}]}'
resp
=
$(
curl
-ksd
"
$req
"
"
${
MAIN_HTTP
}
"
)
echo
"#response:
$resp
"
ok
=
$(
jq
'(.error|not) and (.result[0] | [has("balance", "frozen"), true] | unique | length == 1)'
<<<
"
$resp
"
)
[
"
$ok
"
==
true
]
echo_rst
"
$FUNCNAME
"
"
$?
"
}
\ No newline at end of file
plugin/dapp/guess/cmd/build/test-rpc.sh
View file @
f6e7b46b
This diff is collapsed.
Click to expand it.
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