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
098d0214
Commit
098d0214
authored
May 29, 2019
by
vipwzw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto ci
parent
87c266d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
7 deletions
+4
-7
test-rpc.sh
plugin/dapp/token/cmd/build/test-rpc.sh
+4
-7
No files found.
plugin/dapp/token/cmd/build/test-rpc.sh
View file @
098d0214
...
@@ -10,7 +10,6 @@ tokenSymbol="ABE"
...
@@ -10,7 +10,6 @@ tokenSymbol="ABE"
token_addr
=
""
token_addr
=
""
execName
=
"token"
execName
=
"token"
#color
#color
RED
=
'\033[1;31m'
RED
=
'\033[1;31m'
GRE
=
'\033[1;32m'
GRE
=
'\033[1;32m'
...
@@ -175,7 +174,7 @@ function token_preCreate() {
...
@@ -175,7 +174,7 @@ function token_preCreate() {
function
token_getPreCreated
()
{
function
token_getPreCreated
()
{
res
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"Chain33.Query","params":[{"execer":"'
"
${
execName
}
"
'","funcName":"GetTokens","payload":{"queryAll":true,"status":0,"tokens":[],"symbolOnly":false}}]}'
-H
'content-type:text/plain;'
${
MAIN_HTTP
}
| jq
-r
".error | not"
)
res
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"Chain33.Query","params":[{"execer":"'
"
${
execName
}
"
'","funcName":"GetTokens","payload":{"queryAll":true,"status":0,"tokens":[],"symbolOnly":false}}]}'
-H
'content-type:text/plain;'
${
MAIN_HTTP
}
| jq
-r
".error | not"
)
if
[
"
${
res
}
"
!=
"true"
]
;
then
if
[
"
${
res
}
"
!=
"true"
]
;
then
echo_rst
"token preCreate create tx"
1
echo_rst
"token preCreate create tx"
1
return
return
fi
fi
...
@@ -218,7 +217,7 @@ function token_assets() {
...
@@ -218,7 +217,7 @@ function token_assets() {
return
return
fi
fi
tokenInfo
=
$(
echo
"
${
res
}
"
| jq
-r
'.result.tokenAssets'
|
grep
-A
6
-B
1
"
${
tokenSymbol
}
"
)
tokenInfo
=
$(
echo
"
${
res
}
"
| jq
-r
'.result.tokenAssets'
|
grep
-A
6
-B
1
"
${
tokenSymbol
}
"
)
addr
=
$(
echo
"
${
tokenInfo
}
"
|
grep
"addr"
|
awk
-F
'"'
'{print $4}'
)
addr
=
$(
echo
"
${
tokenInfo
}
"
|
grep
"addr"
|
awk
-F
'"'
'{print $4}'
)
balance
=
$(
echo
"
${
tokenInfo
}
"
|
grep
"balance"
|
awk
-F
'"'
'{print $4}'
)
balance
=
$(
echo
"
${
tokenInfo
}
"
|
grep
"balance"
|
awk
-F
'"'
'{print $4}'
)
...
@@ -230,7 +229,7 @@ function token_assets() {
...
@@ -230,7 +229,7 @@ function token_assets() {
}
}
function
token_balance
()
{
function
token_balance
()
{
res
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"token.GetTokenBalance","params":[{"addresses": ["'
${
tokenAddr
}
'"],"tokenSymbol":"'
"
${
tokenSymbol
}
"
'","execer": "'
"
${
execName
}
"
'"}]}'
-H
'content-type:text/plain;'
${
MAIN_HTTP
}
)
res
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"token.GetTokenBalance","params":[{"addresses": ["'
${
tokenAddr
}
'"],"tokenSymbol":"'
"
${
tokenSymbol
}
"
'","execer": "'
"
${
execName
}
"
'"}]}'
-H
'content-type:text/plain;'
${
MAIN_HTTP
})
if
[
"
${
res
}
"
==
""
]
;
then
if
[
"
${
res
}
"
==
""
]
;
then
echo_rst
"token get balance tx"
1
echo_rst
"token get balance tx"
1
...
@@ -366,7 +365,6 @@ function token_sendExec() {
...
@@ -366,7 +365,6 @@ function token_sendExec() {
fi
fi
}
}
function
token_withdraw
()
{
function
token_withdraw
()
{
unsignedTx
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"Chain33.CreateTransaction","params":[{"execer": "'
"
${
execName
}
"
'","actionName":"Withdraw","payload": {"cointoken":"'
"
${
tokenSymbol
}
"
'", "amount": "10", "note": "", "to": "'
"
${
token_addr
}
"
'", "execName": "'
"
${
execName
}
"
'"}}]}'
-H
'content-type:text/plain;'
${
MAIN_HTTP
}
| jq
-r
".result"
)
unsignedTx
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"Chain33.CreateTransaction","params":[{"execer": "'
"
${
execName
}
"
'","actionName":"Withdraw","payload": {"cointoken":"'
"
${
tokenSymbol
}
"
'", "amount": "10", "note": "", "to": "'
"
${
token_addr
}
"
'", "execName": "'
"
${
execName
}
"
'"}}]}'
-H
'content-type:text/plain;'
${
MAIN_HTTP
}
| jq
-r
".result"
)
if
[
"
${
unsignedTx
}
"
==
""
]
;
then
if
[
"
${
unsignedTx
}
"
==
""
]
;
then
...
@@ -431,4 +429,4 @@ function main() {
...
@@ -431,4 +429,4 @@ function main() {
fi
fi
}
}
main
"
$1
"
main
"
$1
"
\ No newline at end of file
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