Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.b402.ai/llms.txt

Use this file to discover all available pages before exploring further.

POST /wallet/incognito/settle takes the signed UserOperation from /wallet/incognito/verify and submits it to the ERC-4337 bundler for on-chain execution. The flow is identical to standard wallet settlement but executes a privacy pool shield or unshield operation.
POST /wallet/incognito/settle
Settlement typically completes in ~3 seconds on supported chains. The facilitator covers all gas costs.

Request Body

FieldTypeRequiredDescription
userOpobjectYesThe full UserOperation from /wallet/incognito/verify, with signature populated
signaturestringYesUser’s signature of the userOpHash (hex)
The userOp object must contain all fields exactly as returned by /wallet/incognito/verify. Do not modify any field other than signature.

Response

200 - Settlement Successful

FieldTypeDescription
successbooleanWhether the transaction was mined successfully
txHashstringOn-chain transaction hash
userOpHashstringUserOperation hash matching the one from /wallet/incognito/verify

Error Responses

StatusCodeDescription
400validation_errorMissing or malformed userOp or signature
400validation_errorSignature does not match the userOpHash
400userop_errorBundler rejected the UserOp (insufficient gas, nonce conflict, paymaster denial)
500blockchain_errorTransaction reverted or receipt polling timed out

What Happens Server-Side

  1. Injects signature - Places the user’s signature into the UserOp
  2. Submits to bundler - Sends the signed UserOp via eth_sendUserOperation
  3. Polls for receipt - Waits for the bundler to mine the transaction
  4. Returns result - Responds with the transaction hash

Examples

cURL

curl -X POST https://facilitatorv3.b402.ai/wallet/incognito/settle \
  -H "Content-Type: application/json" \
  -d '{
    "userOp": {
      "sender": "0x...wallet_address",
      "nonce": "0x...",
      "callData": "0x...encoded_privacy_pool_call",
      "callGasLimit": "0x...",
      "verificationGasLimit": "0x...",
      "preVerificationGas": "0x...",
      "maxFeePerGas": "0x...",
      "maxPriorityFeePerGas": "0x...",
      "paymaster": "0x...",
      "paymasterVerificationGasLimit": "0x...",
      "paymasterPostOpGasLimit": "0x...",
      "paymasterData": "0x...",
      "signature": "0x...user_signature_of_userOpHash"
    },
    "signature": "0x...user_signature_of_userOpHash"
  }'

TypeScript

import { Wallet } from 'ethers';

// 1. Get unsigned UserOp from /wallet/incognito/verify
const verifyRes = await fetch('https://facilitatorv3.b402.ai/wallet/incognito/verify', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    walletAddress: '0x...nexus_smart_wallet',
    incognitoData: {
      type: 'shield',
      token: '0x55d398326f99059fF775485246999027B3197955',
      amount: '10000000000000000',
    },
    paymentRequirements: { network: 'bsc' }, // or 'base'
  }),
});
const { userOp, userOpHash } = await verifyRes.json();

// 2. Sign the userOpHash
const ownerWallet = new Wallet(process.env.PRIVATE_KEY);
const signature = await ownerWallet.signMessage(
  Buffer.from(userOpHash.slice(2), 'hex')
);

// 3. Submit signed UserOp
const settleRes = await fetch('https://facilitatorv3.b402.ai/wallet/incognito/settle', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    userOp: { ...userOp, signature },
    signature,
  }),
});

const result = await settleRes.json();

if (result.success) {
  console.log('Incognito operation settled');
  console.log('TX:', result.txHash);
  console.log(`View on BscScan: https://bscscan.com/tx/${result.txHash}`);
  // For Base: https://basescan.org/tx/
} else {
  console.error('Settlement failed');
}

Error Handling

Bundler-level failures return userop_error. Common causes:
CauseWhat To Do
Nonce already usedRe-call /wallet/incognito/verify for a fresh UserOp
Paymaster expiredRe-call /wallet/incognito/verify for new paymaster data
Insufficient balanceToken balance changed between verify and settle
Gas estimation mismatchNetwork conditions changed; retry from verify
For all userop_error and blockchain_error responses, the safe recovery path is to re-call /wallet/incognito/verify and restart the flow.