pub fn nft_transfer(
        &mut self,
        nft_account_id: AccountId,
        to_token_id: String,
        to_account_id: AccountId,
    ) {
        assert_eq!(self.owner_id, env::predecessor_account_id(), "Must be owner");

        // Check if treasury holds the ft, and has enough balance
        let mut tokens = self.nft_holdings.get(&nft_account_id).expect("NFT Account not found");
        assert!(tokens.contains(&to_token_id), "NFT Token ID not found");

        // NOTE: Lame logic here, should be changed to callback
        let index = tokens.iter().position(|x| x == &to_token_id);
        if let Some(index) = index {
            tokens.remove(index);
            self.nft_holdings.insert(&nft_account_id, &tokens);
        }
        
        let p = env::promise_create(
            nft_account_id,
            b"nft_transfer",
            json!({
                "receiver_id": to_account_id,
                "token_id": to_token_id,
            }).to_string().as_bytes(),
            ONE_YOCTO,
            GAS_NFT_TRANSFER
        );

        env::promise_return(p);
    }
/// Transfer Non-Fungible Token
/// NOTE: Assumes storage deposit has occurred for recipient
/// 
/// ```bash
/// near call treasury.testnet nft_transfer '{"nft_account_id": "image.testnet", "to_account_id": "user.account.testnet", "to_token_id": "100000000000000000000000000000000"}' --accountId treasury.testnet
/// ```
Transfer Non-Fungible Token
NOTE: Assumes storage deposit has occurred for recipient


Transfer Non - Fungible Token NOTE : Assumes storage deposit has occurred for recipient
pub fn nft_transfer(
        &mut self,
        nft_account_id: AccountId,
        to_token_id: String,
        to_account_id: AccountId,
    ) {
        assert_eq!(self.owner_id, env::predecessor_account_id(), "Must be owner");
        // Check if treasury holds the ft, and has enough balance
        let mut tokens = self.nft_holdings.get(&nft_account_id).expect("NFT Account not found");
        assert!(tokens.contains(&to_token_id), "NFT Token ID not found");
        // NOTE: Lame logic here, should be changed to callback
        let index = tokens.iter().position(|x| x == &to_token_id);
        if let Some(index) = index {
            tokens.remove(index);
            self.nft_holdings.insert(&nft_account_id, &tokens);
        }
        let p = env::promise_create(
            nft_account_id,
            b"nft_transfer",
            json!({
                "receiver_id": to_account_id,
                "token_id": to_token_id,
            }).to_string().as_bytes(),
            ONE_YOCTO,
            GAS_NFT_TRANSFER
        );
        env::promise_return(p);
    }
pub fn nft_transfer ( & mut self , nft_account_id : AccountId , to_token_id : String , to_account_id : AccountId , ) { assert_eq ! ( self owner_id env predecessor_account_id ( ) " " ) ; // Check if treasury holds the ft, and has enough balance let mut tokens = self . nft_holdings . get ( & nft_account_id ) . expect ( " " ) ; assert ! ( tokens contains ( to_token_id ) " " ) ; // NOTE: Lame logic here, should be changed to callback let index = tokens . iter ( ) . position ( | x | x == & to_token_id ) ; if let Some ( index ) = index { tokens . remove ( index ) ; self . nft_holdings . insert ( & nft_account_id , & tokens ) ; } let p = env :: promise_create ( nft_account_id , b" " , json ! ( { " " to_account_id " " to_token_id } ) . to_string ( ) . as_bytes ( ) , ONE_YOCTO , GAS_NFT_TRANSFER ) ; env :: promise_return ( p ) ; }
Transfer Non-Fungible Token
NOTE: Assumes storage deposit has occurred for recipient
Transfer Non - Fungible Token NOTE : Assumes storage deposit has occurred for recipient
&mut self
nft_account_id
AccountId
to_token_id
String
to_account_id
AccountId
&mut self
nft_account_id
AccountId
to_token_id
String
to_account_id
AccountId