# Wallet and limits The user's Cherry wallet is connected the moment your app opens. You ask it to sign through the SDK; Cherry checks the request against your app's trust tier and may refuse it, and the user approves or declines. ## Your app never gets the user's keys The user's wallet keys stay on the user's device, in Cherry or in their own wallet software. Neither your app nor Cherry's servers ever receive them. When your app needs a signature, it asks through the SDK. Cherry checks the request against your app's trust tier and shows it to the user, and **the user approves or declines**. Neither your app nor Cherry can sign for them. With `signAndSendTransaction` Cherry broadcasts the transaction the user signed; it does not change it. Cherry is not a party to your app's transactions and does not hold, settle or guarantee them. You are responsible for what your app asks users to sign: explain every transaction before it is signed ([label it](#label-every-transaction)), and never ask a user for a recovery phrase, private key or password. Limits and checks are Cherry's own tools, not a guarantee to you or your users that a transaction is safe. ## Connect your stack ```tsx // @solana/web3.js + wallet-adapter import { CherryWalletAdapter } from '@cherrydotfun/miniapp-sdk/solana'; const wallets = [new CherryWalletAdapter()]; // ``` ```ts // @solana/kit import { CherryMiniApp } from '@cherrydotfun/miniapp-sdk'; import { createCherrySigner } from '@cherrydotfun/miniapp-sdk/kit'; const app = new CherryMiniApp(); await app.init(); const signer = createCherrySigner(app); ``` | Method | What it does | | --- | --- | | `signTransaction` / `signAllTransactions` | The user signs; you send | | `signAndSendTransaction` | The user signs; Cherry sends and returns the signature | | `signMessage` | The user signs bytes (never to log in: the launch token already did) | Solana is live today. Declare the chains you use in the listing; requests for other chains are refused. ## Trust-tier limits Limits count the value that **leaves the user's wallet** in a transaction, in USD, measured by simulating it. Swaps count their input, payments count the amount paid. | | Unverified | Verified | Partner | | --- | --- | --- | --- | | Per transaction | $50 | $1,000 | By agreement | | Per wallet, per app, per day | $50 | $5,000 | By agreement | | Token approvals and delegation | Refused | Refused | By agreement | | Recurring subscriptions | Refused | Refused | By agreement | | Authority changes, account reassignment | Refused | Refused | By agreement | | Durable-nonce (delayed) transactions | Refused | Refused | By agreement | The daily limit resets at 00:00 UTC. Cherry may pause an app that moves far more than usual in a short time, or keeps sending refused transactions, while it takes a look. See [Pauses](https://portal.cherry.fun/docs/mini-apps/listing.md#pauses). ## Errors The SDK rejects with a typed error. Show a clear message and never retry in a loop. | `code` | `policyCode` | What happened | What to show | | --- | --- | --- | --- | | `USER_REJECTED` | | The user declined | Nothing, or a quiet "Cancelled" | | `POLICY_DENIED` | `TX_LIMIT` | Above the per-transaction limit | Offer a smaller amount | | `POLICY_DENIED` | `DAILY_LIMIT` | The user reached today's limit in your app | "Daily limit reached, try again tomorrow" | | `POLICY_DENIED` | `FORBIDDEN_INSTRUCTION` | The transaction asks for something your tier cannot | Fix the transaction; this is a bug on your side | | `POLICY_DENIED` | `APP_PAUSED` | Cherry paused your app | Check your email and Telegram | | `POLICY_DENIED` | `SIMULATION_FAILED` | The transaction would fail on-chain | Rebuild it with fresh data | | `POLICY_DENIED` | `PRICE_UNAVAILABLE` | A token's price could not be read | Try again shortly | | `PRECHECK_UNAVAILABLE` | | Cherry could not check the request | Try again shortly | ```ts import { isPolicyDenied } from '@cherrydotfun/miniapp-sdk'; try { await wallet.signAndSendTransaction(tx); } catch (err) { if (isPolicyDenied(err) && err.policyCode === 'TX_LIMIT') { showSmallerAmount(err.policy?.perTxLimitUsd); // also outflowUsd, dailyUsedUsd, dailyLimitUsd } else if (err.code === 'USER_REJECTED') { return; } else { showError(err.message); } } ``` ## Which wallet pays Some users pay from a different wallet than the one they signed in with. The SDK exposes it as `paymentWallet` (and in the token as `payment_wallet`). Build transactions for it when it is set; if the host answers `WALLET_CHANGED` or `NOT_A_SIGNER`, rebuild for the new wallet. ## Label every transaction Cherry's wallet sheet shows your app's name and the amount and fee it decodes from the transaction. A **label**, one line in your words shown under your app's name, tells the person what they are paying for. Label every transaction: ```ts await cherry.wallet.signAndSendTransaction(tx, { label: 'Buy 3 lives' }); // also signTransaction, signAllTransactions // wallet-adapter or a kit signer: wrap the call instead import { withTransactionLabel } from '@cherrydotfun/miniapp-sdk/solana'; await withTransactionLabel('Enter the weekly tournament', () => sendTransaction(tx, connection)); ``` Name the action and the thing ("Swap 1 SOL to USDC", "Claim winnings"), in at most 80 characters of plain text. Never state an amount different from what the transaction moves: Cherry shows the decoded amount next to your words. ### When your app calls its own program Cherry decodes transfers, swaps and other common instructions itself. When a transaction calls your own program, Cherry can't read the instruction, so it **simulates** the transaction first and shows what leaves the person's wallet and what arrives, with a **Simulated** mark. The program is listed under Details as unreviewed. Your label is then the only line that says what the action is, so keep it short and plain: "Play: bet 0.1 SOL on rock", "Open a mystery box", "Withdraw winnings". For `signAllTransactions`, one label names the whole batch. If the simulation fails (an expired blockhash, a state your program rejects), the sheet says **Failed to simulate** and the person can still sign. A transaction that simulates cleanly is the one people trust, so build it fresh. Cherry still refuses a transaction that hands control of the person's wallet or token accounts to someone else, or lets anyone spend from them later (an approval or delegate), whether in the open or from inside your program. ## Good transactions - Say what the transaction does and how much it moves before you ask, and label it. - Build it fresh: a recent blockhash, current prices. - Add your app's reference key to one instruction, so Cherry attributes the volume to your app. See [Monetization](https://portal.cherry.fun/docs/mini-apps/monetization.md#attribution).