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
88e26893
Commit
88e26893
authored
Sep 20, 2019
by
pengjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#484 update rpc_test evm
parent
bf16d0e5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
58 deletions
+22
-58
test-rpc.sh
plugin/dapp/evm/cmd/build/test-rpc.sh
+22
-58
No files found.
plugin/dapp/evm/cmd/build/test-rpc.sh
View file @
88e26893
...
...
@@ -9,8 +9,10 @@ CASE_ERR=""
evm_createContract_unsignedTx
=
"0a0365766d129407228405608060405234801561001057600080fd5b50610264806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063b8e010de1461003b578063cc80f6f314610045575b600080fd5b6100436100c2565b005b61004d610109565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561008757818101518382015260200161006f565b50505050905090810190601f1680156100b45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60408051808201909152600d8082527f5468697320697320746573742e000000000000000000000000000000000000006020909201918252610106916000916101a0565b50565b60008054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156101955780601f1061016a57610100808354040283529160200191610195565b820191906000526020600020905b81548152906001019060200180831161017857829003601f168201915b505050505090505b90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106101e157805160ff191683800117855561020e565b8280016001018555821561020e579182015b8281111561020e5782518255916020019190600101906101f3565b5061021a92915061021e565b5090565b61019d91905b8082111561021a576000815560010161022456fea165627a7a72305820fec5dd5ca2cb47523ba08c04749bc5c14c435afee039f3047c2b7ea2faca737800293a8a025b7b22636f6e7374616e74223a66616c73652c22696e70757473223a5b5d2c226e616d65223a22736574222c226f757470757473223a5b5d2c2270617961626c65223a66616c73652c2273746174654d75746162696c697479223a226e6f6e70617961626c65222c2274797065223a2266756e6374696f6e227d2c7b22636f6e7374616e74223a747275652c22696e70757473223a5b5d2c226e616d65223a2273686f77222c226f757470757473223a5b7b226e616d65223a22222c2274797065223a22737472696e67227d5d2c2270617961626c65223a66616c73652c2273746174654d75746162696c697479223a2276696577222c2274797065223a2266756e6374696f6e227d5d20c0c7ee04309aedc4bcfba5beca5f3a223139746a5335316b6a7772436f535153313355336f7765376759424c6653666f466d"
evm_createContract_para_unsignedTx
=
"0a0f757365722e702e706172612e65766d129407228405608060405234801561001057600080fd5b50610264806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063b8e010de1461003b578063cc80f6f314610045575b600080fd5b6100436100c2565b005b61004d610109565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561008757818101518382015260200161006f565b50505050905090810190601f1680156100b45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60408051808201909152600d8082527f5468697320697320746573742e000000000000000000000000000000000000006020909201918252610106916000916101a0565b50565b60008054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156101955780601f1061016a57610100808354040283529160200191610195565b820191906000526020600020905b81548152906001019060200180831161017857829003601f168201915b505050505090505b90565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106101e157805160ff191683800117855561020e565b8280016001018555821561020e579182015b8281111561020e5782518255916020019190600101906101f3565b5061021a92915061021e565b5090565b61019d91905b8082111561021a576000815560010161022456fea165627a7a7230582080ff1004de2195e6c08d0d0a65484b3d393c99c280e305cb383dbc89343cdd6a00293a8a025b7b22636f6e7374616e74223a66616c73652c22696e70757473223a5b5d2c226e616d65223a22736574222c226f757470757473223a5b5d2c2270617961626c65223a66616c73652c2273746174654d75746162696c697479223a226e6f6e70617961626c65222c2274797065223a2266756e6374696f6e227d2c7b22636f6e7374616e74223a747275652c22696e70757473223a5b5d2c226e616d65223a2273686f77222c226f757470757473223a5b7b226e616d65223a22222c2274797065223a22737472696e67227d5d2c2270617961626c65223a66616c73652c2273746174654d75746162696c697479223a2276696577222c2274797065223a2266756e6374696f6e227d5d20c0c7ee0430e1c7facdc1f199956c3a2231483969326a67464a594e5167573350695468694337796b7a5663653570764b7478"
evm_creatorAddr
=
"1PTXh2EZ8aRUzpuoDRASV19K86Kx3qQiPt"
evm_creatorAddr_key
=
"0x4947ce3c4b845cfed59be2edf47320546116a3ff3af5715a7df094d116039b89"
evm_contractAddr
=
""
evm_addr
=
""
txHash
=
""
#color
RED
=
'\033[1;31m'
...
...
@@ -32,19 +34,16 @@ function evm_createContract() {
expectRes
=
$2
if
[
"
$ispara
"
==
"true"
]
;
then
paraName
=
"user.p.para."
signRawTx
"
${
evm_createContract_para_unsignedTx
}
"
"
${
evm_creatorAddr
}
"
chain33_SignRawTx
"
${
evm_createContract_para_unsignedTx
}
"
"
${
evm_creatorAddr_key
}
"
"
$MAIN_HTTP
"
else
signRawTx
"
${
evm_createContract_unsignedTx
}
"
"
${
evm_creatorAddr
}
"
chain33_SignRawTx
"
${
evm_createContract_unsignedTx
}
"
"
${
evm_creatorAddr_key
}
"
"
$MAIN_HTTP
"
fi
echo_rst
"CreateContract signRawTx"
"
$?
"
sendSignedTx
echo_rst
"CreateContract sendSignedTx"
"
$?
"
txHash
=
$RAW_TX_HASH
queryTransaction
"
${
validator
}
"
"
${
expectRes
}
"
chain33_BlockWait 2
"
$MAIN_HTTP
"
echo
"CreateContract queryExecRes end
"
queryTransaction
"
${
validator
}
"
"
${
expectRes
}
"
echo_rst
"CreateContract queryExecRes"
"
$?
"
chain33_BlockWait 1
"
$MAIN_HTTP
"
}
function
evm_addressCheck
()
{
...
...
@@ -73,20 +72,12 @@ function evm_callContract() {
return
fi
signRawTx
"
${
unsignedTx
}
"
"
${
evm_creatorAddr
}
"
rst
=
$?
echo_rst
"CallContract signRawTx"
"
$rst
"
if
[
${
rst
}
==
1
]
;
then
return
fi
sendSignedTx
echo_rst
"CallContract sendSignedTx"
"
$?
"
chain33_BlockWait 2
"
$MAIN_HTTP
"
chain33_SignRawTx
"
${
unsignedTx
}
"
"
${
evm_creatorAddr_key
}
"
"
$MAIN_HTTP
"
txHash
=
$RAW_TX_HASH
queryTransaction
"
${
validator
}
"
"
${
expectRes
}
"
echo_rst
"CallContract queryExecRes"
"
$?
"
echo
"CallContract queryExecRes end"
chain33_BlockWait 1
"
$MAIN_HTTP
"
}
function
evm_abiGet
()
{
...
...
@@ -110,16 +101,12 @@ function evm_transfer() {
return
fi
signRawTx
"
${
unsignedTx
}
"
"
${
evm_creatorAddr
}
"
echo_rst
"evm transfer signRawTx"
"
$?
"
sendSignedTx
echo_rst
"evm transfer sendSignedTx"
"
$?
"
chain33_SignRawTx
"
${
unsignedTx
}
"
"
${
evm_creatorAddr_key
}
"
"
$MAIN_HTTP
"
txHash
=
$RAW_TX_HASH
queryTransaction
"
${
validator
}
"
"
${
expectRes
}
"
echo
"evm transfer queryExecRes end"
chain33_BlockWait 2
"
$MAIN_HTTP
"
queryTransaction
"
${
validator
}
"
"
${
expectRes
}
"
echo_rst
"evm transfer queryExecRes"
"
$?
"
}
function
evm_getBalance
()
{
...
...
@@ -146,35 +133,12 @@ function evm_withDraw() {
return
fi
signRawTx
"
${
unsignedTx
}
"
"
${
evm_creatorAddr
}
"
echo_rst
"evm withdraw signRawTx"
"
$?
"
sendSignedTx
echo_rst
"evm withdraw sendSignedTx"
"
$?
"
chain33_BlockWait 2
"
$MAIN_HTTP
"
chain33_SignRawTx
"
${
unsignedTx
}
"
"
${
evm_creatorAddr_key
}
"
"
$MAIN_HTTP
"
txHash
=
$RAW_TX_HASH
queryTransaction
"
${
validator
}
"
"
${
expectRes
}
"
echo_rst
"evm withdraw queryExecRes"
"
$?
"
}
function
signRawTx
()
{
unsignedTx
=
$1
addr
=
$2
signedTx
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"Chain33.SignRawTx","params":[{"addr":"'
"
${
addr
}
"
'","txHex":"'
"
${
unsignedTx
}
"
'","expire":"120s"}]}'
-H
'content-type:text/plain;'
${
MAIN_HTTP
}
| jq
-r
".result"
)
if
[
"
$signedTx
"
==
"null"
]
;
then
return
1
else
return
0
fi
}
echo
"evm withdraw queryExecRes end"
function
sendSignedTx
()
{
txHash
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"Chain33.SendTransaction","params":[{"token":"","data":"'
"
${
signedTx
}
"
'"}]}'
-H
'content-type:text/plain;'
${
MAIN_HTTP
}
| jq
-r
".result"
)
if
[
"
$txHash
"
==
"null"
]
;
then
return
1
else
return
0
fi
chain33_BlockWait 1
"
$MAIN_HTTP
"
}
# 查询交易的执行结果
...
...
@@ -182,7 +146,7 @@ function sendSignedTx() {
function
queryTransaction
()
{
validators
=
$1
expectRes
=
$2
echo
"tx
h
ash=
${
txHash
}
"
echo
"tx
H
ash=
${
txHash
}
"
res
=
$(
curl
-s
--data-binary
'{"jsonrpc":"2.0","id":2,"method":"Chain33.QueryTransaction","params":[{"hash":"'
"
${
txHash
}
"
'"}]}'
-H
'content-type:text/plain;'
${
MAIN_HTTP
})
...
...
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