@tevm/voltaire / index / BrandedBytes1
BrandedBytes1
Functions
Bytes1()
Bytes1(Defined in: src/primitives/Bytes/Bytes1/index.ts:31value):Bytes1Type
Parameters
value
string | Uint8Array<ArrayBufferLike> | number[]
Returns
Bytes1Type
clone()
clone(Defined in: src/primitives/Bytes/Bytes1/clone.js:12 Clone Bytes1bytes):Bytes1Type
Parameters
bytes
Bytes1Type
Bytes1 to clone
Returns
Bytes1Type
Cloned Bytes1
Example
compare()
compare(Defined in: src/primitives/Bytes/Bytes1/compare.js:13 Compare two Bytes1a,b):number
Parameters
a
Bytes1Type
First Bytes1
b
Bytes1Type
Second Bytes1
Returns
number
-1 if a < b, 0 if equal, 1 if a > b
Example
equals()
equals(Defined in: src/primitives/Bytes/Bytes1/equals.js:13 Check if two Bytes1 are equala,b):boolean
Parameters
a
Bytes1Type
First Bytes1
b
Bytes1Type
Second Bytes1
Returns
boolean
True if equal
Example
from()
from(Defined in: src/primitives/Bytes/Bytes1/from.js:17 Create Bytes1 from various input types with size validationvalue):Bytes1Type
Parameters
value
Uint8Array, hex string, or UTF-8 string (must be exactly 1 byte)string | Uint8Array<ArrayBufferLike>
Returns
Bytes1Type
Bytes1
Throws
If length is not 1 byteExample
fromHex()
fromHex(Defined in: src/primitives/Bytes/Bytes1/fromHex.js:16 Create Bytes1 from hex string with size validationhex):Bytes1Type
Parameters
hex
string
Hex string (must be exactly 2 hex chars + 0x prefix)
Returns
Bytes1Type
Bytes1
Throws
If length is not 1 byteExample
fromNumber()
fromNumber(Defined in: src/primitives/Bytes/Bytes1/fromNumber.js:13 Create Bytes1 from number (0-255)value):Bytes1Type
Parameters
value
number
Number value (0-255)
Returns
Bytes1Type
Bytes1
Throws
If value is out of rangeExample
size()
size(Defined in: src/primitives/Bytes/Bytes1/size.js:12 Get size of Bytes1 (always 1)_bytes):1
Parameters
_bytes
Bytes1Type
Bytes1
Returns
1
Size (always 1)
Example
toBytes()
toBytes(Defined in: src/primitives/Bytes/Bytes1/toBytes.js:12 Convert Bytes1 to generic Bytesbytes):BytesType
Parameters
bytes
Bytes1Type
Bytes1 to convert
Returns
BytesType
Generic Bytes
Example
toHex()
toHex(Defined in: src/primitives/Bytes/Bytes1/toHex.js:12 Convert Bytes1 to hex stringbytes):HexType
Parameters
bytes
Bytes1Type
Bytes1 to convert
Returns
HexType
Hex string
Example
toNumber()
toNumber(Defined in: src/primitives/Bytes/Bytes1/toNumber.js:12 Convert Bytes1 to numberbytes):number
Parameters
bytes
Bytes1Type
Bytes1 to convert
Returns
number
Number value

