From fcb1f35254b9cec0cf57a7ed1d4bbe2a36f247f7 Mon Sep 17 00:00:00 2001 From: albertfolch-redeemeum <102516373+albertfolch-redeemeum@users.noreply.github.com> Date: Fri, 14 Oct 2022 14:10:56 +0200 Subject: [PATCH] fix: conversion to hex value for lens profile id (#322) --- .../modal/components/CreateProfile/Lens/utils.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/modal/components/CreateProfile/Lens/utils.ts b/src/components/modal/components/CreateProfile/Lens/utils.ts index fd6094d78..ae5b155b9 100644 --- a/src/components/modal/components/CreateProfile/Lens/utils.ts +++ b/src/components/modal/components/CreateProfile/Lens/utils.ts @@ -39,7 +39,12 @@ export const getLensTokenIdDecimal = (lenseProfileId: Profile["id"]) => { }; export const getLensTokenIdHex = (lenseProfileIdDecimal: Profile["id"]) => { - return lenseProfileIdDecimal - ? "0x" + Number(lenseProfileIdDecimal).toString(16).padStart(2, "0") - : ""; + if (!lenseProfileIdDecimal) { + return ""; + } + const hex = Number(lenseProfileIdDecimal).toString(16); + if (hex.length % 2 === 0) { + return "0x" + hex; + } + return "0x0" + hex; };