Skip to content

Commit e2b48e4

Browse files
committed
fix: package updates params type for send calls
1 parent e0c7c5f commit e2b48e4

File tree

4 files changed

+8
-5386
lines changed

4 files changed

+8
-5386
lines changed

apps/iframe/src/requests/approved.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

apps/iframe/src/utils/isSendCallsParams.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export function isSendCallsParams(param: unknown): param is WalletSendCallsParam
1313
z.object({
1414
calls: z.array(callSchema).readonly(),
1515
capabilities: z.record(z.string(), z.any()).optional(),
16-
chainId: z.union([z.string(), z.number()]).optional(),
1716
from: z.string(),
1817
version: z.string(),
1918
}),

0 commit comments

Comments
 (0)