Skip to content

Commit d007f9c

Browse files
committed
chore: extracted types and updated docker workflow to add a v prefix
1 parent a77bc96 commit d007f9c

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

.github/workflows/docker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ jobs:
4444
tags: |
4545
type=ref,event=branch
4646
type=ref,event=pr
47-
type=semver,pattern={{version}}
48-
type=semver,pattern={{major}}.{{minor}}
47+
type=semver,pattern=v{{version}}
48+
type=semver,pattern=v{{major}}.{{minor}}
4949
type=sha
5050
5151
- name: Build and push

internal/celestia/client.go

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -208,22 +208,26 @@ func (c *Client) VerifyDataBlobAtHeight(ctx context.Context, unwrappedDataBlob [
208208
return false, nil
209209
}
210210

211-
// GetBlockTimestamp retrieves the timestamp of a celestia da block at the given height
212-
func (c *Client) GetBlockTimestamp(ctx context.Context, daHeight uint64) (time.Time, error) {
213-
type headerResult struct {
214-
Header struct {
215-
Time string `json:"time"`
216-
} `json:"header"`
217-
}
211+
type Header struct {
212+
Time string `json:"time"`
213+
}
218214

219-
type rpcResponse struct {
220-
Result headerResult `json:"result"`
221-
Error *struct {
222-
Code int `json:"code"`
223-
Message string `json:"message"`
224-
} `json:"error"`
225-
}
215+
type HeaderResult struct {
216+
Header Header `json:"header"`
217+
}
226218

219+
type RPCError struct {
220+
Code int `json:"code"`
221+
Message string `json:"message"`
222+
}
223+
224+
type RPCResponse struct {
225+
Result HeaderResult `json:"result"`
226+
Error *RPCError `json:"error"`
227+
}
228+
229+
// GetBlockTimestamp retrieves the timestamp of a celestia da block at the given height
230+
func (c *Client) GetBlockTimestamp(ctx context.Context, daHeight uint64) (time.Time, error) {
227231
payload := map[string]interface{}{
228232
"jsonrpc": "2.0",
229233
"id": 1,
@@ -257,7 +261,7 @@ func (c *Client) GetBlockTimestamp(ctx context.Context, daHeight uint64) (time.T
257261
return time.Time{}, fmt.Errorf("failed to read response body: %w", err)
258262
}
259263

260-
var rpcResp rpcResponse
264+
var rpcResp RPCResponse
261265
if err := json.Unmarshal(respBody, &rpcResp); err != nil {
262266
return time.Time{}, fmt.Errorf("failed to unmarshal response: %w", err)
263267
}

0 commit comments

Comments
 (0)