From df335a1525df6ccd9b3ac93510276e751b49beca Mon Sep 17 00:00:00 2001 From: golangisfun123 Date: Wed, 6 Nov 2024 15:54:30 -0600 Subject: [PATCH] add tx hash command --- contrib/opbot/botmd/commands.go | 18 ++++++++++++------ contrib/opbot/config/signer.txt | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 contrib/opbot/config/signer.txt diff --git a/contrib/opbot/botmd/commands.go b/contrib/opbot/botmd/commands.go index b72f4ff7c2..133a42bdc3 100644 --- a/contrib/opbot/botmd/commands.go +++ b/contrib/opbot/botmd/commands.go @@ -53,7 +53,7 @@ func (b *Bot) requiresSignoz(definition *slacker.CommandDefinition) *slacker.Com func (b *Bot) traceCommand() *slacker.CommandDefinition { return b.requiresSignoz(&slacker.CommandDefinition{ Command: "trace {tags} {order}", - Description: "find a transaction in signoz", + Description: "testing testing", Examples: []string{ "trace transaction_id:0x1234@serviceName:rfq", "trace transaction_id:0x1234@serviceName:rfq a", @@ -345,26 +345,32 @@ 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 } var status submitter.SubmissionStatus + err = retry.WithBackoff( ctx.Context(), func(ctx context.Context) error { status, err = b.submitter.GetSubmissionStatus(ctx, big.NewInt(int64(rawRequest.OriginChainID)), nonce) - if err != nil || !status.HasTx() { - b.logger.Errorf(ctx, "error fetching quote request: %v", err) + if err != nil { return fmt.Errorf("error fetching quote request: %w", err) + } else if !status.HasTx() { + return errors.New("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("error fetching explorer link to refund, but nonce is %d", nonce)) + _, err := ctx.Response().Reply(fmt.Sprintf("refund submitted with nonce %d", nonce)) log.Printf("error fetching quote request: %v\n", err) return } diff --git a/contrib/opbot/config/signer.txt b/contrib/opbot/config/signer.txt new file mode 100644 index 0000000000..5aa95f04ae --- /dev/null +++ b/contrib/opbot/config/signer.txt @@ -0,0 +1 @@ +8bbfcaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaca8a42ceb23