Vana SDK - v3.5.0
    Preparing search index...

    Function getContractController

    • Gets a typed contract instance for the specified contract name.

      Type Parameters

      • T extends
            | "DataPortabilityPermissions"
            | "DataPortabilityServers"
            | "DataPortabilityGrantees"
            | "DataRegistry"
            | "TeePoolPhala"
            | "ComputeEngine"
            | "DataRefinerRegistry"
            | "QueryEngine"
            | "ComputeInstructionRegistry"
            | "TeePoolEphemeralStandard"
            | "TeePoolPersistentStandard"
            | "TeePoolPersistentGpu"
            | "TeePoolDedicatedStandard"
            | "TeePoolDedicatedGpu"
            | "VanaEpoch"
            | "DLPRegistry"
            | "DLPRegistryTreasury"
            | "DLPRegistryTreasuryImplementation"
            | "VanaTreasury"
            | "VanaPoolStaking"
            | "VanaPoolEntity"
            | "VanaPoolTreasury"
            | "DAT"
            | "DATFactory"
            | "DATPausable"
            | "DATVotes"

      Parameters

      • contract: T

        Name of the contract to instantiate. Use const assertion for full typing: "DataRegistry" as const

      • client: {} | {} | {} & { chain: Chain } = ...

        Optional viem client instance. Defaults to auto-configured client. Obtain via createClient() or viem.

      Returns {}

      A fully typed contract instance with methods corresponding to the contract's ABI

      Provides complete type safety following viem's patterns with automatic ABI loading and address resolution. Contract instances are cached per chain for performance. Use const assertion for full type inference.

      // Full type inference with const assertion
      const dataRegistry = getContractController("DataRegistry" as const, client);

      // Now dataRegistry has full type inference for all methods
      const result = await dataRegistry.read.getFileCount(); // Type: bigint
      await dataRegistry.write.addFile([url, proof]); // Typed parameters

      // Auto-configured client
      const permissions = getContractController("DataPortabilityPermissions" as const);
      const granted = await permissions.read.hasPermission([grantor, grantee]);