Learn about the dnsEncode
utils method
Introduction
The dnsEncode
method is used to encode a string for use in a domain name. It replaces characters not supported in domain names with their hexadecimal representation preceded by x
.
Usage
The dnsEncode method can be used when encoding strings to be used in a domain name. Here's an example of how you can use it:
const { Utils } = require("alchemy-sdk");
let string = "sahilaujla";
let encodedString = Utils.dnsEncode(string);
console.log(encodedString); // 0x0a736168696c61756a6c6100