Skip to content

Commit

Permalink
fix types [goreleaser]
Browse files Browse the repository at this point in the history
  • Loading branch information
golangisfun123 committed Jul 22, 2024
1 parent 1f43602 commit 2a10894
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions contrib/opbot/botmd/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ import (
"github.com/synapsecns/sanguine/services/rfq/relayer/relapi"
)

type Status struct {
relayer string
*relapi.GetQuoteRequestStatusResponse
}

func (b *Bot) requiresSignoz(definition *slacker.CommandDefinition) *slacker.CommandDefinition {
if b.signozEnabled {
return definition
Expand Down Expand Up @@ -155,6 +150,11 @@ func (b *Bot) rfqLookupCommand() *slacker.CommandDefinition {
"rfq 0x30f96b45ba689c809f7e936c140609eb31c99b182bef54fccf49778716a7e1ca",
},
Handler: func(ctx *slacker.CommandContext) {
type Status struct {
relayer string
*relapi.GetQuoteRequestStatusResponse
}

var statuses []Status
var sliceMux sync.Mutex

Expand Down Expand Up @@ -234,7 +234,7 @@ func (b *Bot) rfqLookupCommand() *slacker.CommandDefinition {
},
{
Type: slack.MarkdownType,
Text: fmt.Sprintf("*Estimated Tx Age*: %s", getTxAge(ctx.Context(), client, status)),
Text: fmt.Sprintf("*Estimated Tx Age*: %s", getTxAge(ctx.Context(), client, status.GetQuoteRequestStatusResponse)),

Check warning on line 237 in contrib/opbot/botmd/commands.go

View check run for this annotation

Codecov / codecov/patch

contrib/opbot/botmd/commands.go#L237

Added line #L237 was not covered by tests
},
}

Expand Down Expand Up @@ -348,9 +348,9 @@ func (b *Bot) makeFastBridge(ctx context.Context, req *relapi.GetQuoteRequestRes
return fastBridgeHandle, nil
}

func getTxAge(ctx context.Context, client client.EVM, status Status) string {
func getTxAge(ctx context.Context, client client.EVM, res *relapi.GetQuoteRequestStatusResponse) string {
// TODO: add CreatedAt field to GetQuoteRequestStatusResponse so we don't need to make network calls?
receipt, err := client.TransactionReceipt(ctx, common.HexToHash(status.GetQuoteRequestStatusResponse.OriginTxHash))
receipt, err := client.TransactionReceipt(ctx, common.HexToHash(res.OriginTxHash))
if err != nil {
return "unknown time ago"

Check warning on line 355 in contrib/opbot/botmd/commands.go

View check run for this annotation

Codecov / codecov/patch

contrib/opbot/botmd/commands.go#L355

Added line #L355 was not covered by tests
}
Expand Down
9 changes: 4 additions & 5 deletions contrib/opbot/botmd/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ func TestStripLinks(t *testing.T) {
func TestTxAge(t *testing.T) {
notExpected := "unknown time ago" // should be a definite time

status := botmd.Status{
GetQuoteRequestStatusResponse: &relapi.GetQuoteRequestStatusResponse{
OriginTxHash: "0x954264d120f5f3cf50edc39ebaf88ea9dc647d9d6843b7a120ed3677e23d7890",
OriginChainID: 421611,
},
status := &relapi.GetQuoteRequestStatusResponse{
OriginTxHash: "0x954264d120f5f3cf50edc39ebaf88ea9dc647d9d6843b7a120ed3677e23d7890",
OriginChainID: 421611,
}

ctx := context.Background()

client := omnirpcClient.NewOmnirpcClient("https://arb1.arbitrum.io/rpc", metrics.Get())
Expand Down
3 changes: 2 additions & 1 deletion contrib/opbot/botmd/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"context"

"github.com/synapsecns/sanguine/ethergo/client"
"github.com/synapsecns/sanguine/services/rfq/relayer/relapi"
)

func StripLinks(input string) string {
return stripLinks(input)
}

func GetTxAge(ctx context.Context, client client.EVM, res Status) string {
func GetTxAge(ctx context.Context, client client.EVM, res *relapi.GetQuoteRequestStatusResponse) string {
return getTxAge(ctx, client, res)
}

0 comments on commit 2a10894

Please sign in to comment.