# TonSmartContractAddress Provides functions to work with TON smart contract addresses. See [Smart Contract Address](https://ton.org/docs/learn/overviews/addresses) for more info. #### Parse any address into any other address. ```Rust let raw = "0:ba60bfbd527c0cd2d70c6396630c50a498af015b987adaad1d4a9e287f604536"; let bounceable = "EQC6YL-9UnwM0tcMY5ZjDFCkmK8BW5h62q0dSp4of2BFNvnA"; let non_bounceable = "UQC6YL-9UnwM0tcMY5ZjDFCkmK8BW5h62q0dSp4of2BFNqQF"; let raw1 = RawAddress::from_raw_str(raw).unwrap(); let raw2 = RawAddress::from_user_friendly_str(bounceable).unwrap(); let raw3 = RawAddress::from_user_friendly_str(non_bounceable).unwrap(); let user_friendly1 = UserFriendlyAddress::from_raw_str(raw).unwrap(); let user_friendly2 = UserFriendlyAddress::from_user_friendly_str(bounceable).unwrap(); let user_friendly3 = UserFriendlyAddress::from_user_friendly_str(non_bounceable).unwrap(); ``` #### Convert any address to any other address. ```Rust let raw1 = user_friendly1.to_raw(); let raw2 = RawAddress::from_user_friendly(&user_friendly2); let user_friendly1 = raw1.to_user_friendly(UserFriendlyFlag::Bounceable); let user_friendly2 = UserFriendlyAddress::from_raw(&raw2, UserFriendlyFlag::Bounceable).unwrap(); ``` #### Build strings in any format. ```Rust let raw_string1 = raw1.to_string(); let user_friendly_string1 = raw1.to_user_friendly_str(UserFriendlyFlag::Bounceable); let raw_string2 = user_friendly1.to_raw_str(); let user_friendly_string2 = user_friendly1.to_string(); ``` #### Customize addresses ```Rust let mut raw1 = RawAddress::from_raw_str(raw).unwrap(); raw1.set_workchain(Workchaain::MasterChain); let custom_flag = unsafe{ UserFriendlyFlag::custom(0x01) }; let user_friendly1 = raw1.to_user_friendly(custom_flag); ```