alexandria_encoding
Fully qualified path: alexandria_encoding
Modules
Modules
Modules
base58
Fully qualified path: alexandria_encoding::base58
Free functions
| encode_u8_array | Encodes a byte array into Base58 format using the specified character set This function implements Base58 encoding by treating the input bytes as a big integer… |
Traits
Impls
| Base58Encoder | Base58 encoder implementation for u8 spans |
| Base58Decoder | Base58 decoder implementation for u8 spans |
Free functions
Free functions
| encode_u8_array | Encodes a byte array into Base58 format using the specified character set This function implements Base58 encoding by treating the input bytes as a big integer… |
encode_u8_array
Encodes a byte array into Base58 format using the specified character set
This function implements Base58 encoding by treating the input bytes as a big integer and repeatedly dividing by 58 to get the Base58 digits. Leading zero bytes are preserved as leading ‘1’ characters in the output. The algorithm uses “big integer division” to avoid overflow during the conversion process.
Arguments
bytes- Span of bytes to encodebase58_chars- Span containing the 58-character Base58 alphabet to use
Returns
Array<u8>- The Base58 encoded result as an array of character bytes
Fully qualified path: alexandria_encoding::base58::encode_u8_array
pub fn encode_u8_array(bytes: Span<u8>, base58_chars: Span<u8>) -> Array<u8>
Traits
Traits
Encoder
Fully qualified path: alexandria_encoding::base58::Encoder
pub trait Encoder<T>
Trait functions
encode
Encodes data into Base58 format
Arguments
data- The data to encode
Returns
Array<u8>- Base58 encoded representation as bytes
Fully qualified path: alexandria_encoding::base58::Encoder::encode
fn encode(data: T) -> Array<u8>
Decoder
Fully qualified path: alexandria_encoding::base58::Decoder
pub trait Decoder<T>
Trait functions
decode
Decodes Base58 encoded data back to raw bytes
Arguments
data- The Base58 encoded data to decode
Returns
Array<u8>- Raw bytes decoded from Base58 format
Fully qualified path: alexandria_encoding::base58::Decoder::decode
fn decode(data: T) -> Array<u8>
Impls
Impls
| Base58Encoder | Base58 encoder implementation for u8 spans |
| Base58Decoder | Base58 decoder implementation for u8 spans |
Base58Encoder
Base58 encoder implementation for u8 spans
Fully qualified path: alexandria_encoding::base58::Base58Encoder
pub impl Base58Encoder of Encoder<Span<u8>>;
Impl functions
encode
Fully qualified path: alexandria_encoding::base58::Base58Encoder::encode
fn encode(data: Span<u8>) -> Array<u8>
Base58Decoder
Base58 decoder implementation for u8 spans
Fully qualified path: alexandria_encoding::base58::Base58Decoder
pub impl Base58Decoder of Decoder<Span<u8>>;
Impl functions
decode
Fully qualified path: alexandria_encoding::base58::Base58Decoder::decode
fn decode(data: Span<u8>) -> Array<u8>
base64
Fully qualified path: alexandria_encoding::base64
Free functions
| encode_u8_array | Encodes an array of u8 bytes into Base64 format This function takes an array of bytes and converts them to Base64 encoding… |
| encode_felt | Encodes a felt252 value into Base64 format This function converts a felt252 value to its Base64 representation using a specialized algorithm that handles the large numeric range of felt252…. |
| encode_byte_array | Encodes a ByteArray into a Base64 encoded ByteArray. This function processes the input binary data in chunks of 3 bytes, converts them into their corresponding 6-bit values, and combines… |
Traits
| Encoder | Generic trait for encoding data into Base64 format This trait provides a common interface for encoding various data types into Base64 representation, which is widely used for encoding binary data… |
| Decoder | Generic trait for decoding data from Base64 format This trait provides a common interface for decoding Base64 encoded data back to its original binary representation…. |
| ByteArrayEncoder | Trait for encoding ByteArray data into Base64 format This trait is specialized for ByteArray types, providing efficient encoding operations while maintaining the ByteArray type for both… |
| ByteArrayDecoder | Trait for decoding ByteArray data from Base64 format This trait is specialized for ByteArray types, providing efficient decoding operations while maintaining the ByteArray type for both… |
Impls
| Base64Encoder | Standard Base64 encoder implementation for Array |
| Base64UrlEncoder | URL-safe Base64 encoder implementation for Array |
| Base64FeltEncoder | Standard Base64 encoder implementation for felt252 |
| Base64UrlFeltEncoder | URL-safe Base64 encoder implementation for felt252 |
| Base64ByteArrayEncoder | Standard Base64 encoder implementation for ByteArray |
| Base64ByteArrayUrlEncoder | URL-safe Base64 encoder implementation for ByteArray |
| Base64Decoder | Standard Base64 decoder implementation for Array |
| Base64UrlDecoder | URL-safe Base64 decoder implementation for Array |
| Base64ByteArrayDecoder | Base64 decoder implementation for ByteArray |
Free functions
Free functions
| encode_u8_array | Encodes an array of u8 bytes into Base64 format This function takes an array of bytes and converts them to Base64 encoding… |
| encode_felt | Encodes a felt252 value into Base64 format This function converts a felt252 value to its Base64 representation using a specialized algorithm that handles the large numeric range of felt252…. |
| encode_byte_array | Encodes a ByteArray into a Base64 encoded ByteArray. This function processes the input binary data in chunks of 3 bytes, converts them into their corresponding 6-bit values, and combines… |
encode_u8_array
Encodes an array of u8 bytes into Base64 format
This function takes an array of bytes and converts them to Base64 encoding using the provided character set. It processes the input in groups of 3 bytes, converting them to 4 Base64 characters, and handles padding when necessary.
Arguments
bytes- A mutable array of u8 bytes to be encodedbase64_chars- A span containing the Base64 character set for encoding
Returns
Array<u8>- The Base64 encoded result as an array of bytes
Algorithm
- Groups input bytes into chunks of 3
- Converts each 3-byte chunk into a 24-bit number
- Splits the 24-bit number into four 6-bit values
- Maps each 6-bit value to a Base64 character
- Adds padding (‘=’) characters when input length is not divisible by 3
Fully qualified path: alexandria_encoding::base64::encode_u8_array
pub fn encode_u8_array(mut bytes: Array<u8>, base64_chars: Span<u8>) -> Array<u8>
encode_felt
Encodes a felt252 value into Base64 format
This function converts a felt252 value to its Base64 representation using a specialized algorithm that handles the large numeric range of felt252. The encoding process divides the felt252 into manageable chunks and maps them to Base64 characters, with padding to ensure consistent output length.
Arguments
self- The felt252 value to be encodedbase64_chars- A span containing the Base64 character set for encoding
Returns
Array<u8>- The Base64 encoded result as an array of bytes, always 44 characters long
Algorithm
- Converts felt252 to u256 for processing
- Processes the number in chunks using division and modulo operations
- Maps the resulting values to Base64 characters
- Pads with ‘A’ characters to reach the standard 43-character length
- Reverses the result and appends ‘=’ padding character
Fully qualified path: alexandria_encoding::base64::encode_felt
pub fn encode_felt(self: felt252, base64_chars: Span<u8>) -> Array<u8>
encode_byte_array
Encodes a ByteArray into a Base64 encoded ByteArray.
This function processes the input binary data in chunks of 3 bytes, converts them into their corresponding 6-bit values, and combines them into 24-bit numbers. It then maps these values to Base64 characters and handles any necessary padding.
Arguments
self- A mutable ByteArray containing the binary data to be encoded.base64_chars- A Span containing the Base64 character set used for encoding.
Returns
- A ByteArray containing the Base64 encoded data.
Fully qualified path: alexandria_encoding::base64::encode_byte_array
pub fn encode_byte_array(mut self: ByteArray, base64_chars: Span<u8>) -> ByteArray
Traits
Traits
| Encoder | Generic trait for encoding data into Base64 format This trait provides a common interface for encoding various data types into Base64 representation, which is widely used for encoding binary data… |
| Decoder | Generic trait for decoding data from Base64 format This trait provides a common interface for decoding Base64 encoded data back to its original binary representation…. |
| ByteArrayEncoder | Trait for encoding ByteArray data into Base64 format This trait is specialized for ByteArray types, providing efficient encoding operations while maintaining the ByteArray type for both… |
| ByteArrayDecoder | Trait for decoding ByteArray data from Base64 format This trait is specialized for ByteArray types, providing efficient decoding operations while maintaining the ByteArray type for both… |
Encoder
Generic trait for encoding data into Base64 format
This trait provides a common interface for encoding various data types into Base64 representation, which is widely used for encoding binary data in text-based formats and data transmission.
Type Parameters
T- The input data type to be encoded
Fully qualified path: alexandria_encoding::base64::Encoder
pub trait Encoder<T>
Trait functions
encode
Encodes data into Base64 format
Arguments
data- The data to encode
Returns
Array<u8>- Base64 encoded representation as bytes
Fully qualified path: alexandria_encoding::base64::Encoder::encode
fn encode(data: T) -> Array<u8>
Decoder
Generic trait for decoding data from Base64 format
This trait provides a common interface for decoding Base64 encoded data back to its original binary representation.
Type Parameters
T- The input data type to be decoded (typically Base64 encoded bytes)
Fully qualified path: alexandria_encoding::base64::Decoder
pub trait Decoder<T>
Trait functions
decode
Decodes Base64 encoded data back to raw bytes
Arguments
data- The Base64 encoded data to decode
Returns
Array<u8>- Raw bytes decoded from Base64 format
Fully qualified path: alexandria_encoding::base64::Decoder::decode
fn decode(data: T) -> Array<u8>
ByteArrayEncoder
Trait for encoding ByteArray data into Base64 format
This trait is specialized for ByteArray types, providing efficient encoding operations while maintaining the ByteArray type for both input and output.
Fully qualified path: alexandria_encoding::base64::ByteArrayEncoder
pub trait ByteArrayEncoder
Trait functions
encode
Encodes a ByteArray into Base64 format
Arguments
data- The ByteArray to encode
Returns
ByteArray- Base64 encoded representation as ByteArray
Fully qualified path: alexandria_encoding::base64::ByteArrayEncoder::encode
fn encode(data: ByteArray) -> ByteArray
ByteArrayDecoder
Trait for decoding ByteArray data from Base64 format
This trait is specialized for ByteArray types, providing efficient decoding operations while maintaining the ByteArray type for both input and output.
Fully qualified path: alexandria_encoding::base64::ByteArrayDecoder
pub trait ByteArrayDecoder
Trait functions
decode
Decodes a Base64 encoded ByteArray back to raw bytes
Arguments
data- The Base64 encoded ByteArray to decode
Returns
ByteArray- Raw bytes decoded from Base64 format as ByteArray
Fully qualified path: alexandria_encoding::base64::ByteArrayDecoder::decode
fn decode(data: ByteArray) -> ByteArray
Impls
Impls
| Base64Encoder | Standard Base64 encoder implementation for Array |
| Base64UrlEncoder | URL-safe Base64 encoder implementation for Array |
| Base64FeltEncoder | Standard Base64 encoder implementation for felt252 |
| Base64UrlFeltEncoder | URL-safe Base64 encoder implementation for felt252 |
| Base64ByteArrayEncoder | Standard Base64 encoder implementation for ByteArray |
| Base64ByteArrayUrlEncoder | URL-safe Base64 encoder implementation for ByteArray |
| Base64Decoder | Standard Base64 decoder implementation for Array |
| Base64UrlDecoder | URL-safe Base64 decoder implementation for Array |
| Base64ByteArrayDecoder | Base64 decoder implementation for ByteArray |
Base64Encoder
Standard Base64 encoder implementation for Array
Fully qualified path: alexandria_encoding::base64::Base64Encoder
pub impl Base64Encoder of Encoder<Array<u8>>;
Impl functions
encode
Fully qualified path: alexandria_encoding::base64::Base64Encoder::encode
fn encode(data: Array<u8>) -> Array<u8>
Base64UrlEncoder
URL-safe Base64 encoder implementation for Array
Fully qualified path: alexandria_encoding::base64::Base64UrlEncoder
pub impl Base64UrlEncoder of Encoder<Array<u8>>;
Impl functions
encode
Fully qualified path: alexandria_encoding::base64::Base64UrlEncoder::encode
fn encode(data: Array<u8>) -> Array<u8>
Base64FeltEncoder
Standard Base64 encoder implementation for felt252
Fully qualified path: alexandria_encoding::base64::Base64FeltEncoder
pub impl Base64FeltEncoder of Encoder<felt252>;
Impl functions
encode
Fully qualified path: alexandria_encoding::base64::Base64FeltEncoder::encode
fn encode(data: felt252) -> Array<u8>
Base64UrlFeltEncoder
URL-safe Base64 encoder implementation for felt252
Fully qualified path: alexandria_encoding::base64::Base64UrlFeltEncoder
pub impl Base64UrlFeltEncoder of Encoder<felt252>;
Impl functions
encode
Fully qualified path: alexandria_encoding::base64::Base64UrlFeltEncoder::encode
fn encode(data: felt252) -> Array<u8>
Base64ByteArrayEncoder
Standard Base64 encoder implementation for ByteArray
Fully qualified path: alexandria_encoding::base64::Base64ByteArrayEncoder
pub impl Base64ByteArrayEncoder of ByteArrayEncoder;
Impl functions
encode
Fully qualified path: alexandria_encoding::base64::Base64ByteArrayEncoder::encode
fn encode(data: ByteArray) -> ByteArray
Base64ByteArrayUrlEncoder
URL-safe Base64 encoder implementation for ByteArray
Fully qualified path: alexandria_encoding::base64::Base64ByteArrayUrlEncoder
pub impl Base64ByteArrayUrlEncoder of ByteArrayEncoder;
Impl functions
encode
Fully qualified path: alexandria_encoding::base64::Base64ByteArrayUrlEncoder::encode
fn encode(data: ByteArray) -> ByteArray
Base64Decoder
Standard Base64 decoder implementation for Array
Fully qualified path: alexandria_encoding::base64::Base64Decoder
pub impl Base64Decoder of Decoder<Array<u8>>;
Impl functions
decode
Fully qualified path: alexandria_encoding::base64::Base64Decoder::decode
fn decode(data: Array<u8>) -> Array<u8>
Base64UrlDecoder
URL-safe Base64 decoder implementation for Array
Fully qualified path: alexandria_encoding::base64::Base64UrlDecoder
pub impl Base64UrlDecoder of Decoder<Array<u8>>;
Impl functions
decode
Fully qualified path: alexandria_encoding::base64::Base64UrlDecoder::decode
fn decode(data: Array<u8>) -> Array<u8>
Base64ByteArrayDecoder
Base64 decoder implementation for ByteArray
Fully qualified path: alexandria_encoding::base64::Base64ByteArrayDecoder
pub impl Base64ByteArrayDecoder of ByteArrayDecoder;
Impl functions
decode
Fully qualified path: alexandria_encoding::base64::Base64ByteArrayDecoder::decode
fn decode(data: ByteArray) -> ByteArray
bech32
Fully qualified path: alexandria_encoding::bech32
Constants
Free functions
| encode | Encode data into Bech32 string Does not verify checksum; caller must ensure checksum is correct |
| decode | Decode Bech32 string into HRP, data and checksum For consistency, only supports a lowercase string Does not verify checksum; caller must ensure checksum is correct… |
| convert_bits | Convert 5-bit data to 8-bit data |
| hrp_to_values | Convert HRP string to values for polymod |
| compute_bech32_checksum | Create the 6-byte checksum for HRP and data |
| verify_bech32_checksum | Verify checksum for encoded Bech32 string |
| get_bech32_char | Get Bech32 alphabet character by index |
| bech32_char_to_value | Convert Bech32 character to value |
Traits
Impls
| Bech32Encoder | Bech32 encoder implementation for u8 spans |
| Bech32Decoder | Bech32 decoder implementation for ByteArray |
Constants
Constants
CHECKSUM_LEN
Fully qualified path: alexandria_encoding::bech32::CHECKSUM_LEN
pub const CHECKSUM_LEN: u32 = 6;
Free functions
Free functions
| encode | Encode data into Bech32 string Does not verify checksum; caller must ensure checksum is correct |
| decode | Decode Bech32 string into HRP, data and checksum For consistency, only supports a lowercase string Does not verify checksum; caller must ensure checksum is correct… |
| convert_bits | Convert 5-bit data to 8-bit data |
| hrp_to_values | Convert HRP string to values for polymod |
| compute_bech32_checksum | Create the 6-byte checksum for HRP and data |
| verify_bech32_checksum | Verify checksum for encoded Bech32 string |
| get_bech32_char | Get Bech32 alphabet character by index |
| bech32_char_to_value | Convert Bech32 character to value |
encode
Encode data into Bech32 string Does not verify checksum; caller must ensure checksum is correct
Fully qualified path: alexandria_encoding::bech32::encode
pub fn encode(hrp: ByteArray, data: Span<u8>, checksum: Span<u8>) -> ByteArray
decode
Decode Bech32 string into HRP, data and checksum For consistency, only supports a lowercase string Does not verify checksum; caller must ensure checksum is correct HRP must be lowercase alphanumeric characters only (not supporting ?, !, etc)
Fully qualified path: alexandria_encoding::bech32::decode
pub fn decode(encoded: ByteArray) -> (ByteArray, Array<u8>, Array<u8>)
convert_bits
Convert 5-bit data to 8-bit data
Fully qualified path: alexandria_encoding::bech32::convert_bits
pub fn convert_bits(data: Span<u8>, from_bits: u8, to_bits: u8, pad: bool) -> Array<u8>
hrp_to_values
Convert HRP string to values for polymod
Fully qualified path: alexandria_encoding::bech32::hrp_to_values
pub fn hrp_to_values(hrp: ByteArray) -> Array<u8>
compute_bech32_checksum
Create the 6-byte checksum for HRP and data
Fully qualified path: alexandria_encoding::bech32::compute_bech32_checksum
pub fn compute_bech32_checksum(hrp: ByteArray, data: Span<u8>) -> Array<u8>
verify_bech32_checksum
Verify checksum for encoded Bech32 string
Fully qualified path: alexandria_encoding::bech32::verify_bech32_checksum
pub fn verify_bech32_checksum(hrp: ByteArray, data: Span<u8>, checksum: Span<u8>) -> bool
get_bech32_char
Get Bech32 alphabet character by index
Fully qualified path: alexandria_encoding::bech32::get_bech32_char
pub fn get_bech32_char(index: u8) -> u8
bech32_char_to_value
Convert Bech32 character to value
Fully qualified path: alexandria_encoding::bech32::bech32_char_to_value
pub fn bech32_char_to_value(char: u8) -> u8
Traits
Traits
Encoder
Encoder trait for Bech32 encoding
Fully qualified path: alexandria_encoding::bech32::Encoder
pub trait Encoder<T>
Trait functions
encode
Encodes data into Bech32 format
Fully qualified path: alexandria_encoding::bech32::Encoder::encode
fn encode(hrp: ByteArray, data: T) -> ByteArray
Decoder
Decoder trait for Bech32 decoding
Fully qualified path: alexandria_encoding::bech32::Decoder
pub trait Decoder<T>
Trait functions
decode
Decodes Bech32 encoded data back to raw format
Fully qualified path: alexandria_encoding::bech32::Decoder::decode
fn decode(data: T) -> (ByteArray, Array<u8>, Array<u8>)
Impls
Impls
| Bech32Encoder | Bech32 encoder implementation for u8 spans |
| Bech32Decoder | Bech32 decoder implementation for ByteArray |
Bech32Encoder
Bech32 encoder implementation for u8 spans
Fully qualified path: alexandria_encoding::bech32::Bech32Encoder
pub impl Bech32Encoder of Encoder<Span<u8>>;
Impl functions
encode
Fully qualified path: alexandria_encoding::bech32::Bech32Encoder::encode
fn encode(hrp: ByteArray, data: Span<u8>) -> ByteArray
Bech32Decoder
Bech32 decoder implementation for ByteArray
Fully qualified path: alexandria_encoding::bech32::Bech32Decoder
pub impl Bech32Decoder of Decoder<ByteArray>;
Impl functions
decode
Fully qualified path: alexandria_encoding::bech32::Bech32Decoder::decode
fn decode(data: ByteArray) -> (ByteArray, Array<u8>, Array<u8>)
bech32m
Fully qualified path: alexandria_encoding::bech32m
Free functions
| compute_bech32m_checksum | Compute Bech32m checksum according to BIP-350 |
Traits
Impls
| Bech32mEncoder | Bech32m encoder implementation for u8 spans |
| Bech32mDecoder | Bech32m decoder implementation for ByteArray |
Free functions
Free functions
| compute_bech32m_checksum | Compute Bech32m checksum according to BIP-350 |
compute_bech32m_checksum
Compute Bech32m checksum according to BIP-350
Fully qualified path: alexandria_encoding::bech32m::compute_bech32m_checksum
pub fn compute_bech32m_checksum(hrp: ByteArray, data: Span<u8>) -> Array<u8>
Traits
Traits
Encoder
Encoder trait for Bech32 encoding
Fully qualified path: alexandria_encoding::bech32m::Encoder
pub trait Encoder<T>
Trait functions
encode
Encodes data into Bech32 format
Fully qualified path: alexandria_encoding::bech32m::Encoder::encode
fn encode(hrp: ByteArray, data: T) -> ByteArray
Decoder
Decoder trait for Bech32 decoding
Fully qualified path: alexandria_encoding::bech32m::Decoder
pub trait Decoder<T>
Trait functions
decode
Decodes Bech32 encoded data back to raw format
Fully qualified path: alexandria_encoding::bech32m::Decoder::decode
fn decode(data: T) -> (ByteArray, Array<u8>, Array<u8>)
Impls
Impls
| Bech32mEncoder | Bech32m encoder implementation for u8 spans |
| Bech32mDecoder | Bech32m decoder implementation for ByteArray |
Bech32mEncoder
Bech32m encoder implementation for u8 spans
Fully qualified path: alexandria_encoding::bech32m::Bech32mEncoder
pub impl Bech32mEncoder of Encoder<Span<u8>>;
Impl functions
encode
Fully qualified path: alexandria_encoding::bech32m::Bech32mEncoder::encode
fn encode(hrp: ByteArray, data: Span<u8>) -> ByteArray
Bech32mDecoder
Bech32m decoder implementation for ByteArray
Fully qualified path: alexandria_encoding::bech32m::Bech32mDecoder
pub impl Bech32mDecoder of Decoder<ByteArray>;
Impl functions
decode
Fully qualified path: alexandria_encoding::bech32m::Bech32mDecoder::decode
fn decode(data: ByteArray) -> (ByteArray, Array<u8>, Array<u8>)
rlp
Fully qualified path: alexandria_encoding::rlp
Enums
Traits
Impls
Enums
Enums
RLPError
Fully qualified path: alexandria_encoding::rlp::RLPError
pub enum RLPError {
EmptyInput,
InputTooShort,
PayloadTooLong,
}
Variants
EmptyInput
Fully qualified path: alexandria_encoding::rlp::RLPError::EmptyInput
EmptyInput
InputTooShort
Fully qualified path: alexandria_encoding::rlp::RLPError::InputTooShort
InputTooShort
PayloadTooLong
Fully qualified path: alexandria_encoding::rlp::RLPError::PayloadTooLong
PayloadTooLong
RLPType
Fully qualified path: alexandria_encoding::rlp::RLPType
pub enum RLPType {
String,
List,
}
Variants
String
Fully qualified path: alexandria_encoding::rlp::RLPType::String
String
List
Fully qualified path: alexandria_encoding::rlp::RLPType::List
List
RLPItem
Fully qualified path: alexandria_encoding::rlp::RLPItem
pub enum RLPItem {
String: Span<u8>,
List: Span<RLPItem>,
}
Variants
String
Fully qualified path: alexandria_encoding::rlp::RLPItem::String
String: Span<u8>
List
Fully qualified path: alexandria_encoding::rlp::RLPItem::List
List: Span<RLPItem>
Traits
Traits
RLPTrait
Fully qualified path: alexandria_encoding::rlp::RLPTrait
pub trait RLPTrait
Trait functions
decode_type
Returns RLPType from the leading byte with its offset in the array as well as its size.
Arguments
input- Array of byte to decode
Returns
(RLPType, offset, size)- A tuple containing the RLPType the offset and the size of the RLPItem to decode
Errors
- empty input - if the input is empty
- input too short - if the input is too short for a given
Fully qualified path: alexandria_encoding::rlp::RLPTrait::decode_type
fn decode_type(input: Span<u8>) -> Result<(RLPType, u32, u32), RLPError>
encode
Recursively encodes multiple a list of RLPItems
Arguments
input- Span of RLPItem to encode
Returns
- `Span - RLP encoded items as a span of bytes
Errors
- empty input - if the input is empty
Fully qualified path: alexandria_encoding::rlp::RLPTrait::encode
fn encode(input: Span<RLPItem>) -> Result<Span<u8>, RLPError>
encode_string
RLP encodes a Array of bytes representing a RLP String.
Arguments
input- Array of bytes representing a RLP String to encode
Returns
- `Span - RLP encoded items as a span of bytes
Fully qualified path: alexandria_encoding::rlp::RLPTrait::encode_string
fn encode_string(input: Span<u8>) -> Result<Span<u8>, RLPError>
decode
Recursively decodes a rlp encoded byte array as described in https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/
Arguments
input- Array of bytes to decode
Returns
Span<RLPItem>- Span of RLPItem
Errors
- input too short - if the input is too short for a given
Fully qualified path: alexandria_encoding::rlp::RLPTrait::decode
fn decode(input: Span<u8>) -> Result<Span<RLPItem>, RLPError>
Impls
Impls
RLPImpl
Fully qualified path: alexandria_encoding::rlp::RLPImpl
pub impl RLPImpl of RLPTrait;
Impl functions
decode_type
Returns RLPType from the leading byte with its offset in the array as well as its size.
Arguments
input- Array of byte to decode
Returns
(RLPType, offset, size)- A tuple containing the RLPType the offset and the size of the RLPItem to decode
Errors
- empty input - if the input is empty
- input too short - if the input is too short for a given
Fully qualified path: alexandria_encoding::rlp::RLPImpl::decode_type
fn decode_type(input: Span<u8>) -> Result<(RLPType, u32, u32), RLPError>
encode
Recursively encodes multiple a list of RLPItems
Arguments
input- Span of RLPItem to encode
Returns
- `Span - RLP encoded items as a span of bytes
Errors
- empty input - if the input is empty
Fully qualified path: alexandria_encoding::rlp::RLPImpl::encode
fn encode(mut input: Span<RLPItem>) -> Result<Span<u8>, RLPError>
encode_string
RLP encodes a Array of bytes representing a RLP String.
Arguments
input- Array of bytes representing a RLP String to encode
Returns
- `Span - RLP encoded items as a span of bytes
Fully qualified path: alexandria_encoding::rlp::RLPImpl::encode_string
fn encode_string(input: Span<u8>) -> Result<Span<u8>, RLPError>
decode
Recursively decodes a rlp encoded byte array as described in https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/
Arguments
input- Array of bytes to decode
Returns
Span<RLPItem>- Span of RLPItem
Errors
- input too short - if the input is too short for a given
Fully qualified path: alexandria_encoding::rlp::RLPImpl::decode
fn decode(input: Span<u8>) -> Result<Span<RLPItem>, RLPError>
rlp_byte_array
Fully qualified path: alexandria_encoding::rlp_byte_array
Enums
Traits
Impls
Enums
Enums
RLPError
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPError
pub enum RLPError {
EmptyInput,
InputTooShort,
PayloadTooLong,
}
Variants
EmptyInput
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPError::EmptyInput
EmptyInput
InputTooShort
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPError::InputTooShort
InputTooShort
PayloadTooLong
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPError::PayloadTooLong
PayloadTooLong
RLPType
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPType
pub enum RLPType {
String,
List,
}
Variants
String
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPType::String
String
List
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPType::List
List
RLPItemByteArray
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPItemByteArray
pub enum RLPItemByteArray {
String: ByteArray,
List: Span<RLPItemByteArray>,
}
Variants
String
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPItemByteArray::String
String: ByteArray
List
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPItemByteArray::List
List: Span<RLPItemByteArray>
Traits
Traits
RLPTrait
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPTrait
pub trait RLPTrait
Trait functions
encode_byte_array
Encodes a Span of RLPItemByteArray (which can be either strings or lists) into a single
RLP-encoded ByteArray.
This function handles recursive encoding for nested lists.
Arguments
input: A Span containing RLP items, where each item is either a string (ByteArray) or a nested list (Span).prefix: can be used for ex eip1559 is 0x2
Returns
Result<@ByteArray, RLPError>: The RLP-encoded result or an error if input is empty.
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPTrait::encode_byte_array
fn encode_byte_array(input: Span<RLPItemByteArray>, prefix: u8) -> Result<@ByteArray, RLPError>
encode_byte_array_string
Encodes a ByteArray as an RLP string (not a list).
Arguments
input: A reference to the ByteArray to encode.
Returns
Result<@ByteArray, RLPError>: The RLP-encoded result or an error.
RLP Encoding Rules for Strings:
- For empty string, the encoding is 0x80.
- For single byte less than 0x80, it’s the byte itself (no prefix).
- For strings with length < 56, prefix is 0x80 + length.
- For strings with length >= 56, prefix is 0xb7 + length-of-length, followed by actual length and data.
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPTrait::encode_byte_array_string
fn encode_byte_array_string(input: @ByteArray) -> Result<@ByteArray, RLPError>
encode_byte_array_list
Encodes a list of RLP-encoded ByteArrays into a single RLP list item.
Assumes all input elements are already RLP-encoded. Used for creating composite structures like transaction lists or EIP-1559 typed payloads.
Arguments
inputs- Span of RLP-encoded@ByteArrayitems to be wrapped in a list.prefix- Optional prefix byte (e.g., 0x2 for EIP-1559), 0 if unused.
Returns
@ByteArray- a new RLP-encoded ByteArray representing the list.
Behavior
- Uses short or long list prefix depending on total payload size.
- Adds prefix byte if
prefix > 0.
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPTrait::encode_byte_array_list
fn encode_byte_array_list(inputs: Span<@ByteArray>, prefix: u8) -> Result<@ByteArray, RLPError>
decode_byte_array
Recursively decodes a rlp encoded byte array as described in https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/
Arguments
input- ByteArray decode
Returns
Span<ByteArray>- decoded ByteArray
Errors
- input too short - if the input is too short for a given
- empty input - if the input is len is 0
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPTrait::decode_byte_array
fn decode_byte_array(input: @ByteArray) -> Result<Span<ByteArray>, RLPError>
decode_byte_array_type
Decodes the RLP prefix of the input and determines the type (String or List), returning the decoded payload, the total bytes read, and the inferred RLP type.
Arguments
input: Reference to a ByteArray that represents RLP-encoded data.
Returns
Ok((payload, total_bytes_read, RLPType)): On success, returns the decoded payload, how many bytes were consumed from input, and whether it was a String or List.Err(RLPError): If decoding fails due to invalid input length, or size issues.
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPTrait::decode_byte_array_type
fn decode_byte_array_type(input: @ByteArray) -> Result<(ByteArray, u32, RLPType), RLPError>
Impls
Impls
RLPImpl
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPImpl
pub impl RLPImpl of RLPTrait;
Impl functions
encode_byte_array
Encodes a Span of RLPItemByteArray (which can be either strings or lists) into a single
RLP-encoded ByteArray.
This function handles recursive encoding for nested lists.
Arguments
input: A Span containing RLP items, where each item is either a string (ByteArray) or a nested list (Span).prefix: can be used for ex eip1559 is 0x2
Returns
Result<@ByteArray, RLPError>: The RLP-encoded result or an error if input is empty.
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPImpl::encode_byte_array
fn encode_byte_array(mut input: Span<RLPItemByteArray>, prefix: u8) -> Result<@ByteArray, RLPError>
encode_byte_array_string
Encodes a ByteArray as an RLP string (not a list).
Arguments
input: A reference to the ByteArray to encode.
Returns
Result<@ByteArray, RLPError>: The RLP-encoded result or an error.
RLP Encoding Rules for Strings:
- For empty string, the encoding is 0x80.
- For single byte less than 0x80, it’s the byte itself (no prefix).
- For strings with length < 56, prefix is 0x80 + length.
- For strings with length >= 56, prefix is 0xb7 + length-of-length, followed by actual length and data.
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPImpl::encode_byte_array_string
fn encode_byte_array_string(input: @ByteArray) -> Result<@ByteArray, RLPError>
encode_byte_array_list
Encodes a list of RLP-encoded ByteArrays into a single RLP list item.
Assumes all input elements are already RLP-encoded. Used for creating composite structures like transaction lists or EIP-1559 typed payloads.
Arguments
inputs- Span of RLP-encoded@ByteArrayitems to be wrapped in a list.prefix- Optional prefix byte (e.g., 0x2 for EIP-1559), 0 if unused.
Returns
@ByteArray- a new RLP-encoded ByteArray representing the list.
Behavior
- Uses short or long list prefix depending on total payload size.
- Adds prefix byte if
prefix > 0.
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPImpl::encode_byte_array_list
fn encode_byte_array_list(mut inputs: Span<@ByteArray>, prefix: u8) -> Result<@ByteArray, RLPError>
decode_byte_array
Recursively decodes a rlp encoded byte array as described in https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/
Arguments
input- ByteArray decode
Returns
Span<ByteArray>- decoded ByteArray
Errors
- input too short - if the input is too short for a given
- empty input - if the input is len is 0
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPImpl::decode_byte_array
fn decode_byte_array(input: @ByteArray) -> Result<Span<ByteArray>, RLPError>
decode_byte_array_type
Decodes the RLP prefix of the input and determines the type (String or List), returning the decoded payload, the total bytes read, and the inferred RLP type.
Arguments
input: Reference to a ByteArray that represents RLP-encoded data.
Returns
Ok((payload, total_bytes_read, RLPType)): On success, returns the decoded payload, how many bytes were consumed from input, and whether it was a String or List.Err(RLPError): If decoding fails due to invalid input length, or size issues.
Fully qualified path: alexandria_encoding::rlp_byte_array::RLPImpl::decode_byte_array_type
fn decode_byte_array_type(input: @ByteArray) -> Result<(ByteArray, u32, RLPType), RLPError>
sol_abi
Fully qualified path: alexandria_encoding::sol_abi
Modules
Modules
Modules
decode
Fully qualified path: alexandria_encoding::sol_abi::decode
Traits
| SolAbiDecodeTrait | Decode trait meant to provide an interface similar to Solidity’s abi.decode function. It is meant to be used in a chain where the passed in offset is updated after each decode operation…. |
Impls
| SolAbiDecodeU8 | Decode int types Integers are decoded by reading 32 bytes from the offset Bytes encoding is right-aligned/left-paddded Big-endian. |
| SolAbiDecodeU16 | — |
| SolAbiDecodeU32 | — |
| SolAbiDecodeU64 | — |
| SolAbiDecodeU128 | — |
| SolAbiDecodeU256 | — |
| SolAbiDecodeBool | Decode other primitives Primitives are decoded by reading 32 bytes from the offset Bytes encoding is right-aligned/left-paddded Big-endian. |
| SolAbiDecodeFelt252 | — |
| SolAbiDecodeBytes31 | — |
| SolAbiDecodeBytes | Decode byte types Bytes are decoded by reading 32 bytes from the offset Bytes encoding is left-aligned/right-paddded |
| SolAbiDecodeByteArray | — |
| SolAbiDecodeStarknetAddress | Decode address types Addresses are decoded by reading 32 bytes from the offset Bytes encoding is right-aligned/left-paddded Big-endian. |
| SolAbiDecodeEthAddress | — |
Traits
Traits
| SolAbiDecodeTrait | Decode trait meant to provide an interface similar to Solidity’s abi.decode function. It is meant to be used in a chain where the passed in offset is updated after each decode operation…. |
SolAbiDecodeTrait
Decode trait meant to provide an interface similar to Solidity’s abi.decode
function. It is meant to be used in a chain where the passed in offset is
updated after each decode operation.
Values are expected to be 32 bytes long, and will be interpreted as if they
were encoded using the abi.encode function in Solidity.
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeTrait
pub trait SolAbiDecodeTrait<T>
Trait functions
decode
Decodes a value of type T from bytes starting at the given offset
Arguments
self- Reference to the Bytes containing encoded dataoffset- Mutable reference to the current offset position (updated after decode)
Returns
T- The decoded value of type T
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeTrait::decode
fn decode(self: @Bytes, ref offset: u32) -> T
Impls
Impls
| SolAbiDecodeU8 | Decode int types Integers are decoded by reading 32 bytes from the offset Bytes encoding is right-aligned/left-paddded Big-endian. |
| SolAbiDecodeU16 | — |
| SolAbiDecodeU32 | — |
| SolAbiDecodeU64 | — |
| SolAbiDecodeU128 | — |
| SolAbiDecodeU256 | — |
| SolAbiDecodeBool | Decode other primitives Primitives are decoded by reading 32 bytes from the offset Bytes encoding is right-aligned/left-paddded Big-endian. |
| SolAbiDecodeFelt252 | — |
| SolAbiDecodeBytes31 | — |
| SolAbiDecodeBytes | Decode byte types Bytes are decoded by reading 32 bytes from the offset Bytes encoding is left-aligned/right-paddded |
| SolAbiDecodeByteArray | — |
| SolAbiDecodeStarknetAddress | Decode address types Addresses are decoded by reading 32 bytes from the offset Bytes encoding is right-aligned/left-paddded Big-endian. |
| SolAbiDecodeEthAddress | — |
SolAbiDecodeU8
Decode int types
Integers are decoded by reading 32 bytes from the offset
Bytes encoding is right-aligned/left-paddded Big-endian.
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeU8
pub impl SolAbiDecodeU8 of SolAbiDecodeTrait<u8>;
Impl functions
decode
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeU8::decode
fn decode(self: @Bytes, ref offset: u32) -> u8
SolAbiDecodeU16
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeU16
pub impl SolAbiDecodeU16 of SolAbiDecodeTrait<u16>;
Impl functions
decode
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeU16::decode
fn decode(self: @Bytes, ref offset: u32) -> u16
SolAbiDecodeU32
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeU32
pub impl SolAbiDecodeU32 of SolAbiDecodeTrait<u32>;
Impl functions
decode
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeU32::decode
fn decode(self: @Bytes, ref offset: u32) -> u32
SolAbiDecodeU64
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeU64
pub impl SolAbiDecodeU64 of SolAbiDecodeTrait<u64>;
Impl functions
decode
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeU64::decode
fn decode(self: @Bytes, ref offset: u32) -> u64
SolAbiDecodeU128
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeU128
pub impl SolAbiDecodeU128 of SolAbiDecodeTrait<u128>;
Impl functions
decode
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeU128::decode
fn decode(self: @Bytes, ref offset: u32) -> u128
SolAbiDecodeU256
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeU256
pub impl SolAbiDecodeU256 of SolAbiDecodeTrait<u256>;
Impl functions
decode
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeU256::decode
fn decode(self: @Bytes, ref offset: u32) -> u256
SolAbiDecodeBool
Decode other primitives
Primitives are decoded by reading 32 bytes from the offset
Bytes encoding is right-aligned/left-paddded Big-endian.
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeBool
pub impl SolAbiDecodeBool of SolAbiDecodeTrait<bool>;
Impl functions
decode
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeBool::decode
fn decode(self: @Bytes, ref offset: u32) -> bool
SolAbiDecodeFelt252
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeFelt252
pub impl SolAbiDecodeFelt252 of SolAbiDecodeTrait<felt252>;
Impl functions
decode
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeFelt252::decode
fn decode(self: @Bytes, ref offset: u32) -> felt252
SolAbiDecodeBytes31
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeBytes31
pub impl SolAbiDecodeBytes31 of SolAbiDecodeTrait<bytes31>;
Impl functions
decode
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeBytes31::decode
fn decode(self: @Bytes, ref offset: u32) -> bytes31
SolAbiDecodeBytes
Decode byte types
Bytes are decoded by reading 32 bytes from the offset
Bytes encoding is left-aligned/right-paddded
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeBytes
pub impl SolAbiDecodeBytes of SolAbiDecodeTrait<Bytes>;
Impl functions
decode
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeBytes::decode
fn decode(self: @Bytes, ref offset: u32) -> Bytes
SolAbiDecodeByteArray
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeByteArray
pub impl SolAbiDecodeByteArray of SolAbiDecodeTrait<ByteArray>;
Impl functions
decode
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeByteArray::decode
fn decode(self: @Bytes, ref offset: u32) -> ByteArray
SolAbiDecodeStarknetAddress
Decode address types
Addresses are decoded by reading 32 bytes from the offset
Bytes encoding is right-aligned/left-paddded Big-endian.
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeStarknetAddress
pub impl SolAbiDecodeStarknetAddress of SolAbiDecodeTrait<ContractAddress>;
Impl functions
decode
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeStarknetAddress::decode
fn decode(self: @Bytes, ref offset: u32) -> ContractAddress
SolAbiDecodeEthAddress
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeEthAddress
pub impl SolAbiDecodeEthAddress of SolAbiDecodeTrait<EthAddress>;
Impl functions
decode
Fully qualified path: alexandria_encoding::sol_abi::decode::SolAbiDecodeEthAddress::decode
fn decode(self: @Bytes, ref offset: u32) -> EthAddress
encode
Fully qualified path: alexandria_encoding::sol_abi::encode
Traits
| SolAbiEncodeSelectorTrait | Encode selector trait meant to provide an interface similar to Solidity’s abi.encodeWithSelector function. It is meant to be the first call in an… |
| SolAbiEncodeTrait | Encode trait meant to provide an interface similar to Solidity’s abi.encode function. It is meant to allow chaining of encode calls to build up a Bytes… |
Impls
| SolAbiEncodeSelector | — |
| SolAbiEncodeU8 | Encode int types Integers are encoded as 32 bytes long, which are right-aligned/left-padded Big-endian. Packed encodings are not padded and only append the bytes of the value based on type. |
| SolAbiEncodeU16 | — |
| SolAbiEncodeU32 | — |
| SolAbiEncodeU64 | — |
| SolAbiEncodeU128 | — |
| SolAbiEncodeU256 | — |
| SolAbiEncodeBool | Encode other primitives Primitives are encoded as 32 bytes long, which are right-aligned/left-padded Big-endian. Packed encodings are not padded and only append the bytes of the value based on type. |
| SolAbiEncodeFelt252 | — |
| SolAbiEncodeBytes31 | — |
| SolAbiEncodeBytes | Encode byte types Bytes are encoded as 32 bytes long, which are left-aligned/right-padded. Packed encodings are not padded and only append the bytes up to the length of the value. |
| SolAbiEncodeByteArray | — |
| SolAbiEncodeStarknetAddress | Encode address types Addresses are encoded as 32 bytes long, which are right-aligned/left-padded Big-endian. Packed encodings are not padded and only append the bytes of the value based on type. |
| SolAbiEncodeEthAddress | — |
Traits
Traits
| SolAbiEncodeSelectorTrait | Encode selector trait meant to provide an interface similar to Solidity’s abi.encodeWithSelector function. It is meant to be the first call in an… |
| SolAbiEncodeTrait | Encode trait meant to provide an interface similar to Solidity’s abi.encode function. It is meant to allow chaining of encode calls to build up a Bytes… |
SolAbiEncodeSelectorTrait
Encode selector trait meant to provide an interface similar to Solidity’s abi.encodeWithSelector function. It is meant to be the first call in an encode chain, adding the function selector to the encoded data. Value encoded is only 4 bytes long representing the function selector. Use like this: BytesTrait::new_empty().encode_selector(selector).encode(arg1).encode(arg2)…
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeSelectorTrait
pub trait SolAbiEncodeSelectorTrait
Trait functions
encode_selector
Encodes a function selector as 4 bytes at the beginning of the data
Arguments
self- The Bytes object to append the selector toselector- The 4-byte function selector (u32)
Returns
Bytes- The original Bytes object with the selector appended
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeSelectorTrait::encode_selector
fn encode_selector(self: Bytes, selector: u32) -> Bytes
SolAbiEncodeTrait
Encode trait meant to provide an interface similar to Solidity’s abi.encode
function. It is meant to allow chaining of encode calls to build up a Bytes
object. Values are encoded in 32 bytes chunks, and padding is added as necessary.
Also provides a packed version of the encoding similar to Solidity’s
abi.encodePacked, which does not add padding.
Use like this: BytesTrait::new_empty().encode(arg1).encode(arg2)…
Or like this: BytesTrait::new_empty().encode_packed(arg1).encode_packed(arg2)…
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeTrait
pub trait SolAbiEncodeTrait<T>
Trait functions
encode
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeTrait::encode
fn encode(self: Bytes, x: T) -> Bytes
encode_packed
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeTrait::encode_packed
fn encode_packed(self: Bytes, x: T) -> Bytes
Impls
Impls
| SolAbiEncodeSelector | — |
| SolAbiEncodeU8 | Encode int types Integers are encoded as 32 bytes long, which are right-aligned/left-padded Big-endian. Packed encodings are not padded and only append the bytes of the value based on type. |
| SolAbiEncodeU16 | — |
| SolAbiEncodeU32 | — |
| SolAbiEncodeU64 | — |
| SolAbiEncodeU128 | — |
| SolAbiEncodeU256 | — |
| SolAbiEncodeBool | Encode other primitives Primitives are encoded as 32 bytes long, which are right-aligned/left-padded Big-endian. Packed encodings are not padded and only append the bytes of the value based on type. |
| SolAbiEncodeFelt252 | — |
| SolAbiEncodeBytes31 | — |
| SolAbiEncodeBytes | Encode byte types Bytes are encoded as 32 bytes long, which are left-aligned/right-padded. Packed encodings are not padded and only append the bytes up to the length of the value. |
| SolAbiEncodeByteArray | — |
| SolAbiEncodeStarknetAddress | Encode address types Addresses are encoded as 32 bytes long, which are right-aligned/left-padded Big-endian. Packed encodings are not padded and only append the bytes of the value based on type. |
| SolAbiEncodeEthAddress | — |
SolAbiEncodeSelector
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeSelector
pub impl SolAbiEncodeSelector of SolAbiEncodeSelectorTrait;
Impl functions
encode_selector
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeSelector::encode_selector
fn encode_selector(mut self: Bytes, selector: u32) -> Bytes
SolAbiEncodeU8
Encode int types Integers are encoded as 32 bytes long, which are right-aligned/left-padded Big-endian. Packed encodings are not padded and only append the bytes of the value based on type.
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeU8
pub impl SolAbiEncodeU8 of SolAbiEncodeTrait<u8>;
Impl functions
encode
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeU8::encode
fn encode(mut self: Bytes, x: u8) -> Bytes
encode_packed
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeU8::encode_packed
fn encode_packed(mut self: Bytes, x: u8) -> Bytes
SolAbiEncodeU16
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeU16
pub impl SolAbiEncodeU16 of SolAbiEncodeTrait<u16>;
Impl functions
encode
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeU16::encode
fn encode(mut self: Bytes, x: u16) -> Bytes
encode_packed
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeU16::encode_packed
fn encode_packed(mut self: Bytes, x: u16) -> Bytes
SolAbiEncodeU32
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeU32
pub impl SolAbiEncodeU32 of SolAbiEncodeTrait<u32>;
Impl functions
encode
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeU32::encode
fn encode(mut self: Bytes, x: u32) -> Bytes
encode_packed
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeU32::encode_packed
fn encode_packed(mut self: Bytes, x: u32) -> Bytes
SolAbiEncodeU64
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeU64
pub impl SolAbiEncodeU64 of SolAbiEncodeTrait<u64>;
Impl functions
encode
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeU64::encode
fn encode(mut self: Bytes, x: u64) -> Bytes
encode_packed
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeU64::encode_packed
fn encode_packed(mut self: Bytes, x: u64) -> Bytes
SolAbiEncodeU128
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeU128
pub impl SolAbiEncodeU128 of SolAbiEncodeTrait<u128>;
Impl functions
encode
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeU128::encode
fn encode(mut self: Bytes, x: u128) -> Bytes
encode_packed
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeU128::encode_packed
fn encode_packed(mut self: Bytes, x: u128) -> Bytes
SolAbiEncodeU256
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeU256
pub impl SolAbiEncodeU256 of SolAbiEncodeTrait<u256>;
Impl functions
encode
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeU256::encode
fn encode(mut self: Bytes, x: u256) -> Bytes
encode_packed
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeU256::encode_packed
fn encode_packed(mut self: Bytes, x: u256) -> Bytes
SolAbiEncodeBool
Encode other primitives Primitives are encoded as 32 bytes long, which are right-aligned/left-padded Big-endian. Packed encodings are not padded and only append the bytes of the value based on type.
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeBool
pub impl SolAbiEncodeBool of SolAbiEncodeTrait<bool>;
Impl functions
encode
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeBool::encode
fn encode(mut self: Bytes, x: bool) -> Bytes
encode_packed
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeBool::encode_packed
fn encode_packed(mut self: Bytes, x: bool) -> Bytes
SolAbiEncodeFelt252
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeFelt252
pub impl SolAbiEncodeFelt252 of SolAbiEncodeTrait<felt252>;
Impl functions
encode
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeFelt252::encode
fn encode(mut self: Bytes, x: felt252) -> Bytes
encode_packed
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeFelt252::encode_packed
fn encode_packed(mut self: Bytes, x: felt252) -> Bytes
SolAbiEncodeBytes31
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeBytes31
pub impl SolAbiEncodeBytes31 of SolAbiEncodeTrait<bytes31>;
Impl functions
encode
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeBytes31::encode
fn encode(mut self: Bytes, x: bytes31) -> Bytes
encode_packed
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeBytes31::encode_packed
fn encode_packed(mut self: Bytes, x: bytes31) -> Bytes
SolAbiEncodeBytes
Encode byte types Bytes are encoded as 32 bytes long, which are left-aligned/right-padded. Packed encodings are not padded and only append the bytes up to the length of the value.
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeBytes
pub impl SolAbiEncodeBytes of SolAbiEncodeTrait<Bytes>;
Impl functions
encode
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeBytes::encode
fn encode(mut self: Bytes, mut x: Bytes) -> Bytes
encode_packed
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeBytes::encode_packed
fn encode_packed(mut self: Bytes, x: Bytes) -> Bytes
SolAbiEncodeByteArray
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeByteArray
pub impl SolAbiEncodeByteArray of SolAbiEncodeTrait<ByteArray>;
Impl functions
encode
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeByteArray::encode
fn encode(mut self: Bytes, x: ByteArray) -> Bytes
encode_packed
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeByteArray::encode_packed
fn encode_packed(mut self: Bytes, x: ByteArray) -> Bytes
SolAbiEncodeStarknetAddress
Encode address types Addresses are encoded as 32 bytes long, which are right-aligned/left-padded Big-endian. Packed encodings are not padded and only append the bytes of the value based on type.
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeStarknetAddress
pub impl SolAbiEncodeStarknetAddress of SolAbiEncodeTrait<ContractAddress>;
Impl functions
encode
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeStarknetAddress::encode
fn encode(mut self: Bytes, x: ContractAddress) -> Bytes
encode_packed
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeStarknetAddress::encode_packed
fn encode_packed(mut self: Bytes, x: ContractAddress) -> Bytes
SolAbiEncodeEthAddress
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeEthAddress
pub impl SolAbiEncodeEthAddress of SolAbiEncodeTrait<EthAddress>;
Impl functions
encode
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeEthAddress::encode
fn encode(mut self: Bytes, x: EthAddress) -> Bytes
encode_packed
Fully qualified path: alexandria_encoding::sol_abi::encode::SolAbiEncodeEthAddress::encode_packed
fn encode_packed(mut self: Bytes, x: EthAddress) -> Bytes
encode_as
Fully qualified path: alexandria_encoding::sol_abi::encode_as
Traits
| SolAbiEncodeAsTrait | Encode trait for arbitrarily sized encodings, meant to allow easy bytesX type encodings. Encode the value x as Bytes with a specific byteSize …. |
Impls
| SolAbiEncodeAsU256 | Encode as from int types Integers are encoded as byteSize bytes, which are right-aligned/left-padded Big-endian. |
| SolAbiEncodeAsU128 | — |
| SolAbiEncodeAsFelt252 | — |
| SolAbiEncodeAsBytes31 | — |
| SolAbiEncodeAsBytes | Encode as from bytes types Bytes are encoded as byteSize bytes, which are left-aligned/right-padded. |
| SolAbiEncodeAsByteArray | — |
Traits
Traits
| SolAbiEncodeAsTrait | Encode trait for arbitrarily sized encodings, meant to allow easy bytesX type encodings. Encode the value x as Bytes with a specific byteSize …. |
SolAbiEncodeAsTrait
Encode trait for arbitrarily sized encodings, meant to allow easy bytesX
type encodings. Encode the value x as Bytes with a specific byteSize.
Allows chaining of encode/encode_as calls to build up a Bytes object.
Use like :
let encoded: Bytes = Bytes::new_empty().encode_as(32, x).encode_as(13, y)...
Fully qualified path: alexandria_encoding::sol_abi::encode_as::SolAbiEncodeAsTrait
pub trait SolAbiEncodeAsTrait<T>
Trait functions
encode_as
Encodes a value of type T into bytes with specified byte size
Arguments
self- The Bytes object to append encoded data tobyteSize- The number of bytes to use for encoding (must be <= 32)x- The value to encode
Returns
Bytes- The original Bytes object with the encoded value appended
Fully qualified path: alexandria_encoding::sol_abi::encode_as::SolAbiEncodeAsTrait::encode_as
fn encode_as(self: Bytes, byteSize: u32, x: T) -> Bytes
Impls
Impls
| SolAbiEncodeAsU256 | Encode as from int types Integers are encoded as byteSize bytes, which are right-aligned/left-padded Big-endian. |
| SolAbiEncodeAsU128 | — |
| SolAbiEncodeAsFelt252 | — |
| SolAbiEncodeAsBytes31 | — |
| SolAbiEncodeAsBytes | Encode as from bytes types Bytes are encoded as byteSize bytes, which are left-aligned/right-padded. |
| SolAbiEncodeAsByteArray | — |
SolAbiEncodeAsU256
Encode as from int types
Integers are encoded as byteSize bytes, which are right-aligned/left-padded Big-endian.
Fully qualified path: alexandria_encoding::sol_abi::encode_as::SolAbiEncodeAsU256
pub impl SolAbiEncodeAsU256 of SolAbiEncodeAsTrait<u256>;
Impl functions
encode_as
Fully qualified path: alexandria_encoding::sol_abi::encode_as::SolAbiEncodeAsU256::encode_as
fn encode_as(mut self: Bytes, byteSize: u32, mut x: u256) -> Bytes
SolAbiEncodeAsU128
Fully qualified path: alexandria_encoding::sol_abi::encode_as::SolAbiEncodeAsU128
pub impl SolAbiEncodeAsU128 of SolAbiEncodeAsTrait<u128>;
Impl functions
encode_as
Fully qualified path: alexandria_encoding::sol_abi::encode_as::SolAbiEncodeAsU128::encode_as
fn encode_as(mut self: Bytes, byteSize: u32, mut x: u128) -> Bytes
SolAbiEncodeAsFelt252
Fully qualified path: alexandria_encoding::sol_abi::encode_as::SolAbiEncodeAsFelt252
pub impl SolAbiEncodeAsFelt252 of SolAbiEncodeAsTrait<felt252>;
Impl functions
encode_as
Fully qualified path: alexandria_encoding::sol_abi::encode_as::SolAbiEncodeAsFelt252::encode_as
fn encode_as(mut self: Bytes, byteSize: u32, x: felt252) -> Bytes
SolAbiEncodeAsBytes31
Fully qualified path: alexandria_encoding::sol_abi::encode_as::SolAbiEncodeAsBytes31
pub impl SolAbiEncodeAsBytes31 of SolAbiEncodeAsTrait<bytes31>;
Impl functions
encode_as
Fully qualified path: alexandria_encoding::sol_abi::encode_as::SolAbiEncodeAsBytes31::encode_as
fn encode_as(mut self: Bytes, byteSize: u32, x: bytes31) -> Bytes
SolAbiEncodeAsBytes
Encode as from bytes types
Bytes are encoded as byteSize bytes, which are left-aligned/right-padded.
Fully qualified path: alexandria_encoding::sol_abi::encode_as::SolAbiEncodeAsBytes
pub impl SolAbiEncodeAsBytes of SolAbiEncodeAsTrait<Bytes>;
Impl functions
encode_as
Fully qualified path: alexandria_encoding::sol_abi::encode_as::SolAbiEncodeAsBytes::encode_as
fn encode_as(mut self: Bytes, byteSize: u32, x: Bytes) -> Bytes
SolAbiEncodeAsByteArray
Fully qualified path: alexandria_encoding::sol_abi::encode_as::SolAbiEncodeAsByteArray
pub impl SolAbiEncodeAsByteArray of SolAbiEncodeAsTrait<ByteArray>;
Impl functions
encode_as
Fully qualified path: alexandria_encoding::sol_abi::encode_as::SolAbiEncodeAsByteArray::encode_as
fn encode_as(mut self: Bytes, byteSize: u32, x: ByteArray) -> Bytes
sol_bytes
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes
Traits
| SolBytesTrait | Solidity Bytes Trait meant to provide an interface similar to Solidity’s bytesX types, like bytes1 , bytes2 , bytes3 , …, bytes32 . Acts as a wrapper around the encode_as… |
Traits
Traits
| SolBytesTrait | Solidity Bytes Trait meant to provide an interface similar to Solidity’s bytesX types, like bytes1 , bytes2 , bytes3 , …, bytes32 . Acts as a wrapper around the encode_as… |
SolBytesTrait
Solidity Bytes Trait meant to provide an interface similar to Solidity’s
bytesX types, like bytes1, bytes2, bytes3, …, bytes32. Acts as
a wrapper around the encode_as to make it easier to understand and use.
Use like this:
let bytes7Val: Bytes = SolBytesTrait::bytes7(0x01020304050607_u128);
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait
pub trait SolBytesTrait<T>
Trait functions
bytes1
Creates 1-byte representation of a value
Arguments
val- The value to encode as 1 byte
Returns
Bytes- 1-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes1
fn bytes1(val: T) -> Bytes
bytes2
Creates 2-byte representation of a value
Arguments
val- The value to encode as 2 bytes
Returns
Bytes- 2-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes2
fn bytes2(val: T) -> Bytes
bytes3
Creates 3-byte representation of a value
Arguments
val- The value to encode as 3 bytes
Returns
Bytes- 3-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes3
fn bytes3(val: T) -> Bytes
bytes4
Creates 4-byte representation of a value
Arguments
val- The value to encode as 4 bytes
Returns
Bytes- 4-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes4
fn bytes4(val: T) -> Bytes
bytes5
Creates 5-byte representation of a value
Arguments
val- The value to encode as 5 bytes
Returns
Bytes- 5-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes5
fn bytes5(val: T) -> Bytes
bytes6
Creates 6-byte representation of a value
Arguments
val- The value to encode as 6 bytes
Returns
Bytes- 6-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes6
fn bytes6(val: T) -> Bytes
bytes7
Creates 7-byte representation of a value
Arguments
val- The value to encode as 7 bytes
Returns
Bytes- 7-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes7
fn bytes7(val: T) -> Bytes
bytes8
Creates 8-byte representation of a value
Arguments
val- The value to encode as 8 bytes
Returns
Bytes- 8-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes8
fn bytes8(val: T) -> Bytes
bytes9
Creates 9-byte representation of a value
Arguments
val- The value to encode as 9 bytes
Returns
Bytes- 9-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes9
fn bytes9(val: T) -> Bytes
bytes10
Creates 10-byte representation of a value
Arguments
val- The value to encode as 10 bytes
Returns
Bytes- 10-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes10
fn bytes10(val: T) -> Bytes
bytes11
Creates 11-byte representation of a value
Arguments
val- The value to encode as 11 bytes
Returns
Bytes- 11-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes11
fn bytes11(val: T) -> Bytes
bytes12
Creates 12-byte representation of a value
Arguments
val- The value to encode as 12 bytes
Returns
Bytes- 12-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes12
fn bytes12(val: T) -> Bytes
bytes13
Creates 13-byte representation of a value
Arguments
val- The value to encode as 13 bytes
Returns
Bytes- 13-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes13
fn bytes13(val: T) -> Bytes
bytes14
Creates 14-byte representation of a value
Arguments
val- The value to encode as 14 bytes
Returns
Bytes- 14-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes14
fn bytes14(val: T) -> Bytes
bytes15
Creates 15-byte representation of a value
Arguments
val- The value to encode as 15 bytes
Returns
Bytes- 15-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes15
fn bytes15(val: T) -> Bytes
bytes16
Creates 16-byte representation of a value
Arguments
val- The value to encode as 16 bytes
Returns
Bytes- 16-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes16
fn bytes16(val: T) -> Bytes
bytes17
Creates 17-byte representation of a value
Arguments
val- The value to encode as 17 bytes
Returns
Bytes- 17-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes17
fn bytes17(val: T) -> Bytes
bytes18
Creates 18-byte representation of a value
Arguments
val- The value to encode as 18 bytes
Returns
Bytes- 18-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes18
fn bytes18(val: T) -> Bytes
bytes19
Creates 19-byte representation of a value
Arguments
val- The value to encode as 19 bytes
Returns
Bytes- 19-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes19
fn bytes19(val: T) -> Bytes
bytes20
Creates 20-byte representation of a value
Arguments
val- The value to encode as 20 bytes
Returns
Bytes- 20-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes20
fn bytes20(val: T) -> Bytes
bytes21
Creates 21-byte representation of a value
Arguments
val- The value to encode as 21 bytes
Returns
Bytes- 21-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes21
fn bytes21(val: T) -> Bytes
bytes22
Creates 22-byte representation of a value
Arguments
val- The value to encode as 22 bytes
Returns
Bytes- 22-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes22
fn bytes22(val: T) -> Bytes
bytes23
Creates 23-byte representation of a value
Arguments
val- The value to encode as 23 bytes
Returns
Bytes- 23-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes23
fn bytes23(val: T) -> Bytes
bytes24
Creates 24-byte representation of a value
Arguments
val- The value to encode as 24 bytes
Returns
Bytes- 24-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes24
fn bytes24(val: T) -> Bytes
bytes25
Creates 25-byte representation of a value
Arguments
val- The value to encode as 25 bytes
Returns
Bytes- 25-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes25
fn bytes25(val: T) -> Bytes
bytes26
Creates 26-byte representation of a value
Arguments
val- The value to encode as 26 bytes
Returns
Bytes- 26-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes26
fn bytes26(val: T) -> Bytes
bytes27
Creates 27-byte representation of a value
Arguments
val- The value to encode as 27 bytes
Returns
Bytes- 27-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes27
fn bytes27(val: T) -> Bytes
bytes28
Creates 28-byte representation of a value
Arguments
val- The value to encode as 28 bytes
Returns
Bytes- 28-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes28
fn bytes28(val: T) -> Bytes
bytes29
Creates 29-byte representation of a value
Arguments
val- The value to encode as 29 bytes
Returns
Bytes- 29-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes29
fn bytes29(val: T) -> Bytes
bytes30
Creates 30-byte representation of a value
Arguments
val- The value to encode as 30 bytes
Returns
Bytes- 30-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes30
fn bytes30(val: T) -> Bytes
bytes31
Creates 31-byte representation of a value
Arguments
val- The value to encode as 31 bytes
Returns
Bytes- 31-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes31
fn bytes31(val: T) -> Bytes
bytes32
Creates 32-byte representation of a value
Arguments
val- The value to encode as 32 bytes
Returns
Bytes- 32-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes32
fn bytes32(val: T) -> Bytes
bytes
Creates n-byte representation of a value
Arguments
len- The number of bytes to use for encodingval- The value to encode
Returns
Bytes- n-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes
fn bytes(len: u32, val: T) -> Bytes