Signing Transactions
After the user authenticates, the Enoki SDK can return a key pair for the user. You can use this key pair to sign the user's transactions.
Example
Consider the following code example. Unseen here, both the
SuiClientProvider and
EnokiFlowProvider contexts wrap the root of this app. Doing this provides
access to the useSuiClient
and useEnokiFlow
hooks.
When the user taps or clicks the Sign transaction button, this example has Enoki retrieve the
key pair created during a separate log in workflow (enokiFlow.getKeypair()
). The logic then uses
that result to sign the transaction built to the tx
variable.
Unlike a wallet, this example does not require confirmation to approve the transaction. In a production app, you should provide logic that informs the user they are performing a transaction and allow them to cancel it if it was unintended.