@opendatalabs/vana-sdk
Version:
A TypeScript library for interacting with Vana Network smart contracts.
50 lines (49 loc) • 1.72 kB
TypeScript
/**
* Platform detection and adapter utilities
*
* This module provides utilities for detecting the current runtime environment
* and creating appropriate platform adapters automatically.
*/
import type { VanaPlatformAdapter, PlatformType } from "./interface";
/**
* Detects the current runtime environment
*
* @returns The detected platform type
*/
export declare function detectPlatform(): PlatformType;
/**
* Creates the appropriate platform adapter based on the current environment
*
* @returns A platform adapter instance for the current environment
* @throws {Error} If platform adapters cannot be imported or created
*/
export declare function createPlatformAdapter(): Promise<VanaPlatformAdapter>;
/**
* Creates a platform adapter for a specific platform type
*
* @param platformType - The platform type to create an adapter for
* @returns A platform adapter instance for the specified platform
* @throws {Error} If platform adapters cannot be imported or created
*/
export declare function createPlatformAdapterFor(platformType: PlatformType): Promise<VanaPlatformAdapter>;
/**
* Checks if the current environment supports the given platform adapter
*
* @param platformType - The platform type to check
* @returns True if the platform is supported, false otherwise
*/
export declare function isPlatformSupported(platformType: PlatformType): boolean;
/**
* Gets platform-specific capabilities
*
* @returns Object describing available platform capabilities
*/
export declare function getPlatformCapabilities(): {
platform: PlatformType;
crypto: {
webCrypto: false | SubtleCrypto;
nodeCrypto: string | false;
};
fetch: boolean;
streams: boolean;
};