Service creation example
In this section, we will cover in detail how delegation works for the service creation.
1 – The front end
// ..............
const { isActiveDelegate } = useContext(TalentLayerContext);
// ..............
if (isActiveDelegate) {
const response = await delegateCreateService(user.id, user.address, cid);
tx = response.data.transaction;
} else {
const contract = new ethers.Contract(
config.contracts.serviceRegistry,
ServiceRegistry.abi,
signer,
);
tx = await contract.createService(
user?.id,
process.env.NEXT_PUBLIC_PLATFORM_ID,
cid,
signature,
);
} 2 - The Back end
See the Full Code Implemented on Our Demo DAPP
Last updated