v2.1.0
Implement a new struct AssetInfoKey
, which allows AssetInfo
to be used as storage keys in maps:
use cosmwasm_std::testing::mock_dependencies;
use cw_asset::{AssetInfo, AssetInfoKey};
use cw_storage_plus::Map;
let deps = mock_dependencies();
let map: Map<AssetInfoKey, u64> = Map::new("map");
map.save(
deps.as_mut().storage,
AssetInfo::native("uosmo").into(), // cast AssetInfo into AssetInfoKey
&12345,
)
.unwrap();