useUpdatePlatformFees

Hook for updating platform fees on a smart contract.

Available to use on smart contracts that implement the PlatformFee interface.

import {
useUpdatePlatformFees,
useContract,
Web3Button,
} from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress);
const {
mutateAsync: updatePlatformFees,
isLoading,
error,
} = useUpdatePlatformFees(contract);
return (
<Web3Button
contractAddress={contractAddress}
action={() =>
updatePlatformFees({
platform_fee_basis_points: 0,
fee_recipient: "{{wallet_address}}",
})
}
>
Update Platform Fees
</Web3Button>
);
}
function useUpdatePlatformFees(
contract: RequiredParam<ValidContractInstance>,
): UseMutationResult<
Omit<{}, "data">,
unknown,
{ fee_recipient?: string; platform_fee_basis_points?: number },
unknown
>;

Parameters

Instance of a SmartContract

Type

let contract: RequiredParam<ValidContractInstance>;

Returns

let returnType: UseMutationResult<
Omit<{}, "data">,
unknown,
{ fee_recipient?: string; platform_fee_basis_points?: number },
unknown
>;

A mutation object to update the platform fees settings

const { mutateAsync, isLoading, error } =
useUpdatePlatformFees(contract);

options

The mutation function takes an object with below properties:

platform_fee_basis_points

The platform_fee_basis_points property is a number between 0 - 10000 that defines the fee rate.

This number is in percentage points. i.e. 100 is a 1% fee and 10000 is a 100% fee.

fee_recipient

The fee_recipient property is the address of the wallet that will receive the fees.

Use the useAddress hook to get the current wallet address.