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 @@ -24,6 +24,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 @@ -336,17 +337,12 @@
return
}

var txHash *relapi.TxHashByNonceResponse
var status submitter.SubmissionStatus

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

View check run for this annotation

Codecov / codecov/patch

contrib/opbot/botmd/commands.go#L340

Added line #L340 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 345 in contrib/opbot/botmd/commands.go

View check run for this annotation

Codecov / codecov/patch

contrib/opbot/botmd/commands.go#L344-L345

Added lines #L344 - L345 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 @@ -362,7 +358,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 361 in contrib/opbot/botmd/commands.go

View check run for this annotation

Codecov / codecov/patch

contrib/opbot/botmd/commands.go#L361

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