Mumbai
API
Deprecation
The type tx_rollup_l2_address
has been disabled (see the changelog for the Mumbai protocol).
New operators
Bitwise operators of bytes
Bitwise operations are now supported on bytes
const test_bytes_bitwise_module = (() => {
const b_and = Bitwise.and (0x0005, 0x0106 );
const b_or = Bitwise.or (0x0005, 0x0106 );
const b_xor = Bitwise.xor (0x0005, 0x0106 );
const b_shift_left = Bitwise.shift_left (0x06 , 8 as nat);
const b_shift_right = Bitwise.shift_right (0x0006, 1 as nat);
assert (b_and == 0x0004 &&
b_or == 0x0107 &&
b_xor == 0x0103 &&
b_shift_left == 0x0600 &&
b_shift_right == 0x0003 )})()
Conversion between bytes
-int
& bytes
-nat
We can now convert between bytes
-int
& bytes
-nat
using the functions
int
(Convertbytes
toint
)nat
(Convertbytes
tonat
)bytes
(Convertbytes
to eitherint
ornat
)
/* bytes -> nat */
const test_bytes_nat = nat(0x1234) // (1234 as nat)
/* nat -> bytes */
const test_nat_bytes = bytes(4660 as nat) // 0x1234
/* bytes -> int */
const test_bytes_int = int(0x1234) // 4660
/* int -> bytes */
const test_int_bytes = bytes(4660) // 0x1234