Vana SDK - v0.1.0
    Preparing search index...

    Function handleRelayerRequest

    • Unified server-side handler for processing relayed transactions.

      This function encapsulates the complete relayer workflow:

      1. Verifies the signature against the typed data
      2. Optionally checks the signer matches the expected user address
      3. Routes to the appropriate SDK method based on primaryType
      4. Returns the resulting transaction hash

      Supported transaction types:

      • Permission: Permission grants
      • PermissionRevoke: Permission revocations
      • TrustServer: Trust server operations
      • UntrustServer: Untrust server operations

      Parameters

      Returns Promise<`0x${string}`>

      Promise resolving to the transaction hash

      When signature verification fails or signer mismatch occurs

      When primaryType is unsupported or SDK operations fail

      import { handleRelayerRequest } from '@opendatalabs/vana-sdk';

      // In your relayer API endpoint:
      export async function POST(request: NextRequest) {
      try {
      const body = await request.json();
      const vana = await createRelayerVana();

      const txHash = await handleRelayerRequest(vana, {
      typedData: body.typedData,
      signature: body.signature,
      expectedUserAddress: body.expectedUserAddress
      });

      return NextResponse.json({
      success: true,
      transactionHash: txHash
      });
      } catch (error) {
      return NextResponse.json({
      success: false,
      error: error.message
      }, { status: 500 });
      }
      }