@nevermined-io/payments
    Preparing search index...

    Class ContractsAPI

    Contracts API for accessing contract addresses from the Nevermined API info endpoint.

    Hierarchy

    • BasePaymentsAPI
      • ContractsAPI
    Index

    Constructors

    Properties

    accountAddress: string
    appId?: string
    environment: EnvironmentInfo
    environmentName: EnvironmentName
    heliconeApiKey: string
    isBrowserInstance: boolean = true
    nvmApiKey: string
    returnUrl: string
    version?: string

    Methods

    • It returns the account address associated with the NVM API Key used to initialize the Payments Library instance.

      Returns string | undefined

      The account address extracted from the NVM API Key

    • Internal

      Returns the HTTP options required to query the backend.

      Parameters

      • method: string

        HTTP method.

      • Optionalbody: any

        Optional request body.

      Returns any

      HTTP options object.

    • Get a contract address by name (e.g., "PayAsYouGoTemplate").

      Parameters

      • contractName: string

      Returns Promise<`0x${string}`>

    • Fetch deployment info (including contract addresses) from the API root. The result is cached after the first call.

      Returns Promise<DeploymentInfo>

    • Get the PayAsYouGoTemplate contract address (convenience accessor).

      Returns Promise<`0x${string}`>

    • Internal

      Get HTTP options for public backend requests (no authorization header). Converts body keys from snake_case to camelCase for consistency.

      Parameters

      • method: string

        HTTP method

      • Optionalbody: any

        Optional request body (keys will be converted to camelCase)

      Returns {
          body?: string;
          headers: { Accept: string; "Content-Type": string };
          method: string;
      }

      HTTP options object

    • Parses the NVM API Key to extract the account address.

      Returns { accountAddress: string; heliconeApiKey: string }

      PaymentsError if the API key is invalid.