Skip to main content

useAddAdmin

Add an admin on the smart wallet account.

const Component = () => {
const { mutate: addAdmin, isLoading, error } = useAddAdmin();

if (error) {
console.error("failed to add admin", error);
}

return (
<button disabled={isLoading} onClick={() => addAdmin(adminAddress)}>
Add admin
</button>
);
};

Usage

Provide the address to add as an admin on the connected smart wallet account to the mutation function returned from the hook.

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

const adminAddress = "{{admin_address}}";

const Component = () => {
const { mutate: addAdmin, isLoading, error } = useAddAdmin();

if (error) {
console.error("failed to add admin", error);
}

return (
<button disabled={isLoading} onClick={() => addAdmin(adminAddress)}>
Add admin
</button>
);
};

Configuration

address (required)

Address

The address to add as an admin on the account as a string.