Learn how to sign transactions and messages in your React app using Turnkey’s Embedded Wallets or an external browser wallet.
signMessage
function from the useTurnkey
hook. You can grab the wallet account you want to use from the wallets
array in the useTurnkey
hook.
handleSignMessage
function from the useTurnkey
hook. This will automatically show a modal with the message to sign.
signTransaction
function from the useTurnkey
hook. Similar to signing messages, you can grab the wallet account you want to use from the wallets
array.
signMessage
, handleSignMessage
or signTransaction
functions can be used. You simply need to pass in the external wallet’s walletAccount
object from the same wallets
array.
You can check if the wallet is an external wallet by checking the source
property of the wallet
object: