usePlatformFees

Hook for getting the platform fee settings of a contract.

Available to use on contracts that implement the PlatformFee interface.

Example

import { useContract, usePlatformFees } from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress);
const { data, isLoading, error } = usePlatformFees(contract);
}
function usePlatformFees(
contract: RequiredParam<ValidContractInstance>,
): UseQueryResult<
{
platform_fee_basis_points: number;
platform_fee_recipient: string;
},
unknown
>;

Parameters

Instance of a SmartContract

Type

let contract: RequiredParam<ValidContractInstance>;

Returns

let returnType: UseQueryResult<
{
platform_fee_basis_points: number;
platform_fee_recipient: string;
},
unknown
>;

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;
}