Okay After some studying and testing on the playground the answer is a yes.
Whilst the Ledger.Constraints
can not be taken as an input to the smart contract, it can be called from the validator part of the code, not just the Endpoints.
The exception is that if you have multiple smart contracts in a single Dapp the output of the first could be the input to the second. This would allow you to call Ledger.Constraints
from the first contract and have the data readily available in the second.
You can use the Ledger.Contract
module to query the chain, but it's limited and unstable. I am currently writing the CIP to fix this, so you may be able to do this easily and efficiently at the time of reading, but not writing.
Below is a link to a conversation with the plutus team on this topic: https://github.com/input-output-hk/plutus-apps/issues/339