pub struct TokenUtils;Expand description
token utils
Implementations§
Source§impl TokenUtils
impl TokenUtils
Sourcepub fn build_standard_token_type(
creator: &str,
collection: &str,
name: &str,
) -> String
pub fn build_standard_token_type( creator: &str, collection: &str, name: &str, ) -> String
Building standard token types
§Params
creator - token creator address collection - collection name name - token name
§Example
use crate::token::TokenUtils;
use crate::global::rpc::APTOS_MAINNET_URL;
let token_type = TokenUtils::build_standard_token_type(
"0x123",
"my_collection",
"MyToken"
);
assert_eq!(token_type, "0x123::my_collection::MyToken");Sourcepub fn parse_token_type(token_type: &str) -> Option<(String, String, String)>
pub fn parse_token_type(token_type: &str) -> Option<(String, String, String)>
parse token type
§Arguments
token_type - Full token type string
§Example
use crate::token::TokenUtils;
let token_type = "0x123::my_collection::MyToken";
if let Some((creator, collection, name)) = TokenUtils::parse_token_type(token_type) {
println!("Creator: {}, Collection: {}, Name: {}", creator, collection, name);
}Sourcepub fn is_valid_token_address(address: &str) -> bool
pub fn is_valid_token_address(address: &str) -> bool
Auto Trait Implementations§
impl Freeze for TokenUtils
impl RefUnwindSafe for TokenUtils
impl Send for TokenUtils
impl Sync for TokenUtils
impl Unpin for TokenUtils
impl UnwindSafe for TokenUtils
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more