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
3f671512
Commit
3f671512
authored
Dec 31, 2019
by
hxzqlh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
token add Query_GetAccountTokenBalance
parent
8cac51a7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
0 deletions
+40
-0
query.go
plugin/dapp/token/executor/query.go
+7
-0
token.go
plugin/dapp/token/executor/token.go
+33
-0
No files found.
plugin/dapp/token/executor/query.go
View file @
3f671512
...
@@ -59,6 +59,13 @@ func (t *token) Query_GetAccountTokenAssets(in *tokenty.ReqAccountTokenAssets) (
...
@@ -59,6 +59,13 @@ func (t *token) Query_GetAccountTokenAssets(in *tokenty.ReqAccountTokenAssets) (
return
t
.
getAccountTokenAssets
(
in
)
return
t
.
getAccountTokenAssets
(
in
)
}
}
func
(
t
*
token
)
Query_GetAccountTokenBalance
(
in
*
tokenty
.
ReqTokenBalance
)
(
types
.
Message
,
error
)
{
if
in
==
nil
{
return
nil
,
types
.
ErrInvalidParam
}
return
t
.
getAccountTokenBalance
(
in
)
}
// Query_GetTxByToken 获取token相关交易
// Query_GetTxByToken 获取token相关交易
func
(
t
*
token
)
Query_GetTxByToken
(
in
*
tokenty
.
ReqTokenTx
)
(
types
.
Message
,
error
)
{
func
(
t
*
token
)
Query_GetTxByToken
(
in
*
tokenty
.
ReqTokenTx
)
(
types
.
Message
,
error
)
{
if
in
==
nil
{
if
in
==
nil
{
...
...
plugin/dapp/token/executor/token.go
View file @
3f671512
...
@@ -124,6 +124,39 @@ func (t *token) getAccountTokenAssets(req *tokenty.ReqAccountTokenAssets) (types
...
@@ -124,6 +124,39 @@ func (t *token) getAccountTokenAssets(req *tokenty.ReqAccountTokenAssets) (types
return
reply
,
nil
return
reply
,
nil
}
}
func
(
t
*
token
)
getAccountTokenBalance
(
req
*
tokenty
.
ReqTokenBalance
)
(
types
.
Message
,
error
)
{
var
reply
=
&
tokenty
.
ReplyAccountTokenAssets
{}
cfg
:=
t
.
GetAPI
()
.
GetConfig
()
for
_
,
addr
:=
range
req
.
Addresses
{
assets
,
err
:=
t
.
queryTokenAssetsKey
(
addr
)
if
err
!=
nil
{
return
nil
,
err
}
for
_
,
asset
:=
range
assets
.
Datas
{
if
asset
!=
req
.
TokenSymbol
{
continue
}
acc
,
err
:=
account
.
NewAccountDB
(
cfg
,
t
.
GetName
(),
asset
,
t
.
GetStateDB
())
if
err
!=
nil
{
return
nil
,
err
}
var
acc1
*
types
.
Account
if
req
.
Execer
==
t
.
GetName
()
{
acc1
=
acc
.
LoadAccount
(
addr
)
}
else
if
req
.
Execer
!=
""
{
execAddress
:=
address
.
ExecAddress
(
req
.
Execer
)
acc1
=
acc
.
LoadExecAccount
(
addr
,
execAddress
)
}
if
acc1
==
nil
{
continue
}
tokenAsset
:=
&
tokenty
.
TokenAsset
{
Symbol
:
asset
,
Account
:
acc1
}
reply
.
TokenAssets
=
append
(
reply
.
TokenAssets
,
tokenAsset
)
}
}
return
reply
,
nil
}
func
(
t
*
token
)
getAddrReceiverforTokens
(
addrTokens
*
tokenty
.
ReqAddrTokens
)
(
types
.
Message
,
error
)
{
func
(
t
*
token
)
getAddrReceiverforTokens
(
addrTokens
*
tokenty
.
ReqAddrTokens
)
(
types
.
Message
,
error
)
{
var
reply
=
&
tokenty
.
ReplyAddrRecvForTokens
{}
var
reply
=
&
tokenty
.
ReplyAddrRecvForTokens
{}
db
:=
t
.
GetLocalDB
()
db
:=
t
.
GetLocalDB
()
...
...
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