-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERC20Transfers sort #16
Conversation
感谢你的贡献。 请修正CI测试,并且gofmt代码。 |
Codecov Report
@@ Coverage Diff @@
## master #16 +/- ##
==========================================
+ Coverage 78.73% 78.81% +0.07%
==========================================
Files 10 10
Lines 268 269 +1
==========================================
+ Hits 211 212 +1
Misses 34 34
Partials 23 23
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感谢你的贡献。
在考虑你的PR时,我发现你的变更也许需要一些实现风格上的调整,以保持这个库的API风格一致。这一点请参阅详细的评审意见。
最后,请在项目根目录使用 gofmt -w .
格式化代码,这非常重要。
@@ -96,6 +96,7 @@ func (c *Client) ERC20Transfers(contractAddress, address *string, startBlock *in | |||
compose(param, "address", address) | |||
compose(param, "startblock", startBlock) | |||
compose(param, "endblock", endBlock) | |||
compose(param, "sort", sort) // asc - 升序,desc - 降序 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请使用和这里相同的方式来引入排序方式,从而保持这个库的API风格一致:
Lines 35 to 49 in 28455ff
// | |
// if desc is true, result will be sorted in blockNum descendant order. | |
func (c *Client) NormalTxByAddress(address string, startBlock *int, endBlock *int, page int, offset int, desc bool) (txs []NormalTx, err error) { | |
param := M{ | |
"address": address, | |
"page": page, | |
"offset": offset, | |
} | |
compose(param, "startblock", startBlock) | |
compose(param, "endblock", endBlock) | |
if desc { | |
param["sort"] = "desc" | |
} else { | |
param["sort"] = "asc" | |
} |
修改后的该函数形如:
func (c *Client) ERC20Transfers(contractAddress, address, startBlock *int, endBlock *int, page int, offset int, desc bool) (txs []ERC20Transfer, err error)
代码中请使用英文注释,注释请放在函数级别,这句话也许有帮助:
if desc is true, result will be sorted in blockNum descendant order.
Closed due to long period inactivity. If you have got any update, feel free to reopen this PR. |
ERC20Transfers sort