Commit 098d0214 authored by vipwzw's avatar vipwzw

auto ci

parent 87c266d9
...@@ -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
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