Uniswap Sniper Bot  1.0
Typedefs | Functions
Utils Namespace Reference

Namespace holding all converters and other utilities. More...

Typedefs

using Byte = std::uint8_t
 
using Buffer = Byte *
 

Functions

Byte hexCharToByte (char x)
 Converts hexadecimal char to byte. More...
 
char byteToHexChar (Byte x)
 Converts byte to hexadecimal char. More...
 
std::size_t hexStringToBuffer (const char *input, std::size_t inputLength, Buffer output, bool stripZeroes=false)
 Converts hexadecimal string to buffer. More...
 
std::size_t hexStringToBuffer (const char *input, Buffer output, bool stripZeroes=false)
 Converts hexadecimal null-terminated string to buffer. More...
 
std::size_t bufferToHexString (Buffer input, std::size_t inputLength, char *output, bool nullTerminated=false)
 Converts buffer to hexadecimal string. More...
 
std::size_t intToBuffer (std::uint64_t x, Buffer output)
 Converts integer to buffer. More...
 

Detailed Description

Namespace holding all converters and other utilities.

Typedef Documentation

◆ Byte

using Utils::Byte = typedef std::uint8_t

◆ Buffer

using Utils::Buffer = typedef Byte*

Function Documentation

◆ hexCharToByte()

Byte Utils::hexCharToByte ( char  x)
inline

Converts hexadecimal char to byte.

Parameters
xinput hexadecimal char
Returns
output byte
Exceptions
std::invalid_argumentThrows when input is not valid hexadecimal char

◆ byteToHexChar()

char Utils::byteToHexChar ( Byte  x)
inline

Converts byte to hexadecimal char.

Parameters
xinput byte
Returns
output char
Exceptions
std::invalid_argumentThrows when input is not valid hexadecimal value

◆ hexStringToBuffer() [1/2]

std::size_t Utils::hexStringToBuffer ( const char *  input,
std::size_t  inputLength,
Buffer  output,
bool  stripZeroes = false 
)
inline

Converts hexadecimal string to buffer.

Parameters
inputinput hexadecimal c-string
inputLengthlength of the input string
outputoutput buffer
stripZeroesshould input string be trimmed of leading zeroes
Returns
output buffer length

◆ hexStringToBuffer() [2/2]

std::size_t Utils::hexStringToBuffer ( const char *  input,
Buffer  output,
bool  stripZeroes = false 
)
inline

Converts hexadecimal null-terminated string to buffer.

Parameters
inputinput hexadecimal null-terminated c-string
outputoutput buffer
stripZeroesshould input string be trimmed of leading zeroes
Returns
output buffer length

◆ bufferToHexString()

std::size_t Utils::bufferToHexString ( Buffer  input,
std::size_t  inputLength,
char *  output,
bool  nullTerminated = false 
)
inline

Converts buffer to hexadecimal string.

Parameters
inputinput buffer
inputLengthlength of the input buffer
outputoutput hexadecimal c-string, padded to even length
nullTerminatedshould string be null terminated, defaults to false
Returns
output c-string length (without null terminator)

◆ intToBuffer()

std::size_t Utils::intToBuffer ( std::uint64_t  x,
Buffer  output 
)
inline

Converts integer to buffer.

Parameters
xinput integer
outputoutput buffer
Returns
output buffer length