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
526392a7
Commit
526392a7
authored
Nov 28, 2018
by
vipwzw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update chain33 && del query cli
parent
fe6bc6ff
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
148 additions
and
98 deletions
+148
-98
blackwhite.go
plugin/dapp/blackwhite/commands/blackwhite.go
+5
-4
jrpc_channel_test.go
plugin/dapp/blackwhite/rpc/jrpc_channel_test.go
+6
-5
evm.go
plugin/dapp/evm/commands/evm.go
+6
-6
game.go
plugin/dapp/pokerbull/commands/game.go
+4
-3
jrpc_channel_test.go
plugin/dapp/pokerbull/rpc/jrpc_channel_test.go
+2
-2
privacy.go
plugin/dapp/privacy/commands/privacy.go
+4
-4
rpc_channel_test.go
plugin/dapp/privacy/rpc/rpc_channel_test.go
+2
-2
relay.go
plugin/dapp/relay/commands/relay.go
+11
-10
jrpc_channel_test.go
plugin/dapp/relay/rpc/jrpc_channel_test.go
+4
-4
retrieve.go
plugin/dapp/retrieve/commands/retrieve.go
+3
-2
jrpc_channel_test.go
plugin/dapp/retrieve/rpc/jrpc_channel_test.go
+1
-1
ticket.go
plugin/dapp/ticket/commands/ticket.go
+2
-2
jrpc_channel_test.go
plugin/dapp/ticket/rpc/jrpc_channel_test.go
+1
-1
token.go
plugin/dapp/token/commands/token.go
+6
-6
jrpc_channel_test.go
plugin/dapp/token/rpc/jrpc_channel_test.go
+3
-3
trade.go
plugin/dapp/trade/commands/trade.go
+15
-14
jrpc_channel_test.go
plugin/dapp/trade/rpc/jrpc_channel_test.go
+7
-7
CHANGELOG.md
vendor/github.com/33cn/chain33/CHANGELOG.md
+4
-0
version.go
vendor/github.com/33cn/chain33/common/version/version.go
+1
-1
executor.go
vendor/github.com/33cn/chain33/executor/executor.go
+1
-0
executor_real_test.go
...or/github.com/33cn/chain33/executor/executor_real_test.go
+6
-2
jrpchandler.go
vendor/github.com/33cn/chain33/rpc/jrpchandler.go
+6
-1
server_test.go
vendor/github.com/33cn/chain33/rpc/server_test.go
+3
-2
types.go
vendor/github.com/33cn/chain33/rpc/types/types.go
+8
-0
stat.go
vendor/github.com/33cn/chain33/system/dapp/commands/stat.go
+2
-2
utils.go
...thub.com/33cn/chain33/system/dapp/commands/types/utils.go
+4
-0
version.go
...r/github.com/33cn/chain33/system/dapp/commands/version.go
+4
-2
config.go
...ub.com/33cn/chain33/system/dapp/manage/commands/config.go
+3
-2
config.go
vendor/github.com/33cn/chain33/types/config.go
+1
-1
types.go
vendor/github.com/33cn/chain33/types/types.go
+10
-7
util.go
vendor/github.com/33cn/chain33/util/util.go
+13
-2
No files found.
plugin/dapp/blackwhite/commands/blackwhite.go
View file @
526392a7
...
...
@@ -10,6 +10,7 @@ import (
"github.com/33cn/chain33/common"
jsonrpc
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes
"github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
gt
"github.com/33cn/plugin/plugin/dapp/blackwhite/types"
"github.com/spf13/cobra"
...
...
@@ -257,7 +258,7 @@ func showBlackwhiteInfo(cmd *cobra.Command, args []string) {
loopSeq
,
_
:=
cmd
.
Flags
()
.
GetUint32
(
"loopSeq"
)
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
var
rep
interface
{}
...
...
@@ -267,7 +268,7 @@ func showBlackwhiteInfo(cmd *cobra.Command, args []string) {
GameID
:
gameID
,
}
params
.
FuncName
=
gt
.
GetBlackwhiteRoundInfo
params
.
Payload
=
req
params
.
Payload
=
types
.
MustPBToJSON
(
&
req
)
rep
=
&
gt
.
ReplyBlackwhiteRoundInfo
{}
}
else
if
1
==
typ
{
req
:=
gt
.
ReqBlackwhiteRoundList
{
...
...
@@ -278,7 +279,7 @@ func showBlackwhiteInfo(cmd *cobra.Command, args []string) {
Index
:
index
,
}
params
.
FuncName
=
gt
.
GetBlackwhiteByStatusAndAddr
params
.
Payload
=
req
params
.
Payload
=
types
.
MustPBToJSON
(
&
req
)
rep
=
&
gt
.
ReplyBlackwhiteRoundList
{}
}
else
if
2
==
typ
{
req
:=
gt
.
ReqLoopResult
{
...
...
@@ -286,7 +287,7 @@ func showBlackwhiteInfo(cmd *cobra.Command, args []string) {
LoopSeq
:
int32
(
loopSeq
),
}
params
.
FuncName
=
gt
.
GetBlackwhiteloopResult
params
.
Payload
=
req
params
.
Payload
=
types
.
MustPBToJSON
(
&
req
)
rep
=
&
gt
.
ReplyLoopResults
{}
}
...
...
plugin/dapp/blackwhite/rpc/jrpc_channel_test.go
View file @
526392a7
...
...
@@ -10,6 +10,7 @@ import (
commonlog
"github.com/33cn/chain33/common/log"
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes
"github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util/testnode"
pty
"github.com/33cn/plugin/plugin/dapp/blackwhite/types"
...
...
@@ -83,7 +84,7 @@ func testTimeoutDoneTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
func
testRoundInfoCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
ReqBlackwhiteRoundInfo
{}
params
.
FuncName
=
pty
.
GetBlackwhiteRoundInfo
params
.
Payload
=
req
...
...
@@ -93,10 +94,10 @@ func testRoundInfoCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
func
testRoundListCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
ReqBlackwhiteRoundList
{}
params
.
FuncName
=
pty
.
GetBlackwhiteByStatusAndAddr
params
.
Payload
=
req
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
rep
=
&
pty
.
ReplyBlackwhiteRoundList
{}
return
jrpc
.
Call
(
"Chain33.Query"
,
params
,
rep
)
...
...
@@ -104,10 +105,10 @@ func testRoundListCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
func
testLoopResultCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
ReqLoopResult
{}
params
.
FuncName
=
pty
.
GetBlackwhiteloopResult
params
.
Payload
=
req
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
rep
=
&
pty
.
ReplyLoopResults
{}
return
jrpc
.
Call
(
"Chain33.Query"
,
params
,
rep
)
...
...
plugin/dapp/evm/commands/evm.go
View file @
526392a7
...
...
@@ -416,7 +416,7 @@ func estimateContract(cmd *cobra.Command, args []string) {
var
estGasReq
=
evmtypes
.
EstimateEVMGasReq
{
To
:
toAddr
,
Code
:
bCode
,
Caller
:
caller
,
Amount
:
amountInt64
}
var
estGasResp
evmtypes
.
EstimateEVMGasResp
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
query
:=
sendQuery
(
rpcLaddr
,
"EstimateGas"
,
estGasReq
,
&
estGasResp
)
query
:=
sendQuery
(
rpcLaddr
,
"EstimateGas"
,
&
estGasReq
,
&
estGasResp
)
if
query
{
fmt
.
Fprintf
(
os
.
Stdout
,
"gas cost estimate %v
\n
"
,
estGasResp
.
Gas
)
...
...
@@ -481,7 +481,7 @@ func checkContractAddr(cmd *cobra.Command, args []string) {
var
checkAddrReq
=
evmtypes
.
CheckEVMAddrReq
{
Addr
:
toAddr
}
var
checkAddrResp
evmtypes
.
CheckEVMAddrResp
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
query
:=
sendQuery
(
rpcLaddr
,
"CheckAddrExists"
,
checkAddrReq
,
&
checkAddrResp
)
query
:=
sendQuery
(
rpcLaddr
,
"CheckAddrExists"
,
&
checkAddrReq
,
&
checkAddrResp
)
if
query
&&
checkAddrResp
.
Contract
{
proto
.
MarshalText
(
os
.
Stdout
,
&
checkAddrResp
)
...
...
@@ -541,7 +541,7 @@ func evmDebugRPC(cmd *cobra.Command, flag int32) {
var
debugReq
=
evmtypes
.
EvmDebugReq
{
Optype
:
flag
}
var
debugResp
evmtypes
.
EvmDebugResp
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
query
:=
sendQuery
(
rpcLaddr
,
"EvmDebug"
,
debugReq
,
&
debugResp
)
query
:=
sendQuery
(
rpcLaddr
,
"EvmDebug"
,
&
debugReq
,
&
debugResp
)
if
query
{
proto
.
MarshalText
(
os
.
Stdout
,
&
debugResp
)
...
...
@@ -646,11 +646,11 @@ func evmWithdraw(cmd *cobra.Command, args []string) {
ctx
.
RunWithoutMarshal
()
}
func
sendQuery
(
rpcAddr
,
funcName
string
,
request
interface
{}
,
result
proto
.
Message
)
bool
{
params
:=
types
.
Query4Cli
{
func
sendQuery
(
rpcAddr
,
funcName
string
,
request
types
.
Message
,
result
proto
.
Message
)
bool
{
params
:=
rpctypes
.
Query4Jrpc
{
Execer
:
"evm"
,
FuncName
:
funcName
,
Payload
:
request
,
Payload
:
types
.
MustPBToJSON
(
request
)
,
}
jsonrpc
,
err
:=
jsonclient
.
NewJSONClient
(
rpcAddr
)
...
...
plugin/dapp/pokerbull/commands/game.go
View file @
526392a7
...
...
@@ -9,6 +9,7 @@ import (
"strconv"
jsonrpc
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes
"github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
pkt
"github.com/33cn/plugin/plugin/dapp/pokerbull/types"
"github.com/spf13/cobra"
...
...
@@ -166,7 +167,7 @@ func pokerbullQuery(cmd *cobra.Command, args []string) {
index
,
_
:=
strconv
.
ParseInt
(
indexstr
,
10
,
64
)
gameIDs
,
_
:=
cmd
.
Flags
()
.
GetString
(
"gameIDs"
)
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
pkt
.
PokerBullX
req
:=
&
pkt
.
QueryPBGameInfo
{
GameId
:
gameID
,
...
...
@@ -174,7 +175,7 @@ func pokerbullQuery(cmd *cobra.Command, args []string) {
Status
:
int32
(
status
),
Index
:
index
,
}
params
.
Payload
=
req
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
if
gameID
!=
""
{
params
.
FuncName
=
pkt
.
FuncNameQueryGameByID
var
res
pkt
.
ReplyPBGame
...
...
@@ -196,7 +197,7 @@ func pokerbullQuery(cmd *cobra.Command, args []string) {
gameIDsS
=
append
(
gameIDsS
,
gameIDs
)
gameIDsS
=
append
(
gameIDsS
,
gameIDs
)
req
:=
&
pkt
.
QueryPBGameInfos
{
GameIds
:
gameIDsS
}
params
.
Payload
=
req
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
var
res
pkt
.
ReplyPBGameList
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
Run
()
...
...
plugin/dapp/pokerbull/rpc/jrpc_channel_test.go
View file @
526392a7
...
...
@@ -75,7 +75,7 @@ func testQuitRawTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
func
testQueryGameByID
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
QueryPBGameInfo
{}
params
.
Execer
=
"pokerbull"
params
.
FuncName
=
"QueryGameByID"
...
...
@@ -86,7 +86,7 @@ func testQueryGameByID(t *testing.T, jrpc *jsonclient.JSONClient) error {
func
testQueryGameByAddr
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
QueryPBGameInfo
{}
params
.
Execer
=
"pokerbull"
params
.
FuncName
=
"QueryGameByAddr"
...
...
plugin/dapp/privacy/commands/privacy.go
View file @
526392a7
...
...
@@ -364,10 +364,10 @@ func showAmountOfUTXO(cmd *cobra.Command, args []string) {
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
reqPrivacyToken
:=
pty
.
ReqPrivacyToken
{
Token
:
types
.
BTY
}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
pty
.
PrivacyX
params
.
FuncName
=
"ShowAmountsOfUTXO"
params
.
Payload
=
reqPrivacyToken
params
.
Payload
=
types
.
MustPBToJSON
(
&
reqPrivacyToken
)
var
res
pty
.
ReplyPrivacyAmounts
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
...
...
@@ -407,10 +407,10 @@ func showUTXOs4SpecifiedAmount(cmd *cobra.Command, args []string) {
Token
:
types
.
BTY
,
Amount
:
amountInt64
,
}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
pty
.
PrivacyX
params
.
FuncName
=
"ShowUTXOs4SpecifiedAmount"
params
.
Payload
=
reqPrivacyToken
params
.
Payload
=
types
.
MustPBToJSON
(
&
reqPrivacyToken
)
var
res
pty
.
ReplyUTXOsOfAmount
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
...
...
plugin/dapp/privacy/rpc/rpc_channel_test.go
View file @
526392a7
...
...
@@ -145,7 +145,7 @@ func testPrivacy2Public(t *testing.T, jrpc *jsonclient.JSONClient) error {
func
testShowAmountsOfUTXO
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
reqPrivacyToken
:=
pty
.
ReqPrivacyToken
{
Token
:
types
.
BTY
}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
pty
.
PrivacyX
params
.
FuncName
=
"ShowAmountsOfUTXO"
params
.
Payload
=
reqPrivacyToken
...
...
@@ -160,7 +160,7 @@ func testShowUTXOs4SpecifiedAmount(t *testing.T, jrpc *jsonclient.JSONClient) er
Token
:
types
.
BTY
,
Amount
:
123456
,
}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
pty
.
PrivacyX
params
.
FuncName
=
"ShowUTXOs4SpecifiedAmount"
params
.
Payload
=
reqPrivacyToken
...
...
plugin/dapp/relay/commands/relay.go
View file @
526392a7
...
...
@@ -12,6 +12,7 @@ import (
"strings"
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes
"github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
ty
"github.com/33cn/plugin/plugin/dapp/relay/types"
"github.com/spf13/cobra"
...
...
@@ -75,10 +76,10 @@ func showBtcHeadHeightList(cmd *cobra.Command, args []string) {
reqList
.
Counts
=
count
reqList
.
Direction
=
direct
params
:=
types
.
Query4Cli
{
params
:=
rpctypes
.
Query4Jrpc
{
Execer
:
"relay"
,
FuncName
:
"GetBTCHeaderList"
,
Payload
:
reqList
,
Payload
:
types
.
MustPBToJSON
(
&
reqList
)
,
}
rpc
,
err
:=
jsonclient
.
NewJSONClient
(
rpcLaddr
)
if
err
!=
nil
{
...
...
@@ -119,10 +120,10 @@ func showBtcHeadCurHeight(cmd *cobra.Command, args []string) {
var
reqList
ty
.
ReqRelayQryBTCHeadHeight
reqList
.
BaseHeight
=
base
params
:=
types
.
Query4Cli
{
params
:=
rpctypes
.
Query4Jrpc
{
Execer
:
"relay"
,
FuncName
:
"GetBTCHeaderCurHeight"
,
Payload
:
reqList
,
Payload
:
types
.
MustPBToJSON
(
&
reqList
)
,
}
rpc
,
err
:=
jsonclient
.
NewJSONClient
(
rpcLaddr
)
if
err
!=
nil
{
...
...
@@ -170,10 +171,10 @@ func showOnesRelayOrders(cmd *cobra.Command, args []string) {
if
0
!=
len
(
coins
)
{
reqAddrCoins
.
Coins
=
append
(
reqAddrCoins
.
Coins
,
coins
...
)
}
params
:=
types
.
Query4Cli
{
params
:=
rpctypes
.
Query4Jrpc
{
Execer
:
"relay"
,
FuncName
:
"GetSellRelayOrder"
,
Payload
:
reqAddrCoins
,
Payload
:
types
.
MustPBToJSON
(
&
reqAddrCoins
)
,
}
rpc
,
err
:=
jsonclient
.
NewJSONClient
(
rpcLaddr
)
if
err
!=
nil
{
...
...
@@ -220,10 +221,10 @@ func showRelayAcceptOrders(cmd *cobra.Command, args []string) {
if
0
!=
len
(
coins
)
{
reqAddrCoins
.
Coins
=
append
(
reqAddrCoins
.
Coins
,
coins
...
)
}
params
:=
types
.
Query4Cli
{
params
:=
rpctypes
.
Query4Jrpc
{
Execer
:
"relay"
,
FuncName
:
"GetBuyRelayOrder"
,
Payload
:
reqAddrCoins
,
Payload
:
types
.
MustPBToJSON
(
&
reqAddrCoins
)
,
}
rpc
,
err
:=
jsonclient
.
NewJSONClient
(
rpcLaddr
)
if
err
!=
nil
{
...
...
@@ -275,10 +276,10 @@ func showCoinRelayOrders(cmd *cobra.Command, args []string) {
if
0
!=
len
(
coins
)
{
reqAddrCoins
.
Coins
=
append
(
reqAddrCoins
.
Coins
,
coins
...
)
}
params
:=
types
.
Query4Cli
{
params
:=
rpctypes
.
Query4Jrpc
{
Execer
:
"relay"
,
FuncName
:
"GetRelayOrderByStatus"
,
Payload
:
reqAddrCoins
,
Payload
:
types
.
MustPBToJSON
(
&
reqAddrCoins
)
,
}
rpc
,
err
:=
jsonclient
.
NewJSONClient
(
rpcLaddr
)
if
err
!=
nil
{
...
...
plugin/dapp/relay/rpc/jrpc_channel_test.go
View file @
526392a7
...
...
@@ -64,7 +64,7 @@ func TestJRPCChannel(t *testing.T) {
func
testShowOnesCreateRelayOrdersCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
ReqRelayAddrCoins
{}
params
.
Execer
=
"relay"
params
.
FuncName
=
"GetSellRelayOrder"
...
...
@@ -75,7 +75,7 @@ func testShowOnesCreateRelayOrdersCmd(t *testing.T, jrpc *jsonclient.JSONClient)
func
testShowOnesAcceptRelayOrdersCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
ReqRelayAddrCoins
{}
params
.
Execer
=
"relay"
params
.
FuncName
=
"GetBuyRelayOrder"
...
...
@@ -86,7 +86,7 @@ func testShowOnesAcceptRelayOrdersCmd(t *testing.T, jrpc *jsonclient.JSONClient)
func
testShowOnesStatusOrdersCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
ReqRelayAddrCoins
{}
params
.
Execer
=
"relay"
params
.
FuncName
=
"GetRelayOrderByStatus"
...
...
@@ -97,7 +97,7 @@ func testShowOnesStatusOrdersCmd(t *testing.T, jrpc *jsonclient.JSONClient) erro
func
testShowBTCHeadHeightListCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
ReqRelayBtcHeaderHeightList
{}
params
.
Execer
=
"relay"
params
.
FuncName
=
"GetBTCHeaderList"
...
...
plugin/dapp/retrieve/commands/retrieve.go
View file @
526392a7
...
...
@@ -8,6 +8,7 @@ import (
"fmt"
jsonrpc
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes
"github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
"github.com/33cn/plugin/plugin/dapp/retrieve/rpc"
rt
"github.com/33cn/plugin/plugin/dapp/retrieve/types"
...
...
@@ -226,10 +227,10 @@ func queryRetrieveCmd(cmd *cobra.Command, args []string) {
DefaultAddress
:
defaultAddr
,
}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
"retrieve"
params
.
FuncName
=
"GetRetrieveInfo"
params
.
Payload
=
req
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
var
res
rt
.
RetrieveQuery
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
...
...
plugin/dapp/retrieve/rpc/jrpc_channel_test.go
View file @
526392a7
...
...
@@ -77,7 +77,7 @@ func testCancelCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
func
testRetrieveQueryCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
ReqRetrieveInfo
{}
params
.
Execer
=
"retrieve"
params
.
FuncName
=
"GetRetrieveInfo"
...
...
plugin/dapp/ticket/commands/ticket.go
View file @
526392a7
...
...
@@ -182,10 +182,10 @@ func coldAddressOfMiner(cmd *cobra.Command, args []string) {
reqaddr
:=
&
types
.
ReqString
{
Data
:
addr
,
}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
"ticket"
params
.
FuncName
=
"MinerSourceList"
params
.
Payload
=
reqaddr
params
.
Payload
=
types
.
MustPBToJSON
(
reqaddr
)
var
res
types
.
ReplyStrings
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
...
...
plugin/dapp/ticket/rpc/jrpc_channel_test.go
View file @
526392a7
...
...
@@ -56,7 +56,7 @@ func testCloseTicketCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
func
testGetColdAddrByMinerCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
req
:=
&
types
.
ReqString
{}
params
.
Execer
=
"ticket"
params
.
FuncName
=
"MinerSourceList"
...
...
plugin/dapp/token/commands/token.go
View file @
526392a7
...
...
@@ -142,10 +142,10 @@ func getPreCreatedTokens(cmd *cobra.Command, args []string) {
var
reqtokens
tokenty
.
ReqTokens
reqtokens
.
Status
=
tokenty
.
TokenStatusPreCreated
reqtokens
.
QueryAll
=
true
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
getRealExecName
(
paraName
,
"token"
)
params
.
FuncName
=
"GetTokens"
params
.
Payload
=
reqtokens
params
.
Payload
=
types
.
MustPBToJSON
(
&
reqtokens
)
rpc
,
err
:=
jsonclient
.
NewJSONClient
(
rpcLaddr
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
...
...
@@ -188,10 +188,10 @@ func getFinishCreatedTokens(cmd *cobra.Command, args []string) {
var
reqtokens
tokenty
.
ReqTokens
reqtokens
.
Status
=
tokenty
.
TokenStatusCreated
reqtokens
.
QueryAll
=
true
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
getRealExecName
(
paraName
,
"token"
)
params
.
FuncName
=
"GetTokens"
params
.
Payload
=
reqtokens
params
.
Payload
=
types
.
MustPBToJSON
(
&
reqtokens
)
rpc
,
err
:=
jsonclient
.
NewJSONClient
(
rpcLaddr
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
...
...
@@ -249,10 +249,10 @@ func tokenAssets(cmd *cobra.Command, args []string) {
Execer
:
execer
,
}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
getRealExecName
(
paraName
,
"token"
)
params
.
FuncName
=
"GetAccountTokenAssets"
params
.
Payload
=
req
params
.
Payload
=
types
.
MustPBToJSON
(
&
req
)
var
res
tokenty
.
ReplyAccountTokenAssets
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
...
...
plugin/dapp/token/rpc/jrpc_channel_test.go
View file @
526392a7
...
...
@@ -54,7 +54,7 @@ func TestJRPCChannel(t *testing.T) {
func
testGetTokensPreCreatedCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
ReqTokens
{}
params
.
Execer
=
"token"
params
.
FuncName
=
"GetTokens"
...
...
@@ -64,7 +64,7 @@ func testGetTokensPreCreatedCmd(t *testing.T, jrpc *jsonclient.JSONClient) error
}
func
testGetTokensFinishCreatedCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
params
:=
types
.
Query4Cli
{
params
:=
rpctypes
.
Query4Jrpc
{
Execer
:
"token"
,
FuncName
:
"GetTokens"
,
Payload
:
pty
.
ReqTokens
{},
...
...
@@ -75,7 +75,7 @@ func testGetTokensFinishCreatedCmd(t *testing.T, jrpc *jsonclient.JSONClient) er
func
testGetTokenAssetsCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
ReqAccountTokenAssets
{}
params
.
Execer
=
"token"
params
.
FuncName
=
"GetAccountTokenAssets"
...
...
plugin/dapp/trade/commands/trade.go
View file @
526392a7
...
...
@@ -11,6 +11,7 @@ import (
"strings"
jsonrpc
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes
"github.com/33cn/chain33/rpc/types"
"github.com/33cn/chain33/types"
pty
"github.com/33cn/plugin/plugin/dapp/trade/types"
"github.com/spf13/cobra"
...
...
@@ -71,10 +72,10 @@ func showOnesSellOrders(cmd *cobra.Command, args []string) {
if
0
!=
len
(
tokens
)
{
reqAddrtokens
.
Token
=
append
(
reqAddrtokens
.
Token
,
tokens
...
)
}
params
:=
types
.
Query4Cli
{
params
:=
rpctypes
.
Query4Jrpc
{
Execer
:
"trade"
,
FuncName
:
"GetOnesSellOrder"
,
Payload
:
reqAddrtokens
,
Payload
:
types
.
MustPBToJSON
(
&
reqAddrtokens
)
,
}
var
res
pty
.
ReplySellOrders
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
...
...
@@ -113,10 +114,10 @@ func showOnesSellOrdersStatus(cmd *cobra.Command, args []string) {
reqAddrtokens
.
Status
=
statusInt
reqAddrtokens
.
Addr
=
addr
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
"trade"
params
.
FuncName
=
"GetOnesSellOrderWithStatus"
params
.
Payload
=
reqAddrtokens
params
.
Payload
=
types
.
MustPBToJSON
(
&
reqAddrtokens
)
var
res
pty
.
ReplySellOrders
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
SetResultCb
(
parseSellOrders
)
...
...
@@ -166,10 +167,10 @@ func showTokenSellOrdersStatus(cmd *cobra.Command, args []string) {
req
.
Direction
=
dir
req
.
FromKey
=
from
req
.
Status
=
statusInt
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
"trade"
params
.
FuncName
=
"GetTokenSellOrderByStatus"
params
.
Payload
=
req
params
.
Payload
=
types
.
MustPBToJSON
(
&
req
)
var
res
pty
.
ReplySellOrders
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
SetResultCb
(
parseSellOrders
)
...
...
@@ -229,10 +230,10 @@ func showOnesBuyOrders(cmd *cobra.Command, args []string) {
if
0
!=
len
(
tokens
)
{
reqAddrtokens
.
Token
=
append
(
reqAddrtokens
.
Token
,
tokens
...
)
}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
"trade"
params
.
FuncName
=
"GetOnesBuyOrder"
params
.
Payload
=
reqAddrtokens
params
.
Payload
=
types
.
MustPBToJSON
(
&
reqAddrtokens
)
var
res
pty
.
ReplyBuyOrders
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
SetResultCb
(
parseBuyOrders
)
...
...
@@ -269,10 +270,10 @@ func showOnesBuyOrdersStatus(cmd *cobra.Command, args []string) {
var
reqAddrtokens
pty
.
ReqAddrAssets
reqAddrtokens
.
Addr
=
buyer
reqAddrtokens
.
Status
=
statusInt
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
"trade"
params
.
FuncName
=
"GetOnesBuyOrderWithStatus"
params
.
Payload
=
reqAddrtokens
params
.
Payload
=
types
.
MustPBToJSON
(
&
reqAddrtokens
)
var
res
pty
.
ReplyBuyOrders
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
SetResultCb
(
parseBuyOrders
)
...
...
@@ -322,10 +323,10 @@ func showTokenBuyOrdersStatus(cmd *cobra.Command, args []string) {
req
.
Direction
=
dir
req
.
FromKey
=
from
req
.
Status
=
statusInt
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
"trade"
params
.
FuncName
=
"GetTokenBuyOrderByStatus"
params
.
Payload
=
req
params
.
Payload
=
types
.
MustPBToJSON
(
&
req
)
var
res
pty
.
ReplyBuyOrders
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
SetResultCb
(
parseBuyOrders
)
...
...
@@ -396,10 +397,10 @@ func showOnesOrdersStatus(cmd *cobra.Command, args []string) {
reqAddrtokens
.
Direction
=
dir
reqAddrtokens
.
FromKey
=
from
reqAddrtokens
.
Status
=
status
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
"trade"
params
.
FuncName
=
"GetOnesOrderWithStatus"
params
.
Payload
=
reqAddrtokens
params
.
Payload
=
types
.
MustPBToJSON
(
&
reqAddrtokens
)
var
res
pty
.
ReplyTradeOrders
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
ctx
.
SetResultCb
(
parseTradeOrders
)
...
...
plugin/dapp/trade/rpc/jrpc_channel_test.go
View file @
526392a7
...
...
@@ -75,7 +75,7 @@ func testCreateRawTradeRevokeTxCmd(t *testing.T, jrpc *jsonclient.JSONClient) er
}
func
testShowOnesSellOrdersCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
params
:=
types
.
Query4Cli
{
params
:=
rpctypes
.
Query4Jrpc
{
Execer
:
"trade"
,
FuncName
:
"GetOnesSellOrder"
,
Payload
:
pty
.
ReqAddrAssets
{},
...
...
@@ -86,7 +86,7 @@ func testShowOnesSellOrdersCmd(t *testing.T, jrpc *jsonclient.JSONClient) error
func
testShowOnesSellOrdersStatusCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
ReqAddrAssets
{}
params
.
Execer
=
"trade"
params
.
FuncName
=
"GetOnesSellOrderWithStatus"
...
...
@@ -97,7 +97,7 @@ func testShowOnesSellOrdersStatusCmd(t *testing.T, jrpc *jsonclient.JSONClient)
func
testShowTokenSellOrdersStatusCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
ReqTokenSellOrder
{}
params
.
Execer
=
"trade"
params
.
FuncName
=
"GetTokenSellOrderByStatus"
...
...
@@ -109,7 +109,7 @@ func testShowTokenSellOrdersStatusCmd(t *testing.T, jrpc *jsonclient.JSONClient)
func
testShowOnesBuyOrderCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
ReqAddrAssets
{}
params
.
Execer
=
"trade"
params
.
FuncName
=
"GetOnesBuyOrder"
...
...
@@ -121,7 +121,7 @@ func testShowOnesBuyOrderCmd(t *testing.T, jrpc *jsonclient.JSONClient) error {
func
testShowOnesBuyOrdersStatusCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
ReqAddrAssets
{}
params
.
Execer
=
"trade"
params
.
FuncName
=
"GetOnesBuyOrderWithStatus"
...
...
@@ -133,7 +133,7 @@ func testShowOnesBuyOrdersStatusCmd(t *testing.T, jrpc *jsonclient.JSONClient) e
func
testShowTokenBuyOrdersStatusCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
ReqTokenBuyOrder
{}
params
.
Execer
=
"trade"
params
.
FuncName
=
"GetTokenBuyOrderByStatus"
...
...
@@ -145,7 +145,7 @@ func testShowTokenBuyOrdersStatusCmd(t *testing.T, jrpc *jsonclient.JSONClient)
func
testShowOnesOrdersStatusCmd
(
t
*
testing
.
T
,
jrpc
*
jsonclient
.
JSONClient
)
error
{
var
rep
interface
{}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
req
:=
&
pty
.
ReqAddrAssets
{}
params
.
Execer
=
"trade"
params
.
FuncName
=
"GetOnesOrderWithStatus"
...
...
vendor/github.com/33cn/chain33/CHANGELOG.md
View file @
526392a7
...
...
@@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
## [Unreleased]
## [6.0.2]
### Changed
-
changed cli version cmd return json format and added title app localdb version info
## [6.0.1]
### Changed
-
Update configuration files from p2p/verMix to p2p/verMin from
[
@libangzhu
](
https://github.com/libangzhu
)
.
...
...
vendor/github.com/33cn/chain33/common/version/version.go
View file @
526392a7
...
...
@@ -4,7 +4,7 @@
package
version
const
version
=
"6.0.
1
"
const
version
=
"6.0.
2
"
//var
var
(
...
...
vendor/github.com/33cn/chain33/executor/executor.go
100644 → 100755
View file @
526392a7
...
...
@@ -138,6 +138,7 @@ func (exec *Executor) procExecQuery(msg queue.Message) {
db
:=
NewStateDB
(
exec
.
client
,
data
.
StateHash
,
localdb
,
opt
)
db
.
(
*
StateDB
)
.
enableMVCC
()
driver
.
SetStateDB
(
db
)
driver
.
SetAPI
(
exec
.
qclient
)
//查询的情况下下,执行器不做严格校验,allow,尽可能的加载执行器,并且做查询
...
...
vendor/github.com/33cn/chain33/executor/executor_real_test.go
View file @
526392a7
...
...
@@ -232,9 +232,13 @@ func TestExecBlock(t *testing.T) {
func
BenchmarkExecBlock
(
b
*
testing
.
B
)
{
mock33
:=
newMockNode
()
defer
mock33
.
Close
()
block
:=
util
.
CreateNoneBlock
(
mock33
.
GetGenesisKey
(),
10000
)
block
:=
util
.
CreateCoinsBlock
(
mock33
.
GetGenesisKey
(),
10000
)
mock33
.
WaitHeight
(
0
)
block0
:=
mock33
.
GetBlock
(
0
)
account
:=
mock33
.
GetAccount
(
block0
.
StateHash
,
mock33
.
GetGenesisAddress
())
assert
.
Equal
(
b
,
int64
(
10000000000000000
),
account
.
Balance
)
b
.
StartTimer
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
util
.
ExecBlock
(
mock33
.
GetClient
(),
nil
,
block
,
false
,
true
)
util
.
ExecBlock
(
mock33
.
GetClient
(),
block0
.
StateHash
,
block
,
false
,
true
)
}
}
vendor/github.com/33cn/chain33/rpc/jrpchandler.go
View file @
526392a7
...
...
@@ -897,7 +897,12 @@ func (c *Chain33) DumpPrivkey(in types.ReqString, result *interface{}) error {
// Version version
func
(
c
*
Chain33
)
Version
(
in
*
types
.
ReqNil
,
result
*
interface
{})
error
{
*
result
=
version
.
GetVersion
()
*
result
=
&
rpctypes
.
NodeVersion
{
Title
:
types
.
GetTitle
(),
App
:
version
.
GetAppVersion
(),
Chain33
:
version
.
GetVersion
(),
LocalDb
:
version
.
GetLocalDBVersion
(),
}
return
nil
}
...
...
vendor/github.com/33cn/chain33/rpc/server_test.go
View file @
526392a7
...
...
@@ -75,9 +75,10 @@ func TestJSONClient_Call(t *testing.T) {
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
jsonClient
)
err
=
jsonClient
.
Call
(
"Chain33.Version"
,
nil
,
&
result
)
var
nodeVersion
rpctypes
.
NodeVersion
err
=
jsonClient
.
Call
(
"Chain33.Version"
,
nil
,
&
nodeVersion
)
assert
.
Nil
(
t
,
err
)
assert
.
NotEmpty
(
t
,
result
)
assert
.
Equal
(
t
,
"6.0.2"
,
nodeVersion
.
Chain33
)
var
isSnyc
bool
err
=
jsonClient
.
Call
(
"Chain33.IsSync"
,
&
types
.
ReqNil
{},
&
isSnyc
)
...
...
vendor/github.com/33cn/chain33/rpc/types/types.go
View file @
526392a7
...
...
@@ -305,6 +305,14 @@ type NodeNetinfo struct {
Inbounds
int32
`json:"inbounds"`
}
// NodeVersion node version
type
NodeVersion
struct
{
Title
string
`json:"title"`
App
string
`json:"app"`
Chain33
string
`json:"chain33"`
LocalDb
string
`json:"localDb"`
}
// ReplyPrivacyPkPair reply privekey pubkey pair
type
ReplyPrivacyPkPair
struct
{
ShowSuccessful
bool
`json:"showSuccessful,omitempty"`
...
...
vendor/github.com/33cn/chain33/system/dapp/commands/stat.go
View file @
526392a7
...
...
@@ -145,11 +145,11 @@ func totalCoins(cmd *cobra.Command, args []string) {
}
else
{
var
req
types
.
ReqString
req
.
Data
=
symbol
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
"token"
// 查询Token的总量
params
.
FuncName
=
"GetTotalAmount"
params
.
Payload
=
req
params
.
Payload
=
types
.
MustPBToJSON
(
&
req
)
var
res
types
.
TotalAmount
//查询Token总量
...
...
vendor/github.com/33cn/chain33/system/dapp/commands/types/utils.go
View file @
526392a7
...
...
@@ -80,6 +80,10 @@ func CreateRawTx(cmd *cobra.Command, to string, amount float64, note string, isW
if
amount
<
0
{
return
""
,
types
.
ErrAmount
}
if
float64
(
types
.
MaxCoin
/
types
.
Coin
)
<
amount
{
return
""
,
types
.
ErrAmount
}
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
amountInt64
:=
int64
(
math
.
Trunc
((
amount
+
0.0000001
)
*
1e4
))
*
1e4
initExecName
:=
execName
...
...
vendor/github.com/33cn/chain33/system/dapp/commands/version.go
View file @
526392a7
...
...
@@ -6,6 +6,7 @@ package commands
import
(
"github.com/33cn/chain33/rpc/jsonclient"
"github.com/33cn/chain33/rpc/types"
"github.com/spf13/cobra"
)
...
...
@@ -22,7 +23,8 @@ func VersionCmd() *cobra.Command {
func
version
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
var
res
types
.
NodeVersion
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Version"
,
nil
,
&
res
)
ctx
.
Run
()
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Version"
,
nil
,
nil
)
ctx
.
RunWithoutMarshal
()
}
vendor/github.com/33cn/chain33/system/dapp/manage/commands/config.go
View file @
526392a7
...
...
@@ -12,6 +12,7 @@ import (
"github.com/33cn/chain33/util"
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes
"github.com/33cn/chain33/rpc/types"
pty
"github.com/33cn/chain33/system/dapp/manage/types"
"github.com/33cn/chain33/types"
"github.com/spf13/cobra"
...
...
@@ -101,10 +102,10 @@ func queryConfig(cmd *cobra.Command, args []string) {
req
:=
&
types
.
ReqString
{
Data
:
key
,
}
var
params
types
.
Query4Cli
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
util
.
GetParaExecName
(
paraName
,
"manage"
)
params
.
FuncName
=
"GetConfigItem"
params
.
Payload
=
req
params
.
Payload
=
types
.
MustPBToJSON
(
req
)
var
res
types
.
ReplyConfig
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.Query"
,
params
,
&
res
)
...
...
vendor/github.com/33cn/chain33/types/config.go
View file @
526392a7
...
...
@@ -33,7 +33,7 @@ var (
// coin conversation
const
(
Coin
int64
=
1e8
MaxCoin
int64
=
1e17
MaxCoin
int64
=
9e18
MaxTxSize
=
100000
//100K
MaxTxGroupSize
int32
=
20
MaxBlockSize
=
20000000
//20M
...
...
vendor/github.com/33cn/chain33/types/types.go
View file @
526392a7
...
...
@@ -18,6 +18,7 @@ import (
log
"github.com/33cn/chain33/common/log/log15"
"github.com/33cn/chain33/types/jsonpb"
"github.com/golang/protobuf/proto"
// 注册system的crypto 加密算法
_
"github.com/33cn/chain33/system/crypto/init"
)
...
...
@@ -30,13 +31,6 @@ const Size1Kshiftlen uint = 10
// Message 声明proto.Message
type
Message
proto
.
Message
// Query4Cli cli命令行查询格式
type
Query4Cli
struct
{
Execer
string
`json:"execer"`
FuncName
string
`json:"funcName"`
Payload
interface
{}
`json:"payload"`
}
//TxGroup 交易组的接口,Transactions 和 Transaction 都符合这个接口
type
TxGroup
interface
{
Tx
()
*
Transaction
...
...
@@ -429,6 +423,15 @@ func PBToJSON(r Message) ([]byte, error) {
return
buf
.
Bytes
(),
nil
}
//MustPBToJSON panic when error
func
MustPBToJSON
(
req
Message
)
[]
byte
{
data
,
err
:=
PBToJSON
(
req
)
if
err
!=
nil
{
panic
(
err
)
}
return
data
}
// MustDecode 数据是否已经编码
func
MustDecode
(
data
[]
byte
,
v
interface
{})
{
err
:=
json
.
Unmarshal
(
data
,
v
)
...
...
vendor/github.com/33cn/chain33/util/util.go
View file @
526392a7
...
...
@@ -78,7 +78,7 @@ func GenNoneTxs(priv crypto.PrivKey, n int64) (txs []*types.Transaction) {
func
GenCoinsTxs
(
priv
crypto
.
PrivKey
,
n
int64
)
(
txs
[]
*
types
.
Transaction
)
{
to
,
_
:=
Genaddress
()
for
i
:=
0
;
i
<
int
(
n
);
i
++
{
txs
=
append
(
txs
,
CreateCoinsTx
(
priv
,
to
,
types
.
Coin
*
(
n
+
1
)
))
txs
=
append
(
txs
,
CreateCoinsTx
(
priv
,
to
,
n
+
1
))
}
return
txs
}
...
...
@@ -188,7 +188,7 @@ var zeroHash [32]byte
// CreateNoneBlock : Create None Block
func
CreateNoneBlock
(
priv
crypto
.
PrivKey
,
n
int64
)
*
types
.
Block
{
newblock
:=
&
types
.
Block
{}
newblock
.
Height
=
-
1
newblock
.
Height
=
1
newblock
.
BlockTime
=
types
.
Now
()
.
Unix
()
newblock
.
ParentHash
=
zeroHash
[
:
]
newblock
.
Txs
=
GenNoneTxs
(
priv
,
n
)
...
...
@@ -196,6 +196,17 @@ func CreateNoneBlock(priv crypto.PrivKey, n int64) *types.Block {
return
newblock
}
//CreateCoinsBlock : create coins block, n size
func
CreateCoinsBlock
(
priv
crypto
.
PrivKey
,
n
int64
)
*
types
.
Block
{
newblock
:=
&
types
.
Block
{}
newblock
.
Height
=
1
newblock
.
BlockTime
=
types
.
Now
()
.
Unix
()
newblock
.
ParentHash
=
zeroHash
[
:
]
newblock
.
Txs
=
GenCoinsTxs
(
priv
,
n
)
newblock
.
TxHash
=
merkle
.
CalcMerkleRoot
(
newblock
.
Txs
)
return
newblock
}
// ExecBlock : just exec block
func
ExecBlock
(
client
queue
.
Client
,
prevStateRoot
[]
byte
,
block
*
types
.
Block
,
errReturn
bool
,
sync
bool
)
(
*
types
.
BlockDetail
,
[]
*
types
.
Transaction
,
error
)
{
//发送执行交易给execs模块
...
...
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