Skip to main content

usePlatformFees

Hook for getting the platform fee settings of a contract.

Available to use on contracts that implement the PlatformFee interface.

import { usePlatformFees } from "@thirdweb-dev/react";

const { data, isLoading, error } = usePlatformFees(contract);

Usage

Provide your contract instance as the argument.

import { useContract, usePlatformFees } from "@thirdweb-dev/react";

// Your smart contract address (must implement PlatformFee)
const contractAddress = "{{contract_address}}";

function App() {
const { contract } = useContract(contractAddress);
const { data, isLoading, error } = usePlatformFees(contract);
}

Return Value

Return Value

The hook's data property, once loaded, is an object containing two fields:

  • platform_fee_basis_points: the platform fee basis points set on the contract
  • platform_fee_recipient: the wallet address of the platform fee recipient

Note: The basis points are in percentage format, meaning that a value of 500 is equivalent to a 5% fee.

{
platform_fee_basis_points: number;
platform_fee_recipient: string;
}