-
Notifications
You must be signed in to change notification settings - Fork 32
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
refactor(relapi): deprecate GetQuoteRequestStatusResponse
model
#3045
Changes from 1 commit
79d6930
9336647
74f6146
838fe2e
2758b5f
819e357
fbcfba3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,7 +152,7 @@ | |
Handler: func(ctx *slacker.CommandContext) { | ||
type Status struct { | ||
relayer string | ||
*relapi.GetQuoteRequestStatusResponse | ||
*relapi.GetQuoteRequestResponse | ||
} | ||
|
||
var statuses []Status | ||
|
@@ -175,26 +175,26 @@ | |
client := relapi.NewRelayerClient(b.handler, relayer) | ||
go func() { | ||
defer wg.Done() | ||
res, err := client.GetQuoteRequestStatusByTxHash(ctx.Context(), tx) | ||
res, err := client.GetQuoteRequestByTxHash(ctx.Context(), tx) | ||
if err != nil { | ||
log.Printf("error fetching quote request status by tx hash: %v\n", err) | ||
return | ||
} | ||
sliceMux.Lock() | ||
defer sliceMux.Unlock() | ||
statuses = append(statuses, Status{relayer: relayer, GetQuoteRequestStatusResponse: res}) | ||
statuses = append(statuses, Status{relayer: relayer, GetQuoteRequestResponse: res}) | ||
}() | ||
|
||
go func() { | ||
defer wg.Done() | ||
res, err := client.GetQuoteRequestStatusByTxID(ctx.Context(), tx) | ||
res, err := client.GetQuoteRequestByTXID(ctx.Context(), tx) | ||
if err != nil { | ||
log.Printf("error fetching quote request status by tx id: %v\n", err) | ||
return | ||
} | ||
sliceMux.Lock() | ||
defer sliceMux.Unlock() | ||
statuses = append(statuses, Status{relayer: relayer, GetQuoteRequestStatusResponse: res}) | ||
statuses = append(statuses, Status{relayer: relayer, GetQuoteRequestResponse: res}) | ||
}() | ||
} | ||
wg.Wait() | ||
|
@@ -234,7 +234,7 @@ | |
}, | ||
{ | ||
Type: slack.MarkdownType, | ||
Text: fmt.Sprintf("*Estimated Tx Age*: %s", getTxAge(ctx.Context(), client, status.GetQuoteRequestStatusResponse)), | ||
Text: fmt.Sprintf("*Estimated Tx Age*: %s", getTxAge(ctx.Context(), client, status.GetQuoteRequestResponse)), | ||
}, | ||
} | ||
|
||
|
@@ -257,7 +257,8 @@ | |
if err != nil { | ||
log.Println(err) | ||
} | ||
}} | ||
}, | ||
} | ||
} | ||
|
||
// nolint: gocognit, cyclop. | ||
|
@@ -348,7 +349,7 @@ | |
return fastBridgeHandle, nil | ||
} | ||
|
||
func getTxAge(ctx context.Context, client client.EVM, res *relapi.GetQuoteRequestStatusResponse) string { | ||
func getTxAge(ctx context.Context, client client.EVM, res *relapi.GetQuoteRequestResponse) string { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider optimizing the The TODO comment suggests adding a If feasible, add a |
||
// TODO: add CreatedAt field to GetQuoteRequestStatusResponse so we don't need to make network calls? | ||
receipt, err := client.TransactionReceipt(ctx, common.HexToHash(res.OriginTxHash)) | ||
if err != nil { | ||
|
@@ -390,7 +391,7 @@ | |
|
||
func getQuoteRequest(ctx context.Context, client relapi.RelayerClient, tx string) (*relapi.GetQuoteRequestResponse, error) { | ||
// at this point tx can be a txid or a has, we try both | ||
txRequest, err := client.GetQuoteRequestStatusByTxHash(ctx, tx) | ||
txRequest, err := client.GetQuoteRequestByTxHash(ctx, tx) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add tests for the The initial call to Would you like me to generate unit tests for this function or open a GitHub issue to track this task? ToolsGitHub Check: codecov/patch
|
||
if err == nil { | ||
// override tx with txid | ||
tx = txRequest.TxID | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add tests for the new relayer client calls.
The calls to
GetQuoteRequestByTxHash
andGetQuoteRequestByTXID
are not covered by tests.Would you like me to generate unit tests for these calls or open a GitHub issue to track this task?
Tools
GitHub Check: codecov/patch