useUpdatePrimarySaleRecipient

Hook for updating the primary sale recipient on a smart contract.

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

The wallet that initiates this transaction must have the required permissions to change the primary sale recipient (defaults to "admin" level).

Example

import {
useUpdatePrimarySaleRecipient,
useContract,
Web3Button,
} from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress);
const {
mutateAsync: updatePrimarySaleRecipient,
isLoading,
error,
} = useUpdatePrimarySaleRecipient(contract);
return (
<Web3Button
contractAddress={contractAddress}
action={() => updatePrimarySaleRecipient("{{wallet_address}}")}
>
Update Primary Sale Recipient
</Web3Button>
);
}
function useUpdatePrimarySaleRecipient(
contract: RequiredParam<ValidContractInstance>,
): UseMutationResult<
{ receipt: providers.TransactionReceipt },
unknown,
string,
unknown
>;

Parameters

Instance of a SmartContract

Type

let contract: RequiredParam<ValidContractInstance>;

Returns

let returnType: UseMutationResult<
{ receipt: providers.TransactionReceipt },
unknown,
string,
unknown
>;

A mutation object to update the primary sales recipient

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

options

The mutation function takes a walletAddress as argument:

walletAddress

The wallet address to set as the primary sale recipient.