It’s generally up to the client-side application to create the “access list”, specifying which contracts will be included in the transaction.
The application can call estimate_tx_dependencies
, which will simulate the transaction and generate the contract list (similar to gas estimation on the EVM). But in the case you described, where the dependencies can change at execution time, the application would manually add all possible dependencies using the functions with_contracts
or with_contract_ids
.
This page in the docs explains dependency estimation for the Rust SDK, although the same principles apply to the TypeScript SDK.