Blacklisting Addresses

Blacklist Management

Note that only public tokens can blacklist addresses.


// 7. Manage blacklist (add address) 
    println!("\n7. Manage Blacklist");
    println!("===================");

    if let Some(ref info) = token_info {
        if !info.is_private {
            println!("Token is public - proceeding with blacklist operation");
            let blacklist_payload = TokenBlacklistPayload {
                recent_epoch: state.epoch,
                recent_checkpoint: state.checkpoint,
                chain_id,
                nonce: current_nonce,
                action: BlacklistAction::Add,
                address: recipient_address,
                token: token_address,
            };
            current_nonce += 1; // Increment for next transaction

            match client
                .manage_blacklist(blacklist_payload, private_key)
                .await
            {
                Ok(response) => {
                    println!("Address blacklisted - Tx: {}", response.hash);
                }
                Err(e) => {
                    print_detailed_error("Could not manage blacklist", &e);
                }
            }
        } else {
            println!("Token is private - skipping blacklist operation (not applicable)");
        }
    } else {
        println!("Token metadata not available - skipping blacklist operation");
    }
 

Last updated