Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion components/TipForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ export function TipForm({ params }: { params: TipParams }) {

const { address, isConnected } = useAccount();
const { switchChain, isPending: isSwitching } = useSwitchChain();
const { data: saData, error: saError } = useSmartAccount(deployment, true);
// TipForm は Circle 未配線 (useGasQuoteCircle / circlePermitAmount を持たない)。USDC tip が
// Circle に routing されると useBatchPayment の circle 分岐が permitAmount 未算定で throw する
// ため、disableCircle=true で Pimlico erc20 に固定する (JPYC は sponsorship なので非影響)。
const { data: saData, error: saError } = useSmartAccount(deployment, true, true);
const gasless = useBatchPayment(deployment);
const gasQuote = useGasQuote(deployment);

Expand Down
12 changes: 8 additions & 4 deletions hooks/useSmartAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ import type { TokenDeployment } from '@/lib/tokens';
export function useSmartAccount(
deployment: TokenDeployment,
enabled: boolean = true,
// Circle 経路を抑止して Pimlico erc20 に倒すフラグ。Circle 分岐 (useBatchPayment) は
// circlePermitAmount (useGasQuoteCircle 由来) を必須とするため、Circle を配線していない
// 呼出元 (TipForm) が pimlico-simple-7702 + USDC + Circle 有効 chain で Circle に routing
// されると送信時に "permitAmount 未算定" で throw する。そうした文脈で true を渡す。
disableCircle: boolean = false,
) {
const { data: walletClient } = useWalletClient();
const publicClient = usePublicClient();
Expand All @@ -49,10 +54,9 @@ export function useSmartAccount(
// USDC ガスレスを Circle Paymaster (v0.8) で組むか Pimlico erc20 (v0.7) のままに
// するかの解決 (単一の真実点)。queryKey に provider/entryPointVersion を含めて、
// flag/chain 変更で別 client を作り直させる (staleTime:Infinity のキャッシュ汚染防止)。
const usdcProvider = resolveUsdcGaslessProvider(
deployment,
chainId ?? deployment.chainId,
);
const usdcProvider = disableCircle
? 'pimlico'
: resolveUsdcGaslessProvider(deployment, chainId ?? deployment.chainId);
const entryPointVersion = usdcProvider === 'circle' ? '0.8' : '0.7';

return useQuery({
Expand Down
Loading