Attributes
- Companion
- class
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ByteString.type
Members list
Type members
Inherited classlikes
Attributes
- Inherited from:
- ByteStringOffchainApi (hidden)
- Supertypes
Attributes
- Inherited from:
- ByteStringOffchainApi (hidden)
- Supertypes
Attributes
- Inherited from:
- ByteStringOffchainApi (hidden)
- Supertypes
-
trait Ordering[ByteString]trait PartialOrdering[ByteString]trait Equiv[ByteString]trait Serializabletrait Comparator[ByteString]class Objecttrait Matchableclass AnyShow all
Value members
Concrete methods
Encodes a BigInt value as a Big-Endian (most-significant bytes first) ByteString
.
Encodes a BigInt value as a Big-Endian (most-significant bytes first) ByteString
.
Value parameters
- size
-
is the expected size in number of bytes.
- value
-
is the value to encode.
Attributes
- Note
-
This function fails (i.e. halts the program) if the value cannot fit in the given size. When the size is too large, the ByteString is left-padded with zeroes.
- Example
-
ByteString.fromBigIntBigEndian(1_000_000, 3) == hex"0f4240" ByteString.fromBigIntBigEndian(1_000_000, 5) == hex"00000f4240" ByteString.fromBigIntBigEndian(0, 8) == hex"0000000000000000" ByteString.fromBigIntBigEndian(1_000_000, 1) => 💥
Encodes a BigInt value as a Little-Endian (least-significant bytes first) ByteString
.
Encodes a BigInt value as a Little-Endian (least-significant bytes first) ByteString
.
Value parameters
- size
-
is the expected size in number of bytes.
- value
-
is the value to encode.
Attributes
- Example
-
ByteString.fromBigIntLittleEndian(1_000_000, 3) == hex"40420f" ByteString.fromBigIntLittleEndian(1_000_000, 5) == hex"40420f0000" ByteString.fromBigIntLittleEndian(0, 8) == hex"0000000000000000" ByteString.fromBigIntLittleEndian(1_000_000, 1) => 💥
Inherited methods
Creates a ByteString from a variable number of bytes
Creates a ByteString from a variable number of bytes
Offchain operation, not available onchain.
Attributes
- Inherited from:
- ByteStringOffchainApi (hidden)
Creates a ByteString of a given size filled with a specific byte
Creates a ByteString of a given size filled with a specific byte
Offchain operation, not available onchain.
Value parameters
- byte
-
the byte to fill the ByteString with
- size
-
the size of the ByteString
Attributes
- Inherited from:
- ByteStringOffchainApi (hidden)
Creates a ByteString from an [[Array[Byte]]
Creates a ByteString from an [[Array[Byte]]
Offchain operation, not available onchain.
Attributes
- Note
-
This method is specially treated by the Scalus compiler plugin, thus it's not required to be in the @Compile module.
- Inherited from:
- ByteStringOffchainApi (hidden)
Creates a ByteString from a hexadecimal string
Creates a ByteString from a hexadecimal string
Onchain and offchain operation.
Value parameters
- bytes
-
the hexadecimal string to convert to a ByteString
Attributes
- Note
-
This method is specially treated by the Scalus compiler plugin, thus it's not required to be in the @Compile module.
- Inherited from:
- ByteStringOffchainApi (hidden)
Creates a ByteString from a UTF-8 encoded string
Creates a ByteString from a UTF-8 encoded string
Onchain and offchain operation.
Value parameters
- s
-
the string to convert to a ByteString
Attributes
- Note
-
This method is specially treated by the Scalus compiler plugin, thus it's not required to be in the @Compile module.
- Inherited from:
- ByteStringOffchainApi (hidden)
Creates a ByteString from an array of bytes without copying the array
Creates a ByteString from an array of bytes without copying the array
Attributes
- Inherited from:
- ByteStringOffchainApi (hidden)
Inherited fields
Creates an empty ByteString
Creates an empty ByteString
Onchain and offchain operation.
Attributes
- Note
-
This field is specially treated by the Scalus compiler plugin, thus it's not required to be in the @Compile module.
- Inherited from:
- ByteStringOffchainApi (hidden)
Givens
Inherited givens
Attributes
- Inherited from:
- ByteStringOffchainApi (hidden)
Attributes
- Inherited from:
- ByteStringOffchainApi (hidden)
Attributes
- Inherited from:
- ByteStringOffchainApi (hidden)
Extensions
Extensions
Prepends a BigInt to a ByteString and returns a new ByteString
Prepends a BigInt to a ByteString and returns a new ByteString
Attributes
Concatenates two ByteStrings and returns a new ByteString
Concatenates two ByteStrings and returns a new ByteString
Attributes
Checks if one 'ByteString' is less than another
Checks if one 'ByteString' is less than another
Attributes
Checks if one 'ByteString' is less than or equal to another
Checks if one 'ByteString' is less than or equal to another
Attributes
Checks if one 'ByteString' is greater than another
Checks if one 'ByteString' is greater than another
Attributes
Checks if one 'ByteString' is greater than or equal to another
Checks if one 'ByteString' is greater than or equal to another
Attributes
Returns the byte at the specified index in the ByteString
Returns the byte at the specified index in the ByteString
Attributes
- Throws
-
BuiltinException
if the index is out of bounds (offchain)
Drops the first n
bytes from the ByteString
Drops the first n
bytes from the ByteString
Value parameters
- n
-
the number of bytes to drop
Attributes
- Example
-
hex"1234567890abcdef".drop(0) // returns hex"1234567890abcdef" hex"1234567890abcdef".drop(4) // returns hex"90abcdef" hex"1234567890abcdef".drop(20) // returns hex"" hex"".drop(20) // returns hex""
Returns the length of the ByteString
Returns the length of the ByteString
Attributes
Returns a new ByteString that is a slice of the original ByteString
Returns a new ByteString that is a slice of the original ByteString
Value parameters
- from
-
the starting index of the slice (inclusive)
- len
-
the length of the slice
Attributes
- Example
-
hex"1234567890abcdef".slice(2, 4) // returns hex"567890ab" hex"1234567890abcdef".slice(5, 4) // returns hex"abcdef" hex"1234567890abcdef".slice(9, 4) // returns hex"" hex"1234567890abcdef".slice(0, 0) // returns hex""
Takes the first n
bytes from the ByteString
Takes the first n
bytes from the ByteString
Value parameters
- n
-
the number of bytes to take
Attributes
- Example
-
hex"1234567890abcdef".take(0) // returns hex"" hex"1234567890abcdef".take(4) // returns hex"12345678" hex"1234567890abcdef".take(20) // returns hex"1234567890abcdef" hex"".take(20) // returns hex""
Inherited extensions
Hex string interpolator
Hex string interpolator
Works on and offchain. Converts a hexadecimal string to a ByteString.
Attributes
- Note
-
This method is specially treated by the Scalus compiler plugin, thus it's not required to be in the @Compile module.
- Example
-
val hexString = hex"deadbeef" val withSpaces = hex"de ad be ef" val upperCase = hex"DEADBEEF"
- Inherited from:
- ByteStringOffchainApi (hidden)