• R/O
  • HTTP
  • SSH
  • HTTPS

vapor: Commit

Golang implemented sidechain for Bytom


Commit MetaInfo

Revision92aeb26a1eca7ab2b9d16f78ac951931e453d4a7 (tree)
Time2019-08-21 15:59:45
Authoriczc <iczcalan@gmai...>
Commitericzc

Log Message

add list chains api

Change Summary

Incremental Difference

--- a/toolbar/federation/api/handler.go
+++ b/toolbar/federation/api/handler.go
@@ -57,3 +57,12 @@ func (s *Server) ListCrosschainTxs(c *gin.Context, listTxsReq *listCrosschainTxs
5757
5858 return ormTxs, nil
5959 }
60+
61+func (s *Server) ListChains(c *gin.Context) ([]*orm.Chain, error) {
62+ var chains []*orm.Chain
63+ if err := s.db.Find(&chains).Error; err != nil {
64+ return nil, err
65+ }
66+
67+ return chains, nil
68+}
--- a/toolbar/federation/api/server.go
+++ b/toolbar/federation/api/server.go
@@ -37,6 +37,7 @@ func (server *Server) setupRouter() {
3737
3838 v1 := r.Group("/api/v1")
3939 v1.POST("/federation/list-crosschain-txs", handlerMiddleware(server.ListCrosschainTxs))
40+ v1.GET("/federation/list-chains", handlerMiddleware(server.ListChains))
4041
4142 server.engine = r
4243 }
Show on old repository browser