@@ -365,6 +365,8 @@ func (s *transactionServer) Swap(streamer transactionpb.Transaction_SwapServer)
365365 // Section: Transaction submission
366366 //
367367
368+ chatMessageTs := time .Now ()
369+
368370 _ , err = s .data .SubmitBlockchainTransaction (ctx , & txn )
369371 if err != nil {
370372 log .WithError (err ).Warn ("failure submitting transaction" )
@@ -377,7 +379,7 @@ func (s *transactionServer) Swap(streamer transactionpb.Transaction_SwapServer)
377379
378380 log .WithField ("txn" , base64 .StdEncoding .EncodeToString (txn .Marshal ())).Info ("transaction submitted" )
379381
380- err = s .bestEffortNotifyUserOfSwapInProgress (ctx , owner )
382+ err = s .bestEffortNotifyUserOfSwapInProgress (ctx , owner , chatMessageTs )
381383 if err != nil {
382384 log .WithError (err ).Warn ("failure notifying user of swap in progress" )
383385 }
@@ -493,7 +495,7 @@ func (s *transactionServer) validateSwap(
493495 return nil
494496}
495497
496- func (s * transactionServer ) bestEffortNotifyUserOfSwapInProgress (ctx context.Context , owner * common.Account ) error {
498+ func (s * transactionServer ) bestEffortNotifyUserOfSwapInProgress (ctx context.Context , owner * common.Account , ts time. Time ) error {
497499 chatId := chat_util .GetKinPurchasesChatId (owner )
498500
499501 // Inspect the chat history for a USDC deposited message. If that message
@@ -519,7 +521,7 @@ func (s *transactionServer) bestEffortNotifyUserOfSwapInProgress(ctx context.Con
519521 return errors .Wrap (err , "error fetching chat messages" )
520522 }
521523
522- chatMessage , err := chat_util .NewUsdcBeingConvertedMessage ()
524+ chatMessage , err := chat_util .NewUsdcBeingConvertedMessage (ts )
523525 if err != nil {
524526 return errors .Wrap (err , "error creating chat message" )
525527 }
0 commit comments