Documentation Index
Fetch the complete documentation index at: https://docs.sageprotocol.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Users can easily leave channels at any time to stop receiving updates or participating.
React Hook Example for Unfollowing Channels:
import { useChannel } from '@sageprotocol/sdk/react';
import { useWallet } from '@suiet/wallet-kit';
function UnfollowChannel({ channelId }) {
const { unfollow } = useChannel();
const { account, signAndExecuteTransaction } = useWallet();
async function handleUnfollow() {
const result = await unfollow({
amounts: [0, 0], // Required protocol fee (default: [0,0])
channelId, // Channel to unfollow
self: account.address // User's wallet address
});
if (result.ok) {
await signAndExecuteTransaction({ transaction: result.transaction });
console.log("Channel unfollowed successfully!");
} else {
console.error("Error unfollowing channel:", result.err);
}
}
return <button onClick={handleUnfollow}>Unfollow Channel</button>;
}
export default UnfollowChannel;
Direct JavaScript Example for Unfollowing Channels
import { SageClient } from '@sageprotocol/sdk';
const sageClient = new SageClient({
appId: 'your-app-id', // Required application ID
channelRegistryId: 'your-registry-id', // Required channel registry ID
network: 'testnet' // 'testnet' or 'mainnet'
});
await sageClient.initialize();
async function unfollowChannel(channelId, walletAddress) {
const result = await sageClient.unfollowChannel({
amounts: [0, 0], // Required protocol fee (default: [0,0])
channelId, // Channel to unfollow
self: walletAddress // User's wallet address
});
if (result.ok) {
await signAndExecuteTransaction({ transaction: result.transaction });
console.log("Channel unfollowed successfully!");
} else {
console.error("Error unfollowing channel:", result.err);
}
}
unfollowChannel('your-channel-id', walletAddress);