Hi there,
Can anyone provide me an example script to demonstrate how ExecuteScriptAtLatestBlock can be used to read variables from an existing contract? I understand the method can be used for this, but none of the examples I’ve found demonstrate interaction with another contract.
Thanks, Tim
You can find a simple example here: https://github.com/onflow/flow-ft/blob/master/transactions/scripts/get_supply.cdc
The script reads the totalSupply
field from the ExampleToken
contract defined here: https://github.com/onflow/flow-ft/blob/master/contracts/ExampleToken.cdc#L5-L6