diff --git a/rfq/negotiator.go b/rfq/negotiator.go index 8abb39514..01ba9af5a 100644 --- a/rfq/negotiator.go +++ b/rfq/negotiator.go @@ -162,11 +162,11 @@ func (n *Negotiator) HandleOutgoingBuyOrder(buyOrder BuyOrder) error { // We calculate a proposed bid price for our peer's // consideration. If a price oracle is not specified we will // skip this step. - var assetRateBid fn.Option[rfqmath.BigIntFixedPoint] + var assetRateHint fn.Option[rfqmsg.AssetRate] if n.cfg.PriceOracle != nil { // Query the price oracle for a bid price. - rate, _, err := n.queryBidFromPriceOracle( + rate, expiryUnix, err := n.queryBidFromPriceOracle( *buyOrder.Peer, buyOrder.AssetID, buyOrder.AssetGroupKey, buyOrder.MinAssetAmount, fn.None[rfqmsg.AssetRate](), @@ -180,13 +180,16 @@ func (n *Negotiator) HandleOutgoingBuyOrder(buyOrder BuyOrder) error { "request: %v", err) } - assetRateBid = fn.Some[rfqmath.BigIntFixedPoint](*rate) + expiry := time.Unix(int64(expiryUnix), 0) + assetRateHint = fn.Some[rfqmsg.AssetRate]( + rfqmsg.NewAssetRate(*rate, expiry), + ) } request, err := rfqmsg.NewBuyRequest( *buyOrder.Peer, buyOrder.AssetID, buyOrder.AssetGroupKey, buyOrder.MinAssetAmount, - assetRateBid, + assetRateHint, ) if err != nil { err := fmt.Errorf("unable to create buy request "+ diff --git a/rfqmsg/buy_request.go b/rfqmsg/buy_request.go index 16115d03e..693017ebc 100644 --- a/rfqmsg/buy_request.go +++ b/rfqmsg/buy_request.go @@ -8,7 +8,6 @@ import ( "github.com/btcsuite/btcd/btcec/v2" "github.com/lightninglabs/taproot-assets/asset" "github.com/lightninglabs/taproot-assets/fn" - "github.com/lightninglabs/taproot-assets/rfqmath" "github.com/lightningnetwork/lnd/routing/route" "github.com/lightningnetwork/lnd/tlv" ) @@ -52,7 +51,7 @@ type BuyRequest struct { // NewBuyRequest creates a new asset buy quote request. func NewBuyRequest(peer route.Vertex, assetID *asset.ID, assetGroupKey *btcec.PublicKey, assetAmount uint64, - rateHint fn.Option[rfqmath.BigIntFixedPoint]) (*BuyRequest, error) { + assetRateHint fn.Option[AssetRate]) (*BuyRequest, error) { id, err := NewID() if err != nil { @@ -60,13 +59,6 @@ func NewBuyRequest(peer route.Vertex, assetID *asset.ID, "quote request id: %w", err) } - // Construct a suggested asset rate if a rate hint is provided. - var assetRateHint fn.Option[AssetRate] - rateHint.WhenSome(func(rate rfqmath.BigIntFixedPoint) { - expiry := time.Now().Add(DefaultQuoteLifetime).UTC() - assetRateHint = fn.Some(NewAssetRate(rate, expiry)) - }) - return &BuyRequest{ Peer: peer, Version: latestBuyRequestVersion,