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

Implement `FromStr` for the unchecked types #4

Closed larry0x closed 2 years ago

larry0x commented 2 years ago

We should be able to so this:

let info_unchecked = AssetInfoUnchecked::from_str("native:uatom")?;
let info = info_unchecked.check(api, None)?;

let asset_unchecked = AssetUnchecked::from_str("cw20:terra1a7zxk56c72elupp7p44hn4k94fsvavnhylhr6h:12345")?;
let asset = asset_unchecked.check(api, None)?;

let list_unchecked = AssetListUnchecked::from_str("native:uatom:12345,native:uluna:69420")?;
let list = list.unchecked.check(api, None)?;
larry0x commented 2 years ago

Implemented in https://github.com/mars-protocol/cw-asset/commit/4189af317ad756ef7635f12b83b5758fdd47592a