Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix(opbot): use submitter get tx status [SLT-158] #3134

Merged
merged 8 commits into from
Sep 23, 2024
14 changes: 5 additions & 9 deletions contrib/opbot/botmd/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"github.com/synapsecns/sanguine/core/retry"
"github.com/synapsecns/sanguine/ethergo/chaindata"
"github.com/synapsecns/sanguine/ethergo/client"
"github.com/synapsecns/sanguine/ethergo/submitter"
rfqClient "github.com/synapsecns/sanguine/services/rfq/api/client"
"github.com/synapsecns/sanguine/services/rfq/contracts/fastbridge"
"github.com/synapsecns/sanguine/services/rfq/relayer/relapi"
Expand Down Expand Up @@ -347,17 +348,12 @@
return
}

var txHash *relapi.TxHashByNonceResponse
var status submitter.SubmissionStatus

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

View check run for this annotation

Codecov / codecov/patch

contrib/opbot/botmd/commands.go#L351

Added line #L351 was not covered by tests
err = retry.WithBackoff(
ctx.Context(),
func(ctx context.Context) error {
txHash, err = relClient.GetTxHashByNonce(
ctx,
&relapi.GetTxByNonceRequest{
ChainID: rawRequest.OriginChainID,
Nonce: nonce,
})
if err != nil {
status, err = b.submitter.GetSubmissionStatus(ctx, big.NewInt(int64(rawRequest.OriginChainID)), nonce)
if err != nil || !status.HasTx() {

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

View check run for this annotation

Codecov / codecov/patch

contrib/opbot/botmd/commands.go#L355-L356

Added lines #L355 - L356 were not covered by tests
b.logger.Errorf(ctx, "error fetching quote request: %v", err)
return fmt.Errorf("error fetching quote request: %w", err)
}
Expand All @@ -373,7 +369,7 @@
return
}

_, err = ctx.Response().Reply(fmt.Sprintf("refund submitted: %s", toExplorerSlackLink(txHash.Hash)))
_, err = ctx.Response().Reply(fmt.Sprintf("refund submitted: %s", toExplorerSlackLink(status.TxHash().String())))

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

View check run for this annotation

Codecov / codecov/patch

contrib/opbot/botmd/commands.go#L372

Added line #L372 was not covered by tests
if err != nil {
log.Println(err)
}
Expand Down
Loading