Skip to main content
Privy embedded wallets support EIP-7702. This is the minimal Supertransaction API flow: request a quote, sign the 7702 authorization if required, sign the payload from the API response, then execute.
Signing the payload is the critical step. The API returns payloadToSign, and you must sign it with the user’s wallet before calling /v1/execute.

Minimal EIP-7702 flow

import { useSignAuthorization, useWallets } from "@privy-io/react-auth";

const { signAuthorization } = useSignAuthorization();
const { wallets } = useWallets();
const embeddedWallet = wallets?.[0];
if (!embeddedWallet) throw new Error("No wallet found");

const ownerAddress = embeddedWallet.address;

let quoteResponse = await fetch("https://api.biconomy.io/v1/quote", {
  method: "POST",
  headers: {
    "X-API-Key": "YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    mode: "eoa-7702",
    ownerAddress,
    composeFlows: [...],
  }),
});

if (quoteResponse.status === 412) {
  const { authorizations } = await quoteResponse.json();
  const signedAuths = await Promise.all(
    authorizations.map(async (authItem) => {
      const authorization = await signAuthorization({
        contractAddress: authItem.address,
        chainId: authItem.chainId,
        nonce: authItem.nonce,
      });

      return {
        ...authorization,
        yParity: authorization.yParity,
        v: authorization.v?.toString(),
      };
    })
  );

  quoteResponse = await fetch("https://api.biconomy.io/v1/quote", {
    method: "POST",
    headers: {
      "X-API-Key": "YOUR_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      mode: "eoa-7702",
      ownerAddress,
      composeFlows: [...],
      authorizations: signedAuths,
    }),
  });
}

const quote = await quoteResponse.json();
const payload = quote.payloadToSign[0];
const signablePayload = payload.signablePayload ?? payload;

// eoa-7702 returns "simple" payloads (personal message)
const signature = await embeddedWallet.signMessage({
  message: signablePayload.message,
});

await fetch("https://api.biconomy.io/v1/execute", {
  method: "POST",
  headers: {
    "X-API-Key": "YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    ...quote,
    payloadToSign: [{ ...payload, signature }],
  }),
});