Commit 75c62315 authored by Ethen Pociask's avatar Ethen Pociask

[indexer.client] Addressing PR feedback: URL -> BaseURL

parent a91f95a8
...@@ -47,7 +47,7 @@ func WithTimeout(t time.Duration) Option { ...@@ -47,7 +47,7 @@ func WithTimeout(t time.Duration) Option {
// Config ... Indexer client config struct // Config ... Indexer client config struct
type Config struct { type Config struct {
PaginationLimit int PaginationLimit int
URL string BaseURL string
} }
// Client ... Indexer client struct // Client ... Indexer client struct
...@@ -113,7 +113,7 @@ func (c *Client) doRecordRequest(method string, endpoint string) ([]byte, error) ...@@ -113,7 +113,7 @@ func (c *Client) doRecordRequest(method string, endpoint string) ([]byte, error)
// HealthCheck ... Checks the health of the indexer API // HealthCheck ... Checks the health of the indexer API
func (c *Client) HealthCheck() error { func (c *Client) HealthCheck() error {
_, err := c.doRecordRequest(healthz, c.cfg.URL+api.HealthPath) _, err := c.doRecordRequest(healthz, c.cfg.BaseURL+api.HealthPath)
if err != nil { if err != nil {
return err return err
...@@ -125,7 +125,7 @@ func (c *Client) HealthCheck() error { ...@@ -125,7 +125,7 @@ func (c *Client) HealthCheck() error {
// GetDepositsByAddress ... Gets a deposit response object provided an L1 address and cursor // GetDepositsByAddress ... Gets a deposit response object provided an L1 address and cursor
func (c *Client) GetDepositsByAddress(l1Address common.Address, cursor string) (*database.L1BridgeDepositsResponse, error) { func (c *Client) GetDepositsByAddress(l1Address common.Address, cursor string) (*database.L1BridgeDepositsResponse, error) {
var dResponse *database.L1BridgeDepositsResponse var dResponse *database.L1BridgeDepositsResponse
url := c.cfg.URL + api.DepositsPath + l1Address.String() + urlParams url := c.cfg.BaseURL + api.DepositsPath + l1Address.String() + urlParams
endpoint := fmt.Sprintf(url, cursor, c.cfg.PaginationLimit) endpoint := fmt.Sprintf(url, cursor, c.cfg.PaginationLimit)
resp, err := c.doRecordRequest(deposits, endpoint) resp, err := c.doRecordRequest(deposits, endpoint)
...@@ -190,7 +190,7 @@ func (c *Client) GetAllWithdrawalsByAddress(l2Address common.Address) ([]databas ...@@ -190,7 +190,7 @@ func (c *Client) GetAllWithdrawalsByAddress(l2Address common.Address) ([]databas
// GetWithdrawalsByAddress ... Gets a withdrawal response object provided an L2 address and cursor // GetWithdrawalsByAddress ... Gets a withdrawal response object provided an L2 address and cursor
func (c *Client) GetWithdrawalsByAddress(l2Address common.Address, cursor string) (*database.L2BridgeWithdrawalsResponse, error) { func (c *Client) GetWithdrawalsByAddress(l2Address common.Address, cursor string) (*database.L2BridgeWithdrawalsResponse, error) {
var wResponse *database.L2BridgeWithdrawalsResponse var wResponse *database.L2BridgeWithdrawalsResponse
url := c.cfg.URL + api.WithdrawalsPath + l2Address.String() + urlParams url := c.cfg.BaseURL + api.WithdrawalsPath + l2Address.String() + urlParams
endpoint := fmt.Sprintf(url, cursor, c.cfg.PaginationLimit) endpoint := fmt.Sprintf(url, cursor, c.cfg.PaginationLimit)
resp, err := c.doRecordRequest(withdrawals, endpoint) resp, err := c.doRecordRequest(withdrawals, endpoint)
......
...@@ -138,7 +138,7 @@ func createE2ETestSuite(t *testing.T) E2ETestSuite { ...@@ -138,7 +138,7 @@ func createE2ETestSuite(t *testing.T) E2ETestSuite {
client, err := client.NewClient(&client.Config{ client, err := client.NewClient(&client.Config{
PaginationLimit: 100, PaginationLimit: 100,
URL: fmt.Sprintf("http://%s:%d", indexerCfg.HTTPServer.Host, indexerCfg.HTTPServer.Port), BaseURL: fmt.Sprintf("http://%s:%d", indexerCfg.HTTPServer.Host, indexerCfg.HTTPServer.Port),
}) })
require.NoError(t, err) require.NoError(t, err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment