Create a post or comment anonymously (without account.signer or account.author)

Create a post or comment anonymously (without account.signer or account.author) in Bitsocial React Hooks. Usage, options, and examples.

const account = useAccount();
const signer = await account.pkc.createSigner();

const publishCommentOptions = {
  content: "hello",
  title: "hello",
  communityAddress: "12D3KooW...",
  // use a newly generated author address (optional)
  signer,
  // use a different display name (optional)
  author: {
    displayName: "Esteban",
    address: signer.address,
  },
};

const { publishComment } = usePublishComment(publishCommentOptions);
await publishComment();

A publication signed by another signer doesn’t carry the account’s author.wallets: their proofs name the account’s signing key, and pkc-js refuses to publish them under another one. To publish a wallet with it, pass author.wallets signed for that signer’s address.