-
Notifications
You must be signed in to change notification settings - Fork 33
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
RFQ API: add GET /ack endpoint #2643
Changes from all commits
fde6560
e3b690f
3984a35
f5155e6
f56104a
b201299
26fcd00
71651df
43b58f8
b9fe8ca
1941b30
3c47bfb
a682021
b56e825
c8cf473
7e85d35
d9037b4
e50f170
7e9975d
86ff8ee
8265f20
2327ba5
81c7791
85b3dc0
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 |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
// It provides methods for creating, retrieving and updating quotes. | ||
type AuthenticatedClient interface { | ||
PutQuote(ctx context.Context, q *model.PutQuoteRequest) error | ||
PutRelayAck(ctx context.Context, req *model.PutAckRequest) (*model.PutRelayAckResponse, error) | ||
UnauthenticatedClient | ||
} | ||
|
||
|
@@ -124,6 +125,25 @@ | |
return err | ||
} | ||
|
||
func (c *clientImpl) PutRelayAck(ctx context.Context, req *model.PutAckRequest) (*model.PutRelayAckResponse, error) { | ||
var ack *model.PutRelayAckResponse | ||
resp, err := c.rClient.R(). | ||
SetContext(ctx). | ||
SetBody(req). | ||
SetResult(&ack). | ||
Put(rest.AckRoute) | ||
|
||
if err != nil { | ||
return nil, fmt.Errorf("error from server: %s %w", resp.Status(), err) | ||
} | ||
|
||
if resp.IsError() { | ||
return nil, fmt.Errorf("error from server: %s", resp.Status()) | ||
} | ||
|
||
return ack, nil | ||
} | ||
Comment on lines
+128
to
+145
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 test coverage for Do you want me to generate the unit testing code or open a GitHub issue to track this task? |
||
|
||
// GetAllQuotes retrieves all quotes from the RFQ quoting API. | ||
func (c *unauthenticatedClient) GetAllQuotes(ctx context.Context) ([]*model.GetQuoteResponse, error) { | ||
var quotes []*model.GetQuoteResponse | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -5,6 +5,7 @@ import ( | |||||
"fmt" | ||||||
"os" | ||||||
"path/filepath" | ||||||
"time" | ||||||
|
||||||
"github.com/jftuga/ellipsis" | ||||||
"gopkg.in/yaml.v2" | ||||||
|
@@ -21,8 +22,19 @@ type Config struct { | |||||
Database DatabaseConfig `yaml:"database"` | ||||||
OmniRPCURL string `yaml:"omnirpc_url"` | ||||||
// bridges is a map of chainid->address | ||||||
Bridges map[uint32]string `yaml:"bridges"` | ||||||
Port string `yaml:"port"` | ||||||
Bridges map[uint32]string `yaml:"bridges"` | ||||||
Port string `yaml:"port"` | ||||||
RelayAckTimeout time.Duration `yaml:"relay_ack_timeout"` | ||||||
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 a YAML tag for - RelayAckTimeout time.Duration `yaml:"relay_ack_timeout"`
+ RelayAckTimeout time.Duration `yaml:"relay_ack_timeout" yaml:"relay_ack_timeout"` Committable suggestion
Suggested change
|
||||||
} | ||||||
|
||||||
const defaultRelayAckTimeout = 30 * time.Second | ||||||
|
||||||
// GetRelayAckTimeout returns the relay ack timeout. | ||||||
func (c Config) GetRelayAckTimeout() time.Duration { | ||||||
if c.RelayAckTimeout == 0 { | ||||||
return defaultRelayAckTimeout | ||||||
} | ||||||
return c.RelayAckTimeout | ||||||
} | ||||||
|
||||||
// LoadConfig loads the config from the given path. | ||||||
|
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.
Combine error checks for clarity.
Committable suggestion