Skip to content

Commit

Permalink
enforce 32 bytes for toHex (#914)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkas authored Aug 22, 2024
1 parent b9bfc0b commit a7c940f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/web/pages/api/basenames/metadata/[tokenId].ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ export default async function GET(request: Request) {
return NextResponse.json({ error: '406: base domain name is missing' }, { status: 406 });

// Get labelhash from tokenId
const labelHash = toHex(BigInt(tokenId));
const labelhash = toHex(BigInt(tokenId), { size: 32 });

// Convert labelhash to namehash
const namehashNode = keccak256(
encodePacked(['bytes32', 'bytes32'], [namehash(baseDomainName), labelHash]),
encodePacked(['bytes32', 'bytes32'], [namehash(baseDomainName), labelhash]),
);

let basenameFormatted = undefined;
Expand Down

0 comments on commit a7c940f

Please sign in to comment.