Using the Hooks
The Torque UI library provides a set of React hooks that make it easy to integrate Torque functionality into your Solana application. To use the hooks below, make sure that you've already setup the TorqueProvider
inside of your app. The hooks can only be used if the Torque context exists.
useTorque
The main hook for interacting with the Torque SDK. The hook makes it easy to access and interact with the user's offers if you want to implement them directly in your application.
Returns
useOfferStatus
The useOfferStatus hook provides information about the status of a specific offer for the current user.
Returns
useAction
The useAction hook provides a utility for handling Torque Solana actions returned from the Torque API. The actions are Solana actions that allow the user to complete a requirement for an offer.
NOTE: The hook will automatically prompt the user's wallet for their signature.
Returns
Types
TorqueOptions
TorqueOptions
is an interface that defines the configuration options for the Torque SDK:
TorqueInitOptions
If you already have a SIWS or basic signature in your app, you can use the loginInput
property of the TorqueInitOptions
interface to initialize the user with Torque. This lets Torque validate the user's identity and retrieve their offers without requiring a secondary signature to authenticate with Torque.
HandleActionProps
The HandleActionProps
interface is used by the handleBountyStepAction
in the useAction
hook to handle Torque actions.
Last updated