From 840cdc16bedae00cac7aead62b4c550bf80d34e7 Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Mon, 3 Aug 2020 12:48:27 +0200 Subject: [PATCH 01/22] First draft for adr. --- docs/architecture/adr-026-rosetta-api.md | 34 ++++++++++++++++++++++++ go.mod | 1 - go.sum | 4 --- 3 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 docs/architecture/adr-026-rosetta-api.md diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md new file mode 100644 index 000000000000..8a32e0bdd20d --- /dev/null +++ b/docs/architecture/adr-026-rosetta-api.md @@ -0,0 +1,34 @@ +# ADR 26: Rosetta API + +## Changelog + +- {date}: {changelog} + +## Status + +- Approved, pending fine tuning the details of implementation. + +## Context + +There is the need to provide an option to expose the Cosmos SDK applications to use +the Rosetta API. This is an open Standard designed to simplify and integrate different +blockchains. + +Our use case need to be able to provide: + +- Support for the different versions of the Cosmos SDK. +- Support for different versions of the Cosmos Hub. +- Support to be able to provide an abstraction in order to provide querying data, let's say +we have a TxHash which we don't know if it is in cosmos hub 1, 2, 3. But queryng the Data +API will return us the transaction without the need to query 3 versions. + +## Decision + +In order to provide this use cases we have decided that the best approach will be to +use an external repository that will hold the libraries that can be integrated in +different applications if they want to embed it into their own application and a +main.go that will provide a binary that will run as a standalone. + +## References + +- https://www.rosetta-api.org/ diff --git a/go.mod b/go.mod index 960794df245b..8aec1c24bfb7 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,6 @@ require ( github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d github.com/cosmos/ledger-cosmos-go v0.11.1 github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25 - github.com/gibson042/canonicaljson-go v1.0.3 github.com/gogo/protobuf v1.3.1 github.com/golang/mock v1.4.4 github.com/golang/protobuf v1.4.2 diff --git a/go.sum b/go.sum index a83ed880d4a5..2edc8237367d 100644 --- a/go.sum +++ b/go.sum @@ -144,8 +144,6 @@ github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2 github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gibson042/canonicaljson-go v1.0.3 h1:EAyF8L74AWabkyUmrvEFHEt/AGFQeD6RfwbAuf0j1bI= -github.com/gibson042/canonicaljson-go v1.0.3/go.mod h1:DsLpJTThXyGNO+KZlI85C1/KDcImpP67k/RKVjcaEqo= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= @@ -480,8 +478,6 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/spf13/viper v1.6.2/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k= github.com/spf13/viper v1.6.3/go.mod h1:jUMtyi0/lB5yZH/FjyGAoH7IMNrIhlBf6pXZmbMDvzw= -github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= -github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.7.1 h1:pM5oEahlgWv/WnHXpgbKz7iLIxRf65tye2Ci+XFK5sk= github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= From ee79d6324e469c5b59e74e4efee38bc3ae2768a8 Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Mon, 3 Aug 2020 12:52:56 +0200 Subject: [PATCH 02/22] Update date. --- docs/architecture/adr-026-rosetta-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index 8a32e0bdd20d..04d325d8777d 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -2,7 +2,7 @@ ## Changelog -- {date}: {changelog} +- August 3rd, 2020: Initial Draft. ## Status From 981950cb5c43833e3fd66ee196eb51b8e64503b4 Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Mon, 3 Aug 2020 13:02:10 +0200 Subject: [PATCH 03/22] Add some implementation details. --- docs/architecture/adr-026-rosetta-api.md | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index 04d325d8777d..b79aca11e8ef 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -29,6 +29,37 @@ use an external repository that will hold the libraries that can be integrated i different applications if they want to embed it into their own application and a main.go that will provide a binary that will run as a standalone. +This can be achieved providing a Server struct that is configured throught some options +like: + +``` +type Server struct {} +func NewServer(opt Options) + +type Options struct {} +``` + +This struct once started will listen to the port specified by the options and will +expose the Rosetta API. + +Internally we will have an interface that will abstract the different calls that Rosetta supports. + +Example: + +``` +type RosettaDataAPI interface { + GetBlock(req RosettaGetBlockRequest) RosettaGetBlockResponse + ... +} +``` + +And we will provide different implementations of this `adapter` like for 0.38, for 0.39 +and even a `CosmosHub` implementation that will call different versions of the hub. + +This way we offer the possibility to offer developers the opportunity to instantiate +a new server in their applications or just using the binary that can be build from the +repository. + ## References - https://www.rosetta-api.org/ From 13b392f28a5c143b38ecb0695fba5300967e3cf2 Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Mon, 3 Aug 2020 18:24:51 +0200 Subject: [PATCH 04/22] Update docs/architecture/adr-026-rosetta-api.md Co-authored-by: Alessio Treglia --- docs/architecture/adr-026-rosetta-api.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index b79aca11e8ef..4c1edf7ace2f 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -10,9 +10,11 @@ ## Context -There is the need to provide an option to expose the Cosmos SDK applications to use -the Rosetta API. This is an open Standard designed to simplify and integrate different -blockchains. +We think it'd be greatly valuable to application developers to have the Cosmos SDK +provide them with out-of-the-box Rosetta API support. +According to [the project's website](https://www.rosetta-api.org/), Rosetta API is an open +standard designed to simplify blockchain deployment and interaction. The latest specifications are +available at [this URL](https://www.rosetta-api.org/docs/Reference.html). Our use case need to be able to provide: From d437a93264026de3b7b431aed2586e9586d433cd Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Mon, 3 Aug 2020 18:25:06 +0200 Subject: [PATCH 05/22] Update docs/architecture/adr-026-rosetta-api.md Co-authored-by: Alessio Treglia --- docs/architecture/adr-026-rosetta-api.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index 4c1edf7ace2f..94df431f2bd3 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -16,13 +16,11 @@ According to [the project's website](https://www.rosetta-api.org/), Rosetta API standard designed to simplify blockchain deployment and interaction. The latest specifications are available at [this URL](https://www.rosetta-api.org/docs/Reference.html). -Our use case need to be able to provide: +We want to achieve the following objectives: -- Support for the different versions of the Cosmos SDK. -- Support for different versions of the Cosmos Hub. -- Support to be able to provide an abstraction in order to provide querying data, let's say -we have a TxHash which we don't know if it is in cosmos hub 1, 2, 3. But queryng the Data -API will return us the transaction without the need to query 3 versions. +- Support multiple versions of Cosmos SDK. +- Support Cosmos Hub. +- Implement querying of historical data sets. ## Decision From 06bcefd73622f21075e8fb102f39949b07dfc8a3 Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Mon, 3 Aug 2020 21:30:17 +0200 Subject: [PATCH 06/22] Update docs/architecture/adr-026-rosetta-api.md Co-authored-by: Alessio Treglia --- docs/architecture/adr-026-rosetta-api.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index 94df431f2bd3..c52037a0799d 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -29,8 +29,7 @@ use an external repository that will hold the libraries that can be integrated i different applications if they want to embed it into their own application and a main.go that will provide a binary that will run as a standalone. -This can be achieved providing a Server struct that is configured throught some options -like: +### Implementation ``` type Server struct {} From 77e32d13239755457270e09ae2c2180e836df92a Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Mon, 3 Aug 2020 21:30:24 +0200 Subject: [PATCH 07/22] Update docs/architecture/adr-026-rosetta-api.md Co-authored-by: Alessio Treglia --- docs/architecture/adr-026-rosetta-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index c52037a0799d..c167e5b4729a 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -1,4 +1,4 @@ -# ADR 26: Rosetta API +# ADR 26: Rosetta API Support ## Changelog From 06cf54573783f934e572ddbf037e9b99fae136f0 Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Mon, 3 Aug 2020 21:30:42 +0200 Subject: [PATCH 08/22] Update docs/architecture/adr-026-rosetta-api.md Co-authored-by: Alessio Treglia --- docs/architecture/adr-026-rosetta-api.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index c167e5b4729a..42452b8d34f1 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -24,10 +24,11 @@ We want to achieve the following objectives: ## Decision -In order to provide this use cases we have decided that the best approach will be to -use an external repository that will hold the libraries that can be integrated in -different applications if they want to embed it into their own application and a -main.go that will provide a binary that will run as a standalone. +We intend to develop a library that could be extended and used by application +developers to integrate an in-process Rosetta API-compliant server with the +application main binaries. We also intend to provide a standalone gateway server +program that supports a Cosmos SDK's minimum feature set. Such program could +run alongside the client applications main binaries. ### Implementation From 1fd90c7f2c6170708abab06be363b1516942f590 Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Tue, 4 Aug 2020 15:40:59 +0200 Subject: [PATCH 09/22] Rosetta more detailed. --- docs/architecture/adr-026-rosetta-api.md | 75 ++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 5 deletions(-) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index 42452b8d34f1..1ec55d45bcab 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -39,15 +39,59 @@ func NewServer(opt Options) type Options struct {} ``` -This struct once started will listen to the port specified by the options and will -expose the Rosetta API. +Server is the main struct, it can be configured by an options struct. -Internally we will have an interface that will abstract the different calls that Rosetta supports. +This server exposes a Start method. -Example: +``` +func (s Server) Start() error { + ... + s.ListenAndServe(s.options.endpoint, s.router) + ... +} +``` + +We have another struct which is the Router that will expose the rosetta endpoints. + +``` +type Router struct { + muxRouter mux.router + rosettaAdapter RosettaAPIAdapter +} + +func NewRouter(adapter RosettaAPIAdapter) { + router := &Router{ + mux: mux.NewRouter(), + rosettaAdapter: adapter, + } + + router.mux.HandleFunc("/blocks/", router.blocksApi) + ... + ... + + return router +} +``` + +This router has a handler function by every Rosetta endpoint. The blocks handler looks like this: ``` -type RosettaDataAPI interface { +func (r router) blocksApi(w http.ResponseWriter, r *http.Request) { + // We build the RosettaGetBlockRequest + req := .... + + res := r.rosettaAdapter.GetBlocks(req) + ... + + // We write the response. +} +``` + +The router just translates a rest request into the data struct that the interface of an adapter needs to run. +The RosettaAdapter interface looks like this: + +``` +type RosettaAdapterInterface interface { GetBlock(req RosettaGetBlockRequest) RosettaGetBlockResponse ... } @@ -56,6 +100,27 @@ type RosettaDataAPI interface { And we will provide different implementations of this `adapter` like for 0.38, for 0.39 and even a `CosmosHub` implementation that will call different versions of the hub. +An example of an adapter implementation looks like this: + +``` +type CosmosLaunchpad struct {} + +func (CosmosLaunchpad) GetBlock(req RosettaGetBlockRequest) { + // Here we would just convert the RosettaGetBlockRequest + // into the data we need to get the block information + // from a node that uses Launchpad. + + res := client.Get(...) + + // The adapter is responsable to build the response in the type + // specified by the Interface. + + return RosettaGetBlockResponse{...} +} +... + +``` + This way we offer the possibility to offer developers the opportunity to instantiate a new server in their applications or just using the binary that can be build from the repository. From 1a03d1f69802df6fd2b9af1eab94bdef0372c317 Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Tue, 4 Aug 2020 15:45:33 +0200 Subject: [PATCH 10/22] Router maybe does not need to be exposed. --- docs/architecture/adr-026-rosetta-api.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index 1ec55d45bcab..865707394c8b 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -33,10 +33,16 @@ run alongside the client applications main binaries. ### Implementation ``` -type Server struct {} -func NewServer(opt Options) +type Server struct { + options + router +} type Options struct {} + +func NewServer(opt Options, rosettaAdapter RosettaAPIAdapter) { + return Server{opt, newRouter(rosettaAdapter)} +} ``` Server is the main struct, it can be configured by an options struct. @@ -54,12 +60,12 @@ func (s Server) Start() error { We have another struct which is the Router that will expose the rosetta endpoints. ``` -type Router struct { +type router struct { muxRouter mux.router rosettaAdapter RosettaAPIAdapter } -func NewRouter(adapter RosettaAPIAdapter) { +func newRouter(adapter RosettaAPIAdapter) { router := &Router{ mux: mux.NewRouter(), rosettaAdapter: adapter, @@ -121,6 +127,9 @@ func (CosmosLaunchpad) GetBlock(req RosettaGetBlockRequest) { ``` +If our provided adapters don't work for a specific project because they changed their +API they can always create another adapter and inject it into the server. + This way we offer the possibility to offer developers the opportunity to instantiate a new server in their applications or just using the binary that can be build from the repository. From 163e30c7443306a7a1c0ac55e6113491f7a7704d Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Tue, 4 Aug 2020 16:36:51 +0200 Subject: [PATCH 11/22] Update docs/architecture/adr-026-rosetta-api.md Co-authored-by: Alessio Treglia --- docs/architecture/adr-026-rosetta-api.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index 865707394c8b..344c1100847f 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -47,8 +47,6 @@ func NewServer(opt Options, rosettaAdapter RosettaAPIAdapter) { Server is the main struct, it can be configured by an options struct. -This server exposes a Start method. - ``` func (s Server) Start() error { ... From 6787e12328deb1f1d66776ad8e38a1bf61670476 Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Tue, 4 Aug 2020 16:48:58 +0200 Subject: [PATCH 12/22] Update docs/architecture/adr-026-rosetta-api.md Co-authored-by: Alessio Treglia --- docs/architecture/adr-026-rosetta-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index 344c1100847f..21a7680a041f 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -77,7 +77,7 @@ func newRouter(adapter RosettaAPIAdapter) { } ``` -This router has a handler function by every Rosetta endpoint. The blocks handler looks like this: +Each API endpoint has an associated handler, e.g.: ``` func (r router) blocksApi(w http.ResponseWriter, r *http.Request) { From 15c6817cae11a3165c6928706dc28b0b3210026e Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Tue, 4 Aug 2020 16:49:12 +0200 Subject: [PATCH 13/22] Update docs/architecture/adr-026-rosetta-api.md Co-authored-by: Alessio Treglia --- docs/architecture/adr-026-rosetta-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index 21a7680a041f..9804d0152943 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -55,7 +55,7 @@ func (s Server) Start() error { } ``` -We have another struct which is the Router that will expose the rosetta endpoints. +An internal `router` type exposes the Rosetta API endpoints: ``` type router struct { From 1c8e67199946ed5b335d75bb4bc6a824729ca79f Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Tue, 4 Aug 2020 16:49:36 +0200 Subject: [PATCH 14/22] Update docs/architecture/adr-026-rosetta-api.md Co-authored-by: Alessio Treglia --- docs/architecture/adr-026-rosetta-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index 9804d0152943..95d2ec998439 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -45,7 +45,7 @@ func NewServer(opt Options, rosettaAdapter RosettaAPIAdapter) { } ``` -Server is the main struct, it can be configured by an options struct. +Server is the main type that the client application needs to instantiate. It embeds an `Options` type and exposes a `Start()` method: ``` func (s Server) Start() error { From d7e654f813eab724b2a794970e99a53a5cc99d54 Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Tue, 4 Aug 2020 16:58:03 +0200 Subject: [PATCH 15/22] Update docs/architecture/adr-026-rosetta-api.md Co-authored-by: Alessio Treglia --- docs/architecture/adr-026-rosetta-api.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index 95d2ec998439..29cd745a6398 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -125,8 +125,7 @@ func (CosmosLaunchpad) GetBlock(req RosettaGetBlockRequest) { ``` -If our provided adapters don't work for a specific project because they changed their -API they can always create another adapter and inject it into the server. +The adapters that come out-of-the-box can be easily overriden by application-specific implementations. This way we offer the possibility to offer developers the opportunity to instantiate a new server in their applications or just using the binary that can be build from the From cc26e438d81eda64f20b3cbe229dcac9a426a713 Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Tue, 4 Aug 2020 16:58:34 +0200 Subject: [PATCH 16/22] Update docs/architecture/adr-026-rosetta-api.md Co-authored-by: Alessio Treglia --- docs/architecture/adr-026-rosetta-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index 29cd745a6398..7301e8041494 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -127,7 +127,7 @@ func (CosmosLaunchpad) GetBlock(req RosettaGetBlockRequest) { The adapters that come out-of-the-box can be easily overriden by application-specific implementations. -This way we offer the possibility to offer developers the opportunity to instantiate +This way we offer developers the opportunity to embed a new server in their applications or just using the binary that can be build from the repository. From 217a6ad43a7efd8e624e32685a6655ddce51ac35 Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Tue, 4 Aug 2020 16:59:03 +0200 Subject: [PATCH 17/22] Update docs/architecture/adr-026-rosetta-api.md Co-authored-by: Alessio Treglia --- docs/architecture/adr-026-rosetta-api.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index 7301e8041494..05d7dd0c3e3d 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -128,7 +128,8 @@ func (CosmosLaunchpad) GetBlock(req RosettaGetBlockRequest) { The adapters that come out-of-the-box can be easily overriden by application-specific implementations. This way we offer developers the opportunity to embed -a new server in their applications or just using the binary that can be build from the +a new server instance in their applications. Developers always retain the possiblity to using the simple binary +that come with the Cosmos SDK. repository. ## References From 2cc99645c3773f741422a87ce9f9310bc126077c Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Tue, 4 Aug 2020 16:59:17 +0200 Subject: [PATCH 18/22] Update docs/architecture/adr-026-rosetta-api.md Co-authored-by: Alessio Treglia --- docs/architecture/adr-026-rosetta-api.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index 05d7dd0c3e3d..bf1240d025eb 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -130,7 +130,6 @@ The adapters that come out-of-the-box can be easily overriden by application-spe This way we offer developers the opportunity to embed a new server instance in their applications. Developers always retain the possiblity to using the simple binary that come with the Cosmos SDK. -repository. ## References From b08fe9069f85c1e87a2057503a31bd702c2fcb5c Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Thu, 6 Aug 2020 14:02:40 +0200 Subject: [PATCH 19/22] Update docs/architecture/adr-026-rosetta-api.md Co-authored-by: Alessio Treglia --- docs/architecture/adr-026-rosetta-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index bf1240d025eb..e1aa12b2d326 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -63,7 +63,7 @@ type router struct { rosettaAdapter RosettaAPIAdapter } -func newRouter(adapter RosettaAPIAdapter) { +func newRouter(adapter Adapter) { router := &Router{ mux: mux.NewRouter(), rosettaAdapter: adapter, From bab1c5c3fb12b843b4c526a1dff61421885c5db5 Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Thu, 6 Aug 2020 14:02:55 +0200 Subject: [PATCH 20/22] Update docs/architecture/adr-026-rosetta-api.md Co-authored-by: Alessio Treglia --- docs/architecture/adr-026-rosetta-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index e1aa12b2d326..734365216f7a 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -95,7 +95,7 @@ The router just translates a rest request into the data struct that the interfac The RosettaAdapter interface looks like this: ``` -type RosettaAdapterInterface interface { +type Adapter interface { GetBlock(req RosettaGetBlockRequest) RosettaGetBlockResponse ... } From fbd0210dda94189b9078600da66c48ddfeaf2c7a Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Thu, 6 Aug 2020 14:03:20 +0200 Subject: [PATCH 21/22] Update docs/architecture/adr-026-rosetta-api.md Co-authored-by: Alessio Treglia --- docs/architecture/adr-026-rosetta-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index 734365216f7a..c3d9a99343e8 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -40,7 +40,7 @@ type Server struct { type Options struct {} -func NewServer(opt Options, rosettaAdapter RosettaAPIAdapter) { +func NewServer(opt Options, rosettaAdapter Adapter) { return Server{opt, newRouter(rosettaAdapter)} } ``` From 9cb1b28f27f3a7a4c735c4fdae4bd4061e7865d7 Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Thu, 6 Aug 2020 14:12:06 +0200 Subject: [PATCH 22/22] Update docs/architecture/adr-026-rosetta-api.md Co-authored-by: Alessio Treglia --- docs/architecture/adr-026-rosetta-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/adr-026-rosetta-api.md b/docs/architecture/adr-026-rosetta-api.md index c3d9a99343e8..fe0b673601ec 100644 --- a/docs/architecture/adr-026-rosetta-api.md +++ b/docs/architecture/adr-026-rosetta-api.md @@ -60,7 +60,7 @@ An internal `router` type exposes the Rosetta API endpoints: ``` type router struct { muxRouter mux.router - rosettaAdapter RosettaAPIAdapter + rosettaAdapter Adapter } func newRouter(adapter Adapter) {