Skip to content

Commit 54b7743

Browse files
author
Jeff Yanta
committed
Fix source for SendPublicPayment metadata in GetIntentMetadata
1 parent da02895 commit 54b7743

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pkg/code/server/transaction/intent.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,18 @@ func (s *transactionServer) GetIntentMetadata(ctx context.Context, req *transact
754754
}
755755

756756
case intent.SendPublicPayment:
757+
sourceAccountInfoRecord, err := s.data.GetAccountInfoByAuthorityAddress(ctx, intentRecord.InitiatorOwnerAccount)
758+
if err != nil {
759+
log.WithError(err).Warn("failure getting source account info record")
760+
return nil, status.Error(codes.Internal, "")
761+
}
762+
763+
sourceAccount, err := common.NewAccountFromPublicKeyString(sourceAccountInfoRecord.TokenAccount)
764+
if err != nil {
765+
log.WithError(err).Warn("invalid source account")
766+
return nil, status.Error(codes.Internal, "")
767+
}
768+
757769
destinationAccount, err := common.NewAccountFromPublicKeyString(intentRecord.SendPublicPaymentMetadata.DestinationTokenAccount)
758770
if err != nil {
759771
log.WithError(err).Warn("invalid destination account")
@@ -763,6 +775,7 @@ func (s *transactionServer) GetIntentMetadata(ctx context.Context, req *transact
763775
metadata = &transactionpb.Metadata{
764776
Type: &transactionpb.Metadata_SendPublicPayment{
765777
SendPublicPayment: &transactionpb.SendPublicPaymentMetadata{
778+
Source: sourceAccount.ToProto(),
766779
Destination: destinationAccount.ToProto(),
767780
ExchangeData: &transactionpb.ExchangeData{
768781
Currency: strings.ToLower(string(intentRecord.SendPublicPaymentMetadata.ExchangeCurrency)),

0 commit comments

Comments
 (0)