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
28fd68bd
Commit
28fd68bd
authored
Jan 25, 2019
by
linj
Committed by
vipwzw
Jan 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
impl cli with rpc call
parent
9b6676cd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
28 deletions
+33
-28
unfreeze.go
plugin/dapp/unfreeze/commands/unfreeze.go
+33
-28
No files found.
plugin/dapp/unfreeze/commands/unfreeze.go
View file @
28fd68bd
...
...
@@ -128,18 +128,15 @@ func fixAmount(cmd *cobra.Command, args []string) {
create
.
Means
=
pty
.
FixAmountX
create
.
MeansOpt
=
&
pty
.
UnfreezeCreate_FixAmount
{
FixAmount
:
&
pty
.
FixAmount
{
Period
:
period
,
Amount
:
amountInt64
}}
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
tx
,
err
:=
pty
.
CreateUnfreezeCreateTx
(
paraName
,
create
)
if
err
!=
nil
{
fmt
.
Fprintf
(
os
.
Stderr
,
"Create Tx frailed: %s"
,
err
)
return
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
pty
.
UnfreezeX
),
ActionName
:
"createUnfreeze"
,
Payload
:
types
.
MustPBToJSON
(
create
),
}
outputTx
(
tx
)
}
func
outputTx
(
tx
*
types
.
Transaction
)
{
txHex
:=
types
.
Encode
(
tx
)
fmt
.
Println
(
hex
.
EncodeToString
(
txHex
)
)
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.CreateTransaction"
,
params
,
nil
)
ctx
.
RunWithoutMarshal
(
)
}
func
leftCmd
()
*
cobra
.
Command
{
...
...
@@ -170,13 +167,15 @@ func left(cmd *cobra.Command, args []string) {
create
.
MeansOpt
=
&
pty
.
UnfreezeCreate_LeftProportion
{
LeftProportion
:
&
pty
.
LeftProportion
{
Period
:
period
,
TenThousandth
:
tenThousandth
}}
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
tx
,
err
:=
pty
.
CreateUnfreezeCreateTx
(
paraName
,
create
)
if
err
!=
nil
{
fmt
.
Fprintf
(
os
.
Stderr
,
"Create Tx frailed: %s"
,
err
)
return
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
pty
.
UnfreezeX
),
ActionName
:
pty
.
Action_CreateUnfreeze
,
Payload
:
types
.
MustPBToJSON
(
create
),
}
outputTx
(
tx
)
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.CreateTransaction"
,
params
,
nil
)
ctx
.
RunWithoutMarshal
()
}
func
withdrawCmd
()
*
cobra
.
Command
{
...
...
@@ -229,24 +228,30 @@ func queryWithdrawCmd() *cobra.Command {
func
withdraw
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
tx
,
err
:=
pty
.
CreateUnfreezeWithdrawTx
(
paraName
,
&
pty
.
UnfreezeWithdraw
{
UnfreezeID
:
id
})
if
err
!=
nil
{
fmt
.
Printf
(
"Create Tx frailed: %s"
,
err
)
return
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
pty
.
UnfreezeX
),
ActionName
:
pty
.
Action_WithdrawUnfreeze
,
Payload
:
types
.
MustPBToJSON
(
&
pty
.
UnfreezeWithdraw
{
UnfreezeID
:
id
}),
}
outputTx
(
tx
)
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.CreateTransaction"
,
params
,
nil
)
ctx
.
RunWithoutMarshal
()
}
func
terminate
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
id
,
_
:=
cmd
.
Flags
()
.
GetString
(
"id"
)
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
tx
,
err
:=
pty
.
CreateUnfreezeTerminateTx
(
paraName
,
&
pty
.
UnfreezeTerminate
{
UnfreezeID
:
id
})
if
err
!=
nil
{
fmt
.
Printf
(
"Create Tx frailed: %s"
,
err
)
return
params
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
pty
.
UnfreezeX
),
ActionName
:
pty
.
Action_TerminateUnfreeze
,
Payload
:
types
.
MustPBToJSON
(
&
pty
.
UnfreezeTerminate
{
UnfreezeID
:
id
}),
}
outputTx
(
tx
)
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.CreateTransaction"
,
params
,
nil
)
ctx
.
RunWithoutMarshal
()
}
func
queryWithdraw
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
...
...
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