I don’t see where you use a key in the above code snippet.
When invoking a contract, you must specify an invoker (of type accountAddress). Since an accountAddress is not a private and not a public key, you don’t need any of the keys.
I assume that with invoking a contract you mean you want to read from the smart contract, which does not require any signing of a transaction. Here is an explanation:
When interacting with smart contracts on-chain, there are two main options available:
Reading from the smart contract state
Writing to the smart contract state
Reading can be done with the dryRun... function (generated by ccd-js-gen tool; some SDKs use the name invoke for that operation) which interacts with just one blockchain node to read some values from the smart contract state of that node. This interaction should be used if you call a function in the smart contract that has a returnValue. Think about the interaction as a 'simulation/dryRun`, the node will not persist any changes done in the interaction. No transaction is generated (hence no transaction hash, no signing of a transaction needed) and the blockchain (the other nodes) are not aware of your interactions at all.
Writing to the smart contract so that your changes persist has to be done by sending a transaction on-chain. This transaction (while sent to one node in the blockchain) is then distributed to every other node in the blockchain and every node is aware and persists your changes permanently. You have to sign a transaction with your private key, and pay transaction fees to the blockchain. Write functions in the smart contract usually don’t have a returnValue since they are not meant for reading.
When the dapp is supposed to send a transaction (meaning execute a write action), then this transaction is first simulated via the read action to see if the transaction reverts, and if not the same transaction is signed and then finally sent via a write action to the chain.
Thx for great explanation, so I intend to mint tokens (with mint method), since this is a write operation, the above code is incomplete, there should be a signing operation as well?