From f2c79d59a01fd14b630ae66d7ce7c4e797c5c366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D8=B3=D8=AC=D8=A7=D8=AF=20=D9=85=D9=88=D8=AD=D8=AF=D9=8A?= <1190257165@esco.local> Date: Mon, 25 May 2026 14:48:57 +0330 Subject: [PATCH] fix variable-length array destructuring bug in spend-permissions integration example prepareSpendCallData returns 1 call when permission is already registered and 2 calls on first use. The guide destructures it as a fixed 2-element array, causing spendCall=undefined on repeat executions and silently passing undefined into wallet_sendCalls. Replaces fixed destructure with the full array, matching the reference page's own example. Also adds unit clarification for remainingSpend. --- docs/base-account/guides/verify-social-accounts.mdx | 2 +- docs/base-account/improve-ux/spend-permissions.mdx | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/base-account/guides/verify-social-accounts.mdx b/docs/base-account/guides/verify-social-accounts.mdx index 861a1eb46..74f1b9e9a 100644 --- a/docs/base-account/guides/verify-social-accounts.mdx +++ b/docs/base-account/guides/verify-social-accounts.mdx @@ -432,7 +432,7 @@ function redirectToVerifyMiniApp(provider: string) { } ``` -After verification, the user returns to your `redirect_uri` with `?success=true`. Run the check again (step 3) and it now returns 200 with a token. If you're building for the Base app, see the [Apps overview](/apps/introduction/overview) for broader app structure and lifecycle guidance. +After verification, the user returns to your `redirect_uri` with `?success=true`. Run the check again (step 3) and it now returns 200 with a token. If you're building for the Base app, see the see the [Apps overview](/apps) for broader app structure and lifecycle guidance. diff --git a/docs/base-account/improve-ux/spend-permissions.mdx b/docs/base-account/improve-ux/spend-permissions.mdx index 5afa7a69c..5a3cc5aa2 100644 --- a/docs/base-account/improve-ux/spend-permissions.mdx +++ b/docs/base-account/improve-ux/spend-permissions.mdx @@ -234,7 +234,8 @@ const permission = await fetchPermission({ try { const { isActive, remainingSpend } = await getPermissionStatus(permission); const amount = 1000n; - +// Note: remainingSpend and amount are both in the token's smallest unit +// (e.g. for USDC with 6 decimals, 1_000_000n = $1.00) if (!isActive || remainingSpend < amount) { throw new Error("No spend permission available"); } @@ -243,10 +244,8 @@ try { } // 3. prepare the calls -const [approveCall, spendCall] = await prepareSpendCallData({ - permission, - amount, -}); +const spendCalls = await prepareSpendCallData({ permission, amount }); +calls: spendCalls // 4. execute the calls using your app's spender account // this is an example using wallet_sendCalls, in production it could be using eth_sendTransaction.