newbie here, not sure about the terminology, feel free to correct. I'm using Taquito to make a dApp, and using Beacon/Kukai for my wallet. I'm am able to connect to my wallet and programmatically fulfill a method on a smart-contract, but every time I do so, Kukai asks for my approval. I'd like to bypass this authentication, and be able to call methods without needing to clicking on a button in Kukai. How do I do that?
2 Answers
you need to use an in-memory signer to sign the transaction using the private key associated with the wallet that is doing the approval. note that this means you’ll need server architecture of some kind because putting the private key in a client side React app means basically giving the private key to anyone who visits your website - don’t do that :)
The short answer is you can't and you shouldn't. :)
The long answer: Whenever you do an operation on the blockchain, a signature is required from your wallet to "authorise" the transaction. So every time funds are spent or a contract call is done, the wallet needs the details of that operation and calculate a signature for that specific operation. The private key that can do this is located in your wallet, in your case Kukai. This private key holds all of the users tez, tokens, NFTs, etc. It is VERY important that it doesn't fall into the wrong hands, because someone with the private key can steal all the users funds. Wallets will never share that private key with anyone for security reasons.
In theory, wallets could choose to automatically sign something without user interaction, but that is not always possible. For example, if someone uses an hardware signer, then he needs to give his approval on the hardware device, it simply isn't possible without it.
As damian said, the only real option you have is to basically have the private key on your website (in the frontend). But unless you have a very specific use case, that is a terrible thing to do because of the security risks.
If you have to do multiple contract calls at once, they can be batched into a single operation, so you only have to sign one thing, making the user experience better.