You might want to convert between the native types (Bytes32
, Address
, ContractId
, and AssetId
). Because these types are wrappers on [u8; 32]
, converting is a matter of dereferencing one and instantiating the other using the dereferenced value. Here's an example:
use fuels::types::{AssetId, ContractId};
let contract_id = ContractId::new([1u8; 32]);
let asset_id: AssetId = AssetId::new(*contract_id);
assert_eq!([1u8; 32], *asset_id);