Skip to content

Commit

Permalink
get sender from rawtransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkNerdi committed Feb 26, 2024
1 parent 5f3d433 commit cb2f352
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down

0 comments on commit cb2f352

Please sign in to comment.