Skip to main content
Methods for querying verified rights from The Graph The VerifiedRightsMethods class provides specialized queries for retrieving verified rights data from The Graph subgraph. These methods allow you to efficiently access rights attestation data without making direct blockchain calls.

new VerifiedRightsMethods()

new VerifiedRightsMethods(client): VerifiedRightsMethods

Parameters

client
QueryClientInterface

Returns

VerifiedRightsMethods

Methods

getById()

getById(id): Promise<null | VerifiedRights>
Get verified rights by ID

Parameters

id
string The ID of the verified rights

Returns

Promise<null | VerifiedRights> The verified rights data or null if not found

Example

// Get verified rights by ID
const rights = await queryClient.verifiedRights.getById("1")
if (rights) {
  console.log(`Found verified rights with asset class ${rights.assetClass}`)
} else {
  console.log("No verified rights found with that ID")
}

Remarks

This method fetches a single verified rights entry by its ID. It returns null if no matching rights are found. The ID is typically a unique identifier generated when the rights are created through attestation.

getByDigitalAsset()

getByDigitalAsset(assetAddress, assetId): Promise<null | VerifiedRights>
Get verified rights by digital asset info

Parameters

assetAddress
string The address of the digital asset contract
assetId
string The ID of the digital asset

Returns

Promise<null | VerifiedRights> The verified rights data or null if not found

Example

// Get verified rights for a specific digital asset
const rights = await queryClient.verifiedRights.getByDigitalAsset(
  "0x1234567890abcdef1234567890abcdef12345678",
  "42"
)

if (rights) {
  console.log(`Asset verified with asset class ${rights.assetClass} and ${rights.verifierCount} verifiers`)
} else {
  console.log("No verified rights found for this asset")
}

Remarks

This method allows you to find the verified rights associated with a specific digital asset. It’s useful when you know the asset’s contract address and token ID, and want to check if it has been attested and what asset class it received. The method validates that the provided address has the correct format.

getByOwner()

getByOwner(ownerAddress, first, skip): Promise<VerifiedRights[]>
Get verified rights by owner

Parameters

ownerAddress
string The owner’s address
first
number = 100 Number of items to fetch (default: 100)
skip
number = 0 Number of items to skip (default: 0)

Returns

Promise<VerifiedRights[]> Array of verified rights

Example

// Get all verified rights owned by an address
const rights = await queryClient.verifiedRights.getByOwner("0x123...789")
console.log(`Found ${rights.length} verified rights owned by this address`)

// With pagination
const firstPage = await queryClient.verifiedRights.getByOwner("0x123...789", 10, 0)
const secondPage = await queryClient.verifiedRights.getByOwner("0x123...789", 10, 10)

Remarks

This method returns all verified rights entries owned by a specific address. The address must be a valid Ethereum address. Results are ordered by creation date (newest first) and can be paginated using the first and skip parameters. This is useful for creating user dashboards that show all assets a user has had verified.

getByAssetClass()

getByAssetClass(assetClass, first, skip): Promise<VerifiedRights[]>
Get verified rights by asset class

Parameters

assetClass
string The asset class to filter by (e.g. “0”, “1”, “2”, “3”)
first
number = 100 Number of items to fetch (default: 100)
skip
number = 0 Number of items to skip (default: 0)

Returns

Promise<VerifiedRights[]> Array of verified rights

Example

// Get all verified rights with a specific asset class
const generalClassRights = await queryClient.verifiedRights.getByAssetClass("0")
console.log(`Found ${generalClassRights.length} General class verified rights`)

// Get different asset classes for comparison
const class1Rights = await queryClient.verifiedRights.getByAssetClass("1")
const class2Rights = await queryClient.verifiedRights.getByAssetClass("2")

Remarks

This method returns all verified rights with a specific asset class. Currently, there is only the general class (0=General) available. This function is designed for future use when additional asset classes are added, each with their own specific requirements for verification. This query will be useful for filtering assets by their asset class.

getAll()

getAll(first, skip): Promise<VerifiedRights[]>
Get all verified rights

Parameters

first
number = 100 Number of items to fetch (default: 100)
skip
number = 0 Number of items to skip (default: 0)

Returns

Promise<VerifiedRights[]> Array of verified rights

Example

// Get the first 10 verified rights
const rights = await queryClient.verifiedRights.getAll(10, 0)
console.log(`Retrieved ${rights.length} verified rights`)

// Iterate through pages of results
let allRights = []
let pageSize = 50
let currentPage = 0

while (true) {
  const batch = await queryClient.verifiedRights.getAll(pageSize, currentPage * pageSize)
  if (batch.length === 0) break
  allRights = [...allRights, ...batch]
  currentPage++
}
console.log(`Total verified rights collected: ${allRights.length}`)

Remarks

This method returns all verified rights in the system, ordered by creation date (newest first). Use pagination parameters to efficiently handle large result sets. This query is useful for creating explorers or dashboards that display all verified rights in the system. For large datasets, it’s recommended to use pagination to improve performance and user experience.

getVerified()

getVerified(first, skip): Promise<VerifiedRights[]>
Get verified rights that have been successfully verified (isVerified = true)

Parameters

first
number = 100 Number of items to fetch (default: 100)
skip
number = 0 Number of items to skip (default: 0)

Returns

Promise<VerifiedRights[]> Array of verified rights that have been successfully verified

Remarks

This method returns all rights that have been successfully verified (where isVerified = true), and assets have reached level 2.