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
ace156dc
Commit
ace156dc
authored
Sep 04, 2019
by
linj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update rpc & cli
parent
435f843a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletion
+33
-1
retrieve.go
plugin/dapp/retrieve/cmd/retrieve.go
+26
-1
tx.go
plugin/dapp/retrieve/rpc/tx.go
+7
-0
No files found.
plugin/dapp/retrieve/cmd/retrieve.go
View file @
ace156dc
...
@@ -107,6 +107,19 @@ func addRetrieveCmdFlags(cmd *cobra.Command) {
...
@@ -107,6 +107,19 @@ func addRetrieveCmdFlags(cmd *cobra.Command) {
cmd
.
Flags
()
.
Float64P
(
"fee"
,
"f"
,
defaultFee
,
"sign address"
)
cmd
.
Flags
()
.
Float64P
(
"fee"
,
"f"
,
defaultFee
,
"sign address"
)
}
}
func
addPerformCmdFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"backup"
,
"b"
,
""
,
"backup address"
)
cmd
.
MarkFlagRequired
(
"backup"
)
cmd
.
Flags
()
.
StringP
(
"default"
,
"t"
,
""
,
"default address"
)
cmd
.
MarkFlagRequired
(
"default"
)
cmd
.
Flags
()
.
StringArrayP
(
"exec"
,
"e"
,
[]
string
{},
"asset exec"
)
cmd
.
Flags
()
.
StringArrayP
(
"symbol"
,
"s"
,
[]
string
{},
"asset symbol"
)
defaultFee
:=
float64
(
types
.
GInt
(
"MinFee"
))
/
float64
(
types
.
Coin
)
cmd
.
Flags
()
.
Float64P
(
"fee"
,
"f"
,
defaultFee
,
"sign address"
)
}
func
prepareCmd
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
func
prepareCmd
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
backup
,
_
:=
cmd
.
Flags
()
.
GetString
(
"backup"
)
backup
,
_
:=
cmd
.
Flags
()
.
GetString
(
"backup"
)
...
@@ -130,7 +143,7 @@ func PerformCmd() *cobra.Command {
...
@@ -130,7 +143,7 @@ func PerformCmd() *cobra.Command {
Short
:
"Perform the retrieve"
,
Short
:
"Perform the retrieve"
,
Run
:
performCmd
,
Run
:
performCmd
,
}
}
add
Retrieve
CmdFlags
(
cmd
)
add
Perform
CmdFlags
(
cmd
)
return
cmd
return
cmd
}
}
...
@@ -140,12 +153,24 @@ func performCmd(cmd *cobra.Command, args []string) {
...
@@ -140,12 +153,24 @@ func performCmd(cmd *cobra.Command, args []string) {
defaultAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"default"
)
defaultAddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"default"
)
fee
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"fee"
)
fee
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"fee"
)
execs
,
_
:=
cmd
.
Flags
()
.
GetStringArray
(
"exec"
)
symbols
,
_
:=
cmd
.
Flags
()
.
GetStringArray
(
"symbol"
)
feeInt64
:=
int64
(
fee
*
types
.
InputPrecision
)
*
types
.
Multiple1E4
feeInt64
:=
int64
(
fee
*
types
.
InputPrecision
)
*
types
.
Multiple1E4
params
:=
rpc
.
RetrievePerformTx
{
params
:=
rpc
.
RetrievePerformTx
{
BackupAddr
:
backup
,
BackupAddr
:
backup
,
DefaultAddr
:
defaultAddr
,
DefaultAddr
:
defaultAddr
,
Assets
:
[]
rpc
.
Asset
{},
Fee
:
feeInt64
,
Fee
:
feeInt64
,
}
}
if
len
(
execs
)
!=
len
(
symbols
)
{
fmt
.
Printf
(
"exec count must equal to symbol count
\n
"
)
return
}
for
i
:=
0
;
i
<
len
(
execs
);
i
++
{
params
.
Assets
=
append
(
params
.
Assets
,
rpc
.
Asset
{
Exec
:
execs
[
i
],
Symbol
:
symbols
[
0
]})
}
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"retrieve.CreateRawRetrievePerformTx"
,
params
,
nil
)
ctx
:=
jsonrpc
.
NewRPCCtx
(
rpcLaddr
,
"retrieve.CreateRawRetrievePerformTx"
,
params
,
nil
)
ctx
.
RunWithoutMarshal
()
ctx
.
RunWithoutMarshal
()
}
}
...
...
plugin/dapp/retrieve/rpc/tx.go
View file @
ace156dc
...
@@ -19,10 +19,17 @@ type RetrievePrepareTx struct {
...
@@ -19,10 +19,17 @@ type RetrievePrepareTx struct {
Fee
int64
`json:"fee"`
Fee
int64
`json:"fee"`
}
}
// Asset Asset
type
Asset
struct
{
Exec
string
`json:"exec"`
Symbol
string
`json:"symbol"`
}
// RetrievePerformTx construction
// RetrievePerformTx construction
type
RetrievePerformTx
struct
{
type
RetrievePerformTx
struct
{
BackupAddr
string
`json:"backupAddr"`
BackupAddr
string
`json:"backupAddr"`
DefaultAddr
string
`json:"defaultAddr"`
DefaultAddr
string
`json:"defaultAddr"`
Assets
[]
Asset
`json:"assets"`
Fee
int64
`json:"fee"`
Fee
int64
`json:"fee"`
}
}
...
...
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