UNPKG

@privy-io/react-auth

Version:

React client for the Privy Auth API

75 lines (70 loc) 2.54 kB
import { CurveSigningChainType, Wallet } from '@privy-io/api-types'; import { U as User } from './types-D7U23FgR.js'; import '@coinbase/wallet-sdk'; import '@simplewebauthn/browser'; import '@solana/kit'; import 'react'; import 'viem'; import '@privy-io/js-sdk-core'; import '@base-org/account'; import '@wallet-standard/base'; import '@solana/wallet-standard-features'; import '@wallet-standard/features'; import 'eventemitter3'; interface CreateWalletInput { /** The chain type of the wallet to create. */ chainType: CurveSigningChainType | 'spark'; } interface CreateWalletOutput { user: User; wallet: Wallet; } interface UseCreateWalletInterface { /** * Create a new wallet for the user, on an extended chain. */ createWallet: (input: CreateWalletInput) => Promise<CreateWalletOutput>; } declare const useCreateWallet: () => UseCreateWalletInterface; /** * Hook to export extended chain wallets (e.g., spark wallets). * These are wallets built on the unified stack. */ interface UseExportWalletInterface { /** * Shows the user a Privy modal, from which they can copy their embedded wallet's private * key for easy export to another wallet client. The private key is loaded * on an iframe running on a separate domain from your app, meaning your app cannot access it. * * This method will error if the user is not authenticated or does not have an embedded wallet * for the specified address. * * @param options {@link {address: string}} wallet address to export the private key for * @returns Promise that resolves once the user exits the modal */ exportWallet: (options: { address: string; }) => Promise<void>; } declare function useExportWallet(): UseExportWalletInterface; interface SignRawHashInput { /** The address of the wallet to sign the hash with. */ address: string; /** The chain type of the wallet to sign the hash with. */ chainType: CurveSigningChainType; /** The hash to sign. */ hash: `0x${string}`; } interface SignRawHashOutput { /** The signature of the hash. */ signature: `0x${string}`; } interface UseSignRawHashInterface { /** * Sign a raw hash with a wallet along the blockchain's cryptographic curve. * This is only supported for extended chains. */ signRawHash: (input: SignRawHashInput) => Promise<SignRawHashOutput>; } declare const useSignRawHash: () => UseSignRawHashInterface; export { useCreateWallet, useExportWallet, useSignRawHash };