From ebcc19451a0638841c3a0cfb0c74f548ad6382cb Mon Sep 17 00:00:00 2001 From: Marcin Gorzynski Date: Wed, 28 Feb 2024 13:46:08 +0100 Subject: [PATCH] waas: use original intent to avoid data loss because of outdated struct --- rpc/send_transaction.go | 3 ++- rpc/sign_message.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rpc/send_transaction.go b/rpc/send_transaction.go index 80b6b14a..b7223a41 100644 --- a/rpc/send_transaction.go +++ b/rpc/send_transaction.go @@ -24,7 +24,8 @@ func (s *RPC) sendTransaction( return nil, fmt.Errorf("recovering parent wallet: %w", err) } - apiIntent := convertToAPIIntent(intent.ToIntent()) + // use original intent otherwise we may experience lose of data because of outdated struct + apiIntent := convertToAPIIntent(&intent.Intent) bundle, err := s.Wallets.GenTransaction(waasContext(ctx), apiIntent) if err != nil { return nil, fmt.Errorf("generating transaction: %w", err) diff --git a/rpc/sign_message.go b/rpc/sign_message.go index 9e0c5cb3..58d0a0aa 100644 --- a/rpc/sign_message.go +++ b/rpc/sign_message.go @@ -63,7 +63,8 @@ func (s *RPC) signMessage( }, } - apiIntent := convertToAPIIntent(intent.ToIntent()) + // use original intent otherwise we may experience lose of data because of outdated struct + apiIntent := convertToAPIIntent(&intent.Intent) res, err := s.Wallets.SignMessage(waasContext(ctx), apiIntent, signMessage, signatures) if err != nil { return nil, fmt.Errorf("signing message: %w", err)