Lens Blocks are currently in beta and not ready for production use!

Use Tip Account Action Hook

A hook for tipping Lens Accounts using the Lens React SDK.

This hook allows users to tip a account using a specified payment source and amount.

Installation

Usage

import { useTipAccountAction } from "@/hooks/use-tip-account-action";
import { useAccount,useSessionClient, PaymentSource, evmAddress } from "@lens-protocol/react";
import { NativeToken } from "@/lib/lens-utils";
const { data: sessionClient } = useSessionClient();
const { data: walletClient } = useWalletClient();
const { execute: tipAccount } = useTipAccountAction({ sessionClient, walletClient });

const account = evmAddress("SOME_ACCOUNT_ADDRESS");
const res = await tipAccount({ 
  account,
  source: PaymentSource.Signer,
  amount: "1.0",
  tokenAddress: NativeToken
});
// See https://lens.xyz/docs/protocol/best-practices/error-handling 
// on how to handle ResultAsync responses