How can I query the balance of a contract from the SDK?

You can get the balance of a contract using the provider as shown in the example below:

let provider = wallet.get_provider().unwrap();
let balance = provider

You can also use the get_balances method if you have the contract instance.

let contract_balances = contract_instance.get_balances().await?;