Getting Started
Setting up the Torque in a React application
Requirements
Installation
npm install @torque-labs/react @torque-labs/sdk --saveSetup
TorqueProvider
import type { PropsWithChildren } from "react";
import { useWallet } from '@solana/wallet-adapter-react';
import { TorqueProvider } from '@torque-labs/react';
function Provider({ children }: PropsWithChildren) {
const { wallet } = useWallet();
const torqueOptions = {
apiUrl: "https://server.torque.so",
rpcUrl: "<solana rpc>", // Your Solana RPC URL
authDomain: "your-app-domain.com", // Used for Sign-In-With-Solana (SIWS)
}
return (
<TorqueProvider options={torqueOptions} wallet={wallet}>
{children}
</TorqueProvider>
);
}Required Props
TorqueProvider Context
Authentication
Advanced Usage
Using Transaction-Based Authentication
Last updated