Tip Dialog Block
A dialog component for sending tips to Lens Posts and Accounts, with support for multiple tokens and payment sources.
Tipping this post on testnet.
Installation
Usage
The tip dialog can be used to create tips for Posts and Accounts.
import { LensTipDialog, TipDialogRef } from "@/components/lens-tip-dialog";
import { useTipPostAction } from "@/hooks/use-tip-post-action";
import { postId, useSessionClient } from "@lens-protocol/react";
import { useWalletClient } from "wagmi";
const { data: sessionClient } = useSessionClient();
const { data: walletClient } = useWalletClient();
const { execute } = useTipPostAction({ sessionClient, walletClient });
const post = postId("SOME_POST_ID");
const tipDialog = useRef<TipDialogRef>(null);
<>
<button onClick={() => tipDialog?.current?.open()}>
Tip me!
</button>
<LensTipDialog
ref={tipDialog}
sessionClient={sessionClient}
createTip={(source, amount, tokenAddress) => {
return execute({ post, source, amount, tokenAddress });
}}
/>
</>