mars-protocol / cw-asset

A unified representation of various types of Cosmos fungible assets, and helper functions for interacting with them
Apache License 2.0
27 stars 13 forks source link

Legacy example doesn't work #2

Closed etienne-napoleone closed 2 years ago

etienne-napoleone commented 2 years ago

Based on the example at https://docs.rs/cw-asset/0.3.4/cw_asset/#legacy-feature, get error:

the trait bound Asset: From<AssetBase<cosmwasm_std::addresses::Addr>> is not satisfied required because of the requirements on the impl of Into<Asset> for AssetBase<cosmwasm_std::addresses::Addr>

Cargo.toml

[package]
name = "test-assetinfo"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
cw-asset = { version = "0.3.3", features = ["legacy"] }
astroport = "1.0.1"

main.rs

fn main() {
    let a = cw_asset::Asset::native("uusd", 1u128);
    let b: astroport::asset::Asset = a.into();
}
larry0x commented 2 years ago

This issue is due to that Astroport recently bumped their version number from v0.3 to v1.0, while cw-asset still uses v0.3. Fixed in https://github.com/mars-protocol/cw-asset/commit/5612c5a75b314aad0f50001829cf65c10dd0d9ed

etienne-napoleone commented 2 years ago

Thanks @larry0x