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

    Provides direct, low-level access to all Vana protocol smart contracts.

    This controller serves as the designated "escape hatch" for advanced developers who need to interact directly with the underlying blockchain contracts. It provides access to contract addresses, ABIs, and factory methods for creating typed contract instances. Most developers should use the higher-level DataController and PermissionsController instead of this advanced API.

    The controller automatically handles chain detection and provides only contracts that are deployed on the current network. All contract instances are fully typed for enhanced developer experience and type safety.

    Use this controller when:

    • High-level controllers don't provide needed functionality
    • You need direct contract method calls or event access
    • You're building custom integrations or tooling
    • You need advanced querying capabilities

    Most developers should use instead:

    • vana.data.* for file management operations
    • vana.permissions.* for access control workflows
    // Get contract info for direct interaction
    const registry = vana.protocol.getContract("DataRegistry" as const);

    // Access contract address and ABI with full typing
    console.log(registry.address); // Contract address on current chain
    console.log(registry.abi); // Fully typed contract ABI

    // Create a typed contract instance
    const contract = vana.protocol.createContract("DataRegistry" as const);
    const fileCount = await contract.read.filesCount();

    [URL_PLACEHOLDER] | Vana Protocol Contracts for contract specifications

    Index

    Methods

    • Retrieves the address and ABI for a specific Vana protocol contract.

      Type Parameters

      • T extends
            | "TeePool"
            | "DLPRoot"
            | "DataPermissions"
            | "DataRegistry"
            | "TeePoolPhala"
            | "ComputeEngine"
            | "DataRefinerRegistry"
            | "QueryEngine"
            | "ComputeInstructionRegistry"
            | "TeePoolEphemeralStandard"
            | "TeePoolPersistentStandard"
            | "TeePoolPersistentGpu"
            | "TeePoolDedicatedStandard"
            | "TeePoolDedicatedGpu"
            | "VanaEpoch"
            | "DLPRegistry"
            | "DLPRegistryTreasury"
            | "DLPRewardDeployerTreasury"
            | "DLPRegistryTreasuryImplementation"
            | "DLPPerformance"
            | "DLPRewardDeployer"
            | "DLPRewardSwap"
            | "SwapHelper"
            | "DataLiquidityPool"
            | "VanaPoolStaking"
            | "VanaPoolEntity"
            | "VanaPoolTreasury"
            | "DAT"
            | "DATFactory"
            | "DATPausable"
            | "DATVotes"

      Parameters

      • contractName: T

        The name of the Vana contract to retrieve (use const assertion for full typing)

      Returns ContractInfo<{}[T]>

      An object containing the contract's address and fully typed ABI

      This method provides direct access to contract addresses and ABIs for the current chain. It includes full TypeScript type inference when using const assertions, enabling type-safe contract interactions. The method only returns contracts that are actually deployed on the current network.

      When the contract is not deployed on the current chain

      // Get contract info with full type inference
      const dataRegistry = vana.protocol.getContract("DataRegistry" as const);

      // Now dataRegistry.abi is fully typed for the DataRegistry contract
      console.log(dataRegistry.address); // "0x123..."
      console.log(dataRegistry.abi.length); // Full ABI array
    • Creates a fully typed contract instance ready for blockchain interaction.

      Type Parameters

      • T extends
            | "TeePool"
            | "DLPRoot"
            | "DataPermissions"
            | "DataRegistry"
            | "TeePoolPhala"
            | "ComputeEngine"
            | "DataRefinerRegistry"
            | "QueryEngine"
            | "ComputeInstructionRegistry"
            | "TeePoolEphemeralStandard"
            | "TeePoolPersistentStandard"
            | "TeePoolPersistentGpu"
            | "TeePoolDedicatedStandard"
            | "TeePoolDedicatedGpu"
            | "VanaEpoch"
            | "DLPRegistry"
            | "DLPRegistryTreasury"
            | "DLPRewardDeployerTreasury"
            | "DLPRegistryTreasuryImplementation"
            | "DLPPerformance"
            | "DLPRewardDeployer"
            | "DLPRewardSwap"
            | "SwapHelper"
            | "DataLiquidityPool"
            | "VanaPoolStaking"
            | "VanaPoolEntity"
            | "VanaPoolTreasury"
            | "DAT"
            | "DATFactory"
            | "DATPausable"
            | "DATVotes"

      Parameters

      • contractName: T

        The name of the Vana contract (use const assertion for full typing)

      Returns {}

      A fully typed contract instance with read/write methods and event handling

      This method creates a contract instance with complete type safety for all contract methods including read operations, write operations, and event handling. The instance is pre-configured with the correct address, ABI, and wallet client for immediate use. All method parameters and return types are fully typed based on the contract ABI.

      When the contract is not deployed on the current chain

      // Create typed contract instance
      const dataRegistry = vana.protocol.createContract("DataRegistry" as const);

      // Full type safety for all operations
      const fileCount = await dataRegistry.read.filesCount(); // Type: bigint
      const txHash = await dataRegistry.write.addFile(["ipfs://..."]); // Typed parameters

      // Listen to events with full typing
      const logs = await dataRegistry.getEvents.FileAdded();
    • Gets all available contract names that can be used with getContract(). Returns only contracts that are actually deployed on the current chain.

      Returns (
          | "TeePool"
          | "DLPRoot"
          | "DataPermissions"
          | "DataRegistry"
          | "TeePoolPhala"
          | "ComputeEngine"
          | "DataRefinerRegistry"
          | "QueryEngine"
          | "ComputeInstructionRegistry"
          | "TeePoolEphemeralStandard"
          | "TeePoolPersistentStandard"
          | "TeePoolPersistentGpu"
          | "TeePoolDedicatedStandard"
          | "TeePoolDedicatedGpu"
          | "VanaEpoch"
          | "DLPRegistry"
          | "DLPRegistryTreasury"
          | "DLPRewardDeployerTreasury"
          | "DLPRegistryTreasuryImplementation"
          | "DLPPerformance"
          | "DLPRewardDeployer"
          | "DLPRewardSwap"
          | "SwapHelper"
          | "DataLiquidityPool"
          | "VanaPoolStaking"
          | "VanaPoolEntity"
          | "VanaPoolTreasury"
          | "DAT"
          | "DATFactory"
          | "DATPausable"
          | "DATVotes"
      )[]

      Array of all available contract names for the current chain

    • Checks if a specific contract is available on the current chain.

      Parameters

      • contractName:
            | "TeePool"
            | "DLPRoot"
            | "DataPermissions"
            | "DataRegistry"
            | "TeePoolPhala"
            | "ComputeEngine"
            | "DataRefinerRegistry"
            | "QueryEngine"
            | "ComputeInstructionRegistry"
            | "TeePoolEphemeralStandard"
            | "TeePoolPersistentStandard"
            | "TeePoolPersistentGpu"
            | "TeePoolDedicatedStandard"
            | "TeePoolDedicatedGpu"
            | "VanaEpoch"
            | "DLPRegistry"
            | "DLPRegistryTreasury"
            | "DLPRewardDeployerTreasury"
            | "DLPRegistryTreasuryImplementation"
            | "DLPPerformance"
            | "DLPRewardDeployer"
            | "DLPRewardSwap"
            | "SwapHelper"
            | "DataLiquidityPool"
            | "VanaPoolStaking"
            | "VanaPoolEntity"
            | "VanaPoolTreasury"
            | "DAT"
            | "DATFactory"
            | "DATPausable"
            | "DATVotes"

        The contract name to check

      Returns boolean

      Whether the contract is deployed on the current chain

    • Gets the contract factory instance for advanced usage. This provides access to additional contract management methods.

      Returns ContractFactory

      The contract factory instance