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

Hierarchy

  • BasePaymentsAPI
    • ContractsAPI

Constructors

Properties

accountAddress: string
appId?: string
deploymentInfo?: DeploymentInfo
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 undefined | string

    The account address extracted from the NVM API Key

  • Internal

    Returns the HTTP options required to query the backend.

    Parameters

    • method: string

      HTTP method.

    • Optional body: 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

    • Optional body: any

      Optional request body (keys will be converted to camelCase)

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

    HTTP options object

    • Optional body?: string
    • headers: {
          Accept: string;
          Content-Type: string;
      }
      • Accept: string
      • Content-Type: string
    • method: string
  • Parses the NVM API Key to extract the account address.

    Returns {
        accountAddress: string;
        heliconeApiKey: string;
    }

    • accountAddress: string
    • heliconeApiKey: string

    Throws

    PaymentsError if the API key is invalid.