-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transition off removed GRPC endpoint BlockHeadersRequest
- Loading branch information
Showing
6 changed files
with
248 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package beaconchain | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
eth2client "github.com/attestantio/go-eth2-client" | ||
eth2http "github.com/attestantio/go-eth2-client/http" | ||
) | ||
|
||
type BeaconChain struct { | ||
service eth2client.Service | ||
timeout time.Duration | ||
} | ||
|
||
func New(ctx context.Context, address string, timeout time.Duration) (*BeaconChain, error) { | ||
service, err := eth2http.New(ctx, eth2http.WithAddress(address), eth2http.WithTimeout(time.Minute)) | ||
|
||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
result := &BeaconChain{ | ||
service: service, | ||
timeout: timeout, | ||
} | ||
|
||
return result, nil | ||
} | ||
|
||
func (beacon *BeaconChain) Service() eth2client.Service { | ||
return beacon.service | ||
} | ||
|
||
func (beacon *BeaconChain) Timeout() time.Duration { | ||
return beacon.timeout | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.