@tevm/voltaire / index / BrandedBytes32
BrandedBytes32
Type Aliases
Bytes32Like
Bytes32Like =Defined in: src/primitives/Bytes/Bytes32/Bytes32Type.ts:11 Inputs that can be converted to Bytes32Bytes32Type|string|Uint8Array|bigint|number
Variables
SIZE
Defined in: src/primitives/Bytes/Bytes32/Bytes32Type.ts:13constSIZE:32=32
ZERO
Defined in: src/primitives/Bytes/Bytes32/constants.js:12 Zero Bytes32 constant (32 zero bytes)constZERO:Bytes32Type
Functions
Bytes32()
Bytes32(Defined in: src/primitives/Bytes/Bytes32/index.ts:49value):Bytes32Type
Parameters
value
Bytes32Like
Returns
Bytes32Type
clone()
clone(Defined in: src/primitives/Bytes/Bytes32/clone.js:14 Clone a Bytes32 valuebytes):Bytes32Type
Parameters
bytes
Bytes32Type
Value to clone
Returns
Bytes32Type
Cloned value
See
https://voltaire.tevm.sh/primitives/bytes/bytes32 for documentationSince
0.0.0Example
compare()
compare(Defined in: src/primitives/Bytes/Bytes32/compare.js:15 Compare two Bytes32 valuesa,b):number
Parameters
a
Bytes32Type
First value
b
Bytes32Type
Second value
Returns
number
-1 if a < b, 0 if equal, 1 if a > b
See
https://voltaire.tevm.sh/primitives/bytes/bytes32 for documentationSince
0.0.0Example
equals()
equals(Defined in: src/primitives/Bytes/Bytes32/equals.js:15 Check if two Bytes32 values are equala,b):boolean
Parameters
a
Bytes32Type
First value
b
Bytes32Type
Second value
Returns
boolean
True if equal
See
https://voltaire.tevm.sh/primitives/bytes/bytes32 for documentationSince
0.0.0Example
from()
from(Defined in: src/primitives/Bytes/Bytes32/from.js:23 Create Bytes32 from string, bytes, number, or bigintvalue):Bytes32Type
Parameters
value
Value to convertstring | number | bigint | Uint8Array<ArrayBufferLike>
Returns
Bytes32Type
Bytes32
See
https://voltaire.tevm.sh/primitives/bytes/bytes32 for documentationSince
0.0.0Throws
If input is invalid or wrong lengthExample
fromBigint()
fromBigint(Defined in: src/primitives/Bytes/Bytes32/fromBigint.js:16 Create Bytes32 from bigint (padded to 32 bytes)value):Bytes32Type
Parameters
value
bigint
Bigint to convert
Returns
Bytes32Type
Bytes32 (big-endian)
See
https://voltaire.tevm.sh/primitives/bytes/bytes32 for documentationSince
0.0.0Example
fromBytes()
fromBytes(Defined in: src/primitives/Bytes/Bytes32/fromBytes.js:18 Create Bytes32 from raw bytesbytes):Bytes32Type
Parameters
bytes
Uint8Array<ArrayBufferLike>
Raw bytes (must be 32 bytes)
Returns
Bytes32Type
Bytes32
See
https://voltaire.tevm.sh/primitives/bytes/bytes32 for documentationSince
0.0.0Throws
If bytes is wrong lengthExample
fromHex()
fromHex(Defined in: src/primitives/Bytes/Bytes32/fromHex.js:19 Create Bytes32 from hex stringhex):Bytes32Type
Parameters
hex
string
Hex string with optional 0x prefix
Returns
Bytes32Type
Bytes32
See
https://voltaire.tevm.sh/primitives/bytes/bytes32 for documentationSince
0.0.0Throws
If hex is wrong lengthThrows
If hex contains invalid charactersExample
fromNumber()
fromNumber(Defined in: src/primitives/Bytes/Bytes32/fromNumber.js:16 Create Bytes32 from number (padded to 32 bytes)value):Bytes32Type
Parameters
value
number
Number to convert
Returns
Bytes32Type
Bytes32 (big-endian)
See
https://voltaire.tevm.sh/primitives/bytes/bytes32 for documentationSince
0.0.0Example
isZero()
isZero(Defined in: src/primitives/Bytes/Bytes32/isZero.js:14 Check if Bytes32 is all zerosbytes):boolean
Parameters
bytes
Bytes32Type
Value to check
Returns
boolean
True if all zeros
See
https://voltaire.tevm.sh/primitives/bytes/bytes32 for documentationSince
0.0.0Example
size()
size(Defined in: src/primitives/Bytes/Bytes32/size.js:16 Get size of Bytes32 (always 32)_bytes):32
Parameters
_bytes
Bytes32Type
Bytes32 value
Returns
32
Size in bytes
See
https://voltaire.tevm.sh/primitives/bytes/bytes32 for documentationSince
0.0.0Example
toAddress()
toAddress(Defined in: src/primitives/Bytes/Bytes32/toAddress.js:14 Extract Address from Bytes32 (last 20 bytes)bytes):AddressType
Parameters
bytes
Bytes32Type
Bytes32 to extract from
Returns
AddressType
Address
See
https://voltaire.tevm.sh/primitives/bytes/bytes32 for documentationSince
0.0.0Example
toBigint()
toBigint(Defined in: src/primitives/Bytes/Bytes32/toBigint.js:14 Convert Bytes32 to bigint (big-endian)bytes):bigint
Parameters
bytes
Bytes32Type
Bytes32 to convert
Returns
bigint
Bigint value
See
https://voltaire.tevm.sh/primitives/bytes/bytes32 for documentationSince
0.0.0Example
toHash()
toHash(Defined in: src/primitives/Bytes/Bytes32/toHash.js:14 Convert Bytes32 to Hash (same size, different semantic meaning)bytes):HashType
Parameters
bytes
Bytes32Type
Bytes32 to convert
Returns
HashType
Hash
See
https://voltaire.tevm.sh/primitives/bytes/bytes32 for documentationSince
0.0.0Example
toHex()
toHex(Defined in: src/primitives/Bytes/Bytes32/toHex.js:14 Convert Bytes32 to hex stringbytes):string
Parameters
bytes
Bytes32Type
Bytes32 to convert
Returns
string
Hex string with 0x prefix
See
https://voltaire.tevm.sh/primitives/bytes/bytes32 for documentationSince
0.0.0Example
toUint8Array()
toUint8Array(Defined in: src/primitives/Bytes/Bytes32/toUint8Array.js:14 Convert Bytes32 to Uint8Arraybytes):Uint8Array<ArrayBufferLike>
Parameters
bytes
Bytes32Type
Bytes32 to convert
Returns
Uint8Array<ArrayBufferLike>
Raw bytes
See
https://voltaire.tevm.sh/primitives/bytes/bytes32 for documentationSince
0.0.0Example
zero()
zero(): Bytes32Type
Defined in: src/primitives/Bytes/Bytes32/zero.js:15
Create a zero-filled Bytes32
Returns
Bytes32Type
Zero-filled Bytes32

