Question about Rosetta Golang Client and Versioning

Hi There :slightly_smiling_face:

I saw that rosetta-sdk-go includes a client rosetta-sdk-go/client at master
I was wondering if this is the official Rosetta golang client or if folks are working on some other libraries?

At lunar.dev we are using our internal go client so was thinking if we can opensource that or just migrate to use the rosetta-sdk-go one.

One important feature we require is ability to set API Key headers which has some support in the rosetta-sdk-go client. Also because we run multiple chain nodes with potentially different Rosetta versions we would want to have the ability to set a “target” version when calling the api to return correct types etc.

So was wondering if it would make sense to add these features to the rosetta-sdk-go OR to create a higher level client library.
Would love to hear some opinions on this.

2 Likes

We use this client internally at Coinbase via rosetta-sdk-go/fetcher (provides assertion on top of rosetta-sdk-go/client).

I think the ability to set custom headers for each request would be a GREAT addition to rosetta-sdk-go/client! In fact, the client already has the ability to provide headers but we don’t expose it to the caller:

I guess the open question really is if we want to expose setting the header on each request or only when initializing a client.

Is this public? Curious what you guys have done differently!

Yes adding ability to add headers during init client stage should be enough. I don’t think we need to change it on every request.

Actually its not that different or even fully polished. I didn’t realize that rosetta-sdk-go had a client and made a simple one. We should move to using sdk one too I think.

Ours just had simple interface like

interface {
  New(url)
  SetApiKey()
  SetNetwork()
  
  NetworkList()
  NetworkStatus()
  NetworkOptions()

  Block()
  BlockTransaction()
  
  ....
}
1 Like

@patrick.ogrady btw just noticed the client Configuration does have ability to set Headers
rosetta-sdk-go/configuration.go at 23200e54f95116600ff4617be5b78e1768ba689c · coinbase/rosetta-sdk-go (github.com)

Is this what you meant was not exposed ?

I think the ability to set custom headers for each request would be a GREAT addition to rosetta-sdk-go/client ! In fact, the client already has the ability to provide headers but we don’t expose it to the caller:

:man_facepalming: I didn’t realize that method was exposed on Configuration (a lot of this was boilerplate codegen). Will that work ok?

You can see those values are injected into the request here:

@patrick.ogrady yeah its working fine for us.

Thanks

1 Like