From cb2f35237ee8ee2994e2870004da3cb29c549922 Mon Sep 17 00:00:00 2001 From: Mark Nardi Date: Mon, 26 Feb 2024 13:53:25 +0100 Subject: [PATCH] get sender from rawtransaction --- .../handlers/eth_transaction.handler.ts | 2 +- .../handlers/onSessionRequest.handler.ts | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/shared/src/lib/auxiliary/wallet-connect/handlers/eth_transaction.handler.ts b/packages/shared/src/lib/auxiliary/wallet-connect/handlers/eth_transaction.handler.ts index a3e1f7e782..136e0ef675 100644 --- a/packages/shared/src/lib/auxiliary/wallet-connect/handlers/eth_transaction.handler.ts +++ b/packages/shared/src/lib/auxiliary/wallet-connect/handlers/eth_transaction.handler.ts @@ -10,7 +10,7 @@ import { Platform } from '@core/app' import { DappVerification } from '../enums' export async function handleEthTransaction( - evmTransactionData: EvmTransactionData & { from?: string }, + evmTransactionData: EvmTransactionData & { from: string }, dapp: IConnectedDapp, chain: IChain, method: 'eth_sendTransaction' | 'eth_signTransaction' | 'eth_sendRawTransaction', diff --git a/packages/shared/src/lib/auxiliary/wallet-connect/handlers/onSessionRequest.handler.ts b/packages/shared/src/lib/auxiliary/wallet-connect/handlers/onSessionRequest.handler.ts index 605386a0d8..90f629e9ee 100644 --- a/packages/shared/src/lib/auxiliary/wallet-connect/handlers/onSessionRequest.handler.ts +++ b/packages/shared/src/lib/auxiliary/wallet-connect/handlers/onSessionRequest.handler.ts @@ -66,8 +66,20 @@ export function onSessionRequest(event: Web3WalletTypes.SessionRequest): void { void handleEthTransaction(request.params[0], dapp, chain, method, returnResponse, verifiedState) break case 'eth_sendRawTransaction': { - const transaction = TransactionFactory.fromSerializedData(Converter.hexToBytes(request.params[0])).toJSON() - void handleEthTransaction(transaction, dapp, chain, method, returnResponse, verifiedState) + const _transaction = + '0xf8667d85e8d4a510008252089462755b3cd128d8622fd82444f49d19009a6d950f8080820885a08ec84d65d3af77a4233de2f7d090c82d5381f67c175a5d30d7ef33704d458f45a038dfc68b809961e01ca6d21b567fdf35e7f1771143c1268209cc475df5538507' + const transactionData = TransactionFactory.fromSerializedData(Converter.hexToBytes(_transaction)).toJSON() + const transaction = TransactionFactory.fromTxData(transactionData) + const sender = transaction.getSenderAddress().toString() + + void handleEthTransaction( + { ...transaction, from: sender }, + dapp, + chain, + method, + returnResponse, + verifiedState + ) break } case 'eth_sign':