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

    Function Vana

    • Creates a new Vana SDK instance configured for browser environments.

      This function automatically provides the correct TypeScript types based on your configuration:

      • With storage config: All methods including storage-dependent ones are available
      • Without storage: Storage-dependent methods are not available at compile time

      Parameters

      • config: VanaConfigWithStorage

        The configuration object containing wallet client and optional storage settings

      Returns VanaBrowserImpl & StorageRequiredMarker

      A Vana SDK instance configured for browser use

      // With storage - all methods available
      const vana = Vana({
      walletClient,
      storage: { providers: { ipfs: new IPFSStorage() }, defaultProvider: 'ipfs' }
      });
      await vana.data.uploadFile(file); // ✅ Works - TypeScript knows storage is available

      // Without storage - storage methods unavailable at compile time
      const vanaNoStorage = Vana({ walletClient });
      // await vanaNoStorage.data.uploadFile(file); // ❌ TypeScript error

      // Runtime check still available
      if (vanaNoStorage.isStorageEnabled()) {
      // TypeScript now knows storage methods are safe to use
      await vanaNoStorage.data.uploadFile(file); // ✅ Works
      }
    • Creates a new Vana SDK instance configured for browser environments.

      This function automatically provides the correct TypeScript types based on your configuration:

      • With storage config: All methods including storage-dependent ones are available
      • Without storage: Storage-dependent methods are not available at compile time

      Parameters

      • config: VanaConfig

        The configuration object containing wallet client and optional storage settings

      Returns VanaBrowserImpl

      A Vana SDK instance configured for browser use

      // With storage - all methods available
      const vana = Vana({
      walletClient,
      storage: { providers: { ipfs: new IPFSStorage() }, defaultProvider: 'ipfs' }
      });
      await vana.data.uploadFile(file); // ✅ Works - TypeScript knows storage is available

      // Without storage - storage methods unavailable at compile time
      const vanaNoStorage = Vana({ walletClient });
      // await vanaNoStorage.data.uploadFile(file); // ❌ TypeScript error

      // Runtime check still available
      if (vanaNoStorage.isStorageEnabled()) {
      // TypeScript now knows storage methods are safe to use
      await vanaNoStorage.data.uploadFile(file); // ✅ Works
      }