@@ -130,7 +130,13 @@ export async function dispatchHandlers(request: PopupMsgs[Msgs.PopupApprove]) {
130130 const isPayloadValid = isSendCallsParams ( params )
131131 if ( ! isPayloadValid ) throw getEIP1193ErrorObjectFromCode ( EIP1193ErrorCodes . Unknown , "Invalid request body" )
132132
133- if ( ! OxAddressUtils . isEqual ( user . address , params . from ) ) {
133+ if ( params . chainId !== getCurrentChain ( ) . chainId )
134+ throw getEIP1193ErrorObjectFromCode (
135+ EIP1193ErrorCodes . ChainDisconnected ,
136+ "The Provider is not connected to the requested chain." ,
137+ )
138+
139+ if ( ! OxAddressUtils . isEqual ( user . address , params . from ! ) ) {
134140 // MAY reject the request if the from address does not match the enabled account
135141 throw new EIP1193UnauthorizedError ( )
136142 }
@@ -150,13 +156,7 @@ export async function dispatchHandlers(request: PopupMsgs[Msgs.PopupApprove]) {
150156 let userOpHash : Hex | null = null
151157
152158 for ( const call of params . calls ) {
153- const { to, value, data, chainId } = call
154-
155- if ( chainId !== getCurrentChain ( ) . chainId )
156- throw getEIP1193ErrorObjectFromCode (
157- EIP1193ErrorCodes . ChainDisconnected ,
158- "The Provider is not connected to the requested chain." ,
159- )
159+ const { to, value, data } = call
160160
161161 if ( ! to ) throw new Error ( "Missing 'to' address in transaction call" )
162162
0 commit comments