From 7276ed0e125a9812f65ce685faeb03355709352c Mon Sep 17 00:00:00 2001 From: Garvit Khatri Date: Fri, 1 Nov 2024 12:45:50 +0000 Subject: [PATCH] Support both single and multiple url configuration --- packages/wagmi/hooks/useSendTransaction.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/wagmi/hooks/useSendTransaction.ts b/packages/wagmi/hooks/useSendTransaction.ts index 4425bf0b..f0c2238f 100644 --- a/packages/wagmi/hooks/useSendTransaction.ts +++ b/packages/wagmi/hooks/useSendTransaction.ts @@ -31,14 +31,21 @@ const sendTransactionMutationOptions = ( if (parameters.capabilities) { const client = config.getClient({ chainId: variables.chainId }) + const paymasterServiceUrl = parameters.capabilities + ?.paymasterService?.url + ? parameters.capabilities?.paymasterService?.url + : parameters.capabilities?.paymasterService[client.chain.id] + ?.url + return sendCalls(config, { calls: [variables], capabilities: { ...parameters.capabilities, - paymasterService: - parameters.capabilities?.paymasterService[ - client.chain.id - ] + paymasterService: paymasterServiceUrl + ? { + url: paymasterServiceUrl + } + : undefined } }) }