Skip to content

Commit ab6365d

Browse files
authored
added new hooks to minikit docs (#93)
* added new hooks to minikit docs * added new hooks to minikit docs
1 parent 4c91565 commit ab6365d

2 files changed

Lines changed: 86 additions & 1 deletion

File tree

docs/wallet-app/build-with-minikit/debugging.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ The Coinbase Wallet team provides an AI-powered validation tool to check Mini Ap
321321

322322
**How to Use**:
323323

324-
1. Use the validator prompt: [CBW MiniApp Validator](https://raw.githubusercontent.com/base-org/web/main/apps/base-docs/static/cbw-miniapp-validation-final.md)
324+
1. Use the validator prompt: [CBW MiniApp Validator](https://raw.githubusercontent.com/base/demos/refs/heads/master/minikit/mini-app-help/validate.txt)
325325
2. In your preferred AI code editor (Cursor, etc.):
326326
* Add the validator file to your project context
327327
* Ask the AI: "Please validate my Mini App code using the CBW validator guidelines"

docs/wallet-app/build-with-minikit/overview.mdx

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,91 @@ const close = useClose();
223223
<button onClick={close}>Close</button>
224224
```
225225

226+
### useComposeCast
227+
228+
The `useComposeCast` hook provides functionality to open the Farcaster compose interface with pre-filled content.
229+
230+
```tsx
231+
import { useComposeCast } from '@coinbase/onchainkit/minikit';
232+
233+
export default function ComposeCastButton() {
234+
const { composeCast } = useComposeCast();
235+
236+
const handleCompose = () => {
237+
composeCast({
238+
text: 'Just minted an awesome NFT using @coinbase OnchainKit! 🚀',
239+
});
240+
};
241+
242+
const handleComposeWithEmbed = () => {
243+
composeCast({
244+
text: 'Check out this amazing frame!',
245+
embeds: ['https://your-frame-url.com'],
246+
});
247+
};
248+
249+
return (
250+
<div>
251+
<button onClick={handleCompose}>
252+
Share Achievement
253+
</button>
254+
<button onClick={handleComposeWithEmbed}>
255+
Share Frame
256+
</button>
257+
</div>
258+
);
259+
}
260+
```
261+
262+
**Parameters:**
263+
- `text: string` - The text content for the cast
264+
- `embeds?: string[]` - Optional array of URLs to embed in the cast
265+
266+
**Returns:**
267+
- `composeCast: (params: ComposeCastParams) => void` - Function to open compose interface
268+
269+
### useViewCast
270+
271+
The `useViewCast` hook provides functionality to view a specific Farcaster cast by its hash.
272+
273+
```tsx
274+
import { useViewCast } from '@coinbase/onchainkit/minikit';
275+
276+
export default function ViewCastButton() {
277+
const { viewCast } = useViewCast();
278+
279+
const handleViewCast = () => {
280+
viewCast({
281+
hash: '0x32aed77ca61c92d253b98983f1e0fd20a8bd5745',
282+
});
283+
};
284+
285+
const handleViewAnotherCast = () => {
286+
viewCast({
287+
hash: '0x48f4d2c45e7b1a923d5c6f8e9a7b2c1d5e8f3a6b',
288+
});
289+
};
290+
291+
return (
292+
<div>
293+
<button onClick={handleViewCast}>
294+
View Featured Cast
295+
</button>
296+
<button onClick={handleViewAnotherCast}>
297+
View Community Cast
298+
</button>
299+
</div>
300+
);
301+
}
302+
```
303+
304+
**Parameters:**
305+
- `hash: string` - The hash of the cast to view
306+
307+
**Returns:**
308+
- `viewCast: (params: ViewCastParams) => void` - Function to view a specific cast
309+
310+
226311
### usePrimaryButton
227312

228313
This hook accepts primary button options and a callback which will be called on click.

0 commit comments

Comments
 (0)