In rest.rs I have
fn native_asset_contract_address(e: &Env) -> Address {
let env = Env::default();
let native_asset = Asset::Native;
let contract_id_preimage = ContractIdPreimage::Asset(native_asset);
let bytes = Bytes::from_slice(&e, &contract_id_preimage.to_xdr().unwrap());
let native_asset_address = Address::from_contract_id(&e.crypto().sha256(&bytes));
native_asset_address
}
.
.
.
// Set the native token address
let native_address =native_asset_contract_address(&e);
let expected_address_string="CDF3YSDVBXV3QU2QSOZ55L4IVR7UZ74HIJKXNJMN4K5MOVFM3NDBNMLY";
assert_eq!(native_address, expected_address_string);
And I get this error
--> src/test.rs:49:5
|
49 | assert_eq!(native_address, expected_address_string);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| expected `Address`, found `&str`
| expected because this is `soroban_sdk::Address`
It's obvious because they are not the same.... But, how can I build an Address object with the string of the address? Thanks!