@@ -130,7 +130,13 @@ export async function dispatchHandlers(request: PopupMsgs[Msgs.PopupApprove]) {
130
130
const isPayloadValid = isSendCallsParams ( params )
131
131
if ( ! isPayloadValid ) throw getEIP1193ErrorObjectFromCode ( EIP1193ErrorCodes . Unknown , "Invalid request body" )
132
132
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 ! ) ) {
134
140
// MAY reject the request if the from address does not match the enabled account
135
141
throw new EIP1193UnauthorizedError ( )
136
142
}
@@ -150,13 +156,7 @@ export async function dispatchHandlers(request: PopupMsgs[Msgs.PopupApprove]) {
150
156
let userOpHash : Hex | null = null
151
157
152
158
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
160
160
161
161
if ( ! to ) throw new Error ( "Missing 'to' address in transaction call" )
162
162
0 commit comments