MCPcopy Create free account
hub / github.com/ethstorage/es-node / queryElBlockNumberAndKzg

Method queryElBlockNumberAndKzg

ethstorage/archiver/api.go:167–196  ·  view source on GitHub ↗
(queryUrl string)

Source from the content-addressed store, hash-verified

165}
166
167func (a *API) queryElBlockNumberAndKzg(queryUrl string) (uint64, []string, *httpError) {
168 resp, err := http.Get(queryUrl)
169 if err != nil {
170 return 0, nil, errServerError
171 }
172 defer resp.Body.Close()
173
174 respObj := &struct {
175 Data struct {
176 Message struct {
177 Body struct {
178 ExecutionPayload struct {
179 BlockNumber string `json:"block_number"`
180 } `json:"execution_payload"`
181 BlobKzgCommitments []string `json:"blob_kzg_commitments"`
182 } `json:"body"`
183 } `json:"message"`
184 } `json:"data"`
185 }{}
186 err = json.NewDecoder(resp.Body).Decode(&respObj)
187 if err != nil {
188 return 0, nil, errUnknownBlock
189 }
190 body := respObj.Data.Message.Body
191 elBlock, err := strconv.ParseUint(body.ExecutionPayload.BlockNumber, 10, 64)
192 if err != nil {
193 return 0, nil, errUnknownBlock
194 }
195 return elBlock, body.BlobKzgCommitments, nil
196}
197
198// Deprecated since Fusaka
199func (a *API) buildSidecar(kvIndex uint64, kzgCommitment []byte, blobHash common.Hash) (*BlobSidecar, *httpError) {

Callers 2

queryBlobsMethod · 0.95
queryBlobSidecarsMethod · 0.95

Calls 2

GetMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected