diff --git a/README.md b/README.md index d3d19bbbb..52dd475ce 100644 --- a/README.md +++ b/README.md @@ -164,3 +164,6 @@ The core team will review opened PRs. The SLA is 2 weeks, generally on a first-c ## Storybook for UI components See `storybook/README.md` for details on local Storybook and component docs. +## Additional Note + +When building on Base, always ensure that you are using the correct RPC endpoint for the intended network (mainnet or testnet). Misconfiguration can lead to failed transactions or unexpected behavior. diff --git a/docs/apps/quickstart/migrate-minikit-to-apps.mdx b/docs/apps/quickstart/migrate-minikit-to-apps.mdx new file mode 100644 index 000000000..b88a76005 --- /dev/null +++ b/docs/apps/quickstart/migrate-minikit-to-apps.mdx @@ -0,0 +1,23 @@ +--- +title: "Migrate from MiniKit to Base Apps SDK" +description: "A checklist and guide for migrating your existing apps to the new Base Apps SDK." +--- + +# Migrating to Base Apps SDK + +Base has evolved the "Mini Apps" ecosystem into the broader **Base Apps**. This transition involves a few breaking changes in the SDK and documentation structure. + +## Quick Checklist +- [ ] Rename `useMiniKit` to `useBaseApp`. +- [ ] Update imports from `@coinbase/minikit` to the latest version. +- [ ] Review Farcaster manifest requirements (now optional for standard web apps). + +## Code Changes + +### Hook Update +```typescript +// Old +import { useMiniKit } from "@coinbase/minikit"; + +// New +import { useBaseApp } from "@coinbase/minikit"; \ No newline at end of file diff --git a/docs/cookbook/implement-spend-permissions.mdx b/docs/cookbook/implement-spend-permissions.mdx new file mode 100644 index 000000000..8b6b93b3e --- /dev/null +++ b/docs/cookbook/implement-spend-permissions.mdx @@ -0,0 +1,30 @@ +--- +title: "Implement Spend Permissions" +description: "Learn how to allow apps to spend tokens on behalf of users without repeated approval prompts using Base Account." +--- + +# Implement Spend Permissions + +Spend Permissions allow smart wallets to grant specific allowances to a spender (your app's backend) for a set period. This enables seamless experiences like subscriptions, automatic trading, or gasless payments. + +## How it works + +1. **Request Permission:** The user signs a typed data structure defining the `allowance`, `period`, and `spender`. +2. **Onchain Approval:** The signature is submitted to the `SpendPermissionManager` contract. +3. **Execution:** The authorized spender calls `spend()` to transfer assets within the allowed limit. + +## Implementation Steps + +### 1. Build the Permission +```typescript +const permission = { + account: userAddress, + spender: "0xYourBackendAddress", + token: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", // Native ETH + allowance: parseEther("0.1"), + period: 2592000, // 30 days + start: Math.floor(Date.now() / 1000), + end: Math.floor(Date.now() / 1000) + (2592000 * 12), // 1 year + salt: BigInt(0), + extraData: "0x", +}; \ No newline at end of file