MCPcopy Create free account
hub / github.com/PageLeay/celestial-runtime / dnsEncode

Function dnsEncode

lib.esm/hash/namehash.js:73–83  ·  view source on GitHub ↗
(name, _maxLength)

Source from the content-addressed store, hash-verified

71 * as the wildcard resolution.
72 */
73export function dnsEncode(name, _maxLength) {
74 const length = (_maxLength != null) ? _maxLength : 63;
75 assertArgument(length <= 255, "DNS encoded label cannot exceed 255", "length", length);
76 return hexlify(concat(ensNameSplit(name).map((comp) => {
77 assertArgument(comp.length <= length, `label ${JSON.stringify(name)} exceeds ${length} bytes`, "name", name);
78 const bytes = new Uint8Array(comp.length + 1);
79 bytes.set(comp, 1);
80 bytes[0] = bytes.length - 1;
81 return bytes;
82 }))) + "00";
83}
84//# sourceMappingURL=namehash.js.map

Callers 4

#fetchMethod · 0.90
test-hash.tsFile · 0.90
#fetchMethod · 0.90
test-hash.jsFile · 0.90

Calls 6

assertArgumentFunction · 0.90
hexlifyFunction · 0.90
concatFunction · 0.90
ensNameSplitFunction · 0.70
mapMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected