71 lines
1.9 KiB
Go
71 lines
1.9 KiB
Go
// Copyright 2020 Coinbase, Inc.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package services
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/coinbase/rosetta-bitcoin/configuration"
|
|
|
|
"github.com/coinbase/rosetta-sdk-go/asserter"
|
|
"github.com/coinbase/rosetta-sdk-go/server"
|
|
)
|
|
|
|
// NewBlockchainRouter creates a Mux http.Handler from a collection
|
|
// of server controllers.
|
|
func NewBlockchainRouter(
|
|
config *configuration.Configuration,
|
|
client Client,
|
|
i Indexer,
|
|
asserter *asserter.Asserter,
|
|
) http.Handler {
|
|
networkAPIService := NewNetworkAPIService(config, client, i)
|
|
networkAPIController := server.NewNetworkAPIController(
|
|
networkAPIService,
|
|
asserter,
|
|
)
|
|
|
|
blockAPIService := NewBlockAPIService(config, i)
|
|
blockAPIController := server.NewBlockAPIController(
|
|
blockAPIService,
|
|
asserter,
|
|
)
|
|
|
|
accountAPIService := NewAccountAPIService(config, i)
|
|
accountAPIController := server.NewAccountAPIController(
|
|
accountAPIService,
|
|
asserter,
|
|
)
|
|
|
|
constructionAPIService := NewConstructionAPIService(config, client, i)
|
|
constructionAPIController := server.NewConstructionAPIController(
|
|
constructionAPIService,
|
|
asserter,
|
|
)
|
|
|
|
mempoolAPIService := NewMempoolAPIService(client)
|
|
mempoolAPIController := server.NewMempoolAPIController(
|
|
mempoolAPIService,
|
|
asserter,
|
|
)
|
|
|
|
return server.NewRouter(
|
|
networkAPIController,
|
|
blockAPIController,
|
|
accountAPIController,
|
|
constructionAPIController,
|
|
mempoolAPIController,
|
|
)
|
|
}
|