Using Biconomy with Thirdweb SDK yields a 400 Bad Request Error

I am using this setup with sveltekit.

I am setting the code like this and including my biconmy paypaster described here from thirdweb documentation: Bundler & Paymaster Infrastructure | thirdweb

const TWFactoryAddress = TW_FACTORY_SMART_ADDRESS; // on Mumbai
      const wallet = new EmbeddedWallet({
          chain: Mumbai,
          clientId: THIRD_WEB_CLIENT_ID,
        });

      // const authResult = await wallet.authenticate({
      //           strategy: "jwt",
      //           jwt: currentToken,
      //           encryptionKey: THIRD_WEB_ENCRYPT_SECRET,
      //       });
      // const authResult = await wallet.authenticate({
      //     strategy: "google",
      // });


      console.log("🎟️ wallet", wallet)
      let user_custo_wallet = await wallet.getAddress()
      console.log("🎟️ user_custo_wallet", user_custo_wallet)
      let walletSigner = await wallet.getSigner();
      console.log("🔵 walletSigner", walletSigner);

      const config  = {
        chain: Mumbai,
        factoryAddress: TWFactoryAddress,
        clientId: THIRD_WEB_CLIENT_ID,
        gasless: true,
        // bundlerUrl: "your-bundler-url",
        paymasterUrl: `https://paymaster.biconomy.io/api/v1/80001/${BICONOMY_API_KEY}`,
      };
      // Connect the smart wallet
      const smartWallet = new SmartWallet(config);
      await smartWallet.connect({ personalWallet: wallet });
      const isDeployed  = await smartWallet.isDeployed();
      if(!isDeployed){
        await smartWallet.deploy();
      }

      const t3_smartAccount = await smartWallet.getAddress();

then here during the contract.safeMint call is where I get the 400 error as mentioned.



      const totalValue = ethers.BigNumber.from(voucher.price);

      //sends transaction
      const transaction = await contract.safeMint(voucher, { value: totalValue.toString(), gasLimit: 400000 });
      const receipt = await transaction.wait();
      
      // Process the transaction
      txnHash = transaction.hash;
      persistedTxnHash = transaction.hash;

and now when I proceed to trigger the transaction, I get this error:

1 Like

can you share the curl call. It should look something like below.
Sponsor UserOperation End Point | Biconomy where it returns paymasterAndData field. It depends how the call is done internally via thirdweb.

2 Likes

I see in thirdweb its called without the mode params.
{
“mode”: “SPONSORED”,
“calculateGasLimits”: true,
“expiryDuration”: 300 //5mins
“sponsorshipInfo”: {
“webhookData”: {},
“smartAccountInfo”: {
“name”: “BICONOMY”,
“version”: “1.0.0”
}
}
}

Happy to discuss further in the discord channel - Discord

1 Like

Hello I See what’s your discord username so that I may ping you?

1 Like

I see its discussed in the discord. my discord username is himanshugarg06