From ff1e9eaf5b6b74dddab30d09b5083955ed7377fb Mon Sep 17 00:00:00 2001 From: vro <168573323+golangisfun123@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:54:08 -0600 Subject: [PATCH] feat(opbot): add tx hash after refund [SLT-460] (#3375) * add tx hash command * [goreleaser] * remove fake key * add better logging * fix context * [goreleaser] --- contrib/opbot/botmd/commands.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/contrib/opbot/botmd/commands.go b/contrib/opbot/botmd/commands.go index bf49c6a98f..6dcc8bc842 100644 --- a/contrib/opbot/botmd/commands.go +++ b/contrib/opbot/botmd/commands.go @@ -320,6 +320,10 @@ func (b *Bot) rfqRefund() *slacker.CommandDefinition { }) if err != nil { log.Printf("error submitting refund: %v\n", err) + _, err := ctx.Response().Reply("error submitting refund") + if err != nil { + log.Println(err) + } return } @@ -331,17 +335,19 @@ func (b *Bot) rfqRefund() *slacker.CommandDefinition { if err != nil || !status.HasTx() { b.logger.Errorf(ctx, "error fetching quote request: %v", err) return fmt.Errorf("error fetching quote request: %w", err) + } else if !status.HasTx() { + return fmt.Errorf("no transaction hash found yet") } return nil }, - retry.WithMaxAttempts(5), - retry.WithMaxAttemptTime(30*time.Second), + retry.WithMaxTotalTime(1*time.Minute), ) + if err != nil { b.logger.Errorf(ctx.Context(), "error fetching quote request: %v", err) _, err := ctx.Response().Reply(fmt.Sprintf("refund submitted with nonce %d", nonce)) if err != nil { - log.Println(err) + b.logger.Errorf(ctx.Context(), "error fetching quote request: %v", err) } return } @@ -351,6 +357,7 @@ func (b *Bot) rfqRefund() *slacker.CommandDefinition { if err != nil { log.Println(err) } + }, } }