Skip to content

Commit

Permalink
parse rawMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkNerdi committed Feb 26, 2024
1 parent 38a44be commit 5f3d433
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 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 @@ -10,6 +10,8 @@ import { handleEthTransaction } from './eth_transaction.handler'
import { handleSignMessage } from './sign_message.handler'
import { handleWatchAsset } from '@auxiliary/wallet-connect/handlers'
import { DappVerification } from '../enums'
import { TransactionFactory } from '@ethereumjs/tx'
import { Converter } from '@core/utils'

export function onSessionRequest(event: Web3WalletTypes.SessionRequest): void {
// We need to call this here, because if the dapp requests too fast after approval, we won't have the dapp in the store yet
Expand Down Expand Up @@ -61,9 +63,13 @@ export function onSessionRequest(event: Web3WalletTypes.SessionRequest): void {
switch (method) {
case 'eth_sendTransaction':
case 'eth_signTransaction':
case 'eth_sendRawTransaction':
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)
break
}
case 'eth_sign':
case 'personal_sign':
void handleSignMessage(request.params, dapp, method, chain, returnResponse, verifiedState)
Expand Down

0 comments on commit 5f3d433

Please sign in to comment.