Constants.ADDRESS_ZERO

A string representing the zero address 0x0000000000000000000000000000000000000000.

Useful for passing the zero address to various functions.

Constants.NATIVE_TOKEN_ADDRESS

A string representing the native token address 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE.

Useful for passing the native token address (ETH or equivalent) to various functions.

Constants.DECIMALS_18

A double representing the value 1000000000000000000.

Useful for converting values between different decimal places.

Constants.ENTRYPOINT_ADDRESS_V06

A string representing the entrypoint address for Account Abstraction 0.7.0 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789.

Constants.ENTRYPOINT_ADDRESS_V07

A string representing the entrypoint address for Account Abstraction 0.7.0 0x0000000071727De22E5E9d8BAf0edAc6f37da032.

GetSocialProfiles

Fetches the social profiles for the given address or ENS using a Thirdweb client.

var socialProfiles = await Utils.GetSocialProfiles(client, addressOrEns);

GetENSFromAddress

Fetches the ENS name for the given address using a Thirdweb client.

var ensName = await Utils.GetENSFromAddress(client, address);

GetAddressFromENS

Fetches the address for the given ENS name using a Thirdweb client.

var address = await Utils.GetAddressFromENS(client, ensName);

GetChainMetadata

Fetches chain data for a specified chain ID using a Thirdweb client.

var chainData = await Utils.GetChainMetadata (client, chainId);

HexConcat

Concatenates the given hex strings into a single hex string.

var concatenatedHex = Utils.HexConcat("0x1234", "0x5678");

HashPrefixedMessage

Hashes the given message bytes with a prefixed message for Ethereum signing.

var hashedMessage = messageBytes.HashPrefixedMessage();

HashMessage

Hashes the given message using SHA3 Keccak hashing.

var hashedMessage = message.HashMessage();

BytesToHex

Converts a byte array to a hexadecimal string.

var hexString = byteArray.BytesToHex();

HexToBytes

Converts a hexadecimal string to a byte array.

var byteArray = hexString.HexToBytes();

StringToHex

Converts a regular string to a hexadecimal string.

var hexString = "Hello".StringToHex();

GetUnixTimeStampNow

Gets the current Unix timestamp in seconds.

var timestampNow = Utils.GetUnixTimeStampNow();

GetUnixTimeStampIn10Years

Gets the Unix timestamp for 10 years from now.

var timestampIn10Years = Utils.GetUnixTimeStampIn10Years();

ReplaceIPFS

Replaces an IPFS URI with a specified gateway.

var gatewayUri = ipfsUri.ReplaceIPFS("https://ipfs.io/ipfs/");

ToWei

Converts Ether values to Wei.

var weiValue = ethValue.ToWei();

ToEth

Converts Wei values to Ether.

var ethValue = weiValue.ToEth();

GenerateSIWE

Generates a Sign-In With Ethereum (SIWE) message.

var siweMessage = Utils.GenerateSIWE(loginPayloadData);

IsZkSync

Checks if a given chain ID corresponds to zkSync.

var isZkSync = Utils.IsZkSync(chainId);

ToChecksumAddress

Converts an Ethereum address to its checksum format.

var checksummedAddress = address.ToChecksumAddress();

AdjustDecimals

Adjusts the decimal places of a value.

var adjustedValue = value.AdjustDecimals(18, 6);

ToJsonExternalWalletFriendly

Converts typed data into a JSON string suitable for external wallet interaction.

var jsonString = Utils.ToJsonExternalWalletFriendly(typedData, message);