Skip to content

Client

Builder

To interact with web3 and cosmos endpoints we need a client:

client := requester.NewClient()

The client exposes a set of setters to change the default endpoints:

  • WithUnsecureWeb3Endpoint(endpoint string)

  • WithUnsecureCosmosRestEndpoint(endpoint string)

  • WithUnsecureTendermintRestEndpoint(endpoint string)

  • WithSecureWeb3Endpoint(endpoint string, auth string)

  • WithSecureCosmosRestEndpoint(endpoint string, auth string)

  • WithSecureTendermintRestEndpoint(endpoint string, auth string)

General Requests

Get

There are two functions exposed, they are mostly used internally:

  • c.SendGetRequestEasyJSON(endpoint, url, res, auth): It uses a easyjson.Unmarshaller to quickly decode the response
  • c.SendGetRequest(endpoint, url, auth): It returns the response as a byte array if the status code is 200

Post

There is a function exposed, it is mostly used internally:

  • c.SendPostRequestEasyJSON(endpoint, url, res, auth): It uses a easyjson.Unmarshaller to quickly decode the response

Blockchain Requests