filecoin-pin
    Preparing search index...

    Variable setupSynapse

    setupSynapse: (
        config: SynapseSetupConfig,
        logger: Logger,
        options?: CreateStorageContextOptions,
    ) => Promise<SynapseService>

    Type Declaration

      • (
            config: SynapseSetupConfig,
            logger: Logger,
            options?: CreateStorageContextOptions,
        ): Promise<SynapseService>
      • Set up complete Synapse service with SDK and storage context

        This function demonstrates the complete setup flow for Synapse:

        1. Validates required configuration (private key)
        2. Creates Synapse instance with network configuration
        3. Creates a storage context with comprehensive callbacks
        4. Returns a service object for application use

        Our wrapping of Synapse initialization and storage context creation is primarily to handle our custom configuration needs and add detailed logging and progress tracking.

        Parameters

        • config: SynapseSetupConfig

          Application configuration with privateKey and RPC URL

        • logger: Logger

          Logger instance for detailed operation tracking

        • Optionaloptions: CreateStorageContextOptions

          Optional dataset selection and callbacks

        Returns Promise<SynapseService>

        SynapseService with initialized Synapse and storage context

        // Standard setup (reuses wallet's dataset)
        const service = await setupSynapse(config, logger)

        // Create new dataset for multi-user scenario
        const service = await setupSynapse(config, logger, {
        dataset: { createNew: true }
        })

        // Connect to specific dataset
        const service = await setupSynapse(config, logger, {
        dataset: { useExisting: 123 }
        })