Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add common options. #89

Merged
merged 2 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
dev:
- standardise names of options
- add common options (currently just timeout) to options structs

0.19.4:
- revert SubmitProposal() to use v1 of the API

Expand Down
2 changes: 2 additions & 0 deletions api/aggregateattestationopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import "github.com/attestantio/go-eth2-client/spec/phase0"

// AggregateAttestationOpts are the options for obtaining aggregate attestations.
type AggregateAttestationOpts struct {
Common CommonOpts

// Slot is the slot for which the data is obtained.
Slot phase0.Slot
// AttestationDataRoot is the root for which the data is obtained.
Expand Down
2 changes: 2 additions & 0 deletions api/attestationdataopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import "github.com/attestantio/go-eth2-client/spec/phase0"

// AttestationDataOpts are the options for obtaining attestation data.
type AttestationDataOpts struct {
Common CommonOpts

// Slot is the slot for which the data is obtained.
Slot phase0.Slot
// CommitteeIndex is the committee index for which the data is obtained.
Expand Down
2 changes: 2 additions & 0 deletions api/attestationpoolopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import "github.com/attestantio/go-eth2-client/spec/phase0"

// AttestationPoolOpts are the options for obtaining the attestation pool.
type AttestationPoolOpts struct {
Common CommonOpts

// Slot is the slot for which the data is obtained.
Slot phase0.Slot
}
2 changes: 2 additions & 0 deletions api/attesterdutiesopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import "github.com/attestantio/go-eth2-client/spec/phase0"

// AttesterDutiesOpts are the options for obtaining proposer duties.
type AttesterDutiesOpts struct {
Common CommonOpts

// Epoch is the epoch for which the data is obtained.
Epoch phase0.Epoch
// Indices is a list of validators for which to obtain the duties.
Expand Down
2 changes: 2 additions & 0 deletions api/beaconblockheaderopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ package api

// BeaconBlockHeaderOpts are the options for obtaining beacon block headers.
type BeaconBlockHeaderOpts struct {
Common CommonOpts

// Block is the ID of the block which the data is obtained.
Block string
}
2 changes: 2 additions & 0 deletions api/beaconblockrootopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ package api

// BeaconBlockRootOpts are the options for obtaining the beacon block root.
type BeaconBlockRootOpts struct {
Common CommonOpts

// Block is the ID of the block which the data is obtained.
Block string
}
2 changes: 2 additions & 0 deletions api/beaconcommitteesopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import "github.com/attestantio/go-eth2-client/spec/phase0"

// BeaconCommitteesOpts are the options for obtaining proposer duties.
type BeaconCommitteesOpts struct {
Common CommonOpts

// State is the state at which the data is obtained.
// It can be a slot number or state root, or one of the special values "genesis", "head", "justified" or "finalized".
State string
Expand Down
2 changes: 2 additions & 0 deletions api/beaconstateopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ package api

// BeaconStateOpts are the options for obtaining the beacon state.
type BeaconStateOpts struct {
Common CommonOpts

// State is the state at which the data is obtained.
// It can be a slot number or state root, or one of the special values "genesis", "head", "justified" or "finalized".
State string
Expand Down
2 changes: 2 additions & 0 deletions api/beaconstaterandaoopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ package api

// BeaconStateRandaoOpts are the options for obtaining the beacon state RANDAO.
type BeaconStateRandaoOpts struct {
Common CommonOpts

// State is the state at which the data is obtained.
// It can be a slot number or state root, or one of the special values "genesis", "head", "justified" or "finalized".
State string
Expand Down
2 changes: 2 additions & 0 deletions api/beaconstaterootopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ package api

// BeaconStateRootOpts are the options for obtaining the beacon state root.
type BeaconStateRootOpts struct {
Common CommonOpts

// State is the state at which the data is obtained.
// It can be a slot number or state root, or one of the special values "genesis", "head", "justified" or "finalized".
State string
Expand Down
2 changes: 2 additions & 0 deletions api/blindedproposalopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import "github.com/attestantio/go-eth2-client/spec/phase0"

// BlindedProposalOpts are the options for obtaining blinded proposals.
type BlindedProposalOpts struct {
Common CommonOpts

// Slot is the slot for which the proposal should be fetched.
Slot phase0.Slot
// RandaoReveal is the RANDAO reveal for the proposal.
Expand Down
2 changes: 2 additions & 0 deletions api/blobsidecarsopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ package api

// BlobSidecarsOpts are the options for obtaining blob sidecars.
type BlobSidecarsOpts struct {
Common CommonOpts

// Block is the ID of the block for which the data is obtained.
Block string
}
23 changes: 23 additions & 0 deletions api/commonopts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright © 2023 Attestant Limited.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package api

import "time"

// CommonOpts are options common for all calls.
type CommonOpts struct {
// Timeout is a specific timeout for this call.
// If 0 then the default timeout is used.
Timeout time.Duration
}
19 changes: 19 additions & 0 deletions api/depositcontractopts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright © 2023 Attestant Limited.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package api

// DepositContractOpts are the options for obtaining the deposit contract.
type DepositContractOpts struct {
Common CommonOpts
}
2 changes: 2 additions & 0 deletions api/finalityopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ package api

// FinalityOpts are the options for obtaining finality checkpoints.
type FinalityOpts struct {
Common CommonOpts

// State is the state at which the data is obtained.
// It can be a slot number or state root, or one of the special values "genesis", "head", "justified" or "finalized".
State string
Expand Down
19 changes: 19 additions & 0 deletions api/forkchoiceopts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright © 2023 Attestant Limited.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package api

// ForkChoiceOpts are the options for obtaining the fork choice.
type ForkChoiceOpts struct {
Common CommonOpts
}
2 changes: 2 additions & 0 deletions api/forkopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ package api

// ForkOpts are the options for obtaining the fork.
type ForkOpts struct {
Common CommonOpts

// State is the state at which the data is obtained.
// It can be a slot number or state root, or one of the special values "genesis", "head", "justified" or "finalized".
State string
Expand Down
19 changes: 19 additions & 0 deletions api/forkscheduleopts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright © 2023 Attestant Limited.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package api

// ForkScheduleOpts are the options for obtaining the fork schedule.
type ForkScheduleOpts struct {
Common CommonOpts
}
19 changes: 19 additions & 0 deletions api/genesisopts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright © 2023 Attestant Limited.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package api

// GenesisOpts are the options for obtaining genesis information.
type GenesisOpts struct {
Common CommonOpts
}
6 changes: 4 additions & 2 deletions api/peeropts.go → api/nodepeersopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@

package api

// PeerOpts are the options for client side peer filtering.
type PeerOpts struct {
// NodePeersOpts are the options for client side peer filtering.
type NodePeersOpts struct {
Common CommonOpts

// State of the connection (disconnected, connecting, connected, disconnecting)
State []string
// Direction of the connection (inbound, outbound)
Expand Down
19 changes: 19 additions & 0 deletions api/nodesyncingopts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright © 2023 Attestant Limited.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package api

// NodeSyncingOpts are the options for obtaining node sync information.
type NodeSyncingOpts struct {
Common CommonOpts
}
19 changes: 19 additions & 0 deletions api/nodeversionopts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright © 2023 Attestant Limited.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package api

// NodeVersionOpts are the options for obtaining the node version.
type NodeVersionOpts struct {
Common CommonOpts
}
2 changes: 2 additions & 0 deletions api/proposalopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import "github.com/attestantio/go-eth2-client/spec/phase0"

// ProposalOpts are the options for obtaining proposals.
type ProposalOpts struct {
Common CommonOpts

// Slot is the slot for which the proposal should be fetched.
Slot phase0.Slot
// RandaoReveal is the RANDAO reveal for the proposal.
Expand Down
2 changes: 2 additions & 0 deletions api/proposerdutiesopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import "github.com/attestantio/go-eth2-client/spec/phase0"

// ProposerDutiesOpts are the options for obtaining proposer duties.
type ProposerDutiesOpts struct {
Common CommonOpts

// Epoch is the epoch for which the data is obtained.
Epoch phase0.Epoch
// Indices is a list of validators to restrict the returned values. If no indices are supplied then no filter will be applied.
Expand Down
2 changes: 2 additions & 0 deletions api/signedbeaconblockopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ package api

// SignedBeaconBlockOpts are the options for obtaining signed beacon blocks.
type SignedBeaconBlockOpts struct {
Common CommonOpts

// Block is the ID of the block which the data is obtained.
Block string
}
19 changes: 19 additions & 0 deletions api/specopts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright © 2023 Attestant Limited.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package api

// SpecOpts are the options for obtaining the chain specification.
type SpecOpts struct {
Common CommonOpts
}
2 changes: 2 additions & 0 deletions api/synccommitteecontributionopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import "github.com/attestantio/go-eth2-client/spec/phase0"

// SyncCommitteeContributionOpts are the options for obtaining sync committee contributions.
type SyncCommitteeContributionOpts struct {
Common CommonOpts

// Slot is the slot for which the data is obtained.
Slot phase0.Slot
// SubcommitteeIndex is the index of the sync subcommittee for which the data is obtained.
Expand Down
2 changes: 2 additions & 0 deletions api/synccommitteedutiesopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import "github.com/attestantio/go-eth2-client/spec/phase0"

// SyncCommitteeDutiesOpts are the options for obtaining sync committee duties.
type SyncCommitteeDutiesOpts struct {
Common CommonOpts

// Epoch is the epoch for which the data is obtained.
Epoch phase0.Epoch
// Indices is a list of validators for which to obtain the duties.
Expand Down
2 changes: 2 additions & 0 deletions api/synccommitteeopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import "github.com/attestantio/go-eth2-client/spec/phase0"

// SyncCommitteeOpts are the options for obtaining sync committees.
type SyncCommitteeOpts struct {
Common CommonOpts

// State is the state at which the data is obtained.
// It can be a slot number or state root, or one of the special values "genesis", "head", "justified" or "finalized".
State string
Expand Down
2 changes: 2 additions & 0 deletions api/validatorbalancesopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import "github.com/attestantio/go-eth2-client/spec/phase0"

// ValidatorBalancesOpts are the options for obtaining validator balances.
type ValidatorBalancesOpts struct {
Common CommonOpts

// State is the state at which the data is obtained.
// It can be a slot number or state root, or one of the special values "genesis", "head", "justified" or "finalized".
State string
Expand Down
2 changes: 2 additions & 0 deletions api/validatorsopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import "github.com/attestantio/go-eth2-client/spec/phase0"

// ValidatorsOpts are the options for obtaining validators.
type ValidatorsOpts struct {
Common CommonOpts

// State is the state at which the data is obtained.
// It can be a slot number or state root, or one of the special values "genesis", "head", "justified" or "finalized".
State string
Expand Down
Loading