From f04dce35a22c870e251830d52cb6e9cbb5ed86ce Mon Sep 17 00:00:00 2001 From: Shane O'Brien Date: Wed, 24 Apr 2024 10:36:31 -0400 Subject: [PATCH 01/16] Working on adding list stakes filter, currently have a functional prototype with tests --- README.md | 8 +- client/client.go | 6 +- client/filter/filter_test.go | 76 +++++++----- client/rewards/{v1 => }/client.go | 10 +- client/rewards/protocols.go | 11 ++ client/rewards/{v1 => }/reward.go | 2 +- .../rewards/{v1 => reward}/reward_filter.go | 2 +- client/rewards/reward/reward_filter_test.go | 111 ++++++++++++++++++ client/rewards/{v1 => }/stake.go | 2 +- client/rewards/stakes/stake_filter.go | 60 ++++++++++ client/rewards/stakes/stake_filter_test.go | 63 ++++++++++ client/rewards/v1/reward_filter_test.go | 71 ----------- examples/cosmos/list-rewards/main.go | 8 +- examples/ethereum/list-rewards/main.go | 15 ++- examples/ethereum/list-stakes/main.go | 9 +- examples/solana/list-rewards/main.go | 8 +- go.mod | 1 + 17 files changed, 330 insertions(+), 133 deletions(-) rename client/rewards/{v1 => }/client.go (84%) create mode 100644 client/rewards/protocols.go rename client/rewards/{v1 => }/reward.go (99%) rename client/rewards/{v1 => reward}/reward_filter.go (99%) create mode 100644 client/rewards/reward/reward_filter_test.go rename client/rewards/{v1 => }/stake.go (99%) create mode 100644 client/rewards/stakes/stake_filter.go create mode 100644 client/rewards/stakes/stake_filter_test.go delete mode 100644 client/rewards/v1/reward_filter_test.go diff --git a/README.md b/README.md index 196e6db..27779f8 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ import ( "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" - rewardsV1 "github.com/coinbase/staking-client-library-go/client/rewards/v1" + "github.com/coinbase/staking-client-library-go/client/rewards" rewardspb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" ) @@ -150,9 +150,9 @@ func main() { rewardsIter := stakingClient.Rewards.ListRewards(ctx, &rewardspb.ListRewardsRequest{ Parent: rewardspb.ProtocolResourceName{Protocol: "ethereum"}.String(), PageSize: 200, - Filter: rewardsV1.WithAddress().Eq("0xac53512c39d0081ca4437c285305eb423f474e6153693c12fbba4a3df78bcaa3422b31d800c5bea71c1b017168a60474"). - And(rewardsV1.WithPeriodEndTime().Gte(time.Now().AddDate(0, 0, -2))). - And(rewardsV1.WithPeriodEndTime().Lt(time.Now())).String(), + Filter: rewards.WithAddress().Eq("0xac53512c39d0081ca4437c285305eb423f474e6153693c12fbba4a3df78bcaa3422b31d800c5bea71c1b017168a60474"). + And(rewards.WithPeriodEndTime().Gte(time.Now().AddDate(0, 0, -2))). + And(rewards.WithPeriodEndTime().Lt(time.Now())).String(), }) // Iterates through the rewards and print them. diff --git a/client/client.go b/client/client.go index 146a9f0..0c7e4fc 100644 --- a/client/client.go +++ b/client/client.go @@ -6,12 +6,12 @@ import ( "github.com/coinbase/staking-client-library-go/client/options" orchestrationClient "github.com/coinbase/staking-client-library-go/client/orchestration/v1" - rewardsClient "github.com/coinbase/staking-client-library-go/client/rewards/v1" + "github.com/coinbase/staking-client-library-go/client/rewards" ) type StakingClient struct { Orchestration *orchestrationClient.OrchestrationServiceClient - Rewards *rewardsClient.RewardsServiceClient + Rewards *rewards.RewardsServiceClient } // New returns a StakingClient based on the given inputs. @@ -24,7 +24,7 @@ func New( return nil, fmt.Errorf("failed to create orchestration client: %w", err) } - rewardsClient, err := rewardsClient.NewRewardsServiceClient(ctx, stakingOpts...) + rewardsClient, err := rewards.NewRewardsServiceClient(ctx, stakingOpts...) if err != nil { return nil, fmt.Errorf("failed to create rewards client: %w", err) } diff --git a/client/filter/filter_test.go b/client/filter/filter_test.go index e79e107..854b2e1 100644 --- a/client/filter/filter_test.go +++ b/client/filter/filter_test.go @@ -1,42 +1,71 @@ -package filter +package filter_test import ( "testing" + "github.com/coinbase/staking-client-library-go/client/filter" "github.com/stretchr/testify/assert" + "github.com/test-go/testify/suite" ) +// This test suite is used to test the underlying filter package, which powers the other filter types, +// such as ListStakes and ListRewards. +func TestFilterTestSuite(t *testing.T) { + suite.Run(t, new(FilterTestSuite)) +} + +type FilterTestSuite struct { + suite.Suite +} + +func (s *FilterTestSuite) TestFilter_HappyPath() { + f := WithA().Gt(10).String() + assert.Equal(s.T(), "a > 10", f) + + // Filter to perform a simple AND between 2 conditions. + f = WithA().Gte(10).And(WithA().Lt(20)).String() + assert.Equal(s.T(), "(a >= 10 AND a < 20)", f) + + // Filter to perform a simple AND between 3 conditions with no special order enforcement. + f = WithA().Gte(10).And(WithA().Lt(20)).And(WithB().Eq("example")).String() + assert.Equal(s.T(), "(a >= 10 AND a < 20 AND b = 'example')", f) + + // Filter to perform a simple AND between 3 conditions while enforcing order of operations - forcing latter 2 conditions to be AND'ed first. + f = WithA().Gte(10).And(WithA().Lt(20).And(WithB().Eq("example"))).String() + assert.Equal(s.T(), "(a >= 10 AND (a < 20 AND b = 'example'))", f) +} + // AFilter is a custom type to define filter operation on the 'a' field. type AFilter struct{} // Eq method is a custom method to define the equals operation on the 'a' field. -func (AFilter) Eq(value int) *Term { - return NewTerm("a", Equals, value) +func (AFilter) Eq(value int) *filter.Term { + return filter.NewTerm("a", filter.Equals, value) } // Neq method is a custom method to define the not equals operation on the 'a' field. -func (AFilter) Neq(value int) *Term { - return NewTerm("a", NotEquals, value) +func (AFilter) Neq(value int) *filter.Term { + return filter.NewTerm("a", filter.NotEquals, value) } // Gt method is a custom method to define the greater than operation on the 'a' field. -func (AFilter) Gt(value int) *Term { - return NewTerm("a", GreaterThan, value) +func (AFilter) Gt(value int) *filter.Term { + return filter.NewTerm("a", filter.GreaterThan, value) } // Gte method is a custom method to define the greater than or equals operation on the 'a' field. -func (AFilter) Gte(value int) *Term { - return NewTerm("a", GreaterEquals, value) +func (AFilter) Gte(value int) *filter.Term { + return filter.NewTerm("a", filter.GreaterEquals, value) } // Lt method is a custom method to define the less than operation on the 'a' field. -func (AFilter) Lt(value int) *Term { - return NewTerm("a", LessThan, value) +func (AFilter) Lt(value int) *filter.Term { + return filter.NewTerm("a", filter.LessThan, value) } // Lte method is a custom method to define the less than or equals operation on the 'a' field. -func (AFilter) Lte(value int) *Term { - return NewTerm("a", LessEquals, value) +func (AFilter) Lte(value int) *filter.Term { + return filter.NewTerm("a", filter.LessEquals, value) } func WithA() AFilter { @@ -47,27 +76,10 @@ func WithA() AFilter { type BFilter struct{} // Eq method is a custom method to define the equals operation on the 'b' field. -func (BFilter) Eq(value string) *Term { - return NewTerm("b", Equals, value) +func (BFilter) Eq(value string) *filter.Term { + return filter.NewTerm("b", filter.Equals, value) } func WithB() BFilter { return BFilter{} } - -func TestFilter(t *testing.T) { - f := WithA().Gt(10).String() - assert.Equal(t, "a > '10'", f) - - // Filter to perform a simple AND between 2 conditions. - f = WithA().Gte(10).And(WithA().Lt(20)).String() - assert.Equal(t, "(a >= '10' AND a < '20')", f) - - // Filter to perform a simple AND between 3 conditions with no special order enforcement. - f = WithA().Gte(10).And(WithA().Lt(20)).And(WithB().Eq("example")).String() - assert.Equal(t, "(a >= '10' AND a < '20' AND b = 'example')", f) - - // Filter to perform a simple AND between 3 conditions while enforcing order of operations - forcing latter 2 conditions to be AND'ed first. - f = WithA().Gte(10).And(WithA().Lt(20).And(WithB().Eq("example"))).String() - assert.Equal(t, "(a >= '10' AND (a < '20' AND b = 'example'))", f) -} diff --git a/client/rewards/v1/client.go b/client/rewards/client.go similarity index 84% rename from client/rewards/v1/client.go rename to client/rewards/client.go index b8d0702..49117db 100644 --- a/client/rewards/v1/client.go +++ b/client/rewards/client.go @@ -1,11 +1,11 @@ -package v1 +package rewards import ( "context" "google.golang.org/grpc" - clients "github.com/coinbase/staking-client-library-go/client/options" + "github.com/coinbase/staking-client-library-go/client/options" innerClient "github.com/coinbase/staking-client-library-go/gen/client/coinbase/staking/rewards/v1" ) @@ -22,14 +22,14 @@ type RewardsServiceClient struct { // NewRewardsServiceClient returns a RewardsServiceClient based on the given inputs. func NewRewardsServiceClient( ctx context.Context, - stakingOpts ...clients.StakingClientOption, + stakingOpts ...options.StakingClientOption, ) (*RewardsServiceClient, error) { - config, err := clients.GetConfig("rewards-reporting", serviceEndpoint, stakingOpts...) + config, err := options.GetConfig("rewards-reporting", serviceEndpoint, stakingOpts...) if err != nil { return nil, err } - clientOptions, err := clients.GetClientOptions(config) + clientOptions, err := options.GetClientOptions(config) if err != nil { return nil, err } diff --git a/client/rewards/protocols.go b/client/rewards/protocols.go new file mode 100644 index 0000000..83cb4a1 --- /dev/null +++ b/client/rewards/protocols.go @@ -0,0 +1,11 @@ +package rewards + +import ( + rewardspb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" +) + +var ( + Ethereum = rewardspb.ProtocolResourceName{Protocol: "ethereum"}.String() + Solana = rewardspb.ProtocolResourceName{Protocol: "solana"}.String() + Cosmos = rewardspb.ProtocolResourceName{Protocol: "cosmos"}.String() +) diff --git a/client/rewards/v1/reward.go b/client/rewards/reward.go similarity index 99% rename from client/rewards/v1/reward.go rename to client/rewards/reward.go index de7005a..cfba089 100644 --- a/client/rewards/v1/reward.go +++ b/client/rewards/reward.go @@ -1,4 +1,4 @@ -package v1 +package rewards import ( "context" diff --git a/client/rewards/v1/reward_filter.go b/client/rewards/reward/reward_filter.go similarity index 99% rename from client/rewards/v1/reward_filter.go rename to client/rewards/reward/reward_filter.go index 00dd5bb..35db8ee 100644 --- a/client/rewards/v1/reward_filter.go +++ b/client/rewards/reward/reward_filter.go @@ -1,4 +1,4 @@ -package v1 +package reward import ( "time" diff --git a/client/rewards/reward/reward_filter_test.go b/client/rewards/reward/reward_filter_test.go new file mode 100644 index 0000000..1763888 --- /dev/null +++ b/client/rewards/reward/reward_filter_test.go @@ -0,0 +1,111 @@ +package reward_test + +import ( + "fmt" + "testing" + "time" + + "github.com/coinbase/staking-client-library-go/client/rewards/reward" + "github.com/stretchr/testify/assert" + "github.com/test-go/testify/suite" +) + +func TestListRewardsFilterSuite(t *testing.T) { + suite.Run(t, new(ListRewardsFilterSuite)) +} + +type ListRewardsFilterSuite struct { + suite.Suite +} + +func (s *ListRewardsFilterSuite) TestListRewardsFilter_WithAddress() { + f := reward.WithAddress().Eq("abcd").String() + assert.Equal(s.T(), "address = 'abcd'", f) +} + +func (s *ListRewardsFilterSuite) TestListStakesFilter_WithAddress() { + f := reward.WithAddress().Eq("abcd").String() + assert.Equal(s.T(), "address = 'abcd'", f) +} + +func (s *ListRewardsFilterSuite) TestListStakesFilter_WithEpoch() { + var f string + + f = reward.WithEpoch().Eq(10).String() + assert.Equal(s.T(), "epoch = 10", f) + + f = reward.WithAddress().Eq("abcd").And(reward.WithEpoch().Lt(10)).String() + assert.Equal(s.T(), "(address = 'abcd' AND epoch < 10)", f) + + f = reward.WithAddress().Eq("abcd").And(reward.WithEpoch().Lte(10)).String() + assert.Equal(s.T(), "(address = 'abcd' AND epoch <= 10)", f) + + f = reward.WithAddress().Eq("abcd").And(reward.WithEpoch().Gt(10)).String() + assert.Equal(s.T(), "(address = 'abcd' AND epoch > 10)", f) + + f = reward.WithAddress().Eq("abcd").And(reward.WithEpoch().Gte(10)).String() + assert.Equal(s.T(), "(address = 'abcd' AND epoch >= 10)", f) + + f = reward.WithAddress().Eq("abcd").And(reward.WithEpoch().Neq(10)).String() + assert.Equal(s.T(), "(address = 'abcd' AND epoch != 10)", f) +} + +func (s *ListRewardsFilterSuite) TestListStakesFilter_WithDate() { + var f string + + f = reward.WithDate().Eq("2020-01-01").String() + assert.Equal(s.T(), "date = '2020-01-01'", f) + + f = reward.WithAddress().Eq("abcd").And(reward.WithDate().Lt("2020-01-01")).String() + assert.Equal(s.T(), "(address = 'abcd' AND date < '2020-01-01')", f) + + f = reward.WithAddress().Eq("abcd").And(reward.WithDate().Lte("2020-01-01")).String() + assert.Equal(s.T(), "(address = 'abcd' AND date <= '2020-01-01')", f) + + f = reward.WithAddress().Eq("abcd").And(reward.WithDate().Gt("2020-01-01")).String() + assert.Equal(s.T(), "(address = 'abcd' AND date > '2020-01-01')", f) + + f = reward.WithAddress().Eq("abcd").And(reward.WithDate().Gte("2020-01-01")).String() + assert.Equal(s.T(), "(address = 'abcd' AND date >= '2020-01-01')", f) + + f = reward.WithAddress().Eq("abcd").And(reward.WithDate().Neq("2020-01-01")).String() + assert.Equal(s.T(), "(address = 'abcd' AND date != '2020-01-01')", f) +} + +func (s *ListRewardsFilterSuite) TestListStakesFilter_WithPeriodEndTime() { + var f string + + now := time.Now() + fiveDaysAgo := now.AddDate(0, 0, -5) + + nowRFC3339 := now.Format(time.RFC3339) + fiveDaysAgoRFC3339 := fiveDaysAgo.Format(time.RFC3339) + + f = reward.WithPeriodEndTime().Eq(fiveDaysAgo).String() + assert.Equal(s.T(), fmt.Sprintf("period_end_time = '%s'", fiveDaysAgoRFC3339), f) + + f = reward.WithAddress().Eq("abcd").And(reward.WithPeriodEndTime().Lt(fiveDaysAgo)).String() + assert.Equal(s.T(), fmt.Sprintf("(address = 'abcd' AND period_end_time < '%s')", fiveDaysAgoRFC3339), f) + + f = reward.WithAddress().Eq("abcd").And(reward.WithPeriodEndTime().Lte(fiveDaysAgo)).String() + assert.Equal(s.T(), fmt.Sprintf("(address = 'abcd' AND period_end_time <= '%s')", fiveDaysAgoRFC3339), f) + + f = reward.WithAddress().Eq("abcd").And(reward.WithPeriodEndTime().Gt(fiveDaysAgo)).String() + assert.Equal(s.T(), fmt.Sprintf("(address = 'abcd' AND period_end_time > '%s')", fiveDaysAgoRFC3339), f) + + f = reward.WithAddress().Eq("abcd").And(reward.WithPeriodEndTime().Gte(fiveDaysAgo)).And(reward.WithPeriodEndTime().Lt(now)).String() + assert.Equal(s.T(), fmt.Sprintf("(address = 'abcd' AND period_end_time >= '%s' AND period_end_time < '%s')", fiveDaysAgoRFC3339, nowRFC3339), f) +} + +func (s *ListRewardsFilterSuite) TestListStakesFilter_MultipleDifferentComparisons() { + var f string + + now := time.Now() + fiveDaysAgo := now.AddDate(0, 0, -5) + + nowRFC3339 := now.Format(time.RFC3339) + fiveDaysAgoRFC3339 := fiveDaysAgo.Format(time.RFC3339) + + f = reward.WithAddress().Eq("abcd").And(reward.WithPeriodEndTime().Gte(fiveDaysAgo)).And(reward.WithPeriodEndTime().Lt(now)).And(reward.WithEpoch().Eq(50)).String() + assert.Equal(s.T(), fmt.Sprintf("(address = 'abcd' AND period_end_time >= '%s' AND period_end_time < '%s' AND epoch = 50)", fiveDaysAgoRFC3339, nowRFC3339), f) +} diff --git a/client/rewards/v1/stake.go b/client/rewards/stake.go similarity index 99% rename from client/rewards/v1/stake.go rename to client/rewards/stake.go index 5096c8b..ed149ee 100644 --- a/client/rewards/v1/stake.go +++ b/client/rewards/stake.go @@ -1,4 +1,4 @@ -package v1 +package rewards import ( "context" diff --git a/client/rewards/stakes/stake_filter.go b/client/rewards/stakes/stake_filter.go new file mode 100644 index 0000000..6463225 --- /dev/null +++ b/client/rewards/stakes/stake_filter.go @@ -0,0 +1,60 @@ +package stakes + +import ( + "time" + + "github.com/coinbase/staking-client-library-go/client/filter" +) + +// AddressFilter is a custom type to define filter operation on the address field. +type AddressFilter struct{} + +// Eq method is a custom method to define the equals operation on the address field. +func (AddressFilter) Eq(value string) *filter.Term { + return filter.NewTerm("address", filter.Equals, value) +} + +// WithAddress creates a new filter block that has `address` as the key. +// Needs a companion operator to be functional (ex: WithAddress().Eq("my_address"). +func WithAddress() AddressFilter { + return AddressFilter{} +} + +// EvaluationTimeFilter is a custom type to define filter operation on the evaluation_time field. +type EvaluationTimeFilter struct{} + +// Eq method is a custom method to define the equals operation on the evaluation_time field. +func (EvaluationTimeFilter) Eq(value time.Time) *filter.Term { + return filter.NewTerm("evaluation_time", filter.Equals, value) +} + +// Neq method is a custom method to define the not equals operation on the evaluation_time field. +func (EvaluationTimeFilter) Neq(value time.Time) *filter.Term { + return filter.NewTerm("evaluation_time", filter.NotEquals, value) +} + +// Gt method is a custom method to define the greater than operation on the evaluation_time field. +func (EvaluationTimeFilter) Gt(value time.Time) *filter.Term { + return filter.NewTerm("evaluation_time", filter.GreaterThan, value) +} + +// Gte method is a custom method to define the greater than or equals operation on the evaluation_time field. +func (EvaluationTimeFilter) Gte(value time.Time) *filter.Term { + return filter.NewTerm("evaluation_time", filter.GreaterEquals, value) +} + +// Lt method is a custom method to define the less than operation on the evaluation_time field. +func (EvaluationTimeFilter) Lt(value time.Time) *filter.Term { + return filter.NewTerm("evaluation_time", filter.LessThan, value) +} + +// Lte method is a custom method to define the less than or equals operation on the evaluation_time field. +func (EvaluationTimeFilter) Lte(value time.Time) *filter.Term { + return filter.NewTerm("evaluation_time", filter.LessEquals, value) +} + +// Instructs the backend API to return rewards aggregations that have `evaluation_time` set in a manner which matches the desired filter. +// Needs a companion comparison operator (ex: >, <, =, etc) to be functional. +func WithEvaluationTime() EvaluationTimeFilter { + return EvaluationTimeFilter{} +} diff --git a/client/rewards/stakes/stake_filter_test.go b/client/rewards/stakes/stake_filter_test.go new file mode 100644 index 0000000..86205d0 --- /dev/null +++ b/client/rewards/stakes/stake_filter_test.go @@ -0,0 +1,63 @@ +package stakes_test + +import ( + "testing" + "time" + + "github.com/coinbase/staking-client-library-go/client/rewards/stakes" + "github.com/stretchr/testify/assert" + "github.com/test-go/testify/suite" +) + +func TestListStakesFilterSuite(t *testing.T) { + suite.Run(t, new(ListStakesFilterSuite)) +} + +type ListStakesFilterSuite struct { + suite.Suite +} + +func (s *ListStakesFilterSuite) TestListStakesFilter_WithAddress() { + f := stakes.WithAddress().Eq("abcd").String() + assert.Equal(s.T(), "address = 'abcd'", f) +} + +func (s *ListStakesFilterSuite) TestListStakesFilter_EvaluationTime() { + var f string + + specificTime := time.Date(2024, time.February, 1, 0, 0, 1, 0, time.UTC) + + f = stakes.WithEvaluationTime().Eq(specificTime).String() + assert.Equal(s.T(), "evaluation_time = '2024-02-01T00:00:01Z'", f) + + f = stakes.WithAddress().Eq("abcd").And(stakes.WithEvaluationTime().Lt(specificTime)).String() + assert.Equal(s.T(), "(address = 'abcd' AND evaluation_time < '2024-02-01T00:00:01Z')", f) + + f = stakes.WithAddress().Eq("abcd").And(stakes.WithEvaluationTime().Lte(specificTime)).String() + assert.Equal(s.T(), "(address = 'abcd' AND evaluation_time <= '2024-02-01T00:00:01Z')", f) + + f = stakes.WithAddress().Eq("abcd").And(stakes.WithEvaluationTime().Gt(specificTime)).String() + assert.Equal(s.T(), "(address = 'abcd' AND evaluation_time > '2024-02-01T00:00:01Z')", f) + + f = stakes.WithAddress().Eq("abcd").And(stakes.WithEvaluationTime().Gte(specificTime)).String() + assert.Equal(s.T(), "(address = 'abcd' AND evaluation_time >= '2024-02-01T00:00:01Z')", f) + + f = stakes.WithAddress().Eq("abcd").And(stakes.WithEvaluationTime().Neq(specificTime)).String() + assert.Equal(s.T(), "(address = 'abcd' AND evaluation_time != '2024-02-01T00:00:01Z')", f) +} + +func (s *ListStakesFilterSuite) TestListStakesFilter_EvaluationTime_Double() { + var f string + + specificTime1 := time.Date(2024, time.February, 1, 0, 0, 1, 0, time.UTC) + specificTime2 := time.Date(2024, time.March, 1, 0, 0, 1, 0, time.UTC) + + f = stakes.WithEvaluationTime().Eq(specificTime1).And(stakes.WithEvaluationTime().Neq(specificTime2)).String() + assert.Equal(s.T(), "(evaluation_time = '2024-02-01T00:00:01Z' AND evaluation_time != '2024-03-01T00:00:01Z')", f) + + f = stakes.WithAddress().Eq("abcd").And(stakes.WithEvaluationTime().Gt(specificTime1)).And(stakes.WithEvaluationTime().Lt(specificTime2)).String() + assert.Equal(s.T(), "(address = 'abcd' AND evaluation_time > '2024-02-01T00:00:01Z' AND evaluation_time < '2024-03-01T00:00:01Z')", f) + + f = stakes.WithAddress().Eq("abcd").And(stakes.WithEvaluationTime().Gte(specificTime1)).And(stakes.WithEvaluationTime().Lte(specificTime2)).String() + assert.Equal(s.T(), "(address = 'abcd' AND evaluation_time >= '2024-02-01T00:00:01Z' AND evaluation_time <= '2024-03-01T00:00:01Z')", f) +} diff --git a/client/rewards/v1/reward_filter_test.go b/client/rewards/v1/reward_filter_test.go deleted file mode 100644 index 8aff925..0000000 --- a/client/rewards/v1/reward_filter_test.go +++ /dev/null @@ -1,71 +0,0 @@ -package v1 - -import ( - "fmt" - "testing" - "time" - - "github.com/stretchr/testify/assert" -) - -func TestRewardFilter(t *testing.T) { - f := WithAddress().Eq("abcd").String() - assert.Equal(t, "address = 'abcd'", f) - - f = WithEpoch().Eq(10).String() - assert.Equal(t, "epoch = 10", f) - - f = WithAddress().Eq("abcd").And(WithEpoch().Lt(10)).String() - assert.Equal(t, "(address = 'abcd' AND epoch < 10)", f) - - f = WithAddress().Eq("abcd").And(WithEpoch().Lte(10)).String() - assert.Equal(t, "(address = 'abcd' AND epoch <= 10)", f) - - f = WithAddress().Eq("abcd").And(WithEpoch().Gt(10)).String() - assert.Equal(t, "(address = 'abcd' AND epoch > 10)", f) - - f = WithAddress().Eq("abcd").And(WithEpoch().Gte(10)).String() - assert.Equal(t, "(address = 'abcd' AND epoch >= 10)", f) - - f = WithAddress().Eq("abcd").And(WithEpoch().Neq(10)).String() - assert.Equal(t, "(address = 'abcd' AND epoch != 10)", f) - - f = WithDate().Eq("2020-01-01").String() - assert.Equal(t, "date = '2020-01-01'", f) - - f = WithAddress().Eq("abcd").And(WithDate().Lt("2020-01-01")).String() - assert.Equal(t, "(address = 'abcd' AND date < '2020-01-01')", f) - - f = WithAddress().Eq("abcd").And(WithDate().Lte("2020-01-01")).String() - assert.Equal(t, "(address = 'abcd' AND date <= '2020-01-01')", f) - - f = WithAddress().Eq("abcd").And(WithDate().Gt("2020-01-01")).String() - assert.Equal(t, "(address = 'abcd' AND date > '2020-01-01')", f) - - f = WithAddress().Eq("abcd").And(WithDate().Gte("2020-01-01")).String() - assert.Equal(t, "(address = 'abcd' AND date >= '2020-01-01')", f) - - f = WithAddress().Eq("abcd").And(WithDate().Neq("2020-01-01")).String() - assert.Equal(t, "(address = 'abcd' AND date != '2020-01-01')", f) - - now := time.Now() - fiveDaysAgo := now.AddDate(0, 0, -5) - - nowRFC3339 := now.Format(time.RFC3339) - fiveDaysAgoRFC3339 := fiveDaysAgo.Format(time.RFC3339) - - f = WithPeriodEndTime().Eq(fiveDaysAgo).String() - assert.Equal(t, fmt.Sprintf("period_end_time = '%s'", fiveDaysAgoRFC3339), f) - - f = WithAddress().Eq("abcd").And(WithPeriodEndTime().Lt(fiveDaysAgo)).String() - assert.Equal(t, fmt.Sprintf("(address = 'abcd' AND period_end_time < '%s')", fiveDaysAgoRFC3339), f) - - f = WithAddress().Eq("abcd").And(WithPeriodEndTime().Lte(fiveDaysAgo)).String() - assert.Equal(t, fmt.Sprintf("(address = 'abcd' AND period_end_time <= '%s')", fiveDaysAgoRFC3339), f) - - f = WithAddress().Eq("abcd").And(WithPeriodEndTime().Gt(fiveDaysAgo)).String() - assert.Equal(t, fmt.Sprintf("(address = 'abcd' AND period_end_time > '%s')", fiveDaysAgoRFC3339), f) - - f = WithAddress().Eq("abcd").And(WithPeriodEndTime().Gte(fiveDaysAgo)).And(WithPeriodEndTime().Lt(now)).String() - assert.Equal(t, fmt.Sprintf("(address = 'abcd' AND period_end_time >= '%s' AND period_end_time < '%s')", fiveDaysAgoRFC3339, nowRFC3339), f) -} diff --git a/examples/cosmos/list-rewards/main.go b/examples/cosmos/list-rewards/main.go index 366f99f..33f4085 100644 --- a/examples/cosmos/list-rewards/main.go +++ b/examples/cosmos/list-rewards/main.go @@ -16,7 +16,7 @@ import ( "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" - rewardsV1 "github.com/coinbase/staking-client-library-go/client/rewards/v1" + "github.com/coinbase/staking-client-library-go/client/rewards" rewardspb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" ) @@ -53,9 +53,9 @@ func main() { rewardsIter := stakingClient.Rewards.ListRewards(ctx, &rewardspb.ListRewardsRequest{ Parent: rewardspb.ProtocolResourceName{Protocol: "cosmos"}.String(), PageSize: 20, - Filter: rewardsV1.WithAddress().Eq(address). - And(rewardsV1.WithDate().Gte(thirtyDaysAgoDateOnly.Format("2006-01-02"))). - And(rewardsV1.WithDate().Lt(nowDateOnly.Format("2006-01-02"))).String(), + Filter: rewards.WithAddress().Eq(address). + And(rewards.WithDate().Gte(thirtyDaysAgoDateOnly.Format("2006-01-02"))). + And(rewards.WithDate().Lt(nowDateOnly.Format("2006-01-02"))).String(), }) count := 0 diff --git a/examples/ethereum/list-rewards/main.go b/examples/ethereum/list-rewards/main.go index a4a150c..f8d0cd9 100644 --- a/examples/ethereum/list-rewards/main.go +++ b/examples/ethereum/list-rewards/main.go @@ -16,8 +16,9 @@ import ( "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" + "github.com/coinbase/staking-client-library-go/client/filter" "github.com/coinbase/staking-client-library-go/client/options" - rewardsV1 "github.com/coinbase/staking-client-library-go/client/rewards/v1" + "github.com/coinbase/staking-client-library-go/client/rewards" rewardspb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" ) @@ -38,11 +39,15 @@ func main() { // Lists the rewards for the given address for the previous last 2 days, aggregated by day. rewardsIter := stakingClient.Rewards.ListRewards(ctx, &rewardspb.ListRewardsRequest{ - Parent: rewardspb.ProtocolResourceName{Protocol: "ethereum"}.String(), + Parent: rewards.Ethereum, PageSize: 200, - Filter: rewardsV1.WithAddress().Eq("0xac53512c39d0081ca4437c285305eb423f474e6153693c12fbba4a3df78bcaa3422b31d800c5bea71c1b017168a60474"). - And(rewardsV1.WithPeriodEndTime().Gte(time.Now().AddDate(0, 0, -2))). - And(rewardsV1.WithPeriodEndTime().Lt(time.Now())).String(), + Filter: rewards.NewListRewardsFilter(). + WithAddress(filter.Equal("0xac53512c39d0081ca4437c285305eb423f474e6153693c12fbba4a3df78bcaa3422b31d800c5bea71c1b017168a60474")). + And(). + WithPeriodEndTime(filter.GreaterThanOrEqualTo(time.Now().AddDate(0, 0, -20))). + And(). + WithPeriodEndTime(filter.LessThan(time.Now())). + Build(), }) // Iterates through the rewards and print them. diff --git a/examples/ethereum/list-stakes/main.go b/examples/ethereum/list-stakes/main.go index 2a9d181..9ae6a0f 100644 --- a/examples/ethereum/list-stakes/main.go +++ b/examples/ethereum/list-stakes/main.go @@ -8,6 +8,7 @@ import ( "context" "errors" "log" + "time" "google.golang.org/api/iterator" "google.golang.org/protobuf/encoding/protojson" @@ -15,6 +16,8 @@ import ( "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" + "github.com/coinbase/staking-client-library-go/client/rewards" + "github.com/coinbase/staking-client-library-go/client/rewards/stakes" rewardspb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" ) @@ -37,9 +40,11 @@ func main() { // List staking activities for a given protocol. stakesIter := stakingClient.Rewards.ListStakes(ctx, &rewardspb.ListStakesRequest{ - Parent: rewardspb.ProtocolResourceName{Protocol: "ethereum"}.String(), + Parent: rewards.Ethereum, PageSize: 200, - Filter: `address='0xac53512c39d0081ca4437c285305eb423f474e6153693c12fbba4a3df78bcaa3422b31d800c5bea71c1b017168a60474' AND evaluation_time>='2023-12-12T07:25:11-04:00' AND evaluation_time<='2023-12-12T08:20:50-04:00'`, + Filter: stakes.WithAddress().Eq("0xac53512c39d0081ca4437c285305eb423f474e6153693c12fbba4a3df78bcaa3422b31d800c5bea71c1b017168a60474"). + And(stakes.WithEvaluationTime().Lte(time.Now())). + String(), }) count := 0 diff --git a/examples/solana/list-rewards/main.go b/examples/solana/list-rewards/main.go index 6a92c68..1f9f10b 100644 --- a/examples/solana/list-rewards/main.go +++ b/examples/solana/list-rewards/main.go @@ -16,7 +16,7 @@ import ( "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" - rewardsV1 "github.com/coinbase/staking-client-library-go/client/rewards/v1" + "github.com/coinbase/staking-client-library-go/client/rewards" rewardspb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" ) @@ -49,9 +49,9 @@ func main() { rewardsIter := stakingClient.Rewards.ListRewards(ctx, &rewardspb.ListRewardsRequest{ Parent: rewardspb.ProtocolResourceName{Protocol: "solana"}.String(), PageSize: 20, - Filter: rewardsV1.WithAddress().Eq(address). - And(rewardsV1.WithPeriodEndTime().Gte(thirtyDaysAgo)). - And(rewardsV1.WithPeriodEndTime().Lt(now)).String(), + Filter: rewards.WithAddress().Eq(address). + And(rewards.WithPeriodEndTime().Gte(thirtyDaysAgo)). + And(rewards.WithPeriodEndTime().Lt(now)).String(), }) count := 0 diff --git a/go.mod b/go.mod index 181f3b4..e9ac098 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,7 @@ require ( github.com/googleapis/gax-go/v2 v2.11.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 github.com/stretchr/testify v1.8.1 + github.com/test-go/testify v1.1.4 go.einride.tech/aip v0.60.0 google.golang.org/api v0.126.0 google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc From 9e42cc9bcb02d5926a654d205ab19f584c97e7bb Mon Sep 17 00:00:00 2001 From: Shane O'Brien Date: Wed, 24 Apr 2024 10:53:15 -0400 Subject: [PATCH 02/16] Moved protocols around, updated example(s) --- client/{rewards => protocols}/protocols.go | 2 +- client/rewards/reward/reward_filter_test.go | 3 ++ examples/ethereum/list-rewards/main.go | 32 ++++++++++-------- examples/ethereum/list-stakes/main.go | 37 ++++++++++++--------- 4 files changed, 44 insertions(+), 30 deletions(-) rename client/{rewards => protocols}/protocols.go (94%) diff --git a/client/rewards/protocols.go b/client/protocols/protocols.go similarity index 94% rename from client/rewards/protocols.go rename to client/protocols/protocols.go index 83cb4a1..85d5c8b 100644 --- a/client/rewards/protocols.go +++ b/client/protocols/protocols.go @@ -1,4 +1,4 @@ -package rewards +package protocols import ( rewardspb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" diff --git a/client/rewards/reward/reward_filter_test.go b/client/rewards/reward/reward_filter_test.go index 1763888..2cb3e26 100644 --- a/client/rewards/reward/reward_filter_test.go +++ b/client/rewards/reward/reward_filter_test.go @@ -95,6 +95,9 @@ func (s *ListRewardsFilterSuite) TestListStakesFilter_WithPeriodEndTime() { f = reward.WithAddress().Eq("abcd").And(reward.WithPeriodEndTime().Gte(fiveDaysAgo)).And(reward.WithPeriodEndTime().Lt(now)).String() assert.Equal(s.T(), fmt.Sprintf("(address = 'abcd' AND period_end_time >= '%s' AND period_end_time < '%s')", fiveDaysAgoRFC3339, nowRFC3339), f) + + f = reward.WithAddress().Eq("abcd").And(reward.WithPeriodEndTime().Gte(fiveDaysAgo).And(reward.WithPeriodEndTime().Lt(now))).String() + assert.Equal(s.T(), fmt.Sprintf("(address = 'abcd' AND (period_end_time >= '%s' AND period_end_time < '%s'))", fiveDaysAgoRFC3339, nowRFC3339), f) } func (s *ListRewardsFilterSuite) TestListStakesFilter_MultipleDifferentComparisons() { diff --git a/examples/ethereum/list-rewards/main.go b/examples/ethereum/list-rewards/main.go index f8d0cd9..b64305d 100644 --- a/examples/ethereum/list-rewards/main.go +++ b/examples/ethereum/list-rewards/main.go @@ -12,14 +12,24 @@ import ( "log" "time" + "github.com/coinbase/staking-client-library-go/client/protocols" "google.golang.org/api/iterator" "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" - "github.com/coinbase/staking-client-library-go/client/filter" "github.com/coinbase/staking-client-library-go/client/options" - "github.com/coinbase/staking-client-library-go/client/rewards" - rewardspb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" + reward "github.com/coinbase/staking-client-library-go/client/rewards/reward" + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" +) + +/* + * Run the code with 'go run main.go' to view the rewards for the first validator on the Ethereum network. + * Or, to view rewards for any arbitrary validator, simply replace the public key below. + */ + +const ( + // https://beaconcha.in/validator/1 + address = "0xa1d1ad0714035353258038e964ae9675dc0252ee22cea896825c01458e1807bfad2f9969338798548d9858a571f7425c" ) func main() { @@ -38,16 +48,12 @@ func main() { } // Lists the rewards for the given address for the previous last 2 days, aggregated by day. - rewardsIter := stakingClient.Rewards.ListRewards(ctx, &rewardspb.ListRewardsRequest{ - Parent: rewards.Ethereum, + rewardsIter := stakingClient.Rewards.ListRewards(ctx, &api.ListRewardsRequest{ + Parent: protocols.Ethereum, PageSize: 200, - Filter: rewards.NewListRewardsFilter(). - WithAddress(filter.Equal("0xac53512c39d0081ca4437c285305eb423f474e6153693c12fbba4a3df78bcaa3422b31d800c5bea71c1b017168a60474")). - And(). - WithPeriodEndTime(filter.GreaterThanOrEqualTo(time.Now().AddDate(0, 0, -20))). - And(). - WithPeriodEndTime(filter.LessThan(time.Now())). - Build(), + Filter: reward.WithAddress().Eq(address). + And(reward.WithPeriodEndTime().Gte(time.Now().AddDate(0, 0, -20))). + And(reward.WithPeriodEndTime().Lt(time.Now())).String(), }) // Iterates through the rewards and print them. @@ -66,6 +72,6 @@ func main() { log.Fatalf("error marshaling reward: %s", err.Error()) } - fmt.Printf(string(marshaled)) + fmt.Println(string(marshaled)) } } diff --git a/examples/ethereum/list-stakes/main.go b/examples/ethereum/list-stakes/main.go index 9ae6a0f..26db96a 100644 --- a/examples/ethereum/list-stakes/main.go +++ b/examples/ethereum/list-stakes/main.go @@ -6,22 +6,31 @@ package main import ( "context" + "encoding/json" "errors" + "fmt" "log" "time" + "github.com/coinbase/staking-client-library-go/client/protocols" "google.golang.org/api/iterator" - "google.golang.org/protobuf/encoding/protojson" "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" - "github.com/coinbase/staking-client-library-go/client/rewards" - "github.com/coinbase/staking-client-library-go/client/rewards/stakes" - rewardspb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" +) + +/* + * Run the code with 'go run main.go' to view the balances for the first validator on the Ethereum network. + * Or, to view balances for any arbitrary validator, simply replace the public key below. + */ + +const ( + // https://beaconcha.in/validator/1 + address = "0xa1d1ad0714035353258038e964ae9675dc0252ee22cea896825c01458e1807bfad2f9969338798548d9858a571f7425c" ) -// An example function to demonstrate how to use the staking client libraries. func main() { ctx := context.Background() @@ -38,16 +47,13 @@ func main() { log.Fatalf("error instantiating staking client: %s", err.Error()) } - // List staking activities for a given protocol. - stakesIter := stakingClient.Rewards.ListStakes(ctx, &rewardspb.ListStakesRequest{ - Parent: rewards.Ethereum, + // List historical staking balances for the given address starting from the most recent after the given timestamp. + stakesIter := stakingClient.Rewards.ListStakes(ctx, &api.ListStakesRequest{ + Parent: protocols.Ethereum, PageSize: 200, - Filter: stakes.WithAddress().Eq("0xac53512c39d0081ca4437c285305eb423f474e6153693c12fbba4a3df78bcaa3422b31d800c5bea71c1b017168a60474"). - And(stakes.WithEvaluationTime().Lte(time.Now())). - String(), + Filter: fmt.Sprintf(`address='%s' AND evaluation_time<='%s'`, address, time.Now().AddDate(0, 0, -20).Format(time.RFC3339)), }) - count := 0 for { stake, err := stakesIter.Next() if errors.Is(err, iterator.Done) { @@ -58,12 +64,11 @@ func main() { log.Fatalf("error listing stakes: %s", err.Error()) } - d, err := protojson.Marshal(stake) + marshaled, err := json.MarshalIndent(stake, "", " ") if err != nil { - log.Fatalf("error marshalling stake object: %s", err.Error()) + log.Fatalf("error marshaling stake balance: %s", err.Error()) } - log.Printf("[%d] Stake details: %s", count, d) - count += 1 + fmt.Println(string(marshaled)) } } From 414d848460638b3e5380a6b28c524c1105b416d8 Mon Sep 17 00:00:00 2001 From: Shane O'Brien Date: Wed, 24 Apr 2024 11:00:51 -0400 Subject: [PATCH 03/16] Added cosmos example --- examples/cosmos/list-rewards/main.go | 46 ++++++++--------- examples/cosmos/list-stakes/main.go | 71 ++++++++++++++++++++++++++ examples/ethereum/list-rewards/main.go | 2 +- examples/ethereum/list-stakes/main.go | 4 +- examples/solana/list-rewards/main.go | 43 ++++++++-------- 5 files changed, 117 insertions(+), 49 deletions(-) create mode 100644 examples/cosmos/list-stakes/main.go diff --git a/examples/cosmos/list-rewards/main.go b/examples/cosmos/list-rewards/main.go index 33f4085..01a72e3 100644 --- a/examples/cosmos/list-rewards/main.go +++ b/examples/cosmos/list-rewards/main.go @@ -1,31 +1,33 @@ -/* - * This example code, demonstrates rewards client library usage for listing rewards - */ - package main import ( "context" + "encoding/json" "errors" + "fmt" "log" "time" + "github.com/coinbase/staking-client-library-go/client/protocols" + "github.com/coinbase/staking-client-library-go/client/rewards/reward" "google.golang.org/api/iterator" - "google.golang.org/protobuf/encoding/protojson" "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" - "github.com/coinbase/staking-client-library-go/client/rewards" - rewardspb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" ) +/* + * Run the code with 'go run main.go' to view the rewards for Coinbase Cloud's public validator. + * Or, to view rewards for any arbitrary validator, simply replace the address below with any validator on the Cosmos blockchain. + */ + const ( - // TODO: Replace address as per your requirement. + // https://atomscan.com/validators/cosmosvaloper1crqm3598z6qmyn2kkcl9dz7uqs4qdqnr6s8jdn address = "cosmos1crqm3598z6qmyn2kkcl9dz7uqs4qdqnrlyn8pq" ) -// An example function to demonstrate how to use the staking client libraries. func main() { ctx := context.Background() @@ -43,22 +45,15 @@ func main() { } // List all rewards for the given address, aggregated by day, for epochs that ended in the last 30 days. - - now := time.Now() - nowDateOnly := now.Truncate(24 * time.Hour) - - thirtyDaysAgo := now.AddDate(0, 0, -30) - thirtyDaysAgoDateOnly := thirtyDaysAgo.Truncate(24 * time.Hour) - - rewardsIter := stakingClient.Rewards.ListRewards(ctx, &rewardspb.ListRewardsRequest{ - Parent: rewardspb.ProtocolResourceName{Protocol: "cosmos"}.String(), + rewardsIter := stakingClient.Rewards.ListRewards(ctx, &api.ListRewardsRequest{ + Parent: protocols.Cosmos, PageSize: 20, - Filter: rewards.WithAddress().Eq(address). - And(rewards.WithDate().Gte(thirtyDaysAgoDateOnly.Format("2006-01-02"))). - And(rewards.WithDate().Lt(nowDateOnly.Format("2006-01-02"))).String(), + Filter: reward.WithAddress().Eq(address). + And(reward.WithPeriodEndTime().Gte(time.Now().AddDate(0, 0, -20))). + And(reward.WithPeriodEndTime().Lt(time.Now())).String(), }) - count := 0 + // Iterates through the rewards and print them. for { reward, err := rewardsIter.Next() if errors.Is(err, iterator.Done) { @@ -69,12 +64,11 @@ func main() { log.Fatalf("error listing rewards: %s", err.Error()) } - d, err := protojson.Marshal(reward) + marshaled, err := json.MarshalIndent(reward, "", " ") if err != nil { - log.Fatalf("error marshalling reward object: %s", err.Error()) + log.Fatalf("error marshaling reward: %s", err.Error()) } - log.Printf("[%d] Reward details: %s", count, d) - count += 1 + fmt.Println(string(marshaled)) } } diff --git a/examples/cosmos/list-stakes/main.go b/examples/cosmos/list-stakes/main.go new file mode 100644 index 0000000..6a48d71 --- /dev/null +++ b/examples/cosmos/list-stakes/main.go @@ -0,0 +1,71 @@ +package main + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "log" + + "google.golang.org/api/iterator" + + "github.com/coinbase/staking-client-library-go/auth" + "github.com/coinbase/staking-client-library-go/client" + "github.com/coinbase/staking-client-library-go/client/options" + "github.com/coinbase/staking-client-library-go/client/protocols" + "github.com/coinbase/staking-client-library-go/client/rewards/stakes" + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" +) + +/* + * Run the code with 'go run main.go' to view the balances for Coinbase Cloud's public validator. + * Or, to view balances for any arbitrary validator, simply replace the address below with any validator on the Cosmos blockchain. + */ + +const ( + // https://atomscan.com/validators/cosmosvaloper1crqm3598z6qmyn2kkcl9dz7uqs4qdqnr6s8jdn + address = "cosmos1crqm3598z6qmyn2kkcl9dz7uqs4qdqnrlyn8pq" +) + +func main() { + ctx := context.Background() + + apiKey, err := auth.NewAPIKey(auth.WithLoadAPIKeyFromFile(true)) + if err != nil { + log.Fatalf("error loading API key: %s", err.Error()) + } + + authOpt := options.WithAPIKey(apiKey) + + // Create a staking client. + stakingClient, err := client.New(ctx, authOpt) + if err != nil { + log.Fatalf("error instantiating staking client: %s", err.Error()) + } + + // List historical staking balances for the given address starting from the most recent after the given timestamp. + stakesIter := stakingClient.Rewards.ListStakes(ctx, &api.ListStakesRequest{ + Parent: protocols.Cosmos, + PageSize: 20, + Filter: stakes.WithAddress().Eq(address).String(), + }) + + // Iterates through the stakes and print them. + for { + reward, err := stakesIter.Next() + if errors.Is(err, iterator.Done) { + break + } + + if err != nil { + log.Fatalf("error listing stakes: %s", err.Error()) + } + + marshaled, err := json.MarshalIndent(reward, "", " ") + if err != nil { + log.Fatalf("error marshaling reward: %s", err.Error()) + } + + fmt.Println(string(marshaled)) + } +} diff --git a/examples/ethereum/list-rewards/main.go b/examples/ethereum/list-rewards/main.go index b64305d..ee26ddb 100644 --- a/examples/ethereum/list-rewards/main.go +++ b/examples/ethereum/list-rewards/main.go @@ -47,7 +47,7 @@ func main() { log.Fatalf("error instantiating staking client: %s", err.Error()) } - // Lists the rewards for the given address for the previous last 2 days, aggregated by day. + // Lists the rewards for the given address for the previous last 20 days, aggregated by day. rewardsIter := stakingClient.Rewards.ListRewards(ctx, &api.ListRewardsRequest{ Parent: protocols.Ethereum, PageSize: 200, diff --git a/examples/ethereum/list-stakes/main.go b/examples/ethereum/list-stakes/main.go index 26db96a..8601dab 100644 --- a/examples/ethereum/list-stakes/main.go +++ b/examples/ethereum/list-stakes/main.go @@ -10,9 +10,9 @@ import ( "errors" "fmt" "log" - "time" "github.com/coinbase/staking-client-library-go/client/protocols" + "github.com/coinbase/staking-client-library-go/client/rewards/stakes" "google.golang.org/api/iterator" "github.com/coinbase/staking-client-library-go/auth" @@ -51,7 +51,7 @@ func main() { stakesIter := stakingClient.Rewards.ListStakes(ctx, &api.ListStakesRequest{ Parent: protocols.Ethereum, PageSize: 200, - Filter: fmt.Sprintf(`address='%s' AND evaluation_time<='%s'`, address, time.Now().AddDate(0, 0, -20).Format(time.RFC3339)), + Filter: stakes.WithAddress().Eq(address).String(), }) for { diff --git a/examples/solana/list-rewards/main.go b/examples/solana/list-rewards/main.go index 1f9f10b..6e0ae0a 100644 --- a/examples/solana/list-rewards/main.go +++ b/examples/solana/list-rewards/main.go @@ -1,31 +1,38 @@ /* - * This example code, demonstrates rewards client library usage for listing rewards + * This example code list historical staking rewards of a validator on the Solana blockchain + * A user can view historical staking rewards for any validator on the Solana blockchain by replacing the address below */ package main import ( "context" + "encoding/json" "errors" + "fmt" "log" "time" "google.golang.org/api/iterator" - "google.golang.org/protobuf/encoding/protojson" "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" - "github.com/coinbase/staking-client-library-go/client/rewards" - rewardspb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" + "github.com/coinbase/staking-client-library-go/client/protocols" + "github.com/coinbase/staking-client-library-go/client/rewards/reward" + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" ) +/* + * Run the code with 'go run main.go' to view the rewards for Coinbase Cloud's public validator. + * Or, to view rewards for any arbitrary validator, simply replace the address below with any validator on the Solana blockchain. + */ + const ( - // TODO: Replace address as per your requirement. - address = "beefKGBWeSpHzYBHZXwp5So7wdQGX6mu4ZHCsH3uTar" + // https://solanabeach.io/validator/6D2jqw9hyVCpppZexquxa74Fn33rJzzBx38T58VucHx9 + address = "6D2jqw9hyVCpppZexquxa74Fn33rJzzBx38T58VucHx9" ) -// An example function to demonstrate how to use the staking client libraries. func main() { ctx := context.Background() @@ -43,18 +50,15 @@ func main() { } // List all rewards for the given address, aggregated by epoch, for epochs that ended in the last 30 days. - now := time.Now() - thirtyDaysAgo := now.AddDate(0, 0, -30) - - rewardsIter := stakingClient.Rewards.ListRewards(ctx, &rewardspb.ListRewardsRequest{ - Parent: rewardspb.ProtocolResourceName{Protocol: "solana"}.String(), + rewardsIter := stakingClient.Rewards.ListRewards(ctx, &api.ListRewardsRequest{ + Parent: protocols.Solana, PageSize: 20, - Filter: rewards.WithAddress().Eq(address). - And(rewards.WithPeriodEndTime().Gte(thirtyDaysAgo)). - And(rewards.WithPeriodEndTime().Lt(now)).String(), + Filter: reward.WithAddress().Eq(address). + And(reward.WithPeriodEndTime().Gte(time.Now().AddDate(0, 0, -30))). + And(reward.WithPeriodEndTime().Lt(time.Now())).String(), }) - count := 0 + // Iterates through the rewards and print them. for { reward, err := rewardsIter.Next() if errors.Is(err, iterator.Done) { @@ -65,12 +69,11 @@ func main() { log.Fatalf("error listing rewards: %s", err.Error()) } - d, err := protojson.Marshal(reward) + marshaled, err := json.MarshalIndent(reward, "", " ") if err != nil { - log.Fatalf("error marshalling reward object: %s", err.Error()) + log.Fatalf("error marshaling reward: %s", err.Error()) } - log.Printf("[%d] Reward details: %s", count, d) - count += 1 + fmt.Println(string(marshaled)) } } From 8bd8042dff6568b638390f2c4dc12762068f4e63 Mon Sep 17 00:00:00 2001 From: Shane O'Brien Date: Wed, 24 Apr 2024 11:15:02 -0400 Subject: [PATCH 04/16] Move orchestration package, update README code --- README.md | 24 +++++++------------ client/client.go | 6 ++--- client/orchestration/{v1 => }/action.go | 2 +- client/orchestration/{v1 => }/client.go | 2 +- client/orchestration/{v1 => }/network.go | 2 +- client/orchestration/{v1 => }/protocol.go | 2 +- .../orchestration/{v1 => }/staking_target.go | 2 +- .../{v1 => }/view_staking_context.go | 2 +- client/orchestration/{v1 => }/workflow.go | 2 +- .../create-and-process-workflow/main.go | 5 ++-- examples/ethereum/create-workflow/main.go | 14 +++-------- 11 files changed, 24 insertions(+), 39 deletions(-) rename client/orchestration/{v1 => }/action.go (96%) rename client/orchestration/{v1 => }/client.go (98%) rename client/orchestration/{v1 => }/network.go (96%) rename client/orchestration/{v1 => }/protocol.go (96%) rename client/orchestration/{v1 => }/staking_target.go (99%) rename client/orchestration/{v1 => }/view_staking_context.go (97%) rename client/orchestration/{v1 => }/workflow.go (99%) diff --git a/README.md b/README.md index 27779f8..82aaa0b 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,6 @@ package main import ( "context" - "fmt" "log" "github.com/coinbase/staking-client-library-go/auth" @@ -43,9 +42,6 @@ import ( ) func main() { - // TODO: Add your project ID found at cloud.coinbase.com or in your API key. - projectID := "" - ctx := context.Background() // Loads the API key from the default location. @@ -60,9 +56,7 @@ func main() { log.Fatalf("error instantiating staking client: %s", err.Error()) } - // Constructs the API request req := &stakingpb.CreateWorkflowRequest{ - Parent: fmt.Sprintf("projects/%s", projectID), Workflow: &stakingpb.Workflow{ Action: "protocols/ethereum_kiln/networks/holesky/actions/stake", StakingParameters: &stakingpb.Workflow_EthereumKilnStakingParameters{ @@ -79,7 +73,6 @@ func main() { }, }, }, - SkipBroadcast: true, }, } @@ -122,13 +115,14 @@ import ( "log" "time" + "github.com/coinbase/staking-client-library-go/client/protocols" "google.golang.org/api/iterator" "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" - "github.com/coinbase/staking-client-library-go/client/rewards" - rewardspb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" + reward "github.com/coinbase/staking-client-library-go/client/rewards/reward" + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" ) func main() { @@ -146,13 +140,13 @@ func main() { log.Fatalf("error instantiating staking client: %s", err.Error()) } - // Lists the rewards for the given address for the previous last 2 days, aggregated by day. - rewardsIter := stakingClient.Rewards.ListRewards(ctx, &rewardspb.ListRewardsRequest{ - Parent: rewardspb.ProtocolResourceName{Protocol: "ethereum"}.String(), + // Lists the rewards for the given address for the previous last 20 days, aggregated by day. + rewardsIter := stakingClient.Rewards.ListRewards(ctx, &api.ListRewardsRequest{ + Parent: protocols.Ethereum, PageSize: 200, - Filter: rewards.WithAddress().Eq("0xac53512c39d0081ca4437c285305eb423f474e6153693c12fbba4a3df78bcaa3422b31d800c5bea71c1b017168a60474"). - And(rewards.WithPeriodEndTime().Gte(time.Now().AddDate(0, 0, -2))). - And(rewards.WithPeriodEndTime().Lt(time.Now())).String(), + Filter: reward.WithAddress().Eq("0xac53512c39d0081ca4437c285305eb423f474e6153693c12fbba4a3df78bcaa3422b31d800c5bea71c1b017168a60474"). + And(reward.WithPeriodEndTime().Gte(time.Now().AddDate(0, 0, -20))). + And(reward.WithPeriodEndTime().Lt(time.Now())).String(), }) // Iterates through the rewards and print them. diff --git a/client/client.go b/client/client.go index 0c7e4fc..b3e27d5 100644 --- a/client/client.go +++ b/client/client.go @@ -5,12 +5,12 @@ import ( "fmt" "github.com/coinbase/staking-client-library-go/client/options" - orchestrationClient "github.com/coinbase/staking-client-library-go/client/orchestration/v1" + "github.com/coinbase/staking-client-library-go/client/orchestration" "github.com/coinbase/staking-client-library-go/client/rewards" ) type StakingClient struct { - Orchestration *orchestrationClient.OrchestrationServiceClient + Orchestration *orchestration.OrchestrationServiceClient Rewards *rewards.RewardsServiceClient } @@ -19,7 +19,7 @@ func New( ctx context.Context, stakingOpts ...options.StakingClientOption, ) (*StakingClient, error) { - orchestrationClient, err := orchestrationClient.NewOrchestrationServiceClient(ctx, stakingOpts...) + orchestrationClient, err := orchestration.NewOrchestrationServiceClient(ctx, stakingOpts...) if err != nil { return nil, fmt.Errorf("failed to create orchestration client: %w", err) } diff --git a/client/orchestration/v1/action.go b/client/orchestration/action.go similarity index 96% rename from client/orchestration/v1/action.go rename to client/orchestration/action.go index 3d65845..72e37a9 100644 --- a/client/orchestration/v1/action.go +++ b/client/orchestration/action.go @@ -1,4 +1,4 @@ -package v1 +package orchestration import ( "context" diff --git a/client/orchestration/v1/client.go b/client/orchestration/client.go similarity index 98% rename from client/orchestration/v1/client.go rename to client/orchestration/client.go index 6a66486..bd9f39d 100644 --- a/client/orchestration/v1/client.go +++ b/client/orchestration/client.go @@ -1,4 +1,4 @@ -package v1 +package orchestration import ( "context" diff --git a/client/orchestration/v1/network.go b/client/orchestration/network.go similarity index 96% rename from client/orchestration/v1/network.go rename to client/orchestration/network.go index f8cccc8..b6dc540 100644 --- a/client/orchestration/v1/network.go +++ b/client/orchestration/network.go @@ -1,4 +1,4 @@ -package v1 +package orchestration import ( "context" diff --git a/client/orchestration/v1/protocol.go b/client/orchestration/protocol.go similarity index 96% rename from client/orchestration/v1/protocol.go rename to client/orchestration/protocol.go index 7d92b25..91eb6ea 100644 --- a/client/orchestration/v1/protocol.go +++ b/client/orchestration/protocol.go @@ -1,4 +1,4 @@ -package v1 +package orchestration import ( "context" diff --git a/client/orchestration/v1/staking_target.go b/client/orchestration/staking_target.go similarity index 99% rename from client/orchestration/v1/staking_target.go rename to client/orchestration/staking_target.go index 6544d4d..4d0aba3 100644 --- a/client/orchestration/v1/staking_target.go +++ b/client/orchestration/staking_target.go @@ -1,4 +1,4 @@ -package v1 +package orchestration import ( "context" diff --git a/client/orchestration/v1/view_staking_context.go b/client/orchestration/view_staking_context.go similarity index 97% rename from client/orchestration/v1/view_staking_context.go rename to client/orchestration/view_staking_context.go index 60c44fd..e0ba6a0 100644 --- a/client/orchestration/v1/view_staking_context.go +++ b/client/orchestration/view_staking_context.go @@ -1,4 +1,4 @@ -package v1 +package orchestration import ( "context" diff --git a/client/orchestration/v1/workflow.go b/client/orchestration/workflow.go similarity index 99% rename from client/orchestration/v1/workflow.go rename to client/orchestration/workflow.go index 963305a..2b5777a 100644 --- a/client/orchestration/v1/workflow.go +++ b/client/orchestration/workflow.go @@ -1,4 +1,4 @@ -package v1 +package orchestration import ( "context" diff --git a/examples/ethereum/create-and-process-workflow/main.go b/examples/ethereum/create-and-process-workflow/main.go index b262785..e1e9abb 100644 --- a/examples/ethereum/create-and-process-workflow/main.go +++ b/examples/ethereum/create-and-process-workflow/main.go @@ -49,12 +49,11 @@ func main() { log.Fatalf("error instantiating staking client: %s", err.Error()) } - if projectID == "" || privateKey == "" || stakerAddress == "" { - log.Fatalf("projectID, privateKey and stakerAddress must be set") + if privateKey == "" || stakerAddress == "" { + log.Fatalf("privateKey stakerAddress must be set") } req := &stakingpb.CreateWorkflowRequest{ - Parent: fmt.Sprintf("projects/%s", projectID), Workflow: &stakingpb.Workflow{ Action: "protocols/ethereum_kiln/networks/holesky/actions/stake", StakingParameters: &stakingpb.Workflow_EthereumKilnStakingParameters{ diff --git a/examples/ethereum/create-workflow/main.go b/examples/ethereum/create-workflow/main.go index 09612ae..8e6faf9 100644 --- a/examples/ethereum/create-workflow/main.go +++ b/examples/ethereum/create-workflow/main.go @@ -1,12 +1,11 @@ /* - * This example code, demonstrates creating an Ethereum Partial ETH (<32 ETH) workflow, the fundamental process handler for an E2E staking experience. + * This example code demonstrates creating an Ethereum Partial ETH (<32 ETH) workflow, the fundamental process handler for an E2E staking experience. */ package main import ( "context" - "fmt" "log" "github.com/coinbase/staking-client-library-go/auth" @@ -16,28 +15,21 @@ import ( ) func main() { - // TODO: Add your project ID found at cloud.coinbase.com or in your API key. - projectID := "" - ctx := context.Background() + // Loads the API key from the default location. apiKey, err := auth.NewAPIKey(auth.WithLoadAPIKeyFromFile(true)) if err != nil { log.Fatalf("error loading API key: %s", err.Error()) } - // Create a staking client. + // Creates the Coinbase Staking API client. stakingClient, err := client.New(ctx, options.WithAPIKey(apiKey)) if err != nil { log.Fatalf("error instantiating staking client: %s", err.Error()) } - if projectID == "" { - log.Fatalf("projectID must be set") - } - req := &stakingpb.CreateWorkflowRequest{ - Parent: fmt.Sprintf("projects/%s", projectID), Workflow: &stakingpb.Workflow{ Action: "protocols/ethereum_kiln/networks/holesky/actions/stake", StakingParameters: &stakingpb.Workflow_EthereumKilnStakingParameters{ From b3d03f8768cd93b5a65013770e5cfeeb70a26d05 Mon Sep 17 00:00:00 2001 From: Shane O'Brien Date: Wed, 24 Apr 2024 11:23:16 -0400 Subject: [PATCH 05/16] Remove references to projectID, add Github Action --- .github/workflows/golangci-lint.yaml | 27 +++++++++++++++++++ README.md | 2 +- .../create-and-process-workflow/main.go | 11 ++++---- examples/ethereum/list-rewards/main.go | 2 +- examples/list-workflows/main.go | 14 +--------- examples/solana/create-workflow/main.go | 12 ++++----- 6 files changed, 40 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/golangci-lint.yaml diff --git a/.github/workflows/golangci-lint.yaml b/.github/workflows/golangci-lint.yaml new file mode 100644 index 0000000..6040969 --- /dev/null +++ b/.github/workflows/golangci-lint.yaml @@ -0,0 +1,27 @@ +name: golangci-lint +on: + push: + branches: + - master + - main + pull_request: + +permissions: + contents: read + # Optional: allow read access to pull request. Use with `only-new-issues` option. + # pull-requests: read + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "1.20" + cache: false + - name: golangci-lint + uses: golangci/golangci-lint-action@v4 + with: + version: v1.54.2 diff --git a/README.md b/README.md index 82aaa0b..884bee1 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ import ( "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" - reward "github.com/coinbase/staking-client-library-go/client/rewards/reward" + "github.com/coinbase/staking-client-library-go/client/rewards/reward" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" ) diff --git a/examples/ethereum/create-and-process-workflow/main.go b/examples/ethereum/create-and-process-workflow/main.go index e1e9abb..8e3cce7 100644 --- a/examples/ethereum/create-and-process-workflow/main.go +++ b/examples/ethereum/create-and-process-workflow/main.go @@ -15,14 +15,13 @@ import ( "github.com/coinbase/staking-client-library-go/client" stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" "github.com/coinbase/staking-client-library-go/client/options" - v1 "github.com/coinbase/staking-client-library-go/client/orchestration/v1" + "github.com/coinbase/staking-client-library-go/client/orchestration" stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" "github.com/coinbase/staking-client-library-go/internal/signer" ) const ( - // TODO: Replace with your project ID and private key. - projectID = "" + // TODO: Replace with your private key. privateKey = "" // TODO: Replace with your staker addresses and amount. @@ -93,7 +92,7 @@ func main() { printWorkflowProgressDetails(workflow) // If workflow is in WAITING_FOR_EXT_BROADCAST state, sign, broadcast the transaction and update the workflow. - if v1.WorkflowWaitingForExternalBroadcast(workflow) { + if orchestration.WorkflowWaitingForExternalBroadcast(workflow) { unsignedTx := workflow.Steps[workflow.GetCurrentStepId()].GetTxStepOutput().GetUnsignedTx() // Logic to sign the transaction. This can be substituted with any other signing mechanism. @@ -107,7 +106,7 @@ func main() { // Add logic to broadcast the tx here. fmt.Printf("Please broadcast this signed tx %s externally and return back the tx hash via the PerformWorkflowStep API ...\n", signedTx) break - } else if v1.WorkflowFinished(workflow) { + } else if orchestration.WorkflowFinished(workflow) { break } @@ -144,7 +143,7 @@ func printWorkflowProgressDetails(workflow *stakingpb.Workflow) { ) } - if v1.WorkflowFinished(workflow) { + if orchestration.WorkflowFinished(workflow) { log.Printf("Workflow reached end state - step name: %s %s workflow state: %s runtime: %v\n", step.GetName(), stepDetails, diff --git a/examples/ethereum/list-rewards/main.go b/examples/ethereum/list-rewards/main.go index ee26ddb..cbd0e2f 100644 --- a/examples/ethereum/list-rewards/main.go +++ b/examples/ethereum/list-rewards/main.go @@ -18,7 +18,7 @@ import ( "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" - reward "github.com/coinbase/staking-client-library-go/client/rewards/reward" + "github.com/coinbase/staking-client-library-go/client/rewards/reward" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" ) diff --git a/examples/list-workflows/main.go b/examples/list-workflows/main.go index ab51516..90d3f25 100644 --- a/examples/list-workflows/main.go +++ b/examples/list-workflows/main.go @@ -7,7 +7,6 @@ package main import ( "context" "errors" - "fmt" "log" "google.golang.org/api/iterator" @@ -18,11 +17,6 @@ import ( stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" ) -const ( - // TODO: Replace with your project ID. - projectID = "" -) - // An example function to demonstrate how to use the staking client libraries. func main() { ctx := context.Background() @@ -40,14 +34,8 @@ func main() { log.Fatalf("error instantiating staking client: %s", err.Error()) } - if projectID == "" { - log.Fatalf("projectID must be set") - } - // List all workflows for a given project. - workflowIter := stakingClient.Orchestration.ListWorkflows(ctx, &stakingpb.ListWorkflowsRequest{ - Parent: fmt.Sprintf("projects/%s", projectID), - }) + workflowIter := stakingClient.Orchestration.ListWorkflows(ctx, &stakingpb.ListWorkflowsRequest{}) for { workflow, err := workflowIter.Next() diff --git a/examples/solana/create-workflow/main.go b/examples/solana/create-workflow/main.go index 72cd9b0..345f736 100644 --- a/examples/solana/create-workflow/main.go +++ b/examples/solana/create-workflow/main.go @@ -7,22 +7,21 @@ package main import ( "context" "fmt" - "github.com/coinbase/staking-client-library-go/internal/signer" "log" "os" "time" + "github.com/coinbase/staking-client-library-go/internal/signer" + "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" "github.com/coinbase/staking-client-library-go/client/options" - "github.com/coinbase/staking-client-library-go/client/orchestration/v1" stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" ) const ( - // TODO: Replace with your project ID and private key. - projectID = "" + // TODO: Replace with your private key. privateKey = "" // TODO: Replace with your wallet addresses and amount. @@ -49,12 +48,11 @@ func main() { log.Fatalf("error instantiating staking client: %s", err.Error()) } - if projectID == "" || privateKey == "" || walletAddress == "" { - log.Fatalf("projectID, privateKey, and walletAddress must be set") + if privateKey == "" || walletAddress == "" { + log.Fatalf("privateKey and walletAddress must be set") } req := &stakingpb.CreateWorkflowRequest{ - Parent: fmt.Sprintf("projects/%s", projectID), Workflow: &stakingpb.Workflow{ Action: "protocols/solana/networks/testnet/actions/stake", StakingParameters: &stakingpb.Workflow_SolanaStakingParameters{ From 7cf381191d06f2885772837fdce89df8e7bd8bc4 Mon Sep 17 00:00:00 2001 From: Shane O'Brien Date: Wed, 24 Apr 2024 11:23:50 -0400 Subject: [PATCH 06/16] Commenting out branches so that I always get an action triggered --- .github/workflows/golangci-lint.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/golangci-lint.yaml b/.github/workflows/golangci-lint.yaml index 6040969..846b196 100644 --- a/.github/workflows/golangci-lint.yaml +++ b/.github/workflows/golangci-lint.yaml @@ -1,9 +1,9 @@ name: golangci-lint on: push: - branches: - - master - - main + # branches: + # - master + # - main pull_request: permissions: From 3e561085cdc062e30a96bda0f0e20e74c90f187f Mon Sep 17 00:00:00 2001 From: Shane O'Brien Date: Wed, 24 Apr 2024 11:36:05 -0400 Subject: [PATCH 07/16] Added formatting, ran formatting --- Makefile | 8 +- client/options/options.go | 6 +- client/orchestration/action.go | 3 +- client/orchestration/client.go | 3 +- client/orchestration/network.go | 3 +- client/orchestration/protocol.go | 3 +- client/orchestration/staking_target.go | 6 +- client/orchestration/view_staking_context.go | 3 +- client/orchestration/workflow.go | 6 +- client/rewards/client.go | 3 +- client/rewards/reward.go | 6 +- client/rewards/stake.go | 6 +- examples/cosmos/list-rewards/main.go | 7 +- examples/cosmos/list-stakes/main.go | 3 +- examples/ethereum/list-rewards/main.go | 5 +- examples/ethereum/list-stakes/main.go | 7 +- examples/hello-world/main.go | 3 +- examples/list-workflows/main.go | 3 +- examples/solana/create-workflow/main.go | 3 +- examples/solana/list-rewards/main.go | 3 +- .../coinbase/staking/orchestration/v1/doc.go | 73 ++++++------ .../orchestration/v1/staking_client.go | 111 ++++++++---------- gen/client/coinbase/staking/rewards/v1/doc.go | 93 ++++++++------- .../staking/rewards/v1/reward_client.go | 22 ++-- go.mod | 15 ++- go.sum | 46 ++++++++ 26 files changed, 237 insertions(+), 213 deletions(-) diff --git a/Makefile b/Makefile index 806f4ff..6e51220 100644 --- a/Makefile +++ b/Makefile @@ -58,7 +58,7 @@ buf_gen: @ rm -rf gen/client/coinbase/staking/rewards/v1/*test.go .PHONY: gen -gen: install_prerequisites build_deps clean buf_gen +gen: install_prerequisites build_deps clean buf_gen format .PHONY: build build: @@ -81,3 +81,9 @@ lint: validation_deps lintfix: validation_deps @ printf "\nFixing Lint Issues\n" @ golangci-lint run --timeout 3m --fix ./... + +.PHONY: format +format: + @ echo "Formatting app..." + @ docker run --rm -v "${PWD}:/app" -w /app golang:1.20 bash -c "go install mvdan.cc/gofumpt@v0.6.0 && go install github.com/daixiang0/gci@v0.13.4 && gofumpt -l -w . && gci write --skip-generated ." + @ echo "Done formatting app" diff --git a/client/options/options.go b/client/options/options.go index 9026219..3ff8c82 100644 --- a/client/options/options.go +++ b/client/options/options.go @@ -5,12 +5,10 @@ import ( "fmt" "net/http" - "github.com/googleapis/gax-go/v2" - - "google.golang.org/api/option" - "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client/transport" + "github.com/googleapis/gax-go/v2" + "google.golang.org/api/option" ) // StakingClientConfig stores configuration information about a Staking client. diff --git a/client/orchestration/action.go b/client/orchestration/action.go index 72e37a9..e5d36e7 100644 --- a/client/orchestration/action.go +++ b/client/orchestration/action.go @@ -3,10 +3,9 @@ package orchestration import ( "context" - "github.com/googleapis/gax-go/v2" - stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + "github.com/googleapis/gax-go/v2" ) // ListActions lists the Actions supported by Staking API. diff --git a/client/orchestration/client.go b/client/orchestration/client.go index bd9f39d..f647479 100644 --- a/client/orchestration/client.go +++ b/client/orchestration/client.go @@ -3,10 +3,9 @@ package orchestration import ( "context" - "google.golang.org/grpc" - clients "github.com/coinbase/staking-client-library-go/client/options" innerClient "github.com/coinbase/staking-client-library-go/gen/client/coinbase/staking/orchestration/v1" + "google.golang.org/grpc" ) const ( diff --git a/client/orchestration/network.go b/client/orchestration/network.go index b6dc540..fd81354 100644 --- a/client/orchestration/network.go +++ b/client/orchestration/network.go @@ -3,10 +3,9 @@ package orchestration import ( "context" - "github.com/googleapis/gax-go/v2" - stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + "github.com/googleapis/gax-go/v2" ) // ListNetworks lists the Networks supported by Staking API. diff --git a/client/orchestration/protocol.go b/client/orchestration/protocol.go index 91eb6ea..86aa208 100644 --- a/client/orchestration/protocol.go +++ b/client/orchestration/protocol.go @@ -3,10 +3,9 @@ package orchestration import ( "context" - "github.com/googleapis/gax-go/v2" - stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + "github.com/googleapis/gax-go/v2" ) // ListProtocols lists the Protocols supported by Staking API. diff --git a/client/orchestration/staking_target.go b/client/orchestration/staking_target.go index 4d0aba3..1e458c1 100644 --- a/client/orchestration/staking_target.go +++ b/client/orchestration/staking_target.go @@ -4,13 +4,11 @@ import ( "context" "errors" - "github.com/googleapis/gax-go/v2" - - "google.golang.org/api/iterator" - stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" innerClient "github.com/coinbase/staking-client-library-go/gen/client/coinbase/staking/orchestration/v1" stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" ) // StakingTargetIterator is an interface for iterating through the response to ListStakingTargets. diff --git a/client/orchestration/view_staking_context.go b/client/orchestration/view_staking_context.go index e0ba6a0..c0d225d 100644 --- a/client/orchestration/view_staking_context.go +++ b/client/orchestration/view_staking_context.go @@ -3,10 +3,9 @@ package orchestration import ( "context" - "github.com/googleapis/gax-go/v2" - stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + "github.com/googleapis/gax-go/v2" ) // ViewStakingContext helps view staking context information given a specific network address. diff --git a/client/orchestration/workflow.go b/client/orchestration/workflow.go index 2b5777a..dbda9ee 100644 --- a/client/orchestration/workflow.go +++ b/client/orchestration/workflow.go @@ -4,13 +4,11 @@ import ( "context" "errors" - "github.com/googleapis/gax-go/v2" - - "google.golang.org/api/iterator" - stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" innerClient "github.com/coinbase/staking-client-library-go/gen/client/coinbase/staking/orchestration/v1" stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" ) // CreateWorkflow starts a workflow with the given protocol specific parameters. diff --git a/client/rewards/client.go b/client/rewards/client.go index 49117db..8c518c4 100644 --- a/client/rewards/client.go +++ b/client/rewards/client.go @@ -3,10 +3,9 @@ package rewards import ( "context" - "google.golang.org/grpc" - "github.com/coinbase/staking-client-library-go/client/options" innerClient "github.com/coinbase/staking-client-library-go/gen/client/coinbase/staking/rewards/v1" + "google.golang.org/grpc" ) const ( diff --git a/client/rewards/reward.go b/client/rewards/reward.go index cfba089..9b8ba18 100644 --- a/client/rewards/reward.go +++ b/client/rewards/reward.go @@ -4,13 +4,11 @@ import ( "context" "errors" - "github.com/googleapis/gax-go/v2" - - "google.golang.org/api/iterator" - stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" innerClient "github.com/coinbase/staking-client-library-go/gen/client/coinbase/staking/rewards/v1" stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" + "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" ) // RewardIterator is an interface for iterating through the response to ListRewards. diff --git a/client/rewards/stake.go b/client/rewards/stake.go index ed149ee..b759d7b 100644 --- a/client/rewards/stake.go +++ b/client/rewards/stake.go @@ -4,13 +4,11 @@ import ( "context" "errors" - "github.com/googleapis/gax-go/v2" - - "google.golang.org/api/iterator" - stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" innerClient "github.com/coinbase/staking-client-library-go/gen/client/coinbase/staking/rewards/v1" stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" + "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" ) // StakeIterator is an interface for iterating through the response to ListStakes. diff --git a/examples/cosmos/list-rewards/main.go b/examples/cosmos/list-rewards/main.go index 01a72e3..51e06e3 100644 --- a/examples/cosmos/list-rewards/main.go +++ b/examples/cosmos/list-rewards/main.go @@ -8,14 +8,13 @@ import ( "log" "time" - "github.com/coinbase/staking-client-library-go/client/protocols" - "github.com/coinbase/staking-client-library-go/client/rewards/reward" - "google.golang.org/api/iterator" - "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" + "github.com/coinbase/staking-client-library-go/client/protocols" + "github.com/coinbase/staking-client-library-go/client/rewards/reward" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" + "google.golang.org/api/iterator" ) /* diff --git a/examples/cosmos/list-stakes/main.go b/examples/cosmos/list-stakes/main.go index 6a48d71..a4148a7 100644 --- a/examples/cosmos/list-stakes/main.go +++ b/examples/cosmos/list-stakes/main.go @@ -7,14 +7,13 @@ import ( "fmt" "log" - "google.golang.org/api/iterator" - "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" "github.com/coinbase/staking-client-library-go/client/protocols" "github.com/coinbase/staking-client-library-go/client/rewards/stakes" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" + "google.golang.org/api/iterator" ) /* diff --git a/examples/ethereum/list-rewards/main.go b/examples/ethereum/list-rewards/main.go index cbd0e2f..0d495c0 100644 --- a/examples/ethereum/list-rewards/main.go +++ b/examples/ethereum/list-rewards/main.go @@ -12,14 +12,13 @@ import ( "log" "time" - "github.com/coinbase/staking-client-library-go/client/protocols" - "google.golang.org/api/iterator" - "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" + "github.com/coinbase/staking-client-library-go/client/protocols" "github.com/coinbase/staking-client-library-go/client/rewards/reward" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" + "google.golang.org/api/iterator" ) /* diff --git a/examples/ethereum/list-stakes/main.go b/examples/ethereum/list-stakes/main.go index 8601dab..325dee1 100644 --- a/examples/ethereum/list-stakes/main.go +++ b/examples/ethereum/list-stakes/main.go @@ -11,14 +11,13 @@ import ( "fmt" "log" - "github.com/coinbase/staking-client-library-go/client/protocols" - "github.com/coinbase/staking-client-library-go/client/rewards/stakes" - "google.golang.org/api/iterator" - "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" + "github.com/coinbase/staking-client-library-go/client/protocols" + "github.com/coinbase/staking-client-library-go/client/rewards/stakes" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" + "google.golang.org/api/iterator" ) /* diff --git a/examples/hello-world/main.go b/examples/hello-world/main.go index 7c32adf..94903c6 100644 --- a/examples/hello-world/main.go +++ b/examples/hello-world/main.go @@ -9,12 +9,11 @@ import ( "errors" "log" - "google.golang.org/api/iterator" - "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + "google.golang.org/api/iterator" ) // An example function that verifies the API key has been configured correctly and you can connect to the Coinbase Staking API. diff --git a/examples/list-workflows/main.go b/examples/list-workflows/main.go index 90d3f25..c9dca90 100644 --- a/examples/list-workflows/main.go +++ b/examples/list-workflows/main.go @@ -9,12 +9,11 @@ import ( "errors" "log" - "google.golang.org/api/iterator" - "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + "google.golang.org/api/iterator" ) // An example function to demonstrate how to use the staking client libraries. diff --git a/examples/solana/create-workflow/main.go b/examples/solana/create-workflow/main.go index 345f736..649ad97 100644 --- a/examples/solana/create-workflow/main.go +++ b/examples/solana/create-workflow/main.go @@ -11,13 +11,12 @@ import ( "os" "time" - "github.com/coinbase/staking-client-library-go/internal/signer" - "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" "github.com/coinbase/staking-client-library-go/client/options" stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + "github.com/coinbase/staking-client-library-go/internal/signer" ) const ( diff --git a/examples/solana/list-rewards/main.go b/examples/solana/list-rewards/main.go index 6e0ae0a..c92f920 100644 --- a/examples/solana/list-rewards/main.go +++ b/examples/solana/list-rewards/main.go @@ -13,14 +13,13 @@ import ( "log" "time" - "google.golang.org/api/iterator" - "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" "github.com/coinbase/staking-client-library-go/client/protocols" "github.com/coinbase/staking-client-library-go/client/rewards/reward" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" + "google.golang.org/api/iterator" ) /* diff --git a/gen/client/coinbase/staking/orchestration/v1/doc.go b/gen/client/coinbase/staking/orchestration/v1/doc.go index 82cde6d..57e5d9a 100644 --- a/gen/client/coinbase/staking/orchestration/v1/doc.go +++ b/gen/client/coinbase/staking/orchestration/v1/doc.go @@ -14,59 +14,59 @@ // Code generated by protoc-gen-go_gapic. DO NOT EDIT. -// // General documentation // // For information about setting deadlines, reusing contexts, and more // please visit https://pkg.go.dev/cloud.google.com/go. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// // This snippet has been automatically generated and should be regarded as a code template only. -// // It will require modifications to work: -// // - It may require correct/in-range values for request initialization. -// // - It may require specifying regional endpoints when creating the service client as shown in: -// // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options -// c, err := v1.NewStakingClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// // This snippet has been automatically generated and should be regarded as a code template only. +// // It will require modifications to work: +// // - It may require correct/in-range values for request initialization. +// // - It may require specifying regional endpoints when creating the service client as shown in: +// // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options +// c, err := v1.NewStakingClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // // The client will use your default application credentials. Clients should be reused instead of created as needed. // The methods of Client are safe for concurrent use by multiple goroutines. // The returned client must be Closed when it is done being used. // -// Using the Client +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// // This snippet has been automatically generated and should be regarded as a code template only. -// // It will require modifications to work: -// // - It may require correct/in-range values for request initialization. -// // - It may require specifying regional endpoints when creating the service client as shown in: -// // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options -// c, err := v1.NewStakingClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// ctx := context.Background() +// // This snippet has been automatically generated and should be regarded as a code template only. +// // It will require modifications to work: +// // - It may require correct/in-range values for request initialization. +// // - It may require specifying regional endpoints when creating the service client as shown in: +// // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options +// c, err := v1.NewStakingClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // -// req := &stakingpb.ListProtocolsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1#ListProtocolsRequest. -// } -// resp, err := c.ListProtocols(ctx, req) -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp +// req := &stakingpb.ListProtocolsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1#ListProtocolsRequest. +// } +// resp, err := c.ListProtocols(ctx, req) +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp // -// Use of Context +// # Use of Context // // The ctx passed to NewStakingClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. @@ -174,4 +174,3 @@ func buildHeaders(ctx context.Context, mds ...metadata.MD) http.Header { md := metadata.Join(mds...) return http.Header(md) } - diff --git a/gen/client/coinbase/staking/orchestration/v1/staking_client.go b/gen/client/coinbase/staking/orchestration/v1/staking_client.go index c14db70..50cdc2b 100644 --- a/gen/client/coinbase/staking/orchestration/v1/staking_client.go +++ b/gen/client/coinbase/staking/orchestration/v1/staking_client.go @@ -14,7 +14,6 @@ // Code generated by protoc-gen-go_gapic. DO NOT EDIT. - package v1 import ( @@ -44,15 +43,15 @@ var newStakingClientHook clientHook // StakingCallOptions contains the retry settings for each method of StakingClient. type StakingCallOptions struct { - ListProtocols []gax.CallOption - ListNetworks []gax.CallOption - ListStakingTargets []gax.CallOption - ListActions []gax.CallOption - CreateWorkflow []gax.CallOption - GetWorkflow []gax.CallOption - ListWorkflows []gax.CallOption + ListProtocols []gax.CallOption + ListNetworks []gax.CallOption + ListStakingTargets []gax.CallOption + ListActions []gax.CallOption + CreateWorkflow []gax.CallOption + GetWorkflow []gax.CallOption + ListWorkflows []gax.CallOption PerformWorkflowStep []gax.CallOption - ViewStakingContext []gax.CallOption + ViewStakingContext []gax.CallOption } func defaultStakingGRPCClientOptions() []option.ClientOption { @@ -63,53 +62,35 @@ func defaultStakingGRPCClientOptions() []option.ClientOption { internaloption.WithDefaultScopes(DefaultAuthScopes()...), internaloption.EnableJwtWithScope(), option.WithGRPCDialOption(grpc.WithDefaultCallOptions( - grpc.MaxCallRecvMsgSize(math.MaxInt32))), + grpc.MaxCallRecvMsgSize(math.MaxInt32))), } } func defaultStakingCallOptions() *StakingCallOptions { return &StakingCallOptions{ - ListProtocols: []gax.CallOption{ - }, - ListNetworks: []gax.CallOption{ - }, - ListStakingTargets: []gax.CallOption{ - }, - ListActions: []gax.CallOption{ - }, - CreateWorkflow: []gax.CallOption{ - }, - GetWorkflow: []gax.CallOption{ - }, - ListWorkflows: []gax.CallOption{ - }, - PerformWorkflowStep: []gax.CallOption{ - }, - ViewStakingContext: []gax.CallOption{ - }, + ListProtocols: []gax.CallOption{}, + ListNetworks: []gax.CallOption{}, + ListStakingTargets: []gax.CallOption{}, + ListActions: []gax.CallOption{}, + CreateWorkflow: []gax.CallOption{}, + GetWorkflow: []gax.CallOption{}, + ListWorkflows: []gax.CallOption{}, + PerformWorkflowStep: []gax.CallOption{}, + ViewStakingContext: []gax.CallOption{}, } } func defaultStakingRESTCallOptions() *StakingCallOptions { return &StakingCallOptions{ - ListProtocols: []gax.CallOption{ - }, - ListNetworks: []gax.CallOption{ - }, - ListStakingTargets: []gax.CallOption{ - }, - ListActions: []gax.CallOption{ - }, - CreateWorkflow: []gax.CallOption{ - }, - GetWorkflow: []gax.CallOption{ - }, - ListWorkflows: []gax.CallOption{ - }, - PerformWorkflowStep: []gax.CallOption{ - }, - ViewStakingContext: []gax.CallOption{ - }, + ListProtocols: []gax.CallOption{}, + ListNetworks: []gax.CallOption{}, + ListStakingTargets: []gax.CallOption{}, + ListActions: []gax.CallOption{}, + CreateWorkflow: []gax.CallOption{}, + GetWorkflow: []gax.CallOption{}, + ListWorkflows: []gax.CallOption{}, + PerformWorkflowStep: []gax.CallOption{}, + ViewStakingContext: []gax.CallOption{}, } } @@ -139,7 +120,6 @@ type StakingClient struct { // The call options for this service. CallOptions *StakingCallOptions - } // Wrapper methods routed to the internal client. @@ -248,10 +228,9 @@ func NewStakingClient(ctx context.Context, opts ...option.ClientOption) (*Stakin client := StakingClient{CallOptions: defaultStakingCallOptions()} c := &stakingGRPCClient{ - connPool: connPool, + connPool: connPool, stakingClient: stakingpb.NewStakingServiceClient(connPool), - CallOptions: &client.CallOptions, - + CallOptions: &client.CallOptions, } c.setGoogleClientInfo() @@ -310,8 +289,8 @@ func NewStakingRESTClient(ctx context.Context, opts ...option.ClientOption) (*St callOpts := defaultStakingRESTCallOptions() c := &stakingRESTClient{ - endpoint: endpoint, - httpClient: httpClient, + endpoint: endpoint, + httpClient: httpClient, CallOptions: &callOpts, } c.setGoogleClientInfo() @@ -327,6 +306,7 @@ func defaultStakingRESTClientOptions() []option.ClientOption { internaloption.WithDefaultScopes(DefaultAuthScopes()...), } } + // setGoogleClientInfo sets the name and version of the application in // the `x-goog-api-client` header passed on each request. Intended for // use by Google-written clients. @@ -580,7 +560,7 @@ func (c *stakingRESTClient) ListProtocols(ctx context.Context, req *stakingpb.Li httpReq.Header = headers httpRsp, err := c.httpClient.Do(httpReq) - if err != nil{ + if err != nil { return err } defer httpRsp.Body.Close() @@ -605,6 +585,7 @@ func (c *stakingRESTClient) ListProtocols(ctx context.Context, req *stakingpb.Li } return resp, nil } + // ListNetworks list supported staking networks for a given protocol. func (c *stakingRESTClient) ListNetworks(ctx context.Context, req *stakingpb.ListNetworksRequest, opts ...gax.CallOption) (*stakingpb.ListNetworksResponse, error) { baseUrl, err := url.Parse(c.endpoint) @@ -632,7 +613,7 @@ func (c *stakingRESTClient) ListNetworks(ctx context.Context, req *stakingpb.Lis httpReq.Header = headers httpRsp, err := c.httpClient.Do(httpReq) - if err != nil{ + if err != nil { return err } defer httpRsp.Body.Close() @@ -657,6 +638,7 @@ func (c *stakingRESTClient) ListNetworks(ctx context.Context, req *stakingpb.Lis } return resp, nil } + // ListStakingTargets list supported staking targets for a given protocol and network. func (c *stakingRESTClient) ListStakingTargets(ctx context.Context, req *stakingpb.ListStakingTargetsRequest, opts ...gax.CallOption) *StakingTargetIterator { it := &StakingTargetIterator{} @@ -701,7 +683,7 @@ func (c *stakingRESTClient) ListStakingTargets(ctx context.Context, req *staking httpReq.Header = headers httpRsp, err := c.httpClient.Do(httpReq) - if err != nil{ + if err != nil { return err } defer httpRsp.Body.Close() @@ -743,6 +725,7 @@ func (c *stakingRESTClient) ListStakingTargets(ctx context.Context, req *staking return it } + // ListActions list supported actions for a given protocol and network. func (c *stakingRESTClient) ListActions(ctx context.Context, req *stakingpb.ListActionsRequest, opts ...gax.CallOption) (*stakingpb.ListActionsResponse, error) { baseUrl, err := url.Parse(c.endpoint) @@ -770,7 +753,7 @@ func (c *stakingRESTClient) ListActions(ctx context.Context, req *stakingpb.List httpReq.Header = headers httpRsp, err := c.httpClient.Do(httpReq) - if err != nil{ + if err != nil { return err } defer httpRsp.Body.Close() @@ -795,6 +778,7 @@ func (c *stakingRESTClient) ListActions(ctx context.Context, req *stakingpb.List } return resp, nil } + // CreateWorkflow create a workflow to perform an action. func (c *stakingRESTClient) CreateWorkflow(ctx context.Context, req *stakingpb.CreateWorkflowRequest, opts ...gax.CallOption) (*stakingpb.Workflow, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} @@ -829,7 +813,7 @@ func (c *stakingRESTClient) CreateWorkflow(ctx context.Context, req *stakingpb.C httpReq.Header = headers httpRsp, err := c.httpClient.Do(httpReq) - if err != nil{ + if err != nil { return err } defer httpRsp.Body.Close() @@ -854,6 +838,7 @@ func (c *stakingRESTClient) CreateWorkflow(ctx context.Context, req *stakingpb.C } return resp, nil } + // GetWorkflow get the current state of an active workflow. func (c *stakingRESTClient) GetWorkflow(ctx context.Context, req *stakingpb.GetWorkflowRequest, opts ...gax.CallOption) (*stakingpb.Workflow, error) { baseUrl, err := url.Parse(c.endpoint) @@ -881,7 +866,7 @@ func (c *stakingRESTClient) GetWorkflow(ctx context.Context, req *stakingpb.GetW httpReq.Header = headers httpRsp, err := c.httpClient.Do(httpReq) - if err != nil{ + if err != nil { return err } defer httpRsp.Body.Close() @@ -906,6 +891,7 @@ func (c *stakingRESTClient) GetWorkflow(ctx context.Context, req *stakingpb.GetW } return resp, nil } + // ListWorkflows list all workflows in a project. func (c *stakingRESTClient) ListWorkflows(ctx context.Context, req *stakingpb.ListWorkflowsRequest, opts ...gax.CallOption) *WorkflowIterator { it := &WorkflowIterator{} @@ -953,7 +939,7 @@ func (c *stakingRESTClient) ListWorkflows(ctx context.Context, req *stakingpb.Li httpReq.Header = headers httpRsp, err := c.httpClient.Do(httpReq) - if err != nil{ + if err != nil { return err } defer httpRsp.Body.Close() @@ -995,6 +981,7 @@ func (c *stakingRESTClient) ListWorkflows(ctx context.Context, req *stakingpb.Li return it } + // PerformWorkflowStep perform the next step in a workflow. func (c *stakingRESTClient) PerformWorkflowStep(ctx context.Context, req *stakingpb.PerformWorkflowStepRequest, opts ...gax.CallOption) (*stakingpb.Workflow, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} @@ -1028,7 +1015,7 @@ func (c *stakingRESTClient) PerformWorkflowStep(ctx context.Context, req *stakin httpReq.Header = headers httpRsp, err := c.httpClient.Do(httpReq) - if err != nil{ + if err != nil { return err } defer httpRsp.Body.Close() @@ -1053,6 +1040,7 @@ func (c *stakingRESTClient) PerformWorkflowStep(ctx context.Context, req *stakin } return resp, nil } + // ViewStakingContext view Staking context information given a specific network address. func (c *stakingRESTClient) ViewStakingContext(ctx context.Context, req *stakingpb.ViewStakingContextRequest, opts ...gax.CallOption) (*stakingpb.ViewStakingContextResponse, error) { baseUrl, err := url.Parse(c.endpoint) @@ -1087,7 +1075,7 @@ func (c *stakingRESTClient) ViewStakingContext(ctx context.Context, req *staking httpReq.Header = headers httpRsp, err := c.httpClient.Do(httpReq) - if err != nil{ + if err != nil { return err } defer httpRsp.Body.Close() @@ -1112,6 +1100,7 @@ func (c *stakingRESTClient) ViewStakingContext(ctx context.Context, req *staking } return resp, nil } + // StakingTargetIterator manages a stream of *stakingpb.StakingTarget. type StakingTargetIterator struct { items []*stakingpb.StakingTarget diff --git a/gen/client/coinbase/staking/rewards/v1/doc.go b/gen/client/coinbase/staking/rewards/v1/doc.go index 811df79..b333208 100644 --- a/gen/client/coinbase/staking/rewards/v1/doc.go +++ b/gen/client/coinbase/staking/rewards/v1/doc.go @@ -14,67 +14,67 @@ // Code generated by protoc-gen-go_gapic. DO NOT EDIT. +// NOTE: This package is in alpha. It is not stable, and is likely to change. // -// NOTE: This package is in alpha. It is not stable, and is likely to change. -// -// General documentation +// # General documentation // // For information about setting deadlines, reusing contexts, and more // please visit https://pkg.go.dev/cloud.google.com/go. // -// Example usage +// # Example usage // // To get started with this package, create a client. -// ctx := context.Background() -// // This snippet has been automatically generated and should be regarded as a code template only. -// // It will require modifications to work: -// // - It may require correct/in-range values for request initialization. -// // - It may require specifying regional endpoints when creating the service client as shown in: -// // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options -// c, err := v1.NewRewardClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() +// +// ctx := context.Background() +// // This snippet has been automatically generated and should be regarded as a code template only. +// // It will require modifications to work: +// // - It may require correct/in-range values for request initialization. +// // - It may require specifying regional endpoints when creating the service client as shown in: +// // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options +// c, err := v1.NewRewardClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() // // The client will use your default application credentials. Clients should be reused instead of created as needed. // The methods of Client are safe for concurrent use by multiple goroutines. // The returned client must be Closed when it is done being used. // -// Using the Client +// # Using the Client // // The following is an example of making an API call with the newly created client. // -// ctx := context.Background() -// // This snippet has been automatically generated and should be regarded as a code template only. -// // It will require modifications to work: -// // - It may require correct/in-range values for request initialization. -// // - It may require specifying regional endpoints when creating the service client as shown in: -// // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options -// c, err := v1.NewRewardRESTClient(ctx) -// if err != nil { -// // TODO: Handle error. -// } -// defer c.Close() -// -// req := &rewardpb.ListRewardsRequest{ -// // TODO: Fill request struct fields. -// // See https://pkg.go.dev/github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1#ListRewardsRequest. -// } -// it := c.ListRewards(ctx, req) -// for { -// resp, err := it.Next() -// if err == iterator.Done { -// break -// } -// if err != nil { -// // TODO: Handle error. -// } -// // TODO: Use resp. -// _ = resp -// } -// -// Use of Context +// ctx := context.Background() +// // This snippet has been automatically generated and should be regarded as a code template only. +// // It will require modifications to work: +// // - It may require correct/in-range values for request initialization. +// // - It may require specifying regional endpoints when creating the service client as shown in: +// // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options +// c, err := v1.NewRewardRESTClient(ctx) +// if err != nil { +// // TODO: Handle error. +// } +// defer c.Close() +// +// req := &rewardpb.ListRewardsRequest{ +// // TODO: Fill request struct fields. +// // See https://pkg.go.dev/github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1#ListRewardsRequest. +// } +// it := c.ListRewards(ctx, req) +// for { +// resp, err := it.Next() +// if err == iterator.Done { +// break +// } +// if err != nil { +// // TODO: Handle error. +// } +// // TODO: Use resp. +// _ = resp +// } +// +// # Use of Context // // The ctx passed to NewRewardClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. @@ -182,4 +182,3 @@ func buildHeaders(ctx context.Context, mds ...metadata.MD) http.Header { md := metadata.Join(mds...) return http.Header(md) } - diff --git a/gen/client/coinbase/staking/rewards/v1/reward_client.go b/gen/client/coinbase/staking/rewards/v1/reward_client.go index fbad391..0eb6239 100644 --- a/gen/client/coinbase/staking/rewards/v1/reward_client.go +++ b/gen/client/coinbase/staking/rewards/v1/reward_client.go @@ -14,7 +14,6 @@ // Code generated by protoc-gen-go_gapic. DO NOT EDIT. - package v1 import ( @@ -43,15 +42,13 @@ var newRewardClientHook clientHook // RewardCallOptions contains the retry settings for each method of RewardClient. type RewardCallOptions struct { ListRewards []gax.CallOption - ListStakes []gax.CallOption + ListStakes []gax.CallOption } func defaultRewardRESTCallOptions() *RewardCallOptions { return &RewardCallOptions{ - ListRewards: []gax.CallOption{ - }, - ListStakes: []gax.CallOption{ - }, + ListRewards: []gax.CallOption{}, + ListStakes: []gax.CallOption{}, } } @@ -74,7 +71,6 @@ type RewardClient struct { // The call options for this service. CallOptions *RewardCallOptions - } // Wrapper methods routed to the internal client. @@ -137,8 +133,8 @@ func NewRewardRESTClient(ctx context.Context, opts ...option.ClientOption) (*Rew callOpts := defaultRewardRESTCallOptions() c := &rewardRESTClient{ - endpoint: endpoint, - httpClient: httpClient, + endpoint: endpoint, + httpClient: httpClient, CallOptions: &callOpts, } c.setGoogleClientInfo() @@ -154,6 +150,7 @@ func defaultRewardRESTClientOptions() []option.ClientOption { internaloption.WithDefaultScopes(DefaultAuthScopes()...), } } + // setGoogleClientInfo sets the name and version of the application in // the `x-goog-api-client` header passed on each request. Intended for // use by Google-written clients. @@ -177,6 +174,7 @@ func (c *rewardRESTClient) Close() error { func (c *rewardRESTClient) Connection() *grpc.ClientConn { return nil } + // ListRewards list rewards for a given protocol. func (c *rewardRESTClient) ListRewards(ctx context.Context, req *rewardpb.ListRewardsRequest, opts ...gax.CallOption) *RewardIterator { it := &RewardIterator{} @@ -224,7 +222,7 @@ func (c *rewardRESTClient) ListRewards(ctx context.Context, req *rewardpb.ListRe httpReq.Header = headers httpRsp, err := c.httpClient.Do(httpReq) - if err != nil{ + if err != nil { return err } defer httpRsp.Body.Close() @@ -266,6 +264,7 @@ func (c *rewardRESTClient) ListRewards(ctx context.Context, req *rewardpb.ListRe return it } + // ListStakes list staking activities for a given protocol. func (c *rewardRESTClient) ListStakes(ctx context.Context, req *rewardpb.ListStakesRequest, opts ...gax.CallOption) *StakeIterator { it := &StakeIterator{} @@ -316,7 +315,7 @@ func (c *rewardRESTClient) ListStakes(ctx context.Context, req *rewardpb.ListSta httpReq.Header = headers httpRsp, err := c.httpClient.Do(httpReq) - if err != nil{ + if err != nil { return err } defer httpRsp.Body.Close() @@ -358,6 +357,7 @@ func (c *rewardRESTClient) ListStakes(ctx context.Context, req *rewardpb.ListSta return it } + // RewardIterator manages a stream of *rewardpb.Reward. type RewardIterator struct { items []*rewardpb.Reward diff --git a/go.mod b/go.mod index e9ac098..8c89133 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/gagliardetto/solana-go v1.10.0 github.com/googleapis/gax-go/v2 v2.11.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.9.0 github.com/test-go/testify v1.1.4 go.einride.tech/aip v0.60.0 google.golang.org/api v0.126.0 @@ -27,16 +27,19 @@ require ( github.com/blendle/zapdriver v1.3.1 // indirect github.com/btcsuite/btcd v0.20.1-beta // indirect github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect + github.com/daixiang0/gci v0.13.4 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect github.com/fatih/color v1.16.0 // indirect github.com/gagliardetto/treeout v0.1.4 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/google/s2a-go v0.1.4 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect + github.com/hexops/gotextdiff v1.0.3 // indirect github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c // indirect + github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.17.7 // indirect github.com/logrusorgru/aurora v2.0.3+incompatible // indirect @@ -48,18 +51,24 @@ require ( github.com/mostynb/zstdpool-freelist v0.0.0-20201229113212-927304c0c3b1 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/spf13/cobra v1.6.1 // indirect + github.com/spf13/pflag v1.0.5 // indirect github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091 // indirect go.mongodb.org/mongo-driver v1.14.0 // indirect go.opencensus.io v0.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/crypto v0.22.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/mod v0.16.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/oauth2 v0.8.0 // indirect + golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.19.0 // indirect golang.org/x/term v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.19.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + mvdan.cc/gofumpt v0.6.0 // indirect ) diff --git a/go.sum b/go.sum index c15118e..7c4f275 100644 --- a/go.sum +++ b/go.sum @@ -43,6 +43,9 @@ github.com/cockroachdb/errors v1.9.1 h1:yFVvsI0VxmRShfawbt/laCIDy/mtTqqnvoNgiy5b github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 h1:ytcWPaNPhNoGMWEhDvS3zToKcDpRsLuRolQJBVGdozk= github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/daixiang0/gci v0.13.4 h1:61UGkmpoAcxHM2hhNkZEf5SzwQtWJXTSws7jaPyqwlw= +github.com/daixiang0/gci v0.13.4/go.mod h1:12etP2OniiIdP4q+kjUGrC/rUagga7ODbqsom5Eo5Yk= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -106,6 +109,8 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= @@ -114,12 +119,18 @@ github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9 github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= github.com/googleapis/gax-go/v2 v2.11.0 h1:9V9PWXEsWnPpQhu/PeQIkS4eGzMlTLGgt80cUUI8Ki4= github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 h1:gDLXvp5S9izjldquuoAhDzccbskOL6tDC5jMSyx3zxE= github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2/go.mod h1:7pdNwVWBBHGiCxa9lAszqCJMbfTISJ7oMftp8+UGV08= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= +github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c h1:DZfsyhDK1hnSS5lH8l+JggqzEleHteTYfutAiVlSUM8= github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= +github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -137,6 +148,7 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8= github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= @@ -151,6 +163,7 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/mostynb/zstdpool-freelist v0.0.0-20201229113212-927304c0c3b1 h1:mPMvm6X6tf4w8y7j9YIt6V9jfWhL6QlbEc7CCmeQlWk= github.com/mostynb/zstdpool-freelist v0.0.0-20201229113212-927304c0c3b1/go.mod h1:ye2e/VUEtE2BHE+G/QcKkcLQVAEJoYRFj5VUOQatCRE= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= @@ -159,8 +172,10 @@ github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= @@ -170,9 +185,19 @@ github.com/prometheus/common v0.39.0 h1:oOyhkDq05hPZKItWVBkJ6g6AtGxi+fy7F4JvUV8u github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= +github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091 h1:RN5mrigyirb8anBEtdjtHFIufXdacyTi6i4KBfeNXeo= github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091/go.mod h1:VlduQ80JcGJSargkRU4Sg9Xo63wZD/l8A5NC/Uo1/uU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -185,11 +210,16 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE= github.com/test-go/testify v1.1.4/go.mod h1:rH7cfJo/47vWGdi4GPj16x3/t1xGOj2YxzmNQzk2ghU= github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4= github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.einride.tech/aip v0.60.0 h1:h6bgabZ5BCfAptbGex8jbh3VvPBRLa6xq+pQ1CAjHYw= @@ -229,6 +259,10 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic= +golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -246,6 +280,8 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8= @@ -257,6 +293,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -294,10 +332,15 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= +golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw= +golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/api v0.126.0 h1:q4GJq+cAdMAC7XP7njvQ4tvohGLiSlytuL4BQxbIZ+o= google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= @@ -341,6 +384,7 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI= gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= @@ -356,3 +400,5 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +mvdan.cc/gofumpt v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo= +mvdan.cc/gofumpt v0.6.0/go.mod h1:4L0wf+kgIPZtcCWXynNS2e6bhmj73umwnuXSZarixzA= From 5885072e003f0ffebc24482f9b289c54e8e4b37f Mon Sep 17 00:00:00 2001 From: Shane O'Brien Date: Wed, 24 Apr 2024 11:58:34 -0400 Subject: [PATCH 08/16] Add testing workflow, fix linting errors --- .../{golangci-lint.yaml => lint.yaml} | 2 +- .github/workflows/test.yaml | 26 ++ .golangci.yaml | 17 -- Makefile | 21 +- client/client.go | 4 +- client/orchestration/action.go | 2 +- client/orchestration/client.go | 12 +- client/orchestration/network.go | 2 +- client/orchestration/protocol.go | 2 +- client/orchestration/staking_target.go | 2 +- client/orchestration/view_staking_context.go | 2 +- client/orchestration/workflow.go | 8 +- client/rewards/client.go | 12 +- client/rewards/reward.go | 2 +- client/rewards/stake.go | 2 +- docs/openapi/orchestration.swagger.json | 214 +++++++------- .../orchestration/v1/staking_client.go | 20 +- .../staking/orchestration/v1/api.pb.go | 277 +++++++++--------- .../staking/orchestration/v1/api.pb.gw.go | 94 +----- .../staking/orchestration/v1/api_grpc.pb.go | 4 +- .../staking/orchestration/v1/workflow.pb.go | 134 ++++----- .../staking/orchestration/v1/workflow_aip.go | 15 +- 22 files changed, 372 insertions(+), 502 deletions(-) rename .github/workflows/{golangci-lint.yaml => lint.yaml} (96%) create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/golangci-lint.yaml b/.github/workflows/lint.yaml similarity index 96% rename from .github/workflows/golangci-lint.yaml rename to .github/workflows/lint.yaml index 846b196..0ae6b55 100644 --- a/.github/workflows/golangci-lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,4 +1,4 @@ -name: golangci-lint +name: Go Lint on: push: # branches: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..b9476b7 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,26 @@ +name: Go Test + +on: + push: + # branches: [ main ] + pull_request: + branches: [main] + +jobs: + test: + name: Run Tests + runs-on: ubuntu-latest + steps: + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.20 + + - name: Check out code + uses: actions/checkout@v2 + + - name: Get dependencies + run: go mod download + + - name: Run tests + run: go test -v ./... diff --git a/.golangci.yaml b/.golangci.yaml index c7ffca7..01126ef 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -97,26 +97,9 @@ linters-settings: avro: snake mapstructure: kebab gci: - # Section configuration to compare against. - # Section names are case-insensitive and may contain parameters in (). - # The default order of sections is `standard > default > custom > blank > dot`, - # If `custom-order` is `true`, it follows the order of `sections` option. - # Default: ["standard", "default"] - sections: - - standard # Standard section: captures all standard packages. - - default # Default section: contains all imports that could not be matched to another section type. - - prefix(go.mongodb.org) - - prefix(google.golang.org) - - prefix(gopkg.in) - - blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled. - - dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled. # Skip generated files. # Default: true skip-generated: true - # Enable custom order of sections. - # If `true`, make the section order the same as the order of `sections`. - # Default: false - custom-order: true gofumpt: # Module path which contains the source code being formatted. # Default: "" diff --git a/Makefile b/Makefile index 6e51220..6ab7d46 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,6 @@ # BUILD_PREREQUISITES = git go buf protoc-gen-go protoc-gen-go-grpc protoc-gen-csf protoc-gen-grpc-gateway protoc-gen-go-aip mockery -VALIDATION_PREREQUISITES = golangci-lint # # Informational Targets @@ -36,12 +35,6 @@ build_deps: $(if $(shell which $(exec)),"", \ $(error "No $(exec) in PATH. Prerequisites are: $(BUILD_PREREQUISITES)"))) -.PHONY: validation_deps -validation_deps: - @ printf $(foreach exec,$(VALIDATION_PREREQUISITES), \ - $(if $(shell which $(exec)),"", \ - $(error "No $(exec) in PATH. Prerequisites are: $(VALIDATION_PREREQUISITES)"))) - .PHONY: buf_gen buf_gen: @ buf generate --template protos/buf.gen.orchestration.yaml buf.build/cdp/orchestration --path coinbase/staking/orchestration/v1 @@ -73,14 +66,16 @@ build: @ go build -o bin/solana/solana_create_workflow examples/solana/create-workflow/main.go .PHONY: lint -lint: validation_deps - @ printf "\nLint App\n" - @ golangci-lint run --timeout 3m ./... +lint: + @ echo "Linting app..." + @ docker run --rm -v "${PWD}:/app" -w /app golangci/golangci-lint:v1.52.2 golangci-lint run --timeout 3m ./... + @ echo "Done linting app" .PHONY: lintfix -lintfix: validation_deps - @ printf "\nFixing Lint Issues\n" - @ golangci-lint run --timeout 3m --fix ./... +lintfix: + @ echo "Linting app and fixing issues..." + @ docker run --rm -v "${PWD}:/app" -w /app golangci/golangci-lint:v1.52.2 golangci-lint run --timeout 3m --fix ./... + @ echo "Done linting app and fixing issues" .PHONY: format format: diff --git a/client/client.go b/client/client.go index b3e27d5..badcace 100644 --- a/client/client.go +++ b/client/client.go @@ -10,8 +10,8 @@ import ( ) type StakingClient struct { - Orchestration *orchestration.OrchestrationServiceClient - Rewards *rewards.RewardsServiceClient + Orchestration *orchestration.Client + Rewards *rewards.Client } // New returns a StakingClient based on the given inputs. diff --git a/client/orchestration/action.go b/client/orchestration/action.go index e5d36e7..e80107e 100644 --- a/client/orchestration/action.go +++ b/client/orchestration/action.go @@ -9,7 +9,7 @@ import ( ) // ListActions lists the Actions supported by Staking API. -func (s *OrchestrationServiceClient) ListActions( +func (s *Client) ListActions( ctx context.Context, req *stakingpb.ListActionsRequest, opts ...gax.CallOption, diff --git a/client/orchestration/client.go b/client/orchestration/client.go index f647479..65e298b 100644 --- a/client/orchestration/client.go +++ b/client/orchestration/client.go @@ -16,8 +16,8 @@ const ( serviceEndpoint = "https://api.developer.coinbase.com/staking/orchestration" ) -// OrchestrationServiceClient is the client to use to access StakingService APIs. -type OrchestrationServiceClient struct { +// Client is the client to use to access StakingService APIs. +type Client struct { client *innerClient.StakingClient } @@ -25,7 +25,7 @@ type OrchestrationServiceClient struct { func NewOrchestrationServiceClient( ctx context.Context, stakingOpts ...clients.StakingClientOption, -) (*OrchestrationServiceClient, error) { +) (*Client, error) { config, err := clients.GetConfig(serviceName, serviceEndpoint, stakingOpts...) if err != nil { return nil, err @@ -41,14 +41,14 @@ func NewOrchestrationServiceClient( return nil, err } - return &OrchestrationServiceClient{ + return &Client{ client: innerClient, }, nil } // Close closes the connection to the API service. The user should invoke this when // the client is no longer required. -func (s *OrchestrationServiceClient) Close() error { +func (s *Client) Close() error { return s.client.Close() } @@ -56,6 +56,6 @@ func (s *OrchestrationServiceClient) Close() error { // // Deprecated: Connections are now pooled so this method does not always // return the same resource. -func (s *OrchestrationServiceClient) Connection() *grpc.ClientConn { +func (s *Client) Connection() *grpc.ClientConn { return s.client.Connection() } diff --git a/client/orchestration/network.go b/client/orchestration/network.go index fd81354..4a4b67f 100644 --- a/client/orchestration/network.go +++ b/client/orchestration/network.go @@ -9,7 +9,7 @@ import ( ) // ListNetworks lists the Networks supported by Staking API. -func (s *OrchestrationServiceClient) ListNetworks( +func (s *Client) ListNetworks( ctx context.Context, req *stakingpb.ListNetworksRequest, opts ...gax.CallOption, diff --git a/client/orchestration/protocol.go b/client/orchestration/protocol.go index 86aa208..3fdf058 100644 --- a/client/orchestration/protocol.go +++ b/client/orchestration/protocol.go @@ -9,7 +9,7 @@ import ( ) // ListProtocols lists the Protocols supported by Staking API. -func (s *OrchestrationServiceClient) ListProtocols( +func (s *Client) ListProtocols( ctx context.Context, req *stakingpb.ListProtocolsRequest, opts ...gax.CallOption, diff --git a/client/orchestration/staking_target.go b/client/orchestration/staking_target.go index 1e458c1..ee1bf3b 100644 --- a/client/orchestration/staking_target.go +++ b/client/orchestration/staking_target.go @@ -62,7 +62,7 @@ func (n *StakingTargetIteratorImpl) Response() *stakingpb.ListStakingTargetsResp } // ListStakingTargets lists the StakingTargets supported by Staking API. -func (s *OrchestrationServiceClient) ListStakingTargets( +func (s *Client) ListStakingTargets( ctx context.Context, req *stakingpb.ListStakingTargetsRequest, opts ...gax.CallOption, diff --git a/client/orchestration/view_staking_context.go b/client/orchestration/view_staking_context.go index c0d225d..e6ec144 100644 --- a/client/orchestration/view_staking_context.go +++ b/client/orchestration/view_staking_context.go @@ -9,7 +9,7 @@ import ( ) // ViewStakingContext helps view staking context information given a specific network address. -func (s *OrchestrationServiceClient) ViewStakingContext( +func (s *Client) ViewStakingContext( ctx context.Context, req *stakingpb.ViewStakingContextRequest, opts ...gax.CallOption, diff --git a/client/orchestration/workflow.go b/client/orchestration/workflow.go index dbda9ee..0d1d9b7 100644 --- a/client/orchestration/workflow.go +++ b/client/orchestration/workflow.go @@ -12,7 +12,7 @@ import ( ) // CreateWorkflow starts a workflow with the given protocol specific parameters. -func (s *OrchestrationServiceClient) CreateWorkflow( +func (s *Client) CreateWorkflow( ctx context.Context, req *stakingpb.CreateWorkflowRequest, opts ...gax.CallOption, @@ -29,7 +29,7 @@ func (s *OrchestrationServiceClient) CreateWorkflow( } // GetWorkflow get the current state of a workflow. -func (s *OrchestrationServiceClient) GetWorkflow( +func (s *Client) GetWorkflow( ctx context.Context, req *stakingpb.GetWorkflowRequest, opts ...gax.CallOption, @@ -96,7 +96,7 @@ func (n *WorkflowIteratorImpl) Response() *stakingpb.ListWorkflowsResponse { } // ListWorkflows lists the Workflows supported by Staking API. -func (s *OrchestrationServiceClient) ListWorkflows( +func (s *Client) ListWorkflows( ctx context.Context, req *stakingpb.ListWorkflowsRequest, opts ...gax.CallOption, @@ -105,7 +105,7 @@ func (s *OrchestrationServiceClient) ListWorkflows( } // PerformWorkflowStep helps update workflow move to the next state by returning the signed tx back. -func (s *OrchestrationServiceClient) PerformWorkflowStep( +func (s *Client) PerformWorkflowStep( ctx context.Context, req *stakingpb.PerformWorkflowStepRequest, opts ...gax.CallOption, diff --git a/client/rewards/client.go b/client/rewards/client.go index 8c518c4..79d9ef3 100644 --- a/client/rewards/client.go +++ b/client/rewards/client.go @@ -13,8 +13,8 @@ const ( serviceEndpoint = "https://api.developer.coinbase.com/staking/rewards" ) -// RewardsServiceClient is the client to use to access StakingService APIs. -type RewardsServiceClient struct { +// Client is the client to use to access StakingService APIs. +type Client struct { client *innerClient.RewardClient } @@ -22,7 +22,7 @@ type RewardsServiceClient struct { func NewRewardsServiceClient( ctx context.Context, stakingOpts ...options.StakingClientOption, -) (*RewardsServiceClient, error) { +) (*Client, error) { config, err := options.GetConfig("rewards-reporting", serviceEndpoint, stakingOpts...) if err != nil { return nil, err @@ -38,14 +38,14 @@ func NewRewardsServiceClient( return nil, err } - return &RewardsServiceClient{ + return &Client{ client: innerClient, }, nil } // Close closes the connection to the API service. The user should invoke this when // the client is no longer required. -func (s *RewardsServiceClient) Close() error { +func (s *Client) Close() error { return s.client.Close() } @@ -53,6 +53,6 @@ func (s *RewardsServiceClient) Close() error { // // Deprecated: Connections are now pooled so this method does not always // return the same resource. -func (s *RewardsServiceClient) Connection() *grpc.ClientConn { +func (s *Client) Connection() *grpc.ClientConn { return s.client.Connection() } diff --git a/client/rewards/reward.go b/client/rewards/reward.go index 9b8ba18..170517d 100644 --- a/client/rewards/reward.go +++ b/client/rewards/reward.go @@ -62,7 +62,7 @@ func (n *RewardIteratorImpl) Response() *stakingpb.ListRewardsResponse { } // ListRewards helps list onchain rewards of an address for a specific protocol, with optional filters for time range, aggregation period, and more. -func (s *RewardsServiceClient) ListRewards( +func (s *Client) ListRewards( ctx context.Context, req *stakingpb.ListRewardsRequest, opts ...gax.CallOption, diff --git a/client/rewards/stake.go b/client/rewards/stake.go index b759d7b..73bdf8f 100644 --- a/client/rewards/stake.go +++ b/client/rewards/stake.go @@ -62,7 +62,7 @@ func (n *StakeIteratorImpl) Response() *stakingpb.ListStakesResponse { } // ListStakes list staking activities for a given protocol. -func (s *RewardsServiceClient) ListStakes( +func (s *Client) ListStakes( ctx context.Context, req *stakingpb.ListStakesRequest, opts ...gax.CallOption, diff --git a/docs/openapi/orchestration.swagger.json b/docs/openapi/orchestration.swagger.json index 4c65091..80bb3cb 100644 --- a/docs/openapi/orchestration.swagger.json +++ b/docs/openapi/orchestration.swagger.json @@ -189,15 +189,15 @@ ] } }, - "/v1/{name}": { + "/v1/workflows": { "get": { - "summary": "Get workflow", - "operationId": "getWorkflow", + "summary": "List supported workflows", + "operationId": "listWorkflows", "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1Workflow" + "$ref": "#/definitions/v1ListWorkflowsResponse" } }, "400": { @@ -245,24 +245,35 @@ }, "parameters": [ { - "name": "name", - "description": "The resource name of the workflow.\nFormat: projects/{project}/workflows/{workflow}", - "in": "path", - "required": true, - "type": "string", - "pattern": "projects/[^/]+/workflows/[^/]+" + "name": "filter", + "description": "[AIP-160](https://google.aip.dev/160) filter\nSupported fields:\n- string action: \"stake\", \"unstake\"\n- string protocol: \"ethereum_kiln\"\n- string network: \"holesky\", \"mainnet\"", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "pageSize", + "description": "The maximum number of workflows to return. The service may\nreturn fewer than this value.\n\nIf unspecified, 100 workflows will be returned.\nThe maximum value is 1000; values over 1000 will be floored to 1000.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "pageToken", + "description": "A page token as part of the response of a previous call.\nProvide this to retrieve the next page.\n\nWhen paginating, all other parameters must match the previous\nrequest to list resources.", + "in": "query", + "required": false, + "type": "string" } ], "tags": [ "Workflow" ] - } - }, - "/v1/{name}/step": { + }, "post": { - "summary": "Perform the next step in a workflow", - "description": "Perform the next step in a workflow", - "operationId": "updateWorkflow", + "summary": "Create workflow", + "operationId": "createWorkflow", "responses": { "200": { "description": "OK", @@ -315,19 +326,15 @@ }, "parameters": [ { - "name": "name", - "description": "The resource name of the workflow.\nFormat: projects/{project}/workflows/{workflow}", - "in": "path", - "required": true, - "type": "string", - "pattern": "projects/[^/]+/workflows/[^/]+" - }, - { - "name": "body", + "name": "workflow", + "description": "The workflow to create.", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/StakingServicePerformWorkflowStepBody" + "$ref": "#/definitions/v1Workflow", + "required": [ + "workflow" + ] } } ], @@ -336,16 +343,15 @@ ] } }, - "/v1/{parent}/actions": { + "/v1/{name}": { "get": { - "summary": "List supported actions", - "description": "List supported actions", - "operationId": "listActions", + "summary": "Get workflow", + "operationId": "getWorkflow", "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1ListActionsResponse" + "$ref": "#/definitions/v1Workflow" } }, "400": { @@ -393,29 +399,29 @@ }, "parameters": [ { - "name": "parent", - "description": "The resource name of the parent that owns\nthe collection of actions.\nFormat: protocols/{protocol}/networks/{network}", + "name": "name", + "description": "The resource name of the workflow.\nFormat: workflows/{workflow}", "in": "path", "required": true, "type": "string", - "pattern": "protocols/[^/]+/networks/[^/]+" + "pattern": "workflows/[^/]+" } ], "tags": [ - "Action" + "Workflow" ] } }, - "/v1/{parent}/networks": { - "get": { - "summary": "List supported networks", - "description": "List supported networks", - "operationId": "listNetworks", + "/v1/{name}/step": { + "post": { + "summary": "Perform the next step in a workflow", + "description": "Perform the next step in a workflow", + "operationId": "updateWorkflow", "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1ListNetworksResponse" + "$ref": "#/definitions/v1Workflow" } }, "400": { @@ -463,29 +469,37 @@ }, "parameters": [ { - "name": "parent", - "description": "The resource name of the parent that owns\nthe collection of networks.\nFormat: protocols/{protocol}", + "name": "name", + "description": "The resource name of the workflow.\nFormat: workflows/{workflow}", "in": "path", "required": true, "type": "string", - "pattern": "protocols/[^/]+" + "pattern": "workflows/[^/]+" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/StakingServicePerformWorkflowStepBody" + } } ], "tags": [ - "Network" + "Workflow" ] } }, - "/v1/{parent}/stakingTargets": { + "/v1/{parent}/actions": { "get": { - "summary": "List supported staking targets", - "description": "List supported staking targets", - "operationId": "listStakingTargets", + "summary": "List supported actions", + "description": "List supported actions", + "operationId": "listActions", "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1ListStakingTargetsResponse" + "$ref": "#/definitions/v1ListActionsResponse" } }, "400": { @@ -534,42 +548,28 @@ "parameters": [ { "name": "parent", - "description": "The resource name of the parent that owns\nthe collection of staking targets.\nFormat: protocols/{protocol}/networks/{network}", + "description": "The resource name of the parent that owns\nthe collection of actions.\nFormat: protocols/{protocol}/networks/{network}", "in": "path", "required": true, "type": "string", "pattern": "protocols/[^/]+/networks/[^/]+" - }, - { - "name": "pageSize", - "description": "The maximum number of staking targets to return. The service may\nreturn fewer than this value.\n\nIf unspecified, 100 staking targets will be returned.\nThe maximum value is 1000; values over 1000 will be floored to 1000.", - "in": "query", - "required": false, - "type": "integer", - "format": "int32" - }, - { - "name": "pageToken", - "description": "A page token as part of the response of a previous call.\nProvide this to retrieve the next page.\n\nWhen paginating, all other parameters must match the previous\nrequest to list resources.", - "in": "query", - "required": false, - "type": "string" } ], "tags": [ - "StakingTarget" + "Action" ] } }, - "/v1/{parent}/workflows": { + "/v1/{parent}/networks": { "get": { - "summary": "List supported workflows", - "operationId": "listWorkflows", + "summary": "List supported networks", + "description": "List supported networks", + "operationId": "listNetworks", "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1ListWorkflowsResponse" + "$ref": "#/definitions/v1ListNetworksResponse" } }, "400": { @@ -618,47 +618,28 @@ "parameters": [ { "name": "parent", - "description": "The resource name of the parent that owns\nthe collection of networks.\nFormat: projects/{project}", + "description": "The resource name of the parent that owns\nthe collection of networks.\nFormat: protocols/{protocol}", "in": "path", "required": true, "type": "string", - "pattern": "projects/[^/]+" - }, - { - "name": "filter", - "description": "[AIP-160](https://google.aip.dev/160) filter\nSupported fields:\n- string action: \"stake\", \"unstake\"\n- string protocol: \"ethereum_kiln\"\n- string network: \"holesky\", \"mainnet\"", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "pageSize", - "description": "The maximum number of workflows to return. The service may\nreturn fewer than this value.\n\nIf unspecified, 100 workflows will be returned.\nThe maximum value is 1000; values over 1000 will be floored to 1000.", - "in": "query", - "required": false, - "type": "integer", - "format": "int32" - }, - { - "name": "pageToken", - "description": "A page token as part of the response of a previous call.\nProvide this to retrieve the next page.\n\nWhen paginating, all other parameters must match the previous\nrequest to list resources.", - "in": "query", - "required": false, - "type": "string" + "pattern": "protocols/[^/]+" } ], "tags": [ - "Workflow" + "Network" ] - }, - "post": { - "summary": "Create workflow", - "operationId": "createWorkflow", + } + }, + "/v1/{parent}/stakingTargets": { + "get": { + "summary": "List supported staking targets", + "description": "List supported staking targets", + "operationId": "listStakingTargets", "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1Workflow" + "$ref": "#/definitions/v1ListStakingTargetsResponse" } }, "400": { @@ -707,27 +688,30 @@ "parameters": [ { "name": "parent", - "description": "The resource name of the parent that owns\nthe workflow.\nFormat: projects/{project}", + "description": "The resource name of the parent that owns\nthe collection of staking targets.\nFormat: protocols/{protocol}/networks/{network}", "in": "path", "required": true, "type": "string", - "pattern": "projects/[^/]+" + "pattern": "protocols/[^/]+/networks/[^/]+" }, { - "name": "workflow", - "description": "The workflow to create.", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1Workflow", - "required": [ - "workflow" - ] - } + "name": "pageSize", + "description": "The maximum number of staking targets to return. The service may\nreturn fewer than this value.\n\nIf unspecified, 100 staking targets will be returned.\nThe maximum value is 1000; values over 1000 will be floored to 1000.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "pageToken", + "description": "A page token as part of the response of a previous call.\nProvide this to retrieve the next page.\n\nWhen paginating, all other parameters must match the previous\nrequest to list resources.", + "in": "query", + "required": false, + "type": "string" } ], "tags": [ - "Workflow" + "StakingTarget" ] } } @@ -1442,7 +1426,7 @@ "properties": { "name": { "type": "string", - "title": "The resource name of the workflow.\nFormat: projects/{projectUUID}/workflows/{workflowUUID}\nEx: projects/ 123e4567-e89b-12d3-a456-426614174000/workflows/123e4567-e89b-12d3-a456-426614174000", + "title": "The resource name of the workflow.\nFormat: workflows/{workflowUUID}\nEx: workflows/123e4567-e89b-12d3-a456-426614174000", "readOnly": true }, "action": { diff --git a/gen/client/coinbase/staking/orchestration/v1/staking_client.go b/gen/client/coinbase/staking/orchestration/v1/staking_client.go index 50cdc2b..8bdc89e 100644 --- a/gen/client/coinbase/staking/orchestration/v1/staking_client.go +++ b/gen/client/coinbase/staking/orchestration/v1/staking_client.go @@ -175,7 +175,7 @@ func (c *StakingClient) GetWorkflow(ctx context.Context, req *stakingpb.GetWorkf return c.internalClient.GetWorkflow(ctx, req, opts...) } -// ListWorkflows list all workflows in a project. +// ListWorkflows list all workflows func (c *StakingClient) ListWorkflows(ctx context.Context, req *stakingpb.ListWorkflowsRequest, opts ...gax.CallOption) *WorkflowIterator { return c.internalClient.ListWorkflows(ctx, req, opts...) } @@ -425,9 +425,7 @@ func (c *stakingGRPCClient) ListActions(ctx context.Context, req *stakingpb.List } func (c *stakingGRPCClient) CreateWorkflow(ctx context.Context, req *stakingpb.CreateWorkflowRequest, opts ...gax.CallOption) (*stakingpb.Workflow, error) { - md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) - - ctx = insertMetadata(ctx, c.xGoogMetadata, md) + ctx = insertMetadata(ctx, c.xGoogMetadata) opts = append((*c.CallOptions).CreateWorkflow[0:len((*c.CallOptions).CreateWorkflow):len((*c.CallOptions).CreateWorkflow)], opts...) var resp *stakingpb.Workflow err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { @@ -459,9 +457,7 @@ func (c *stakingGRPCClient) GetWorkflow(ctx context.Context, req *stakingpb.GetW } func (c *stakingGRPCClient) ListWorkflows(ctx context.Context, req *stakingpb.ListWorkflowsRequest, opts ...gax.CallOption) *WorkflowIterator { - md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) - - ctx = insertMetadata(ctx, c.xGoogMetadata, md) + ctx = insertMetadata(ctx, c.xGoogMetadata) opts = append((*c.CallOptions).ListWorkflows[0:len((*c.CallOptions).ListWorkflows):len((*c.CallOptions).ListWorkflows)], opts...) it := &WorkflowIterator{} req = proto.Clone(req).(*stakingpb.ListWorkflowsRequest) @@ -792,12 +788,10 @@ func (c *stakingRESTClient) CreateWorkflow(ctx context.Context, req *stakingpb.C if err != nil { return nil, err } - baseUrl.Path += fmt.Sprintf("/v1/%v/workflows", req.GetParent()) + baseUrl.Path += fmt.Sprintf("/v1/workflows") // Build HTTP headers from client and context metadata. - md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) - - headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json")) + headers := buildHeaders(ctx, c.xGoogMetadata, metadata.Pairs("Content-Type", "application/json")) opts = append((*c.CallOptions).CreateWorkflow[0:len((*c.CallOptions).CreateWorkflow):len((*c.CallOptions).CreateWorkflow)], opts...) unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} resp := &stakingpb.Workflow{} @@ -892,7 +886,7 @@ func (c *stakingRESTClient) GetWorkflow(ctx context.Context, req *stakingpb.GetW return resp, nil } -// ListWorkflows list all workflows in a project. +// ListWorkflows list all workflows func (c *stakingRESTClient) ListWorkflows(ctx context.Context, req *stakingpb.ListWorkflowsRequest, opts ...gax.CallOption) *WorkflowIterator { it := &WorkflowIterator{} req = proto.Clone(req).(*stakingpb.ListWorkflowsRequest) @@ -911,7 +905,7 @@ func (c *stakingRESTClient) ListWorkflows(ctx context.Context, req *stakingpb.Li if err != nil { return nil, "", err } - baseUrl.Path += fmt.Sprintf("/v1/%v/workflows", req.GetParent()) + baseUrl.Path += fmt.Sprintf("/v1/workflows") params := url.Values{} if req.GetFilter() != "" { diff --git a/gen/go/coinbase/staking/orchestration/v1/api.pb.go b/gen/go/coinbase/staking/orchestration/v1/api.pb.go index 9508c1d..9543116 100644 --- a/gen/go/coinbase/staking/orchestration/v1/api.pb.go +++ b/gen/go/coinbase/staking/orchestration/v1/api.pb.go @@ -54,7 +54,7 @@ var file_coinbase_staking_orchestration_v1_api_proto_rawDesc = []byte{ 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x37, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x5f, - 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x86, 0x14, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xb7, 0x13, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xf9, 0x01, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x12, 0x37, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, @@ -126,7 +126,7 @@ var file_coinbase_staking_orchestration_v1_api_proto_rawDesc = []byte{ 0xda, 0x41, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x12, 0x2b, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x2f, 0x2a, 0x2f, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, - 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0xfa, 0x01, 0x0a, + 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0xde, 0x01, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x38, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, @@ -134,151 +134,146 @@ var file_coinbase_staking_orchestration_v1_api_proto_rawDesc = []byte{ 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, - 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x22, 0x80, 0x01, 0x92, 0x41, 0x38, 0x0a, 0x08, 0x57, 0x6f, - 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x77, - 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2a, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, - 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4a, 0x0b, 0x0a, 0x03, 0x32, 0x30, 0x30, 0x12, 0x04, - 0x0a, 0x02, 0x4f, 0x4b, 0xda, 0x41, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x2c, 0x77, 0x6f, - 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x3a, 0x08, 0x77, 0x6f, - 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x22, 0x21, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, - 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, - 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x12, 0xd8, 0x01, 0x0a, 0x0b, 0x47, 0x65, - 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x35, 0x2e, 0x63, 0x6f, 0x69, 0x6e, - 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x63, - 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, - 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x6b, - 0x69, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x22, 0x65, 0x92, - 0x41, 0x32, 0x0a, 0x08, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x0c, 0x47, 0x65, - 0x74, 0x20, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2a, 0x0b, 0x67, 0x65, 0x74, 0x57, - 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4a, 0x0b, 0x0a, 0x03, 0x32, 0x30, 0x30, 0x12, 0x04, - 0x0a, 0x02, 0x4f, 0x4b, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x23, 0x12, 0x21, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, - 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, - 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0xf9, 0x01, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, - 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x12, 0x37, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, - 0x65, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, - 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x57, - 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x38, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, + 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x22, 0x65, 0x92, 0x41, 0x38, 0x0a, 0x08, 0x57, 0x6f, 0x72, + 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x77, 0x6f, + 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2a, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x6f, + 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4a, 0x0b, 0x0a, 0x03, 0x32, 0x30, 0x30, 0x12, 0x04, 0x0a, + 0x02, 0x4f, 0x4b, 0xda, 0x41, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x19, 0x3a, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x22, 0x0d, + 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x12, 0xcd, 0x01, + 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x35, 0x2e, + 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, + 0x2e, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, + 0x31, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, + 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, + 0x77, 0x22, 0x5a, 0x92, 0x41, 0x32, 0x0a, 0x08, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, + 0x12, 0x0c, 0x47, 0x65, 0x74, 0x20, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2a, 0x0b, + 0x67, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4a, 0x0b, 0x0a, 0x03, 0x32, + 0x30, 0x30, 0x12, 0x04, 0x0a, 0x02, 0x4f, 0x4b, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, + 0x3d, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0xdc, 0x01, + 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x12, + 0x37, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x75, 0x92, 0x41, 0x40, 0x0a, 0x08, - 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x20, 0x73, - 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, - 0x77, 0x73, 0x2a, 0x0d, 0x6c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, - 0x73, 0x4a, 0x0b, 0x0a, 0x03, 0x32, 0x30, 0x30, 0x12, 0x04, 0x0a, 0x02, 0x4f, 0x4b, 0xda, 0x41, - 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x12, 0x21, 0x2f, - 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, - 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, - 0x12, 0xa9, 0x02, 0x0a, 0x13, 0x50, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x57, 0x6f, 0x72, 0x6b, - 0x66, 0x6c, 0x6f, 0x77, 0x53, 0x74, 0x65, 0x70, 0x12, 0x3d, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x63, 0x68, - 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x65, 0x72, - 0x66, 0x6f, 0x72, 0x6d, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x53, 0x74, 0x65, 0x70, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, - 0x73, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x63, 0x68, 0x65, - 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, - 0x66, 0x6c, 0x6f, 0x77, 0x22, 0xa5, 0x01, 0x92, 0x41, 0x71, 0x0a, 0x08, 0x57, 0x6f, 0x72, 0x6b, - 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x23, 0x50, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x74, 0x68, - 0x65, 0x20, 0x6e, 0x65, 0x78, 0x74, 0x20, 0x73, 0x74, 0x65, 0x70, 0x20, 0x69, 0x6e, 0x20, 0x61, - 0x20, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x1a, 0x23, 0x50, 0x65, 0x72, 0x66, 0x6f, - 0x72, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x65, 0x78, 0x74, 0x20, 0x73, 0x74, 0x65, 0x70, - 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2a, 0x0e, - 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4a, 0x0b, - 0x0a, 0x03, 0x32, 0x30, 0x30, 0x12, 0x04, 0x0a, 0x02, 0x4f, 0x4b, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x2b, 0x3a, 0x01, 0x2a, 0x22, 0x26, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, - 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x66, - 0x6c, 0x6f, 0x77, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x73, 0x74, 0x65, 0x70, 0x12, 0xe8, 0x02, 0x0a, - 0x12, 0x56, 0x69, 0x65, 0x77, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x74, - 0x65, 0x78, 0x74, 0x12, 0x3c, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, + 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x58, 0x92, 0x41, 0x40, 0x0a, 0x08, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, + 0x77, 0x12, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x20, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x64, 0x20, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x2a, 0x0d, 0x6c, 0x69, 0x73, + 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x4a, 0x0b, 0x0a, 0x03, 0x32, 0x30, + 0x30, 0x12, 0x04, 0x0a, 0x02, 0x4f, 0x4b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, 0x2f, + 0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x12, 0x9e, 0x02, 0x0a, + 0x13, 0x50, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, + 0x53, 0x74, 0x65, 0x70, 0x12, 0x3d, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, + 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, + 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x53, 0x74, 0x65, 0x70, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x53, 0x74, 0x61, 0x6b, - 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x3d, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x61, - 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, - 0x67, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0xd4, 0x01, 0x92, 0x41, 0xad, 0x01, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x3c, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, - 0x20, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2d, 0x69, 0x6e, 0x2d, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, - 0x67, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6e, 0x20, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x1a, 0x3c, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x70, - 0x6f, 0x69, 0x6e, 0x74, 0x2d, 0x69, 0x6e, 0x2d, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x20, - 0x64, 0x61, 0x74, 0x61, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6e, 0x20, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x2a, 0x12, 0x56, 0x69, 0x65, 0x77, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x4a, 0x0b, 0x0a, 0x03, 0x32, 0x30, 0x30, 0x12, 0x04, - 0x0a, 0x02, 0x4f, 0x4b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x76, 0x31, 0x2f, - 0x76, 0x69, 0x65, 0x77, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x74, 0x65, - 0x78, 0x74, 0x3a, 0x76, 0x69, 0x65, 0x77, 0x1a, 0x1d, 0xca, 0x41, 0x1a, 0x61, 0x70, 0x69, 0x2e, - 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, - 0x73, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x42, 0xe5, 0x07, 0x92, 0x41, 0x99, 0x07, 0x12, 0x65, 0x0a, - 0x15, 0x4f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x48, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, - 0x74, 0x68, 0x61, 0x74, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x20, 0x6e, - 0x6f, 0x6e, 0x2d, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x64, 0x69, 0x61, 0x6c, 0x20, 0x73, 0x74, 0x61, - 0x6b, 0x69, 0x6e, 0x67, 0x20, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x65, 0x6e, 0x63, 0x65, 0x73, - 0x20, 0x66, 0x6f, 0x72, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2e, - 0x32, 0x02, 0x76, 0x31, 0x1a, 0x1a, 0x61, 0x70, 0x69, 0x2e, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, - 0x70, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x63, 0x6f, 0x6d, - 0x22, 0x08, 0x2f, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2a, 0x01, 0x02, 0x32, 0x10, 0x61, - 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, - 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, - 0x6e, 0x52, 0x52, 0x0a, 0x03, 0x34, 0x30, 0x30, 0x12, 0x4b, 0x0a, 0x2c, 0x54, 0x68, 0x65, 0x20, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x20, 0x61, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x65, - 0x64, 0x20, 0x68, 0x61, 0x73, 0x20, 0x69, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x20, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x1b, 0x0a, 0x19, 0x1a, 0x17, 0x23, 0x2f, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, + 0x22, 0x9a, 0x01, 0x92, 0x41, 0x71, 0x0a, 0x08, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, + 0x12, 0x23, 0x50, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x65, + 0x78, 0x74, 0x20, 0x73, 0x74, 0x65, 0x70, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x20, 0x77, 0x6f, 0x72, + 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x1a, 0x23, 0x50, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x74, + 0x68, 0x65, 0x20, 0x6e, 0x65, 0x78, 0x74, 0x20, 0x73, 0x74, 0x65, 0x70, 0x20, 0x69, 0x6e, 0x20, + 0x61, 0x20, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2a, 0x0e, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4a, 0x0b, 0x0a, 0x03, 0x32, 0x30, + 0x30, 0x12, 0x04, 0x0a, 0x02, 0x4f, 0x4b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x3a, 0x01, 0x2a, + 0x22, 0x1b, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x77, 0x6f, 0x72, 0x6b, + 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x73, 0x74, 0x65, 0x70, 0x12, 0xe8, 0x02, + 0x0a, 0x12, 0x56, 0x69, 0x65, 0x77, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, + 0x74, 0x65, 0x78, 0x74, 0x12, 0x3c, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, + 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x53, 0x74, 0x61, + 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x3d, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, + 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69, 0x65, 0x77, 0x53, 0x74, 0x61, 0x6b, 0x69, + 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0xd4, 0x01, 0x92, 0x41, 0xad, 0x01, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, + 0x67, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x3c, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, + 0x73, 0x20, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2d, 0x69, 0x6e, 0x2d, 0x74, 0x69, 0x6d, 0x65, 0x20, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x74, 0x61, 0x6b, 0x69, + 0x6e, 0x67, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6e, 0x20, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x1a, 0x3c, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x2d, 0x69, 0x6e, 0x2d, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x63, 0x6f, + 0x6e, 0x74, 0x65, 0x78, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, + 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6e, 0x20, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x2a, 0x12, 0x56, 0x69, 0x65, 0x77, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, + 0x67, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x4a, 0x0b, 0x0a, 0x03, 0x32, 0x30, 0x30, 0x12, + 0x04, 0x0a, 0x02, 0x4f, 0x4b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x76, 0x31, + 0x2f, 0x76, 0x69, 0x65, 0x77, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x74, + 0x65, 0x78, 0x74, 0x3a, 0x76, 0x69, 0x65, 0x77, 0x1a, 0x1d, 0xca, 0x41, 0x1a, 0x61, 0x70, 0x69, + 0x2e, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, + 0x61, 0x73, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x42, 0xe5, 0x07, 0x92, 0x41, 0x99, 0x07, 0x12, 0x65, + 0x0a, 0x15, 0x4f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x48, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x20, + 0x6e, 0x6f, 0x6e, 0x2d, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x64, 0x69, 0x61, 0x6c, 0x20, 0x73, 0x74, + 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x20, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x65, 0x6e, 0x63, 0x65, + 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20, 0x75, 0x73, 0x65, 0x72, 0x73, + 0x2e, 0x32, 0x02, 0x76, 0x31, 0x1a, 0x1a, 0x61, 0x70, 0x69, 0x2e, 0x64, 0x65, 0x76, 0x65, 0x6c, + 0x6f, 0x70, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x63, 0x6f, + 0x6d, 0x22, 0x08, 0x2f, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2a, 0x01, 0x02, 0x32, 0x10, + 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, + 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, + 0x6f, 0x6e, 0x52, 0x52, 0x0a, 0x03, 0x34, 0x30, 0x30, 0x12, 0x4b, 0x0a, 0x2c, 0x54, 0x68, 0x65, + 0x20, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x20, 0x61, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, + 0x65, 0x64, 0x20, 0x68, 0x61, 0x73, 0x20, 0x69, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x20, 0x70, + 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x1b, 0x0a, 0x19, 0x1a, 0x17, 0x23, + 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x72, 0x70, 0x63, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x57, 0x0a, 0x03, 0x34, 0x30, 0x31, 0x12, 0x50, 0x0a, + 0x31, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x69, 0x66, 0x20, 0x61, 0x75, 0x74, + 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x66, 0x6f, + 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x69, 0x6e, 0x76, 0x61, 0x6c, + 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x19, 0x1a, 0x17, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x64, 0x0a, 0x03, 0x34, 0x30, 0x33, 0x12, 0x5d, 0x0a, 0x3e, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, + 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x61, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x64, + 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x70, 0x65, 0x72, + 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x12, 0x1b, 0x0a, 0x19, 0x1a, 0x17, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x72, 0x70, 0x63, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x57, 0x0a, 0x03, 0x34, 0x30, 0x31, 0x12, 0x50, 0x0a, 0x31, - 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x69, 0x66, 0x20, 0x61, 0x75, 0x74, 0x68, - 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x72, - 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x69, 0x6e, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x12, 0x1b, 0x0a, 0x19, 0x1a, 0x17, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x64, - 0x0a, 0x03, 0x34, 0x30, 0x33, 0x12, 0x5d, 0x0a, 0x3e, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, - 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x61, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x64, 0x6f, - 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x70, 0x65, 0x72, 0x6d, - 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x12, 0x1b, 0x0a, 0x19, 0x1a, 0x17, 0x23, 0x2f, 0x64, - 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x72, 0x70, 0x63, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x52, 0x4c, 0x0a, 0x03, 0x34, 0x30, 0x34, 0x12, 0x45, 0x0a, 0x26, 0x52, - 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x61, 0x20, 0x72, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, - 0x6f, 0x75, 0x6e, 0x64, 0x2e, 0x12, 0x1b, 0x0a, 0x19, 0x1a, 0x17, 0x23, 0x2f, 0x64, 0x65, 0x66, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x4c, 0x0a, 0x03, 0x34, 0x30, 0x34, 0x12, 0x45, 0x0a, 0x26, + 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x61, 0x20, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, + 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x2e, 0x12, 0x1b, 0x0a, 0x19, 0x1a, 0x17, 0x23, 0x2f, 0x64, 0x65, + 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x56, 0x0a, 0x03, 0x34, 0x32, 0x39, 0x12, 0x4f, 0x0a, 0x30, 0x52, 0x65, + 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x61, 0x20, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x20, 0x68, 0x61, 0x73, + 0x20, 0x62, 0x65, 0x65, 0x6e, 0x20, 0x72, 0x65, 0x61, 0x63, 0x68, 0x65, 0x64, 0x2e, 0x12, 0x1b, + 0x0a, 0x19, 0x1a, 0x17, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2f, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x55, 0x0a, 0x03, 0x35, + 0x30, 0x30, 0x12, 0x4e, 0x0a, 0x2f, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, + 0x68, 0x65, 0x6e, 0x20, 0x61, 0x6e, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x20, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x68, 0x61, 0x70, + 0x70, 0x65, 0x6e, 0x73, 0x2e, 0x12, 0x1b, 0x0a, 0x19, 0x1a, 0x17, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x52, 0x56, 0x0a, 0x03, 0x34, 0x32, 0x39, 0x12, 0x4f, 0x0a, 0x30, 0x52, 0x65, 0x74, - 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x61, 0x20, 0x72, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x20, 0x68, 0x61, 0x73, 0x20, - 0x62, 0x65, 0x65, 0x6e, 0x20, 0x72, 0x65, 0x61, 0x63, 0x68, 0x65, 0x64, 0x2e, 0x12, 0x1b, 0x0a, - 0x19, 0x1a, 0x17, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2f, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x55, 0x0a, 0x03, 0x35, 0x30, - 0x30, 0x12, 0x4e, 0x0a, 0x2f, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, - 0x65, 0x6e, 0x20, 0x61, 0x6e, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x20, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x68, 0x61, 0x70, 0x70, - 0x65, 0x6e, 0x73, 0x2e, 0x12, 0x1b, 0x0a, 0x19, 0x1a, 0x17, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, - 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x6a, 0x1d, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x11, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, - 0x6a, 0x1b, 0x0a, 0x07, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x10, 0x4e, 0x65, 0x74, - 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x6a, 0x19, 0x0a, - 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x6a, 0x28, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x6b, - 0x69, 0x6e, 0x67, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x17, 0x53, 0x74, 0x61, 0x6b, 0x69, - 0x6e, 0x67, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, - 0x6c, 0x73, 0x6a, 0x29, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x12, 0x17, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x6a, 0x27, 0x0a, - 0x08, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x1b, 0x57, 0x6f, 0x72, 0x6b, 0x66, - 0x6c, 0x6f, 0x77, 0x20, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x64, - 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x62, 0x68, 0x71, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x73, 0x74, - 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x69, - 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x6f, 0x72, - 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x75, 0x73, 0x6a, 0x1d, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x11, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, + 0x73, 0x6a, 0x1b, 0x0a, 0x07, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x10, 0x4e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x6a, 0x19, + 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x6a, 0x28, 0x0a, 0x0d, 0x53, 0x74, 0x61, + 0x6b, 0x69, 0x6e, 0x67, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x17, 0x53, 0x74, 0x61, 0x6b, + 0x69, 0x6e, 0x67, 0x20, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x20, 0x64, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x73, 0x6a, 0x29, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x6f, + 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x17, 0x53, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x20, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x6a, 0x27, + 0x0a, 0x08, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x1b, 0x57, 0x6f, 0x72, 0x6b, + 0x66, 0x6c, 0x6f, 0x77, 0x20, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, + 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x62, 0x68, 0x71, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x73, + 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, + 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x6f, + 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_coinbase_staking_orchestration_v1_api_proto_goTypes = []interface{}{ diff --git a/gen/go/coinbase/staking/orchestration/v1/api.pb.gw.go b/gen/go/coinbase/staking/orchestration/v1/api.pb.gw.go index 644a627..0d13c65 100644 --- a/gen/go/coinbase/staking/orchestration/v1/api.pb.gw.go +++ b/gen/go/coinbase/staking/orchestration/v1/api.pb.gw.go @@ -235,23 +235,6 @@ func request_StakingService_CreateWorkflow_0(ctx context.Context, marshaler runt return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["parent"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") - } - - protoReq.Parent, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) - } - msg, err := client.CreateWorkflow(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -269,23 +252,6 @@ func local_request_StakingService_CreateWorkflow_0(ctx context.Context, marshale return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["parent"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") - } - - protoReq.Parent, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) - } - msg, err := server.CreateWorkflow(ctx, &protoReq) return msg, metadata, err @@ -344,30 +310,13 @@ func local_request_StakingService_GetWorkflow_0(ctx context.Context, marshaler r } var ( - filter_StakingService_ListWorkflows_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 2, 0, 0}, Check: []int{0, 1, 2, 2}} + filter_StakingService_ListWorkflows_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) func request_StakingService_ListWorkflows_0(ctx context.Context, marshaler runtime.Marshaler, client StakingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ListWorkflowsRequest var metadata runtime.ServerMetadata - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["parent"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") - } - - protoReq.Parent, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) - } - if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -384,23 +333,6 @@ func local_request_StakingService_ListWorkflows_0(ctx context.Context, marshaler var protoReq ListWorkflowsRequest var metadata runtime.ServerMetadata - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["parent"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") - } - - protoReq.Parent, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) - } - if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -631,7 +563,7 @@ func RegisterStakingServiceHandlerServer(ctx context.Context, mux *runtime.Serve inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/coinbase.staking.orchestration.v1.StakingService/CreateWorkflow", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/workflows")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/coinbase.staking.orchestration.v1.StakingService/CreateWorkflow", runtime.WithHTTPPathPattern("/v1/workflows")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -656,7 +588,7 @@ func RegisterStakingServiceHandlerServer(ctx context.Context, mux *runtime.Serve inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/coinbase.staking.orchestration.v1.StakingService/GetWorkflow", runtime.WithHTTPPathPattern("/v1/{name=projects/*/workflows/*}")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/coinbase.staking.orchestration.v1.StakingService/GetWorkflow", runtime.WithHTTPPathPattern("/v1/{name=workflows/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -681,7 +613,7 @@ func RegisterStakingServiceHandlerServer(ctx context.Context, mux *runtime.Serve inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/coinbase.staking.orchestration.v1.StakingService/ListWorkflows", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/workflows")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/coinbase.staking.orchestration.v1.StakingService/ListWorkflows", runtime.WithHTTPPathPattern("/v1/workflows")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -706,7 +638,7 @@ func RegisterStakingServiceHandlerServer(ctx context.Context, mux *runtime.Serve inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/coinbase.staking.orchestration.v1.StakingService/PerformWorkflowStep", runtime.WithHTTPPathPattern("/v1/{name=projects/*/workflows/*}/step")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/coinbase.staking.orchestration.v1.StakingService/PerformWorkflowStep", runtime.WithHTTPPathPattern("/v1/{name=workflows/*}/step")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -883,7 +815,7 @@ func RegisterStakingServiceHandlerClient(ctx context.Context, mux *runtime.Serve inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/coinbase.staking.orchestration.v1.StakingService/CreateWorkflow", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/workflows")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/coinbase.staking.orchestration.v1.StakingService/CreateWorkflow", runtime.WithHTTPPathPattern("/v1/workflows")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -905,7 +837,7 @@ func RegisterStakingServiceHandlerClient(ctx context.Context, mux *runtime.Serve inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/coinbase.staking.orchestration.v1.StakingService/GetWorkflow", runtime.WithHTTPPathPattern("/v1/{name=projects/*/workflows/*}")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/coinbase.staking.orchestration.v1.StakingService/GetWorkflow", runtime.WithHTTPPathPattern("/v1/{name=workflows/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -927,7 +859,7 @@ func RegisterStakingServiceHandlerClient(ctx context.Context, mux *runtime.Serve inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/coinbase.staking.orchestration.v1.StakingService/ListWorkflows", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/workflows")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/coinbase.staking.orchestration.v1.StakingService/ListWorkflows", runtime.WithHTTPPathPattern("/v1/workflows")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -949,7 +881,7 @@ func RegisterStakingServiceHandlerClient(ctx context.Context, mux *runtime.Serve inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/coinbase.staking.orchestration.v1.StakingService/PerformWorkflowStep", runtime.WithHTTPPathPattern("/v1/{name=projects/*/workflows/*}/step")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/coinbase.staking.orchestration.v1.StakingService/PerformWorkflowStep", runtime.WithHTTPPathPattern("/v1/{name=workflows/*}/step")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -999,13 +931,13 @@ var ( pattern_StakingService_ListActions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3, 2, 4}, []string{"v1", "protocols", "networks", "parent", "actions"}, "")) - pattern_StakingService_CreateWorkflow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "workflows"}, "")) + pattern_StakingService_CreateWorkflow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "workflows"}, "")) - pattern_StakingService_GetWorkflow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "workflows", "name"}, "")) + pattern_StakingService_GetWorkflow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "workflows", "name"}, "")) - pattern_StakingService_ListWorkflows_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "workflows"}, "")) + pattern_StakingService_ListWorkflows_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "workflows"}, "")) - pattern_StakingService_PerformWorkflowStep_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3, 2, 4}, []string{"v1", "projects", "workflows", "name", "step"}, "")) + pattern_StakingService_PerformWorkflowStep_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "workflows", "name", "step"}, "")) pattern_StakingService_ViewStakingContext_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "viewStakingContext"}, "view")) ) diff --git a/gen/go/coinbase/staking/orchestration/v1/api_grpc.pb.go b/gen/go/coinbase/staking/orchestration/v1/api_grpc.pb.go index 672788c..71a9ed6 100644 --- a/gen/go/coinbase/staking/orchestration/v1/api_grpc.pb.go +++ b/gen/go/coinbase/staking/orchestration/v1/api_grpc.pb.go @@ -46,7 +46,7 @@ type StakingServiceClient interface { CreateWorkflow(ctx context.Context, in *CreateWorkflowRequest, opts ...grpc.CallOption) (*Workflow, error) // Get the current state of an active workflow. GetWorkflow(ctx context.Context, in *GetWorkflowRequest, opts ...grpc.CallOption) (*Workflow, error) - // List all workflows in a project. + // List all workflows ListWorkflows(ctx context.Context, in *ListWorkflowsRequest, opts ...grpc.CallOption) (*ListWorkflowsResponse, error) // Perform the next step in a workflow. PerformWorkflowStep(ctx context.Context, in *PerformWorkflowStepRequest, opts ...grpc.CallOption) (*Workflow, error) @@ -159,7 +159,7 @@ type StakingServiceServer interface { CreateWorkflow(context.Context, *CreateWorkflowRequest) (*Workflow, error) // Get the current state of an active workflow. GetWorkflow(context.Context, *GetWorkflowRequest) (*Workflow, error) - // List all workflows in a project. + // List all workflows ListWorkflows(context.Context, *ListWorkflowsRequest) (*ListWorkflowsResponse, error) // Perform the next step in a workflow. PerformWorkflowStep(context.Context, *PerformWorkflowStepRequest) (*Workflow, error) diff --git a/gen/go/coinbase/staking/orchestration/v1/workflow.pb.go b/gen/go/coinbase/staking/orchestration/v1/workflow.pb.go index 972338f..b39a500 100644 --- a/gen/go/coinbase/staking/orchestration/v1/workflow.pb.go +++ b/gen/go/coinbase/staking/orchestration/v1/workflow.pb.go @@ -680,8 +680,8 @@ type Workflow struct { unknownFields protoimpl.UnknownFields // The resource name of the workflow. - // Format: projects/{projectUUID}/workflows/{workflowUUID} - // Ex: projects/ 123e4567-e89b-12d3-a456-426614174000/workflows/123e4567-e89b-12d3-a456-426614174000 + // Format: workflows/{workflowUUID} + // Ex: workflows/123e4567-e89b-12d3-a456-426614174000 Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // The resource name of the action being // performed. @@ -856,10 +856,6 @@ type CreateWorkflowRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The resource name of the parent that owns - // the workflow. - // Format: projects/{project} - Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` // The workflow to create. Workflow *Workflow `protobuf:"bytes,2,opt,name=workflow,proto3" json:"workflow,omitempty"` } @@ -896,13 +892,6 @@ func (*CreateWorkflowRequest) Descriptor() ([]byte, []int) { return file_coinbase_staking_orchestration_v1_workflow_proto_rawDescGZIP(), []int{5} } -func (x *CreateWorkflowRequest) GetParent() string { - if x != nil { - return x.Parent - } - return "" -} - func (x *CreateWorkflowRequest) GetWorkflow() *Workflow { if x != nil { return x.Workflow @@ -917,7 +906,7 @@ type GetWorkflowRequest struct { unknownFields protoimpl.UnknownFields // The resource name of the workflow. - // Format: projects/{project}/workflows/{workflow} + // Format: workflows/{workflow} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` } @@ -966,10 +955,6 @@ type ListWorkflowsRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The resource name of the parent that owns - // the collection of networks. - // Format: projects/{project} - Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` // [AIP-160](https://google.aip.dev/160) filter // Supported fields: // - string action: "stake", "unstake" @@ -1023,13 +1008,6 @@ func (*ListWorkflowsRequest) Descriptor() ([]byte, []int) { return file_coinbase_staking_orchestration_v1_workflow_proto_rawDescGZIP(), []int{7} } -func (x *ListWorkflowsRequest) GetParent() string { - if x != nil { - return x.Parent - } - return "" -} - func (x *ListWorkflowsRequest) GetFilter() string { if x != nil { return x.Filter @@ -1117,7 +1095,7 @@ type PerformWorkflowStepRequest struct { unknownFields protoimpl.UnknownFields // The resource name of the workflow. - // Format: projects/{project}/workflows/{workflow} + // Format: workflows/{workflow} Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // The index of the step to be performed. Step int32 `protobuf:"varint,2,opt,name=step,proto3" json:"step,omitempty"` @@ -1316,7 +1294,7 @@ var file_coinbase_staking_orchestration_v1_workflow_proto_rawDesc = []byte{ 0x0a, 0x2c, 0x2a, 0x2a, 0x54, 0x68, 0x65, 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x20, 0x73, 0x74, 0x65, 0x70, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x42, 0x08, - 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, 0xe8, 0x09, 0x0a, 0x08, 0x57, 0x6f, 0x72, + 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, 0xd5, 0x09, 0x0a, 0x08, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, @@ -1387,62 +1365,54 @@ var file_coinbase_staking_orchestration_v1_workflow_proto_rawDesc = []byte{ 0x2a, 0x13, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x2a, 0x18, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x5f, 0x52, 0x45, 0x46, 0x52, 0x45, 0x53, 0x48, 0x41, 0x42, 0x4c, 0x45, 0x3a, - 0x60, 0xea, 0x41, 0x5d, 0x0a, 0x1d, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x63, 0x6f, + 0x4d, 0xea, 0x41, 0x4a, 0x0a, 0x1d, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x57, 0x6f, 0x72, 0x6b, 0x66, - 0x6c, 0x6f, 0x77, 0x12, 0x27, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x7b, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x7d, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, - 0x73, 0x2f, 0x7b, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x7d, 0x2a, 0x09, 0x77, 0x6f, - 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x32, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, - 0x77, 0x42, 0x14, 0x0a, 0x12, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x4a, 0x04, 0x08, 0x03, 0x10, 0x04, 0x4a, 0x04, 0x08, - 0x0b, 0x10, 0x0c, 0x22, 0xa4, 0x01, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x6f, - 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3d, 0x0a, - 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x25, 0xe0, - 0x41, 0x02, 0xfa, 0x41, 0x1f, 0x12, 0x1d, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x63, - 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x57, 0x6f, 0x72, 0x6b, - 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x4c, 0x0a, 0x08, - 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, - 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, - 0x67, 0x2e, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, - 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x42, 0x03, 0xe0, 0x41, 0x02, - 0x52, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x22, 0x4f, 0x0a, 0x12, 0x47, 0x65, - 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x39, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x25, - 0xe0, 0x41, 0x02, 0xfa, 0x41, 0x1f, 0x0a, 0x1d, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, - 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x57, 0x6f, 0x72, - 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xb8, 0x01, 0x0a, 0x14, - 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x3d, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x25, 0xe0, 0x41, 0x02, 0xfa, 0x41, 0x1f, 0x12, 0x1d, 0x73, 0x74, - 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x06, 0x70, 0x61, 0x72, - 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, - 0x12, 0x20, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x05, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, - 0x7a, 0x65, 0x12, 0x22, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x09, 0x70, 0x61, 0x67, - 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x8a, 0x01, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x57, - 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x49, 0x0a, 0x09, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, - 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, - 0x52, 0x09, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, - 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x22, 0x67, 0x0a, 0x1a, 0x50, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x57, 0x6f, - 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x53, 0x74, 0x65, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x03, 0xe0, 0x41, 0x02, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, - 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x12, 0x17, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x48, 0x5a, 0x46, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x62, 0x68, 0x71, 0x2e, 0x6e, 0x65, 0x74, 0x2f, - 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x67, 0x65, - 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x73, 0x74, - 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x6f, 0x77, 0x12, 0x14, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x2f, 0x7b, + 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x7d, 0x2a, 0x09, 0x77, 0x6f, 0x72, 0x6b, 0x66, + 0x6c, 0x6f, 0x77, 0x73, 0x32, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x42, 0x14, + 0x0a, 0x12, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, + 0x74, 0x65, 0x72, 0x73, 0x4a, 0x04, 0x08, 0x03, 0x10, 0x04, 0x4a, 0x04, 0x08, 0x0b, 0x10, 0x0c, + 0x22, 0x6b, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, + 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x4c, 0x0a, 0x08, 0x77, 0x6f, 0x72, + 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x63, 0x6f, + 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x6f, + 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, + 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x08, 0x77, + 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x22, 0x4f, 0x0a, + 0x12, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x39, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x25, 0xe0, 0x41, 0x02, 0xfa, 0x41, 0x1f, 0x0a, 0x1d, 0x73, 0x74, 0x61, 0x6b, 0x69, + 0x6e, 0x67, 0x2e, 0x63, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x7f, + 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x06, 0x66, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x08, 0x70, 0x61, 0x67, + 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x22, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x01, 0x52, 0x09, + 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4a, 0x04, 0x08, 0x01, 0x10, 0x02, 0x22, + 0x8a, 0x01, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x09, 0x77, 0x6f, 0x72, + 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x63, + 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, + 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, + 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x09, 0x77, 0x6f, 0x72, 0x6b, 0x66, + 0x6c, 0x6f, 0x77, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, + 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, + 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x67, 0x0a, 0x1a, + 0x50, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x53, + 0x74, 0x65, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x12, 0x17, 0x0a, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x62, 0x68, 0x71, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x73, + 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, + 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2f, 0x6f, + 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/gen/go/coinbase/staking/orchestration/v1/workflow_aip.go b/gen/go/coinbase/staking/orchestration/v1/workflow_aip.go index e2dad6f..e241cb1 100644 --- a/gen/go/coinbase/staking/orchestration/v1/workflow_aip.go +++ b/gen/go/coinbase/staking/orchestration/v1/workflow_aip.go @@ -14,17 +14,10 @@ import ( ) type WorkflowResourceName struct { - Project string Workflow string } func (n WorkflowResourceName) Validate() error { - if n.Project == "" { - return fmt.Errorf("project: empty") - } - if strings.IndexByte(n.Project, '/') != -1 { - return fmt.Errorf("project: contains illegal character '/'") - } if n.Workflow == "" { return fmt.Errorf("workflow: empty") } @@ -35,13 +28,12 @@ func (n WorkflowResourceName) Validate() error { } func (n WorkflowResourceName) ContainsWildcard() bool { - return false || n.Project == "-" || n.Workflow == "-" + return false || n.Workflow == "-" } func (n WorkflowResourceName) String() string { return resourcename.Sprint( - "projects/{project}/workflows/{workflow}", - n.Project, + "workflows/{workflow}", n.Workflow, ) } @@ -56,8 +48,7 @@ func (n WorkflowResourceName) MarshalString() (string, error) { func (n *WorkflowResourceName) UnmarshalString(name string) error { return resourcename.Sscan( name, - "projects/{project}/workflows/{workflow}", - &n.Project, + "workflows/{workflow}", &n.Workflow, ) } From e5cea85d53ebfa603ae0e61ca54ea0d20861a85e Mon Sep 17 00:00:00 2001 From: Shane O'Brien Date: Wed, 24 Apr 2024 12:08:24 -0400 Subject: [PATCH 09/16] Fixed tests --- .github/workflows/test.yaml | 18 ++++++++---------- examples/solana/create-workflow/main.go | 7 ++++--- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b9476b7..506f64b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -8,19 +8,17 @@ on: jobs: test: - name: Run Tests runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 + - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: - go-version: 1.20 - - - name: Check out code - uses: actions/checkout@v2 + go-version-file: go.mod - - name: Get dependencies - run: go mod download + - name: Build + run: go build -v ./... - - name: Run tests - run: go test -v ./... + - name: Test + uses: robherley/go-test-action@v0 diff --git a/examples/solana/create-workflow/main.go b/examples/solana/create-workflow/main.go index 649ad97..7fd530a 100644 --- a/examples/solana/create-workflow/main.go +++ b/examples/solana/create-workflow/main.go @@ -15,6 +15,7 @@ import ( "github.com/coinbase/staking-client-library-go/client" stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" "github.com/coinbase/staking-client-library-go/client/options" + "github.com/coinbase/staking-client-library-go/client/orchestration" stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" "github.com/coinbase/staking-client-library-go/internal/signer" ) @@ -91,7 +92,7 @@ func main() { printWorkflowProgressDetails(workflow) // If workflow is in WAITING_FOR_EXT_BROADCAST state, sign, broadcast the transaction and update the workflow. - if v1.WorkflowWaitingForExternalBroadcast(workflow) { + if orchestration.WorkflowWaitingForExternalBroadcast(workflow) { unsignedTx := workflow.Steps[workflow.GetCurrentStepId()].GetTxStepOutput().GetUnsignedTx() // Logic to sign the transaction. This can be substituted with any other signing mechanism. @@ -105,7 +106,7 @@ func main() { // Add logic to broadcast the tx here. fmt.Printf("Please broadcast this signed tx %s externally and return back the tx hash via the PerformWorkflowStep API ...\n", signedTx) break - } else if v1.WorkflowFinished(workflow) { + } else if orchestration.WorkflowFinished(workflow) { break } @@ -142,7 +143,7 @@ func printWorkflowProgressDetails(workflow *stakingpb.Workflow) { ) } - if v1.WorkflowFinished(workflow) { + if orchestration.WorkflowFinished(workflow) { log.Printf("Workflow reached end state - step name: %s %s workflow state: %s runtime: %v\n", step.GetName(), stepDetails, From 310124959bb322d452258c0f06c4e31ad5006432 Mon Sep 17 00:00:00 2001 From: Shane O'Brien Date: Wed, 24 Apr 2024 12:16:38 -0400 Subject: [PATCH 10/16] Cleaning up actions --- .github/workflows/lint.yaml | 13 +++++++------ .github/workflows/test.yaml | 11 +++++++++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 0ae6b55..f5a42bf 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,20 +1,21 @@ name: Go Lint on: push: - # branches: - # - master - # - main + branches: + - master + # We only run tests when we open PRs (and not for ex: on every commit) + # to avoid running workflows too frequently and incurring costs pull_request: permissions: contents: read - # Optional: allow read access to pull request. Use with `only-new-issues` option. - # pull-requests: read jobs: - golangci: + lint: name: lint runs-on: ubuntu-latest + # This prevents the workflow from running on PRs from forks + if: github.event.pull_request.head.repo.full_name == github.repository steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 506f64b..3b97643 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -2,13 +2,20 @@ name: Go Test on: push: - # branches: [ main ] + branches: + - master + # We only run tests when we open PRs (and not for ex: on every commit) + # to avoid running workflows too frequently and incurring costs pull_request: - branches: [main] + +permissions: + contents: read jobs: test: runs-on: ubuntu-latest + # This prevents the workflow from running on PRs from forks + if: github.event.pull_request.head.repo.full_name == github.repository steps: - uses: actions/checkout@v4 From 0712f8bb8a706c2ec6e05b25ec475f381b571c53 Mon Sep 17 00:00:00 2001 From: Shane O'Brien Date: Wed, 24 Apr 2024 12:31:48 -0400 Subject: [PATCH 11/16] Remove gci from go.mod --- go.mod | 13 +++------- go.sum | 77 ++++++++++++++++++++++++++-------------------------------- 2 files changed, 38 insertions(+), 52 deletions(-) diff --git a/go.mod b/go.mod index 8c89133..cf5adbd 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/coinbase/staking-client-library-go -go 1.20 +go 1.21 + +toolchain go1.21.7 require ( github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce @@ -27,7 +29,6 @@ require ( github.com/blendle/zapdriver v1.3.1 // indirect github.com/btcsuite/btcd v0.20.1-beta // indirect github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect - github.com/daixiang0/gci v0.13.4 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect github.com/fatih/color v1.16.0 // indirect @@ -37,9 +38,7 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/s2a-go v0.1.4 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect - github.com/hexops/gotextdiff v1.0.3 // indirect github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c // indirect - github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.17.7 // indirect github.com/logrusorgru/aurora v2.0.3+incompatible // indirect @@ -51,24 +50,20 @@ require ( github.com/mostynb/zstdpool-freelist v0.0.0-20201229113212-927304c0c3b1 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/spf13/cobra v1.6.1 // indirect - github.com/spf13/pflag v1.0.5 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091 // indirect go.mongodb.org/mongo-driver v1.14.0 // indirect go.opencensus.io v0.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/crypto v0.22.0 // indirect - golang.org/x/mod v0.16.0 // indirect golang.org/x/net v0.22.0 // indirect golang.org/x/oauth2 v0.8.0 // indirect golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.19.0 // indirect golang.org/x/term v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect - golang.org/x/tools v0.19.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - mvdan.cc/gofumpt v0.6.0 // indirect ) diff --git a/go.sum b/go.sum index 7c4f275..f04fe37 100644 --- a/go.sum +++ b/go.sum @@ -8,12 +8,16 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= +github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= +github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= +github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/blendle/zapdriver v1.3.1 h1:C3dydBOWYRiOk+B8X9IVZ5IOe+7cl+tGOexN4QqHfpE= github.com/blendle/zapdriver v1.3.1/go.mod h1:mdXfREi6u5MArG4j9fewC+FGnXaBR+T4Ox4J2u4eHCc= github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= @@ -32,6 +36,7 @@ github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46f github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -40,12 +45,13 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/errors v1.9.1 h1:yFVvsI0VxmRShfawbt/laCIDy/mtTqqnvoNgiy5bEV8= +github.com/cockroachdb/errors v1.9.1/go.mod h1:2sxOtL2WIc096WSZqZ5h8fa17rdDq9HZOZLBCor4mBk= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 h1:ytcWPaNPhNoGMWEhDvS3zToKcDpRsLuRolQJBVGdozk= +github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811/go.mod h1:Nb5lgvnQ2+oGlE/EyZy4+2/CxRh9KfvCXnag1vtpxVM= github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/daixiang0/gci v0.13.4 h1:61UGkmpoAcxHM2hhNkZEf5SzwQtWJXTSws7jaPyqwlw= -github.com/daixiang0/gci v0.13.4/go.mod h1:12etP2OniiIdP4q+kjUGrC/rUagga7ODbqsom5Eo5Yk= +github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -72,13 +78,19 @@ github.com/gagliardetto/solana-go v1.10.0/go.mod h1:afBEcIRrDLJst3lvAahTr63m6W2N github.com/gagliardetto/treeout v0.1.4 h1:ozeYerrLCmCubo1TcIjFiOWTTGteOOHND1twdFpgwaw= github.com/gagliardetto/treeout v0.1.4/go.mod h1:loUefvXTrlRG5rYmJmExNryyBRh8f89VZhmMOyCyqok= github.com/getsentry/sentry-go v0.18.0 h1:MtBW5H9QgdcJabtZcuJG80BMOwaBpkRDZkxRkNC1sN0= +github.com/getsentry/sentry-go v0.18.0/go.mod h1:Kgon4Mby+FJ7ZWHFUAZgVaIa8sxHtnRJRLTXZr51aKQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= +github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= +github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= +github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= +github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -100,6 +112,7 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -107,8 +120,6 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -119,18 +130,12 @@ github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9 github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= github.com/googleapis/gax-go/v2 v2.11.0 h1:9V9PWXEsWnPpQhu/PeQIkS4eGzMlTLGgt80cUUI8Ki4= github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 h1:gDLXvp5S9izjldquuoAhDzccbskOL6tDC5jMSyx3zxE= github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2/go.mod h1:7pdNwVWBBHGiCxa9lAszqCJMbfTISJ7oMftp8+UGV08= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= -github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c h1:DZfsyhDK1hnSS5lH8l+JggqzEleHteTYfutAiVlSUM8= github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= -github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -142,20 +147,24 @@ github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ib github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8= github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -163,41 +172,36 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/mostynb/zstdpool-freelist v0.0.0-20201229113212-927304c0c3b1 h1:mPMvm6X6tf4w8y7j9YIt6V9jfWhL6QlbEc7CCmeQlWk= github.com/mostynb/zstdpool-freelist v0.0.0-20201229113212-927304c0c3b1/go.mod h1:ye2e/VUEtE2BHE+G/QcKkcLQVAEJoYRFj5VUOQatCRE= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= +github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= +github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= +github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/prometheus/common v0.39.0 h1:oOyhkDq05hPZKItWVBkJ6g6AtGxi+fy7F4JvUV8uhsI= +github.com/prometheus/common v0.39.0/go.mod h1:6XBZ7lYdLCbkAVhwRsWTZn+IN5AB9F/NXd5w0BbEX0Y= github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= +github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= +github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= -github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091 h1:RN5mrigyirb8anBEtdjtHFIufXdacyTi6i4KBfeNXeo= github.com/streamingfast/logging v0.0.0-20230608130331-f22c91403091/go.mod h1:VlduQ80JcGJSargkRU4Sg9Xo63wZD/l8A5NC/Uo1/uU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -208,18 +212,17 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE= github.com/test-go/testify v1.1.4/go.mod h1:rH7cfJo/47vWGdi4GPj16x3/t1xGOj2YxzmNQzk2ghU= github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4= +github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= -github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.einride.tech/aip v0.60.0 h1:h6bgabZ5BCfAptbGex8jbh3VvPBRLa6xq+pQ1CAjHYw= @@ -233,6 +236,7 @@ go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= @@ -253,16 +257,13 @@ golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20230206171751-46f607a40771 h1:xP7rWLUr1e1n2xkK5YB4LI0hPEy3LJC6Wk+D4pGlOJg= +golang.org/x/exp v0.0.0-20230206171751-46f607a40771/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= -golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic= -golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -278,8 +279,6 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -292,7 +291,6 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -332,15 +330,10 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= -golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= -golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw= -golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/api v0.126.0 h1:q4GJq+cAdMAC7XP7njvQ4tvohGLiSlytuL4BQxbIZ+o= google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= @@ -384,7 +377,6 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI= gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= @@ -398,7 +390,6 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= +gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -mvdan.cc/gofumpt v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo= -mvdan.cc/gofumpt v0.6.0/go.mod h1:4L0wf+kgIPZtcCWXynNS2e6bhmj73umwnuXSZarixzA= From 5311ce090adddfccd6e6ddc50cf32bd01c3dfda5 Mon Sep 17 00:00:00 2001 From: Shane O'Brien Date: Wed, 24 Apr 2024 14:59:40 -0400 Subject: [PATCH 12/16] Changed imports to standardize around api, fixed smaller PR comments --- .github/workflows/lint.yaml | 3 +- README.md | 16 +++---- client/orchestration/action.go | 6 +-- client/orchestration/network.go | 6 +-- client/orchestration/protocol.go | 6 +-- client/orchestration/staking_target.go | 14 +++--- client/orchestration/view_staking_context.go | 6 +-- client/orchestration/workflow.go | 36 +++++++-------- client/protocols/protocols.go | 11 ----- client/rewards/protocols.go | 11 +++++ client/rewards/reward.go | 14 +++--- .../reward_filter.go | 2 +- .../reward_filter_test.go | 46 +++++++++---------- client/rewards/stake.go | 14 +++--- .../{stakes => stakes_filter}/stake_filter.go | 2 +- .../stake_filter_test.go | 24 +++++----- examples/cosmos/list-rewards/main.go | 12 ++--- examples/cosmos/list-stakes/main.go | 8 ++-- .../create-and-process-workflow/main.go | 24 +++++----- examples/ethereum/create-workflow/main.go | 16 +++---- examples/ethereum/list-rewards/main.go | 12 ++--- examples/ethereum/list-stakes/main.go | 8 ++-- examples/hello-world/main.go | 14 +++--- examples/list-workflows/main.go | 4 +- examples/solana/create-workflow/main.go | 24 +++++----- examples/solana/list-rewards/main.go | 12 ++--- 26 files changed, 176 insertions(+), 175 deletions(-) delete mode 100644 client/protocols/protocols.go create mode 100644 client/rewards/protocols.go rename client/rewards/{reward => rewards_filter}/reward_filter.go (99%) rename client/rewards/{reward => rewards_filter}/reward_filter_test.go (65%) rename client/rewards/{stakes => stakes_filter}/stake_filter.go (99%) rename client/rewards/{stakes => stakes_filter}/stake_filter_test.go (69%) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index f5a42bf..0db24a6 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,9 +1,10 @@ name: Go Lint + on: push: branches: - master - # We only run tests when we open PRs (and not for ex: on every commit) + # We only run tests when we open PRs (and not for ex: on every commit) # to avoid running workflows too frequently and incurring costs pull_request: diff --git a/README.md b/README.md index 884bee1..e8215c8 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ import ( "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" - stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" ) func main() { @@ -56,16 +56,16 @@ func main() { log.Fatalf("error instantiating staking client: %s", err.Error()) } - req := &stakingpb.CreateWorkflowRequest{ - Workflow: &stakingpb.Workflow{ + req := &api.CreateWorkflowRequest{ + Workflow: &api.Workflow{ Action: "protocols/ethereum_kiln/networks/holesky/actions/stake", - StakingParameters: &stakingpb.Workflow_EthereumKilnStakingParameters{ - EthereumKilnStakingParameters: &stakingpb.EthereumKilnStakingParameters{ - Parameters: &stakingpb.EthereumKilnStakingParameters_StakeParameters{ - StakeParameters: &stakingpb.EthereumKilnStakeParameters{ + StakingParameters: &api.Workflow_EthereumKilnStakingParameters{ + EthereumKilnStakingParameters: &api.EthereumKilnStakingParameters{ + Parameters: &api.EthereumKilnStakingParameters_StakeParameters{ + StakeParameters: &api.EthereumKilnStakeParameters{ StakerAddress: "0xdb816889F2a7362EF242E5a717dfD5B38Ae849FE", IntegratorContractAddress: "0xA55416de5DE61A0AC1aa8970a280E04388B1dE4b", - Amount: &stakingpb.Amount{ + Amount: &api.Amount{ Value: "20", Currency: "ETH", }, diff --git a/client/orchestration/action.go b/client/orchestration/action.go index e80107e..f2e22f7 100644 --- a/client/orchestration/action.go +++ b/client/orchestration/action.go @@ -4,16 +4,16 @@ import ( "context" stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" - stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" "github.com/googleapis/gax-go/v2" ) // ListActions lists the Actions supported by Staking API. func (s *Client) ListActions( ctx context.Context, - req *stakingpb.ListActionsRequest, + req *api.ListActionsRequest, opts ...gax.CallOption, -) (*stakingpb.ListActionsResponse, error) { +) (*api.ListActionsResponse, error) { actions, err := s.client.ListActions(ctx, req, opts...) if err != nil { err := stakingerrors.FromError(err) diff --git a/client/orchestration/network.go b/client/orchestration/network.go index 4a4b67f..c8ec745 100644 --- a/client/orchestration/network.go +++ b/client/orchestration/network.go @@ -4,16 +4,16 @@ import ( "context" stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" - stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" "github.com/googleapis/gax-go/v2" ) // ListNetworks lists the Networks supported by Staking API. func (s *Client) ListNetworks( ctx context.Context, - req *stakingpb.ListNetworksRequest, + req *api.ListNetworksRequest, opts ...gax.CallOption, -) (*stakingpb.ListNetworksResponse, error) { +) (*api.ListNetworksResponse, error) { networks, err := s.client.ListNetworks(ctx, req, opts...) if err != nil { err := stakingerrors.FromError(err) diff --git a/client/orchestration/protocol.go b/client/orchestration/protocol.go index 3fdf058..f913c65 100644 --- a/client/orchestration/protocol.go +++ b/client/orchestration/protocol.go @@ -4,16 +4,16 @@ import ( "context" stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" - stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" "github.com/googleapis/gax-go/v2" ) // ListProtocols lists the Protocols supported by Staking API. func (s *Client) ListProtocols( ctx context.Context, - req *stakingpb.ListProtocolsRequest, + req *api.ListProtocolsRequest, opts ...gax.CallOption, -) (*stakingpb.ListProtocolsResponse, error) { +) (*api.ListProtocolsResponse, error) { protocols, err := s.client.ListProtocols(ctx, req, opts...) if err != nil { err := stakingerrors.FromError(err) diff --git a/client/orchestration/staking_target.go b/client/orchestration/staking_target.go index ee1bf3b..a153757 100644 --- a/client/orchestration/staking_target.go +++ b/client/orchestration/staking_target.go @@ -6,7 +6,7 @@ import ( stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" innerClient "github.com/coinbase/staking-client-library-go/gen/client/coinbase/staking/orchestration/v1" - stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" "github.com/googleapis/gax-go/v2" "google.golang.org/api/iterator" ) @@ -18,11 +18,11 @@ type StakingTargetIterator interface { // Next returns the next result. Its second return value is iterator.Done if there are no more // results. Once Next returns Done, all subsequent calls will return Done. - Next() (*stakingpb.StakingTarget, error) + Next() (*api.StakingTarget, error) // Response is the raw response for the current page. // Calling Next() or InternalFetch() updates this value. - Response() *stakingpb.ListStakingTargetsResponse + Response() *api.ListStakingTargetsResponse } // StakingTargetIteratorImpl is an implementation of StakingTargetIterator that unwraps correctly. @@ -37,7 +37,7 @@ func (n *StakingTargetIteratorImpl) PageInfo() *iterator.PageInfo { // Next returns the next result. Its second return value is iterator.Done if there are no more // results. Once Next returns Done, all subsequent calls will return Done. -func (n *StakingTargetIteratorImpl) Next() (*stakingpb.StakingTarget, error) { +func (n *StakingTargetIteratorImpl) Next() (*api.StakingTarget, error) { stakingTarget, err := n.iter.Next() if errors.Is(err, iterator.Done) || err == nil { return stakingTarget, err @@ -48,12 +48,12 @@ func (n *StakingTargetIteratorImpl) Next() (*stakingpb.StakingTarget, error) { // Response is the raw response for the current page. // Calling Next() or InternalFetch() updates this value. -func (n *StakingTargetIteratorImpl) Response() *stakingpb.ListStakingTargetsResponse { +func (n *StakingTargetIteratorImpl) Response() *api.ListStakingTargetsResponse { if n.iter.Response == nil { return nil } - response, ok := n.iter.Response.(*stakingpb.ListStakingTargetsResponse) + response, ok := n.iter.Response.(*api.ListStakingTargetsResponse) if !ok { return nil } @@ -64,7 +64,7 @@ func (n *StakingTargetIteratorImpl) Response() *stakingpb.ListStakingTargetsResp // ListStakingTargets lists the StakingTargets supported by Staking API. func (s *Client) ListStakingTargets( ctx context.Context, - req *stakingpb.ListStakingTargetsRequest, + req *api.ListStakingTargetsRequest, opts ...gax.CallOption, ) StakingTargetIterator { return &StakingTargetIteratorImpl{iter: s.client.ListStakingTargets(ctx, req, opts...)} diff --git a/client/orchestration/view_staking_context.go b/client/orchestration/view_staking_context.go index e6ec144..f1231da 100644 --- a/client/orchestration/view_staking_context.go +++ b/client/orchestration/view_staking_context.go @@ -4,16 +4,16 @@ import ( "context" stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" - stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" "github.com/googleapis/gax-go/v2" ) // ViewStakingContext helps view staking context information given a specific network address. func (s *Client) ViewStakingContext( ctx context.Context, - req *stakingpb.ViewStakingContextRequest, + req *api.ViewStakingContextRequest, opts ...gax.CallOption, -) (*stakingpb.ViewStakingContextResponse, error) { +) (*api.ViewStakingContextResponse, error) { response, err := s.client.ViewStakingContext(ctx, req, opts...) if err == nil { return response, nil diff --git a/client/orchestration/workflow.go b/client/orchestration/workflow.go index 0d1d9b7..4fd745c 100644 --- a/client/orchestration/workflow.go +++ b/client/orchestration/workflow.go @@ -6,7 +6,7 @@ import ( stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" innerClient "github.com/coinbase/staking-client-library-go/gen/client/coinbase/staking/orchestration/v1" - stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" "github.com/googleapis/gax-go/v2" "google.golang.org/api/iterator" ) @@ -14,9 +14,9 @@ import ( // CreateWorkflow starts a workflow with the given protocol specific parameters. func (s *Client) CreateWorkflow( ctx context.Context, - req *stakingpb.CreateWorkflowRequest, + req *api.CreateWorkflowRequest, opts ...gax.CallOption, -) (*stakingpb.Workflow, error) { +) (*api.Workflow, error) { wf, err := s.client.CreateWorkflow(ctx, req, opts...) if err == nil { return wf, nil @@ -31,9 +31,9 @@ func (s *Client) CreateWorkflow( // GetWorkflow get the current state of a workflow. func (s *Client) GetWorkflow( ctx context.Context, - req *stakingpb.GetWorkflowRequest, + req *api.GetWorkflowRequest, opts ...gax.CallOption, -) (*stakingpb.Workflow, error) { +) (*api.Workflow, error) { wf, err := s.client.GetWorkflow(ctx, req, opts...) if err == nil { return wf, nil @@ -52,11 +52,11 @@ type WorkflowIterator interface { // Next returns the next result. Its second return value is iterator.Done if there are no more // results. Once Next returns Done, all subsequent calls will return Done. - Next() (*stakingpb.Workflow, error) + Next() (*api.Workflow, error) // Response is the raw response for the current page. // Calling Next() or InternalFetch() updates this value. - Response() *stakingpb.ListWorkflowsResponse + Response() *api.ListWorkflowsResponse } // WorkflowIteratorImpl is an implementation of WorkflowIterator that unwraps correctly. @@ -71,7 +71,7 @@ func (n *WorkflowIteratorImpl) PageInfo() *iterator.PageInfo { // Next returns the next result. Its second return value is iterator.Done if there are no more // results. Once Next returns Done, all subsequent calls will return Done. -func (n *WorkflowIteratorImpl) Next() (*stakingpb.Workflow, error) { +func (n *WorkflowIteratorImpl) Next() (*api.Workflow, error) { workflow, err := n.iter.Next() if errors.Is(err, iterator.Done) || err == nil { return workflow, err @@ -82,12 +82,12 @@ func (n *WorkflowIteratorImpl) Next() (*stakingpb.Workflow, error) { // Response is the raw response for the current page. // Calling Next() or InternalFetch() updates this value. -func (n *WorkflowIteratorImpl) Response() *stakingpb.ListWorkflowsResponse { +func (n *WorkflowIteratorImpl) Response() *api.ListWorkflowsResponse { if n.iter.Response == nil { return nil } - response, ok := n.iter.Response.(*stakingpb.ListWorkflowsResponse) + response, ok := n.iter.Response.(*api.ListWorkflowsResponse) if !ok { return nil } @@ -98,7 +98,7 @@ func (n *WorkflowIteratorImpl) Response() *stakingpb.ListWorkflowsResponse { // ListWorkflows lists the Workflows supported by Staking API. func (s *Client) ListWorkflows( ctx context.Context, - req *stakingpb.ListWorkflowsRequest, + req *api.ListWorkflowsRequest, opts ...gax.CallOption, ) WorkflowIterator { return &WorkflowIteratorImpl{iter: s.client.ListWorkflows(ctx, req, opts...)} @@ -107,9 +107,9 @@ func (s *Client) ListWorkflows( // PerformWorkflowStep helps update workflow move to the next state by returning the signed tx back. func (s *Client) PerformWorkflowStep( ctx context.Context, - req *stakingpb.PerformWorkflowStepRequest, + req *api.PerformWorkflowStepRequest, opts ...gax.CallOption, -) (*stakingpb.Workflow, error) { +) (*api.Workflow, error) { wf, err := s.client.PerformWorkflowStep(ctx, req, opts...) if err == nil { return wf, nil @@ -121,11 +121,11 @@ func (s *Client) PerformWorkflowStep( return wf, sae } -func WorkflowFinished(workflow *stakingpb.Workflow) bool { - return workflow.State == stakingpb.Workflow_STATE_COMPLETED || - workflow.State == stakingpb.Workflow_STATE_FAILED +func WorkflowFinished(workflow *api.Workflow) bool { + return workflow.State == api.Workflow_STATE_COMPLETED || + workflow.State == api.Workflow_STATE_FAILED } -func WorkflowWaitingForExternalBroadcast(workflow *stakingpb.Workflow) bool { - return workflow.State == stakingpb.Workflow_STATE_WAITING_FOR_EXT_BROADCAST +func WorkflowWaitingForExternalBroadcast(workflow *api.Workflow) bool { + return workflow.State == api.Workflow_STATE_WAITING_FOR_EXT_BROADCAST } diff --git a/client/protocols/protocols.go b/client/protocols/protocols.go deleted file mode 100644 index 85d5c8b..0000000 --- a/client/protocols/protocols.go +++ /dev/null @@ -1,11 +0,0 @@ -package protocols - -import ( - rewardspb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" -) - -var ( - Ethereum = rewardspb.ProtocolResourceName{Protocol: "ethereum"}.String() - Solana = rewardspb.ProtocolResourceName{Protocol: "solana"}.String() - Cosmos = rewardspb.ProtocolResourceName{Protocol: "cosmos"}.String() -) diff --git a/client/rewards/protocols.go b/client/rewards/protocols.go new file mode 100644 index 0000000..da187db --- /dev/null +++ b/client/rewards/protocols.go @@ -0,0 +1,11 @@ +package rewards + +import ( + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" +) + +var ( + Ethereum = api.ProtocolResourceName{Protocol: "ethereum"}.String() + Solana = api.ProtocolResourceName{Protocol: "solana"}.String() + Cosmos = api.ProtocolResourceName{Protocol: "cosmos"}.String() +) diff --git a/client/rewards/reward.go b/client/rewards/reward.go index 170517d..3a7cf94 100644 --- a/client/rewards/reward.go +++ b/client/rewards/reward.go @@ -6,7 +6,7 @@ import ( stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" innerClient "github.com/coinbase/staking-client-library-go/gen/client/coinbase/staking/rewards/v1" - stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" "github.com/googleapis/gax-go/v2" "google.golang.org/api/iterator" ) @@ -18,11 +18,11 @@ type RewardIterator interface { // Next returns the next result. Its second return value is iterator.Done if there are no more // results. Once Next returns Done, all subsequent calls will return Done. - Next() (*stakingpb.Reward, error) + Next() (*api.Reward, error) // Response is the raw response for the current page. // Calling Next() or InternalFetch() updates this value. - Response() *stakingpb.ListRewardsResponse + Response() *api.ListRewardsResponse } // RewardIteratorImpl is an implementation of RewardIterator that unwraps correctly. @@ -37,7 +37,7 @@ func (n *RewardIteratorImpl) PageInfo() *iterator.PageInfo { // Next returns the next result. Its second return value is iterator.Done if there are no more // results. Once Next returns Done, all subsequent calls will return Done. -func (n *RewardIteratorImpl) Next() (*stakingpb.Reward, error) { +func (n *RewardIteratorImpl) Next() (*api.Reward, error) { reward, err := n.iter.Next() if errors.Is(err, iterator.Done) || err == nil { return reward, err @@ -48,12 +48,12 @@ func (n *RewardIteratorImpl) Next() (*stakingpb.Reward, error) { // Response is the raw response for the current page. // Calling Next() or InternalFetch() updates this value. -func (n *RewardIteratorImpl) Response() *stakingpb.ListRewardsResponse { +func (n *RewardIteratorImpl) Response() *api.ListRewardsResponse { if n.iter.Response == nil { return nil } - response, ok := n.iter.Response.(*stakingpb.ListRewardsResponse) + response, ok := n.iter.Response.(*api.ListRewardsResponse) if !ok { return nil } @@ -64,7 +64,7 @@ func (n *RewardIteratorImpl) Response() *stakingpb.ListRewardsResponse { // ListRewards helps list onchain rewards of an address for a specific protocol, with optional filters for time range, aggregation period, and more. func (s *Client) ListRewards( ctx context.Context, - req *stakingpb.ListRewardsRequest, + req *api.ListRewardsRequest, opts ...gax.CallOption, ) RewardIterator { return &RewardIteratorImpl{iter: s.client.ListRewards(ctx, req, opts...)} diff --git a/client/rewards/reward/reward_filter.go b/client/rewards/rewards_filter/reward_filter.go similarity index 99% rename from client/rewards/reward/reward_filter.go rename to client/rewards/rewards_filter/reward_filter.go index 35db8ee..9bab3ba 100644 --- a/client/rewards/reward/reward_filter.go +++ b/client/rewards/rewards_filter/reward_filter.go @@ -1,4 +1,4 @@ -package reward +package rewards_filter import ( "time" diff --git a/client/rewards/reward/reward_filter_test.go b/client/rewards/rewards_filter/reward_filter_test.go similarity index 65% rename from client/rewards/reward/reward_filter_test.go rename to client/rewards/rewards_filter/reward_filter_test.go index 2cb3e26..adb442b 100644 --- a/client/rewards/reward/reward_filter_test.go +++ b/client/rewards/rewards_filter/reward_filter_test.go @@ -1,11 +1,11 @@ -package reward_test +package rewards_filter_test import ( "fmt" "testing" "time" - "github.com/coinbase/staking-client-library-go/client/rewards/reward" + filter "github.com/coinbase/staking-client-library-go/client/rewards/rewards_filter" "github.com/stretchr/testify/assert" "github.com/test-go/testify/suite" ) @@ -19,56 +19,56 @@ type ListRewardsFilterSuite struct { } func (s *ListRewardsFilterSuite) TestListRewardsFilter_WithAddress() { - f := reward.WithAddress().Eq("abcd").String() + f := filter.WithAddress().Eq("abcd").String() assert.Equal(s.T(), "address = 'abcd'", f) } func (s *ListRewardsFilterSuite) TestListStakesFilter_WithAddress() { - f := reward.WithAddress().Eq("abcd").String() + f := filter.WithAddress().Eq("abcd").String() assert.Equal(s.T(), "address = 'abcd'", f) } func (s *ListRewardsFilterSuite) TestListStakesFilter_WithEpoch() { var f string - f = reward.WithEpoch().Eq(10).String() + f = filter.WithEpoch().Eq(10).String() assert.Equal(s.T(), "epoch = 10", f) - f = reward.WithAddress().Eq("abcd").And(reward.WithEpoch().Lt(10)).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithEpoch().Lt(10)).String() assert.Equal(s.T(), "(address = 'abcd' AND epoch < 10)", f) - f = reward.WithAddress().Eq("abcd").And(reward.WithEpoch().Lte(10)).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithEpoch().Lte(10)).String() assert.Equal(s.T(), "(address = 'abcd' AND epoch <= 10)", f) - f = reward.WithAddress().Eq("abcd").And(reward.WithEpoch().Gt(10)).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithEpoch().Gt(10)).String() assert.Equal(s.T(), "(address = 'abcd' AND epoch > 10)", f) - f = reward.WithAddress().Eq("abcd").And(reward.WithEpoch().Gte(10)).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithEpoch().Gte(10)).String() assert.Equal(s.T(), "(address = 'abcd' AND epoch >= 10)", f) - f = reward.WithAddress().Eq("abcd").And(reward.WithEpoch().Neq(10)).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithEpoch().Neq(10)).String() assert.Equal(s.T(), "(address = 'abcd' AND epoch != 10)", f) } func (s *ListRewardsFilterSuite) TestListStakesFilter_WithDate() { var f string - f = reward.WithDate().Eq("2020-01-01").String() + f = filter.WithDate().Eq("2020-01-01").String() assert.Equal(s.T(), "date = '2020-01-01'", f) - f = reward.WithAddress().Eq("abcd").And(reward.WithDate().Lt("2020-01-01")).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithDate().Lt("2020-01-01")).String() assert.Equal(s.T(), "(address = 'abcd' AND date < '2020-01-01')", f) - f = reward.WithAddress().Eq("abcd").And(reward.WithDate().Lte("2020-01-01")).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithDate().Lte("2020-01-01")).String() assert.Equal(s.T(), "(address = 'abcd' AND date <= '2020-01-01')", f) - f = reward.WithAddress().Eq("abcd").And(reward.WithDate().Gt("2020-01-01")).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithDate().Gt("2020-01-01")).String() assert.Equal(s.T(), "(address = 'abcd' AND date > '2020-01-01')", f) - f = reward.WithAddress().Eq("abcd").And(reward.WithDate().Gte("2020-01-01")).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithDate().Gte("2020-01-01")).String() assert.Equal(s.T(), "(address = 'abcd' AND date >= '2020-01-01')", f) - f = reward.WithAddress().Eq("abcd").And(reward.WithDate().Neq("2020-01-01")).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithDate().Neq("2020-01-01")).String() assert.Equal(s.T(), "(address = 'abcd' AND date != '2020-01-01')", f) } @@ -81,22 +81,22 @@ func (s *ListRewardsFilterSuite) TestListStakesFilter_WithPeriodEndTime() { nowRFC3339 := now.Format(time.RFC3339) fiveDaysAgoRFC3339 := fiveDaysAgo.Format(time.RFC3339) - f = reward.WithPeriodEndTime().Eq(fiveDaysAgo).String() + f = filter.WithPeriodEndTime().Eq(fiveDaysAgo).String() assert.Equal(s.T(), fmt.Sprintf("period_end_time = '%s'", fiveDaysAgoRFC3339), f) - f = reward.WithAddress().Eq("abcd").And(reward.WithPeriodEndTime().Lt(fiveDaysAgo)).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithPeriodEndTime().Lt(fiveDaysAgo)).String() assert.Equal(s.T(), fmt.Sprintf("(address = 'abcd' AND period_end_time < '%s')", fiveDaysAgoRFC3339), f) - f = reward.WithAddress().Eq("abcd").And(reward.WithPeriodEndTime().Lte(fiveDaysAgo)).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithPeriodEndTime().Lte(fiveDaysAgo)).String() assert.Equal(s.T(), fmt.Sprintf("(address = 'abcd' AND period_end_time <= '%s')", fiveDaysAgoRFC3339), f) - f = reward.WithAddress().Eq("abcd").And(reward.WithPeriodEndTime().Gt(fiveDaysAgo)).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithPeriodEndTime().Gt(fiveDaysAgo)).String() assert.Equal(s.T(), fmt.Sprintf("(address = 'abcd' AND period_end_time > '%s')", fiveDaysAgoRFC3339), f) - f = reward.WithAddress().Eq("abcd").And(reward.WithPeriodEndTime().Gte(fiveDaysAgo)).And(reward.WithPeriodEndTime().Lt(now)).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithPeriodEndTime().Gte(fiveDaysAgo)).And(filter.WithPeriodEndTime().Lt(now)).String() assert.Equal(s.T(), fmt.Sprintf("(address = 'abcd' AND period_end_time >= '%s' AND period_end_time < '%s')", fiveDaysAgoRFC3339, nowRFC3339), f) - f = reward.WithAddress().Eq("abcd").And(reward.WithPeriodEndTime().Gte(fiveDaysAgo).And(reward.WithPeriodEndTime().Lt(now))).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithPeriodEndTime().Gte(fiveDaysAgo).And(filter.WithPeriodEndTime().Lt(now))).String() assert.Equal(s.T(), fmt.Sprintf("(address = 'abcd' AND (period_end_time >= '%s' AND period_end_time < '%s'))", fiveDaysAgoRFC3339, nowRFC3339), f) } @@ -109,6 +109,6 @@ func (s *ListRewardsFilterSuite) TestListStakesFilter_MultipleDifferentCompariso nowRFC3339 := now.Format(time.RFC3339) fiveDaysAgoRFC3339 := fiveDaysAgo.Format(time.RFC3339) - f = reward.WithAddress().Eq("abcd").And(reward.WithPeriodEndTime().Gte(fiveDaysAgo)).And(reward.WithPeriodEndTime().Lt(now)).And(reward.WithEpoch().Eq(50)).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithPeriodEndTime().Gte(fiveDaysAgo)).And(filter.WithPeriodEndTime().Lt(now)).And(filter.WithEpoch().Eq(50)).String() assert.Equal(s.T(), fmt.Sprintf("(address = 'abcd' AND period_end_time >= '%s' AND period_end_time < '%s' AND epoch = 50)", fiveDaysAgoRFC3339, nowRFC3339), f) } diff --git a/client/rewards/stake.go b/client/rewards/stake.go index 73bdf8f..e03d337 100644 --- a/client/rewards/stake.go +++ b/client/rewards/stake.go @@ -6,7 +6,7 @@ import ( stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" innerClient "github.com/coinbase/staking-client-library-go/gen/client/coinbase/staking/rewards/v1" - stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" "github.com/googleapis/gax-go/v2" "google.golang.org/api/iterator" ) @@ -18,11 +18,11 @@ type StakeIterator interface { // Next returns the next result. Its second return value is iterator.Done if there are no more // results. Once Next returns Done, all subsequent calls will return Done. - Next() (*stakingpb.Stake, error) + Next() (*api.Stake, error) // Response is the raw response for the current page. // Calling Next() or InternalFetch() updates this value. - Response() *stakingpb.ListStakesResponse + Response() *api.ListStakesResponse } // StakeIteratorImpl is an implementation of StakeIterator that unwraps correctly. @@ -37,7 +37,7 @@ func (n *StakeIteratorImpl) PageInfo() *iterator.PageInfo { // Next returns the next result. Its second return value is iterator.Done if there are no more // results. Once Next returns Done, all subsequent calls will return Done. -func (n *StakeIteratorImpl) Next() (*stakingpb.Stake, error) { +func (n *StakeIteratorImpl) Next() (*api.Stake, error) { reward, err := n.iter.Next() if errors.Is(err, iterator.Done) || err == nil { return reward, err @@ -48,12 +48,12 @@ func (n *StakeIteratorImpl) Next() (*stakingpb.Stake, error) { // Response is the raw response for the current page. // Calling Next() or InternalFetch() updates this value. -func (n *StakeIteratorImpl) Response() *stakingpb.ListStakesResponse { +func (n *StakeIteratorImpl) Response() *api.ListStakesResponse { if n.iter.Response == nil { return nil } - response, ok := n.iter.Response.(*stakingpb.ListStakesResponse) + response, ok := n.iter.Response.(*api.ListStakesResponse) if !ok { return nil } @@ -64,7 +64,7 @@ func (n *StakeIteratorImpl) Response() *stakingpb.ListStakesResponse { // ListStakes list staking activities for a given protocol. func (s *Client) ListStakes( ctx context.Context, - req *stakingpb.ListStakesRequest, + req *api.ListStakesRequest, opts ...gax.CallOption, ) StakeIterator { return &StakeIteratorImpl{iter: s.client.ListStakes(ctx, req, opts...)} diff --git a/client/rewards/stakes/stake_filter.go b/client/rewards/stakes_filter/stake_filter.go similarity index 99% rename from client/rewards/stakes/stake_filter.go rename to client/rewards/stakes_filter/stake_filter.go index 6463225..e7e5c45 100644 --- a/client/rewards/stakes/stake_filter.go +++ b/client/rewards/stakes_filter/stake_filter.go @@ -1,4 +1,4 @@ -package stakes +package stakes_filter import ( "time" diff --git a/client/rewards/stakes/stake_filter_test.go b/client/rewards/stakes_filter/stake_filter_test.go similarity index 69% rename from client/rewards/stakes/stake_filter_test.go rename to client/rewards/stakes_filter/stake_filter_test.go index 86205d0..464f495 100644 --- a/client/rewards/stakes/stake_filter_test.go +++ b/client/rewards/stakes_filter/stake_filter_test.go @@ -1,10 +1,10 @@ -package stakes_test +package stakes_filter_test import ( "testing" "time" - "github.com/coinbase/staking-client-library-go/client/rewards/stakes" + filter "github.com/coinbase/staking-client-library-go/client/rewards/stakes_filter" "github.com/stretchr/testify/assert" "github.com/test-go/testify/suite" ) @@ -18,7 +18,7 @@ type ListStakesFilterSuite struct { } func (s *ListStakesFilterSuite) TestListStakesFilter_WithAddress() { - f := stakes.WithAddress().Eq("abcd").String() + f := filter.WithAddress().Eq("abcd").String() assert.Equal(s.T(), "address = 'abcd'", f) } @@ -27,22 +27,22 @@ func (s *ListStakesFilterSuite) TestListStakesFilter_EvaluationTime() { specificTime := time.Date(2024, time.February, 1, 0, 0, 1, 0, time.UTC) - f = stakes.WithEvaluationTime().Eq(specificTime).String() + f = filter.WithEvaluationTime().Eq(specificTime).String() assert.Equal(s.T(), "evaluation_time = '2024-02-01T00:00:01Z'", f) - f = stakes.WithAddress().Eq("abcd").And(stakes.WithEvaluationTime().Lt(specificTime)).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithEvaluationTime().Lt(specificTime)).String() assert.Equal(s.T(), "(address = 'abcd' AND evaluation_time < '2024-02-01T00:00:01Z')", f) - f = stakes.WithAddress().Eq("abcd").And(stakes.WithEvaluationTime().Lte(specificTime)).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithEvaluationTime().Lte(specificTime)).String() assert.Equal(s.T(), "(address = 'abcd' AND evaluation_time <= '2024-02-01T00:00:01Z')", f) - f = stakes.WithAddress().Eq("abcd").And(stakes.WithEvaluationTime().Gt(specificTime)).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithEvaluationTime().Gt(specificTime)).String() assert.Equal(s.T(), "(address = 'abcd' AND evaluation_time > '2024-02-01T00:00:01Z')", f) - f = stakes.WithAddress().Eq("abcd").And(stakes.WithEvaluationTime().Gte(specificTime)).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithEvaluationTime().Gte(specificTime)).String() assert.Equal(s.T(), "(address = 'abcd' AND evaluation_time >= '2024-02-01T00:00:01Z')", f) - f = stakes.WithAddress().Eq("abcd").And(stakes.WithEvaluationTime().Neq(specificTime)).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithEvaluationTime().Neq(specificTime)).String() assert.Equal(s.T(), "(address = 'abcd' AND evaluation_time != '2024-02-01T00:00:01Z')", f) } @@ -52,12 +52,12 @@ func (s *ListStakesFilterSuite) TestListStakesFilter_EvaluationTime_Double() { specificTime1 := time.Date(2024, time.February, 1, 0, 0, 1, 0, time.UTC) specificTime2 := time.Date(2024, time.March, 1, 0, 0, 1, 0, time.UTC) - f = stakes.WithEvaluationTime().Eq(specificTime1).And(stakes.WithEvaluationTime().Neq(specificTime2)).String() + f = filter.WithEvaluationTime().Eq(specificTime1).And(filter.WithEvaluationTime().Neq(specificTime2)).String() assert.Equal(s.T(), "(evaluation_time = '2024-02-01T00:00:01Z' AND evaluation_time != '2024-03-01T00:00:01Z')", f) - f = stakes.WithAddress().Eq("abcd").And(stakes.WithEvaluationTime().Gt(specificTime1)).And(stakes.WithEvaluationTime().Lt(specificTime2)).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithEvaluationTime().Gt(specificTime1)).And(filter.WithEvaluationTime().Lt(specificTime2)).String() assert.Equal(s.T(), "(address = 'abcd' AND evaluation_time > '2024-02-01T00:00:01Z' AND evaluation_time < '2024-03-01T00:00:01Z')", f) - f = stakes.WithAddress().Eq("abcd").And(stakes.WithEvaluationTime().Gte(specificTime1)).And(stakes.WithEvaluationTime().Lte(specificTime2)).String() + f = filter.WithAddress().Eq("abcd").And(filter.WithEvaluationTime().Gte(specificTime1)).And(filter.WithEvaluationTime().Lte(specificTime2)).String() assert.Equal(s.T(), "(address = 'abcd' AND evaluation_time >= '2024-02-01T00:00:01Z' AND evaluation_time <= '2024-03-01T00:00:01Z')", f) } diff --git a/examples/cosmos/list-rewards/main.go b/examples/cosmos/list-rewards/main.go index 51e06e3..7305ba9 100644 --- a/examples/cosmos/list-rewards/main.go +++ b/examples/cosmos/list-rewards/main.go @@ -11,8 +11,8 @@ import ( "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" - "github.com/coinbase/staking-client-library-go/client/protocols" - "github.com/coinbase/staking-client-library-go/client/rewards/reward" + "github.com/coinbase/staking-client-library-go/client/rewards" + filter "github.com/coinbase/staking-client-library-go/client/rewards/rewards_filter" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" "google.golang.org/api/iterator" ) @@ -45,11 +45,11 @@ func main() { // List all rewards for the given address, aggregated by day, for epochs that ended in the last 30 days. rewardsIter := stakingClient.Rewards.ListRewards(ctx, &api.ListRewardsRequest{ - Parent: protocols.Cosmos, + Parent: rewards.Cosmos, PageSize: 20, - Filter: reward.WithAddress().Eq(address). - And(reward.WithPeriodEndTime().Gte(time.Now().AddDate(0, 0, -20))). - And(reward.WithPeriodEndTime().Lt(time.Now())).String(), + Filter: filter.WithAddress().Eq(address). + And(filter.WithPeriodEndTime().Gte(time.Now().AddDate(0, 0, -20))). + And(filter.WithPeriodEndTime().Lt(time.Now())).String(), }) // Iterates through the rewards and print them. diff --git a/examples/cosmos/list-stakes/main.go b/examples/cosmos/list-stakes/main.go index a4148a7..8f9b883 100644 --- a/examples/cosmos/list-stakes/main.go +++ b/examples/cosmos/list-stakes/main.go @@ -10,8 +10,8 @@ import ( "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" - "github.com/coinbase/staking-client-library-go/client/protocols" - "github.com/coinbase/staking-client-library-go/client/rewards/stakes" + "github.com/coinbase/staking-client-library-go/client/rewards" + filter "github.com/coinbase/staking-client-library-go/client/rewards/stakes_filter" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" "google.golang.org/api/iterator" ) @@ -44,9 +44,9 @@ func main() { // List historical staking balances for the given address starting from the most recent after the given timestamp. stakesIter := stakingClient.Rewards.ListStakes(ctx, &api.ListStakesRequest{ - Parent: protocols.Cosmos, + Parent: rewards.Cosmos, PageSize: 20, - Filter: stakes.WithAddress().Eq(address).String(), + Filter: filter.WithAddress().Eq(address).String(), }) // Iterates through the stakes and print them. diff --git a/examples/ethereum/create-and-process-workflow/main.go b/examples/ethereum/create-and-process-workflow/main.go index 8e3cce7..fbf0fff 100644 --- a/examples/ethereum/create-and-process-workflow/main.go +++ b/examples/ethereum/create-and-process-workflow/main.go @@ -16,7 +16,7 @@ import ( stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" "github.com/coinbase/staking-client-library-go/client/options" "github.com/coinbase/staking-client-library-go/client/orchestration" - stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" "github.com/coinbase/staking-client-library-go/internal/signer" ) @@ -52,16 +52,16 @@ func main() { log.Fatalf("privateKey stakerAddress must be set") } - req := &stakingpb.CreateWorkflowRequest{ - Workflow: &stakingpb.Workflow{ + req := &api.CreateWorkflowRequest{ + Workflow: &api.Workflow{ Action: "protocols/ethereum_kiln/networks/holesky/actions/stake", - StakingParameters: &stakingpb.Workflow_EthereumKilnStakingParameters{ - EthereumKilnStakingParameters: &stakingpb.EthereumKilnStakingParameters{ - Parameters: &stakingpb.EthereumKilnStakingParameters_StakeParameters{ - StakeParameters: &stakingpb.EthereumKilnStakeParameters{ + StakingParameters: &api.Workflow_EthereumKilnStakingParameters{ + EthereumKilnStakingParameters: &api.EthereumKilnStakingParameters{ + Parameters: &api.EthereumKilnStakingParameters_StakeParameters{ + StakeParameters: &api.EthereumKilnStakeParameters{ StakerAddress: stakerAddress, IntegratorContractAddress: integratorContractAddress, - Amount: &stakingpb.Amount{ + Amount: &api.Amount{ Value: amount, Currency: currency, }, @@ -84,7 +84,7 @@ func main() { // Run loop until workflow reaches a terminal state for { // Get the latest workflow state - workflow, err = stakingClient.Orchestration.GetWorkflow(ctx, &stakingpb.GetWorkflowRequest{Name: workflow.Name}) + workflow, err = stakingClient.Orchestration.GetWorkflow(ctx, &api.GetWorkflowRequest{Name: workflow.Name}) if err != nil { log.Fatalf(fmt.Errorf("error getting workflow: %w", err).Error()) } @@ -115,7 +115,7 @@ func main() { } } -func printWorkflowProgressDetails(workflow *stakingpb.Workflow) { +func printWorkflowProgressDetails(workflow *api.Workflow) { if len(workflow.GetSteps()) <= 0 { fmt.Println("Waiting for steps to be created ...") time.Sleep(2 * time.Second) @@ -130,12 +130,12 @@ func printWorkflowProgressDetails(workflow *stakingpb.Workflow) { var stepDetails string switch step.GetOutput().(type) { - case *stakingpb.WorkflowStep_TxStepOutput: + case *api.WorkflowStep_TxStepOutput: stepDetails = fmt.Sprintf("state: %s tx hash: %s", step.GetTxStepOutput().GetState().String(), step.GetTxStepOutput().GetTxHash(), ) - case *stakingpb.WorkflowStep_WaitStepOutput: + case *api.WorkflowStep_WaitStepOutput: stepDetails = fmt.Sprintf("state: %s current: %d target: %d", step.GetWaitStepOutput().GetState().String(), step.GetWaitStepOutput().GetCurrent(), diff --git a/examples/ethereum/create-workflow/main.go b/examples/ethereum/create-workflow/main.go index 8e6faf9..216f365 100644 --- a/examples/ethereum/create-workflow/main.go +++ b/examples/ethereum/create-workflow/main.go @@ -11,7 +11,7 @@ import ( "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" - stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" ) func main() { @@ -29,16 +29,16 @@ func main() { log.Fatalf("error instantiating staking client: %s", err.Error()) } - req := &stakingpb.CreateWorkflowRequest{ - Workflow: &stakingpb.Workflow{ + req := &api.CreateWorkflowRequest{ + Workflow: &api.Workflow{ Action: "protocols/ethereum_kiln/networks/holesky/actions/stake", - StakingParameters: &stakingpb.Workflow_EthereumKilnStakingParameters{ - EthereumKilnStakingParameters: &stakingpb.EthereumKilnStakingParameters{ - Parameters: &stakingpb.EthereumKilnStakingParameters_StakeParameters{ - StakeParameters: &stakingpb.EthereumKilnStakeParameters{ + StakingParameters: &api.Workflow_EthereumKilnStakingParameters{ + EthereumKilnStakingParameters: &api.EthereumKilnStakingParameters{ + Parameters: &api.EthereumKilnStakingParameters_StakeParameters{ + StakeParameters: &api.EthereumKilnStakeParameters{ StakerAddress: "0xdb816889F2a7362EF242E5a717dfD5B38Ae849FE", IntegratorContractAddress: "0xA55416de5DE61A0AC1aa8970a280E04388B1dE4b", - Amount: &stakingpb.Amount{ + Amount: &api.Amount{ Value: "20", Currency: "ETH", }, diff --git a/examples/ethereum/list-rewards/main.go b/examples/ethereum/list-rewards/main.go index 0d495c0..c512d41 100644 --- a/examples/ethereum/list-rewards/main.go +++ b/examples/ethereum/list-rewards/main.go @@ -15,8 +15,8 @@ import ( "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" - "github.com/coinbase/staking-client-library-go/client/protocols" - "github.com/coinbase/staking-client-library-go/client/rewards/reward" + "github.com/coinbase/staking-client-library-go/client/rewards" + filter "github.com/coinbase/staking-client-library-go/client/rewards/rewards_filter" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" "google.golang.org/api/iterator" ) @@ -48,11 +48,11 @@ func main() { // Lists the rewards for the given address for the previous last 20 days, aggregated by day. rewardsIter := stakingClient.Rewards.ListRewards(ctx, &api.ListRewardsRequest{ - Parent: protocols.Ethereum, + Parent: rewards.Ethereum, PageSize: 200, - Filter: reward.WithAddress().Eq(address). - And(reward.WithPeriodEndTime().Gte(time.Now().AddDate(0, 0, -20))). - And(reward.WithPeriodEndTime().Lt(time.Now())).String(), + Filter: filter.WithAddress().Eq(address). + And(filter.WithPeriodEndTime().Gte(time.Now().AddDate(0, 0, -20))). + And(filter.WithPeriodEndTime().Lt(time.Now())).String(), }) // Iterates through the rewards and print them. diff --git a/examples/ethereum/list-stakes/main.go b/examples/ethereum/list-stakes/main.go index 325dee1..ba86a0b 100644 --- a/examples/ethereum/list-stakes/main.go +++ b/examples/ethereum/list-stakes/main.go @@ -14,8 +14,8 @@ import ( "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" - "github.com/coinbase/staking-client-library-go/client/protocols" - "github.com/coinbase/staking-client-library-go/client/rewards/stakes" + "github.com/coinbase/staking-client-library-go/client/rewards" + filter "github.com/coinbase/staking-client-library-go/client/rewards/stakes_filter" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" "google.golang.org/api/iterator" ) @@ -48,9 +48,9 @@ func main() { // List historical staking balances for the given address starting from the most recent after the given timestamp. stakesIter := stakingClient.Rewards.ListStakes(ctx, &api.ListStakesRequest{ - Parent: protocols.Ethereum, + Parent: rewards.Ethereum, PageSize: 200, - Filter: stakes.WithAddress().Eq(address).String(), + Filter: filter.WithAddress().Eq(address).String(), }) for { diff --git a/examples/hello-world/main.go b/examples/hello-world/main.go index 94903c6..53f123c 100644 --- a/examples/hello-world/main.go +++ b/examples/hello-world/main.go @@ -12,7 +12,7 @@ import ( "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" - stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" "google.golang.org/api/iterator" ) @@ -34,7 +34,7 @@ func main() { } // List all protocols. - protocols, err := stakingClient.Orchestration.ListProtocols(ctx, &stakingpb.ListProtocolsRequest{}) + protocols, err := stakingClient.Orchestration.ListProtocols(ctx, &api.ListProtocolsRequest{}) if err != nil { log.Fatalf("error listing protocols: %s", err.Error()) } @@ -46,7 +46,7 @@ func main() { protocol := "protocols/ethereum_kiln" // List all networks for a supported protocol. - networks, err := stakingClient.Orchestration.ListNetworks(ctx, &stakingpb.ListNetworksRequest{ + networks, err := stakingClient.Orchestration.ListNetworks(ctx, &api.ListNetworksRequest{ Parent: protocol, }) if err != nil { @@ -60,7 +60,7 @@ func main() { network := "protocols/ethereum_kiln/networks/holesky" // List all actions for a supported network. - actions, err := stakingClient.Orchestration.ListActions(ctx, &stakingpb.ListActionsRequest{ + actions, err := stakingClient.Orchestration.ListActions(ctx, &api.ListActionsRequest{ Parent: network, }) if err != nil { @@ -72,7 +72,7 @@ func main() { } // List all staking targets for a supported network. - iter := stakingClient.Orchestration.ListStakingTargets(ctx, &stakingpb.ListStakingTargetsRequest{ + iter := stakingClient.Orchestration.ListStakingTargets(ctx, &api.ListStakingTargetsRequest{ Parent: network, }) @@ -87,9 +87,9 @@ func main() { } switch stakingTarget.GetStakingTargets().(type) { - case *stakingpb.StakingTarget_Validator: + case *api.StakingTarget_Validator: log.Printf("got validator: %s", stakingTarget.GetValidator().String()) - case *stakingpb.StakingTarget_Contract: + case *api.StakingTarget_Contract: log.Printf("got contract: %s", stakingTarget.GetContract().String()) } diff --git a/examples/list-workflows/main.go b/examples/list-workflows/main.go index c9dca90..0e914f2 100644 --- a/examples/list-workflows/main.go +++ b/examples/list-workflows/main.go @@ -12,7 +12,7 @@ import ( "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" - stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" "google.golang.org/api/iterator" ) @@ -34,7 +34,7 @@ func main() { } // List all workflows for a given project. - workflowIter := stakingClient.Orchestration.ListWorkflows(ctx, &stakingpb.ListWorkflowsRequest{}) + workflowIter := stakingClient.Orchestration.ListWorkflows(ctx, &api.ListWorkflowsRequest{}) for { workflow, err := workflowIter.Next() diff --git a/examples/solana/create-workflow/main.go b/examples/solana/create-workflow/main.go index 7fd530a..e1dd815 100644 --- a/examples/solana/create-workflow/main.go +++ b/examples/solana/create-workflow/main.go @@ -16,7 +16,7 @@ import ( stakingerrors "github.com/coinbase/staking-client-library-go/client/errors" "github.com/coinbase/staking-client-library-go/client/options" "github.com/coinbase/staking-client-library-go/client/orchestration" - stakingpb "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" + api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1" "github.com/coinbase/staking-client-library-go/internal/signer" ) @@ -52,16 +52,16 @@ func main() { log.Fatalf("privateKey and walletAddress must be set") } - req := &stakingpb.CreateWorkflowRequest{ - Workflow: &stakingpb.Workflow{ + req := &api.CreateWorkflowRequest{ + Workflow: &api.Workflow{ Action: "protocols/solana/networks/testnet/actions/stake", - StakingParameters: &stakingpb.Workflow_SolanaStakingParameters{ - SolanaStakingParameters: &stakingpb.SolanaStakingParameters{ - Parameters: &stakingpb.SolanaStakingParameters_StakeParameters{ - StakeParameters: &stakingpb.SolanaStakeParameters{ + StakingParameters: &api.Workflow_SolanaStakingParameters{ + SolanaStakingParameters: &api.SolanaStakingParameters{ + Parameters: &api.SolanaStakingParameters_StakeParameters{ + StakeParameters: &api.SolanaStakeParameters{ WalletAddress: walletAddress, ValidatorAddress: validatorAddress, - Amount: &stakingpb.Amount{ + Amount: &api.Amount{ Value: amount, Currency: currency, }, @@ -84,7 +84,7 @@ func main() { // Run loop until workflow reaches a terminal state for { // Get the latest workflow state - workflow, err = stakingClient.Orchestration.GetWorkflow(ctx, &stakingpb.GetWorkflowRequest{Name: workflow.Name}) + workflow, err = stakingClient.Orchestration.GetWorkflow(ctx, &api.GetWorkflowRequest{Name: workflow.Name}) if err != nil { log.Fatalf(fmt.Errorf("error getting workflow: %w", err).Error()) } @@ -115,7 +115,7 @@ func main() { } } -func printWorkflowProgressDetails(workflow *stakingpb.Workflow) { +func printWorkflowProgressDetails(workflow *api.Workflow) { if len(workflow.GetSteps()) <= 0 { fmt.Println("Waiting for steps to be created ...") time.Sleep(2 * time.Second) @@ -130,12 +130,12 @@ func printWorkflowProgressDetails(workflow *stakingpb.Workflow) { var stepDetails string switch step.GetOutput().(type) { - case *stakingpb.WorkflowStep_TxStepOutput: + case *api.WorkflowStep_TxStepOutput: stepDetails = fmt.Sprintf("state: %s tx hash: %s", step.GetTxStepOutput().GetState().String(), step.GetTxStepOutput().GetTxHash(), ) - case *stakingpb.WorkflowStep_WaitStepOutput: + case *api.WorkflowStep_WaitStepOutput: stepDetails = fmt.Sprintf("state: %s current: %d target: %d", step.GetWaitStepOutput().GetState().String(), step.GetWaitStepOutput().GetCurrent(), diff --git a/examples/solana/list-rewards/main.go b/examples/solana/list-rewards/main.go index c92f920..205e2bc 100644 --- a/examples/solana/list-rewards/main.go +++ b/examples/solana/list-rewards/main.go @@ -16,8 +16,8 @@ import ( "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" - "github.com/coinbase/staking-client-library-go/client/protocols" - "github.com/coinbase/staking-client-library-go/client/rewards/reward" + "github.com/coinbase/staking-client-library-go/client/rewards" + filter "github.com/coinbase/staking-client-library-go/client/rewards/rewards_filter" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" "google.golang.org/api/iterator" ) @@ -50,11 +50,11 @@ func main() { // List all rewards for the given address, aggregated by epoch, for epochs that ended in the last 30 days. rewardsIter := stakingClient.Rewards.ListRewards(ctx, &api.ListRewardsRequest{ - Parent: protocols.Solana, + Parent: rewards.Solana, PageSize: 20, - Filter: reward.WithAddress().Eq(address). - And(reward.WithPeriodEndTime().Gte(time.Now().AddDate(0, 0, -30))). - And(reward.WithPeriodEndTime().Lt(time.Now())).String(), + Filter: filter.WithAddress().Eq(address). + And(filter.WithPeriodEndTime().Gte(time.Now().AddDate(0, 0, -30))). + And(filter.WithPeriodEndTime().Lt(time.Now())).String(), }) // Iterates through the rewards and print them. From a043ba276b6bc39e1ffe9fd8d540a191b3fa7d32 Mon Sep 17 00:00:00 2001 From: Shane O'Brien Date: Wed, 24 Apr 2024 15:00:57 -0400 Subject: [PATCH 13/16] Adjust example comments --- examples/cosmos/list-rewards/main.go | 2 +- examples/cosmos/list-stakes/main.go | 2 +- examples/ethereum/list-rewards/main.go | 2 +- examples/ethereum/list-stakes/main.go | 2 +- examples/solana/list-rewards/main.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/cosmos/list-rewards/main.go b/examples/cosmos/list-rewards/main.go index 7305ba9..9aa210a 100644 --- a/examples/cosmos/list-rewards/main.go +++ b/examples/cosmos/list-rewards/main.go @@ -18,7 +18,7 @@ import ( ) /* - * Run the code with 'go run main.go' to view the rewards for Coinbase Cloud's public validator. + * Run the code with 'go run examples/cosmos/list-rewards/main.go' to view the rewards for Coinbase Cloud's public validator. * Or, to view rewards for any arbitrary validator, simply replace the address below with any validator on the Cosmos blockchain. */ diff --git a/examples/cosmos/list-stakes/main.go b/examples/cosmos/list-stakes/main.go index 8f9b883..82df0b9 100644 --- a/examples/cosmos/list-stakes/main.go +++ b/examples/cosmos/list-stakes/main.go @@ -17,7 +17,7 @@ import ( ) /* - * Run the code with 'go run main.go' to view the balances for Coinbase Cloud's public validator. + * Run the code with 'go run examples/cosmos/list-stakes/main.go' to view the balances for Coinbase Cloud's public validator. * Or, to view balances for any arbitrary validator, simply replace the address below with any validator on the Cosmos blockchain. */ diff --git a/examples/ethereum/list-rewards/main.go b/examples/ethereum/list-rewards/main.go index c512d41..97cec97 100644 --- a/examples/ethereum/list-rewards/main.go +++ b/examples/ethereum/list-rewards/main.go @@ -22,7 +22,7 @@ import ( ) /* - * Run the code with 'go run main.go' to view the rewards for the first validator on the Ethereum network. + * Run the code with 'go run examples/ethereum/list-rewards/main.go' to view the rewards for the first validator on the Ethereum network. * Or, to view rewards for any arbitrary validator, simply replace the public key below. */ diff --git a/examples/ethereum/list-stakes/main.go b/examples/ethereum/list-stakes/main.go index ba86a0b..ec1489b 100644 --- a/examples/ethereum/list-stakes/main.go +++ b/examples/ethereum/list-stakes/main.go @@ -21,7 +21,7 @@ import ( ) /* - * Run the code with 'go run main.go' to view the balances for the first validator on the Ethereum network. + * Run the code with 'go run examples/ethereum/list-stakes/main.go' to view the balances for the first validator on the Ethereum network. * Or, to view balances for any arbitrary validator, simply replace the public key below. */ diff --git a/examples/solana/list-rewards/main.go b/examples/solana/list-rewards/main.go index 205e2bc..109894b 100644 --- a/examples/solana/list-rewards/main.go +++ b/examples/solana/list-rewards/main.go @@ -23,7 +23,7 @@ import ( ) /* - * Run the code with 'go run main.go' to view the rewards for Coinbase Cloud's public validator. + * Run the code with 'go run examples/solana/list-rewards/main.go' to view the rewards for Coinbase Cloud's public validator. * Or, to view rewards for any arbitrary validator, simply replace the address below with any validator on the Solana blockchain. */ From f9d83c4ef8e11b70b110b5cab3a15adfa5bb9554 Mon Sep 17 00:00:00 2001 From: Shane O'Brien Date: Wed, 24 Apr 2024 15:09:58 -0400 Subject: [PATCH 14/16] Update printing and README --- README.md | 158 ++++++++++++------------- examples/cosmos/list-rewards/main.go | 12 +- examples/cosmos/list-stakes/main.go | 12 +- examples/ethereum/list-rewards/main.go | 14 ++- examples/ethereum/list-stakes/main.go | 14 ++- examples/solana/list-rewards/main.go | 12 +- 6 files changed, 129 insertions(+), 93 deletions(-) diff --git a/README.md b/README.md index e8215c8..3361aa4 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,7 @@ This code sample returns rewards for an Ethereum validator address. View the ful package main import ( + "bytes" "context" "encoding/json" "errors" @@ -115,14 +116,19 @@ import ( "log" "time" - "github.com/coinbase/staking-client-library-go/client/protocols" - "google.golang.org/api/iterator" - "github.com/coinbase/staking-client-library-go/auth" "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" - "github.com/coinbase/staking-client-library-go/client/rewards/reward" + "github.com/coinbase/staking-client-library-go/client/rewards" + filter "github.com/coinbase/staking-client-library-go/client/rewards/rewards_filter" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" + "google.golang.org/api/iterator" + "google.golang.org/protobuf/encoding/protojson" +) + +const ( + // https://beaconcha.in/validator/1 + address = "0xa1d1ad0714035353258038e964ae9675dc0252ee22cea896825c01458e1807bfad2f9969338798548d9858a571f7425c" ) func main() { @@ -134,7 +140,7 @@ func main() { log.Fatalf("error loading API key: %s", err.Error()) } - // Creates the Coinbase Staking API client. + // Creates the Coinbase Staking API client stakingClient, err := client.New(ctx, options.WithAPIKey(apiKey)) if err != nil { log.Fatalf("error instantiating staking client: %s", err.Error()) @@ -142,14 +148,14 @@ func main() { // Lists the rewards for the given address for the previous last 20 days, aggregated by day. rewardsIter := stakingClient.Rewards.ListRewards(ctx, &api.ListRewardsRequest{ - Parent: protocols.Ethereum, + Parent: rewards.Ethereum, PageSize: 200, - Filter: reward.WithAddress().Eq("0xac53512c39d0081ca4437c285305eb423f474e6153693c12fbba4a3df78bcaa3422b31d800c5bea71c1b017168a60474"). - And(reward.WithPeriodEndTime().Gte(time.Now().AddDate(0, 0, -20))). - And(reward.WithPeriodEndTime().Lt(time.Now())).String(), + Filter: filter.WithAddress().Eq(address). + And(filter.WithPeriodEndTime().Gte(time.Now().AddDate(0, 0, -20))). + And(filter.WithPeriodEndTime().Lt(time.Now())).String(), }) - // Iterates through the rewards and print them. + // Iterates through the rewards and pretty print them. for { reward, err := rewardsIter.Next() if errors.Is(err, iterator.Done) { @@ -160,12 +166,18 @@ func main() { log.Fatalf("error listing rewards: %s", err.Error()) } - marshaled, err := json.MarshalIndent(reward, "", " ") + marshaled, err := protojson.Marshal(reward) if err != nil { log.Fatalf("error marshaling reward: %s", err.Error()) } - fmt.Printf(string(marshaled)) + var prettyJSON bytes.Buffer + if err := json.Indent(&prettyJSON, marshaled, "", "\t"); err != nil { + log.Fatalf("JSON parse error: %s", err) + return + } + + fmt.Println(prettyJSON.String()) } } ``` @@ -177,75 +189,59 @@ func main() { ```json { - "address": "0xac53512c39d0081ca4437c285305eb423f474e6153693c12fbba4a3df78bcaa3422b31d800c5bea71c1b017168a60474", - "period_identifier": { - "date": "2024-03-26" - }, - "aggregation_unit": 2, - "period_start_time": { - "seconds": 1711411200 - }, - "period_end_time": { - "seconds": 1711497599 - }, - "total_earned_native_unit": { - "amount": "0.00211503", - "exp": "18", - "ticker": "ETH", - "raw_numeric": "2115030000000000" - }, - "total_earned_usd": [ - { - "source": 1, - "conversion_time": { - "seconds": 1711498140 - }, - "amount": { - "amount": "7.58", - "exp": "2", - "ticker": "USD", - "raw_numeric": "758" - }, - "conversion_price": "3582.979980" - } - ], - "protocol": "ethereum" - } - { - "address": "0xac53512c39d0081ca4437c285305eb423f474e6153693c12fbba4a3df78bcaa3422b31d800c5bea71c1b017168a60474", - "period_identifier": { - "date": "2024-03-27" - }, - "aggregation_unit": 2, - "period_start_time": { - "seconds": 1711497600 - }, - "period_end_time": { - "seconds": 1711583999 - }, - "total_earned_native_unit": { - "amount": "0.002034193", - "exp": "18", - "ticker": "ETH", - "raw_numeric": "2034193000000000" - }, - "total_earned_usd": [ - { - "source": 1, - "conversion_time": { - "seconds": 1711584540 - }, - "amount": { - "amount": "7.13", - "exp": "2", - "ticker": "USD", - "raw_numeric": "713" - }, - "conversion_price": "3504.580078" - } - ], - "protocol": "ethereum" - } + "address": "0xa1d1ad0714035353258038e964ae9675dc0252ee22cea896825c01458e1807bfad2f9969338798548d9858a571f7425c", + "date": "2024-04-20", + "aggregationUnit": "DAY", + "periodStartTime": "2024-04-20T00:00:00Z", + "periodEndTime": "2024-04-20T23:59:59Z", + "totalEarnedNativeUnit": { + "amount": "0.002118354", + "exp": "18", + "ticker": "ETH", + "rawNumeric": "2118354000000000" + }, + "totalEarnedUsd": [ + { + "source": "COINBASE_EXCHANGE", + "conversionTime": "2024-04-21T00:09:00Z", + "amount": { + "amount": "6.67", + "exp": "2", + "ticker": "USD", + "rawNumeric": "667" + }, + "conversionPrice": "3145.550049" + } + ], + "protocol": "ethereum" + } + { + "address": "0xa1d1ad0714035353258038e964ae9675dc0252ee22cea896825c01458e1807bfad2f9969338798548d9858a571f7425c", + "date": "2024-04-21", + "aggregationUnit": "DAY", + "periodStartTime": "2024-04-21T00:00:00Z", + "periodEndTime": "2024-04-21T23:59:59Z", + "totalEarnedNativeUnit": { + "amount": "0.00211564", + "exp": "18", + "ticker": "ETH", + "rawNumeric": "2115640000000000" + }, + "totalEarnedUsd": [ + { + "source": "COINBASE_EXCHANGE", + "conversionTime": "2024-04-22T00:09:00Z", + "amount": { + "amount": "6.68", + "exp": "2", + "ticker": "USD", + "rawNumeric": "668" + }, + "conversionPrice": "3155.449951" + } + ], + "protocol": "ethereum" + } ``` diff --git a/examples/cosmos/list-rewards/main.go b/examples/cosmos/list-rewards/main.go index 9aa210a..a5b3bfa 100644 --- a/examples/cosmos/list-rewards/main.go +++ b/examples/cosmos/list-rewards/main.go @@ -1,6 +1,7 @@ package main import ( + "bytes" "context" "encoding/json" "errors" @@ -15,6 +16,7 @@ import ( filter "github.com/coinbase/staking-client-library-go/client/rewards/rewards_filter" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" "google.golang.org/api/iterator" + "google.golang.org/protobuf/encoding/protojson" ) /* @@ -63,11 +65,17 @@ func main() { log.Fatalf("error listing rewards: %s", err.Error()) } - marshaled, err := json.MarshalIndent(reward, "", " ") + marshaled, err := protojson.Marshal(reward) if err != nil { log.Fatalf("error marshaling reward: %s", err.Error()) } - fmt.Println(string(marshaled)) + var prettyJSON bytes.Buffer + if err := json.Indent(&prettyJSON, marshaled, "", "\t"); err != nil { + log.Fatalf("JSON parse error: %s", err) + return + } + + fmt.Println(prettyJSON.String()) } } diff --git a/examples/cosmos/list-stakes/main.go b/examples/cosmos/list-stakes/main.go index 82df0b9..82b28ef 100644 --- a/examples/cosmos/list-stakes/main.go +++ b/examples/cosmos/list-stakes/main.go @@ -1,6 +1,7 @@ package main import ( + "bytes" "context" "encoding/json" "errors" @@ -14,6 +15,7 @@ import ( filter "github.com/coinbase/staking-client-library-go/client/rewards/stakes_filter" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" "google.golang.org/api/iterator" + "google.golang.org/protobuf/encoding/protojson" ) /* @@ -60,11 +62,17 @@ func main() { log.Fatalf("error listing stakes: %s", err.Error()) } - marshaled, err := json.MarshalIndent(reward, "", " ") + marshaled, err := protojson.Marshal(reward) if err != nil { log.Fatalf("error marshaling reward: %s", err.Error()) } - fmt.Println(string(marshaled)) + var prettyJSON bytes.Buffer + if err := json.Indent(&prettyJSON, marshaled, "", "\t"); err != nil { + log.Fatalf("JSON parse error: %s", err) + return + } + + fmt.Println(prettyJSON.String()) } } diff --git a/examples/ethereum/list-rewards/main.go b/examples/ethereum/list-rewards/main.go index 97cec97..7a15224 100644 --- a/examples/ethereum/list-rewards/main.go +++ b/examples/ethereum/list-rewards/main.go @@ -5,6 +5,7 @@ package main import ( + "bytes" "context" "encoding/json" "errors" @@ -19,6 +20,7 @@ import ( filter "github.com/coinbase/staking-client-library-go/client/rewards/rewards_filter" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" "google.golang.org/api/iterator" + "google.golang.org/protobuf/encoding/protojson" ) /* @@ -55,7 +57,7 @@ func main() { And(filter.WithPeriodEndTime().Lt(time.Now())).String(), }) - // Iterates through the rewards and print them. + // Iterates through the rewards and pretty print them. for { reward, err := rewardsIter.Next() if errors.Is(err, iterator.Done) { @@ -66,11 +68,17 @@ func main() { log.Fatalf("error listing rewards: %s", err.Error()) } - marshaled, err := json.MarshalIndent(reward, "", " ") + marshaled, err := protojson.Marshal(reward) if err != nil { log.Fatalf("error marshaling reward: %s", err.Error()) } - fmt.Println(string(marshaled)) + var prettyJSON bytes.Buffer + if err := json.Indent(&prettyJSON, marshaled, "", "\t"); err != nil { + log.Fatalf("JSON parse error: %s", err) + return + } + + fmt.Println(prettyJSON.String()) } } diff --git a/examples/ethereum/list-stakes/main.go b/examples/ethereum/list-stakes/main.go index ec1489b..111f122 100644 --- a/examples/ethereum/list-stakes/main.go +++ b/examples/ethereum/list-stakes/main.go @@ -5,6 +5,7 @@ package main import ( + "bytes" "context" "encoding/json" "errors" @@ -18,6 +19,7 @@ import ( filter "github.com/coinbase/staking-client-library-go/client/rewards/stakes_filter" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" "google.golang.org/api/iterator" + "google.golang.org/protobuf/encoding/protojson" ) /* @@ -63,11 +65,17 @@ func main() { log.Fatalf("error listing stakes: %s", err.Error()) } - marshaled, err := json.MarshalIndent(stake, "", " ") + marshaled, err := protojson.Marshal(reward) if err != nil { - log.Fatalf("error marshaling stake balance: %s", err.Error()) + log.Fatalf("error marshaling reward: %s", err.Error()) } - fmt.Println(string(marshaled)) + var prettyJSON bytes.Buffer + if err := json.Indent(&prettyJSON, marshaled, "", "\t"); err != nil { + log.Fatalf("JSON parse error: %s", err) + return + } + + fmt.Println(prettyJSON.String()) } } diff --git a/examples/solana/list-rewards/main.go b/examples/solana/list-rewards/main.go index 109894b..b9ee381 100644 --- a/examples/solana/list-rewards/main.go +++ b/examples/solana/list-rewards/main.go @@ -6,6 +6,7 @@ package main import ( + "bytes" "context" "encoding/json" "errors" @@ -20,6 +21,7 @@ import ( filter "github.com/coinbase/staking-client-library-go/client/rewards/rewards_filter" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" "google.golang.org/api/iterator" + "google.golang.org/protobuf/encoding/protojson" ) /* @@ -68,11 +70,17 @@ func main() { log.Fatalf("error listing rewards: %s", err.Error()) } - marshaled, err := json.MarshalIndent(reward, "", " ") + marshaled, err := protojson.Marshal(reward) if err != nil { log.Fatalf("error marshaling reward: %s", err.Error()) } - fmt.Println(string(marshaled)) + var prettyJSON bytes.Buffer + if err := json.Indent(&prettyJSON, marshaled, "", "\t"); err != nil { + log.Fatalf("JSON parse error: %s", err) + return + } + + fmt.Println(prettyJSON.String()) } } From b5ebdb13f10776cf4b20569b0ab462ce8f261dcb Mon Sep 17 00:00:00 2001 From: Shane O'Brien Date: Wed, 24 Apr 2024 15:33:05 -0400 Subject: [PATCH 15/16] Fix linting errors --- .github/workflows/lint.yaml | 3 +-- .github/workflows/test.yaml | 2 -- examples/cosmos/list-stakes/main.go | 4 ++-- examples/ethereum/list-stakes/main.go | 2 +- go.mod | 2 -- 5 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 0db24a6..610eff2 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -15,8 +15,6 @@ jobs: lint: name: lint runs-on: ubuntu-latest - # This prevents the workflow from running on PRs from forks - if: github.event.pull_request.head.repo.full_name == github.repository steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 @@ -27,3 +25,4 @@ jobs: uses: golangci/golangci-lint-action@v4 with: version: v1.54.2 + args: --timeout=3m diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 3b97643..4c06f2f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -14,8 +14,6 @@ permissions: jobs: test: runs-on: ubuntu-latest - # This prevents the workflow from running on PRs from forks - if: github.event.pull_request.head.repo.full_name == github.repository steps: - uses: actions/checkout@v4 diff --git a/examples/cosmos/list-stakes/main.go b/examples/cosmos/list-stakes/main.go index 82b28ef..c786d9f 100644 --- a/examples/cosmos/list-stakes/main.go +++ b/examples/cosmos/list-stakes/main.go @@ -53,7 +53,7 @@ func main() { // Iterates through the stakes and print them. for { - reward, err := stakesIter.Next() + stake, err := stakesIter.Next() if errors.Is(err, iterator.Done) { break } @@ -62,7 +62,7 @@ func main() { log.Fatalf("error listing stakes: %s", err.Error()) } - marshaled, err := protojson.Marshal(reward) + marshaled, err := protojson.Marshal(stake) if err != nil { log.Fatalf("error marshaling reward: %s", err.Error()) } diff --git a/examples/ethereum/list-stakes/main.go b/examples/ethereum/list-stakes/main.go index 111f122..7d47291 100644 --- a/examples/ethereum/list-stakes/main.go +++ b/examples/ethereum/list-stakes/main.go @@ -65,7 +65,7 @@ func main() { log.Fatalf("error listing stakes: %s", err.Error()) } - marshaled, err := protojson.Marshal(reward) + marshaled, err := protojson.Marshal(stake) if err != nil { log.Fatalf("error marshaling reward: %s", err.Error()) } diff --git a/go.mod b/go.mod index cf5adbd..2d66ff3 100644 --- a/go.mod +++ b/go.mod @@ -2,8 +2,6 @@ module github.com/coinbase/staking-client-library-go go 1.21 -toolchain go1.21.7 - require ( github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/ethereum/go-ethereum v1.12.0 From da1b98b67603be2fb7bdc709f29399686b8f1ea9 Mon Sep 17 00:00:00 2001 From: Shane O'Brien Date: Wed, 24 Apr 2024 15:40:41 -0400 Subject: [PATCH 16/16] Fix package names, protojson pretty print --- README.md | 11 +++-------- .../reward_filter.go | 2 +- .../reward_filter_test.go | 4 ++-- .../stake_filter.go | 2 +- .../stake_filter_test.go | 4 ++-- examples/cosmos/list-rewards/main.go | 15 ++++----------- examples/cosmos/list-stakes/main.go | 15 ++++----------- examples/ethereum/list-rewards/main.go | 15 ++++----------- examples/ethereum/list-stakes/main.go | 15 ++++----------- examples/solana/list-rewards/main.go | 15 ++++----------- 10 files changed, 29 insertions(+), 69 deletions(-) rename client/rewards/{rewards_filter => rewardsfilter}/reward_filter.go (99%) rename client/rewards/{rewards_filter => rewardsfilter}/reward_filter_test.go (98%) rename client/rewards/{stakes_filter => stakesfilter}/stake_filter.go (99%) rename client/rewards/{stakes_filter => stakesfilter}/stake_filter_test.go (98%) diff --git a/README.md b/README.md index 3361aa4..87323ff 100644 --- a/README.md +++ b/README.md @@ -166,18 +166,13 @@ func main() { log.Fatalf("error listing rewards: %s", err.Error()) } - marshaled, err := protojson.Marshal(reward) + marshaler := protojson.MarshalOptions{Indent: "\t"} + marshaled, err := marshaler.Marshal(reward) if err != nil { log.Fatalf("error marshaling reward: %s", err.Error()) } - var prettyJSON bytes.Buffer - if err := json.Indent(&prettyJSON, marshaled, "", "\t"); err != nil { - log.Fatalf("JSON parse error: %s", err) - return - } - - fmt.Println(prettyJSON.String()) + fmt.Println(string(marshaled)) } } ``` diff --git a/client/rewards/rewards_filter/reward_filter.go b/client/rewards/rewardsfilter/reward_filter.go similarity index 99% rename from client/rewards/rewards_filter/reward_filter.go rename to client/rewards/rewardsfilter/reward_filter.go index 9bab3ba..800b9a9 100644 --- a/client/rewards/rewards_filter/reward_filter.go +++ b/client/rewards/rewardsfilter/reward_filter.go @@ -1,4 +1,4 @@ -package rewards_filter +package rewardsfilter import ( "time" diff --git a/client/rewards/rewards_filter/reward_filter_test.go b/client/rewards/rewardsfilter/reward_filter_test.go similarity index 98% rename from client/rewards/rewards_filter/reward_filter_test.go rename to client/rewards/rewardsfilter/reward_filter_test.go index adb442b..c76eb49 100644 --- a/client/rewards/rewards_filter/reward_filter_test.go +++ b/client/rewards/rewardsfilter/reward_filter_test.go @@ -1,11 +1,11 @@ -package rewards_filter_test +package rewardsfilter_test import ( "fmt" "testing" "time" - filter "github.com/coinbase/staking-client-library-go/client/rewards/rewards_filter" + filter "github.com/coinbase/staking-client-library-go/client/rewards/rewardsfilter" "github.com/stretchr/testify/assert" "github.com/test-go/testify/suite" ) diff --git a/client/rewards/stakes_filter/stake_filter.go b/client/rewards/stakesfilter/stake_filter.go similarity index 99% rename from client/rewards/stakes_filter/stake_filter.go rename to client/rewards/stakesfilter/stake_filter.go index e7e5c45..59338af 100644 --- a/client/rewards/stakes_filter/stake_filter.go +++ b/client/rewards/stakesfilter/stake_filter.go @@ -1,4 +1,4 @@ -package stakes_filter +package stakesfilter import ( "time" diff --git a/client/rewards/stakes_filter/stake_filter_test.go b/client/rewards/stakesfilter/stake_filter_test.go similarity index 98% rename from client/rewards/stakes_filter/stake_filter_test.go rename to client/rewards/stakesfilter/stake_filter_test.go index 464f495..4ab9674 100644 --- a/client/rewards/stakes_filter/stake_filter_test.go +++ b/client/rewards/stakesfilter/stake_filter_test.go @@ -1,10 +1,10 @@ -package stakes_filter_test +package stakesfilter_test import ( "testing" "time" - filter "github.com/coinbase/staking-client-library-go/client/rewards/stakes_filter" + filter "github.com/coinbase/staking-client-library-go/client/rewards/stakesfilter" "github.com/stretchr/testify/assert" "github.com/test-go/testify/suite" ) diff --git a/examples/cosmos/list-rewards/main.go b/examples/cosmos/list-rewards/main.go index a5b3bfa..247d195 100644 --- a/examples/cosmos/list-rewards/main.go +++ b/examples/cosmos/list-rewards/main.go @@ -1,9 +1,7 @@ package main import ( - "bytes" "context" - "encoding/json" "errors" "fmt" "log" @@ -13,7 +11,7 @@ import ( "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" "github.com/coinbase/staking-client-library-go/client/rewards" - filter "github.com/coinbase/staking-client-library-go/client/rewards/rewards_filter" + filter "github.com/coinbase/staking-client-library-go/client/rewards/rewardsfilter" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" "google.golang.org/api/iterator" "google.golang.org/protobuf/encoding/protojson" @@ -65,17 +63,12 @@ func main() { log.Fatalf("error listing rewards: %s", err.Error()) } - marshaled, err := protojson.Marshal(reward) + marshaler := protojson.MarshalOptions{Indent: "\t"} + marshaled, err := marshaler.Marshal(reward) if err != nil { log.Fatalf("error marshaling reward: %s", err.Error()) } - var prettyJSON bytes.Buffer - if err := json.Indent(&prettyJSON, marshaled, "", "\t"); err != nil { - log.Fatalf("JSON parse error: %s", err) - return - } - - fmt.Println(prettyJSON.String()) + fmt.Println(string(marshaled)) } } diff --git a/examples/cosmos/list-stakes/main.go b/examples/cosmos/list-stakes/main.go index c786d9f..6f3d76e 100644 --- a/examples/cosmos/list-stakes/main.go +++ b/examples/cosmos/list-stakes/main.go @@ -1,9 +1,7 @@ package main import ( - "bytes" "context" - "encoding/json" "errors" "fmt" "log" @@ -12,7 +10,7 @@ import ( "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" "github.com/coinbase/staking-client-library-go/client/rewards" - filter "github.com/coinbase/staking-client-library-go/client/rewards/stakes_filter" + filter "github.com/coinbase/staking-client-library-go/client/rewards/stakesfilter" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" "google.golang.org/api/iterator" "google.golang.org/protobuf/encoding/protojson" @@ -62,17 +60,12 @@ func main() { log.Fatalf("error listing stakes: %s", err.Error()) } - marshaled, err := protojson.Marshal(stake) + marshaler := protojson.MarshalOptions{Indent: "\t"} + marshaled, err := marshaler.Marshal(stake) if err != nil { log.Fatalf("error marshaling reward: %s", err.Error()) } - var prettyJSON bytes.Buffer - if err := json.Indent(&prettyJSON, marshaled, "", "\t"); err != nil { - log.Fatalf("JSON parse error: %s", err) - return - } - - fmt.Println(prettyJSON.String()) + fmt.Println(string(marshaled)) } } diff --git a/examples/ethereum/list-rewards/main.go b/examples/ethereum/list-rewards/main.go index 7a15224..ee9b1f0 100644 --- a/examples/ethereum/list-rewards/main.go +++ b/examples/ethereum/list-rewards/main.go @@ -5,9 +5,7 @@ package main import ( - "bytes" "context" - "encoding/json" "errors" "fmt" "log" @@ -17,7 +15,7 @@ import ( "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" "github.com/coinbase/staking-client-library-go/client/rewards" - filter "github.com/coinbase/staking-client-library-go/client/rewards/rewards_filter" + filter "github.com/coinbase/staking-client-library-go/client/rewards/rewardsfilter" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" "google.golang.org/api/iterator" "google.golang.org/protobuf/encoding/protojson" @@ -68,17 +66,12 @@ func main() { log.Fatalf("error listing rewards: %s", err.Error()) } - marshaled, err := protojson.Marshal(reward) + marshaler := protojson.MarshalOptions{Indent: "\t"} + marshaled, err := marshaler.Marshal(reward) if err != nil { log.Fatalf("error marshaling reward: %s", err.Error()) } - var prettyJSON bytes.Buffer - if err := json.Indent(&prettyJSON, marshaled, "", "\t"); err != nil { - log.Fatalf("JSON parse error: %s", err) - return - } - - fmt.Println(prettyJSON.String()) + fmt.Println(string(marshaled)) } } diff --git a/examples/ethereum/list-stakes/main.go b/examples/ethereum/list-stakes/main.go index 7d47291..5a13d22 100644 --- a/examples/ethereum/list-stakes/main.go +++ b/examples/ethereum/list-stakes/main.go @@ -5,9 +5,7 @@ package main import ( - "bytes" "context" - "encoding/json" "errors" "fmt" "log" @@ -16,7 +14,7 @@ import ( "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" "github.com/coinbase/staking-client-library-go/client/rewards" - filter "github.com/coinbase/staking-client-library-go/client/rewards/stakes_filter" + filter "github.com/coinbase/staking-client-library-go/client/rewards/stakesfilter" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" "google.golang.org/api/iterator" "google.golang.org/protobuf/encoding/protojson" @@ -65,17 +63,12 @@ func main() { log.Fatalf("error listing stakes: %s", err.Error()) } - marshaled, err := protojson.Marshal(stake) + marshaler := protojson.MarshalOptions{Indent: "\t"} + marshaled, err := marshaler.Marshal(stake) if err != nil { log.Fatalf("error marshaling reward: %s", err.Error()) } - var prettyJSON bytes.Buffer - if err := json.Indent(&prettyJSON, marshaled, "", "\t"); err != nil { - log.Fatalf("JSON parse error: %s", err) - return - } - - fmt.Println(prettyJSON.String()) + fmt.Println(string(marshaled)) } } diff --git a/examples/solana/list-rewards/main.go b/examples/solana/list-rewards/main.go index b9ee381..5554357 100644 --- a/examples/solana/list-rewards/main.go +++ b/examples/solana/list-rewards/main.go @@ -6,9 +6,7 @@ package main import ( - "bytes" "context" - "encoding/json" "errors" "fmt" "log" @@ -18,7 +16,7 @@ import ( "github.com/coinbase/staking-client-library-go/client" "github.com/coinbase/staking-client-library-go/client/options" "github.com/coinbase/staking-client-library-go/client/rewards" - filter "github.com/coinbase/staking-client-library-go/client/rewards/rewards_filter" + filter "github.com/coinbase/staking-client-library-go/client/rewards/rewardsfilter" api "github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/rewards/v1" "google.golang.org/api/iterator" "google.golang.org/protobuf/encoding/protojson" @@ -70,17 +68,12 @@ func main() { log.Fatalf("error listing rewards: %s", err.Error()) } - marshaled, err := protojson.Marshal(reward) + marshaler := protojson.MarshalOptions{Indent: "\t"} + marshaled, err := marshaler.Marshal(reward) if err != nil { log.Fatalf("error marshaling reward: %s", err.Error()) } - var prettyJSON bytes.Buffer - if err := json.Indent(&prettyJSON, marshaled, "", "\t"); err != nil { - log.Fatalf("JSON parse error: %s", err) - return - } - - fmt.Println(prettyJSON.String()) + fmt.Println(string(marshaled)) } }