> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cultura.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Class: AttestationService

Client for interacting with the Cultura Attestation Service.

The Attestation Service manages the creation and verification of attestations
that prove digital asset ownership and rights. The attestation process is a crucial
first step after minting a digital asset, where creators bond tokens to validate their
ownership claims.

## Attestation Service

### getDigitalAssetGrade()

> **getDigitalAssetGrade**(`digitalAssetAddress`, `digitalAssetId`): `Promise`\<`number`>

Gets the current grade of a digital asset.

The grade is selected by the digital asset minter during attestation and determines
both the initial bond requirement and the thresholds for verified rights promotion.

#### Parameters

##### digitalAssetAddress

`` `0x${string}` ``

Address of the digital asset contract

##### digitalAssetId

`bigint`

Token ID of the digital asset to check

#### Returns

`Promise`\<`number`>

Numerical grade value (0-3), where:

* Grade S (0): Elite level
* Grade A (1): Premium level
* Grade B (2): Intermediate level
* Grade C (3): Entry level

#### Remarks

The grade cannot be changed after attestation and affects the requirements for verified rights level:

* Higher grades require larger initial bonds from the digital asset creator
* Higher grades also require more total bonded tokens or attesters to achieve higher verified level
* The grade affects the trust factor in the verification process
* Professional attesters may prioritize higher-grade digital assets for verification

#### Example

```typescript theme={null}
const grade = await sdk.attestationService.getDigitalAssetGrade(digitalAssetAddress, digitalAssetId);
console.log('Digital Asset Grade:',
  grade === 0 ? 'S (Elite)' :
  grade === 1 ? 'A (Premium)' :
  grade === 2 ? 'B (Intermediate)' :
  grade === 3 ? 'C (Entry)' : 'Unknown'
);
```

### getAttestation()

> **getAttestation**(`uid`): `Promise`\<\{ `uid`: `` `0x${string}` ``; `schema`: `` `0x${string}` ``; `time`: `bigint`; `expirationTime`: `bigint`; `revocationTime`: `bigint`; `refUID`: `` `0x${string}` ``; `recipient`: `` `0x${string}` ``; `attester`: `` `0x${string}` ``; `verifierCount`: `bigint`; `revocable`: `boolean`; `data`: `` `0x${string}` ``; `bondedAmount`: `bigint`; `digitalAssetAddress`: `` `0x${string}` ``; `digitalAssetId`: `bigint`; `communityUserCount`: `bigint`; `WLVerifierCount`: `bigint`; }>

Retrieves detailed information about an attestation by its unique identifier.

Use this method to get complete information about a specific attestation,
including the recipient, attester, schema reference, and associated data.

#### Parameters

##### uid

`` `0x${string}` ``

Unique identifier of the attestation to retrieve

#### Returns

`Promise`\<\{ `uid`: `` `0x${string}` ``; `schema`: `` `0x${string}` ``; `time`: `bigint`; `expirationTime`: `bigint`; `revocationTime`: `bigint`; `refUID`: `` `0x${string}` ``; `recipient`: `` `0x${string}` ``; `attester`: `` `0x${string}` ``; `verifierCount`: `bigint`; `revocable`: `boolean`; `data`: `` `0x${string}` ``; `bondedAmount`: `bigint`; `digitalAssetAddress`: `` `0x${string}` ``; `digitalAssetId`: `bigint`; `communityUserCount`: `bigint`; `WLVerifierCount`: `bigint`; }>

Complete attestation data including recipient, attester, schema, digital asset details, and bond amounts

#### Example

```typescript theme={null}
const attestation = await sdk.attestationService.getAttestation(attestationUID);
console.log('Attestation details:', attestation);
```

### new AttestationServiceClient()

> **new AttestationServiceClient**(`publicClient`, `walletClient`, `contractAddress`): [`AttestationServiceClient`](./attestation-service)

#### Parameters

##### publicClient

##### walletClient

##### contractAddress

`` `0x${string}` ``

#### Returns

[`AttestationServiceClient`](./attestation-service)

## Methods

### attest()

> **attest**(`attestationRequest`, `digitalAssetAddress`, `digitalAssetId`, `grade`, `bondAmount`): `Promise`\<`` `0x${string}` ``>

Create an attestation for a digital asset

#### Parameters

##### attestationRequest

[`AttestationRequest`](../types/attestation-request)

Object containing attestation details

##### digitalAssetAddress

`` `0x${string}` ``

Address of the digital asset token contract

##### digitalAssetId

`bigint`

Token ID of the digital asset being attested

##### grade

`bigint`

Grade level for the attestation (affects fees and requirements)

##### bondAmount

`bigint`

Amount of tokens to bond for the attestation

#### Returns

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

Unique identifier (UID) of the created attestation

#### Example

```typescript theme={null}
const attestationRequest = {
  schema: schemaHash,
  data: {
    recipient: userAddress,
    expirationTime: BigInt(Math.floor(Date.now() / 1000) + 365 * 24 * 60 * 60),
    revocable: true,
    refUID: "0x0000000000000000000000000000000000000000000000000000000000000000",
    data: "0x"
  }
}

const attestationUID = await sdk.attestationService.attest(
  attestationRequest,
  tokenAddress,
  tokenId,
  grade,
  bondAmount
);
```

### delegatedAttest()

> **delegatedAttest**(`signatureParams`, `attestationRequest`, `digitalAssetAddress`, `digitalAssetId`, `grade`, `bondAmount`, `delegatedAddress`): `Promise`\<`` `0x${string}` ``>

Create a delegated attestation

This method allows a user to create an attestation on behalf of another account,
using a signature from that account for authorization.

#### Parameters

##### signatureParams

[`SignatureParams`](../types/signature-params)

Parameters for the signature verification

##### attestationRequest

[`AttestationRequest`](../types/attestation-request)

Object containing attestation details

##### digitalAssetAddress

`` `0x${string}` ``

Address of the digital asset token contract

##### digitalAssetId

`bigint`

Token ID of the digital asset being attested

##### grade

`bigint`

Grade level for the attestation (affects fees and requirements)

##### bondAmount

`bigint`

Amount of tokens to bond for the attestation

##### delegatedAddress

`` `0x${string}` ``

Address that will perform the attestation on behalf of the signer

#### Returns

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

Transaction hash of the attestation transaction

### verifyAttestation()

> **verifyAttestation**(`attestationUID`, `bondAmount`): `Promise`\<`` `0x${string}` ``>

Verify an attestation by bonding tokens

This method allows a verifier to stake tokens against an attestation,
supporting its validity. Verifiers receive rewards for accurate verifications.

A digital asset can achieve Verified Rights status when it meets either of these thresholds:

1. Total bonded tokens reach the level requirement
2. Number of unique attesters reaches the minimum threshold

#### Parameters

##### attestationUID

`` `0x${string}` ``

Unique identifier of the attestation to verify

##### bondAmount

`bigint`

Amount of tokens to bond for the verification

#### Returns

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

Transaction hash of the verification transaction

#### Remarks

Important notes about the Verified Rights promotion process:

* Only one endorsement per address is counted towards the attester threshold
* Endorsement amounts are cumulative for the token threshold
* Once Verified Rights level 2 is achieved, the digital asset can be used in licensing and other trust-dependent transactions
* Professional attesters' endorsements may carry additional weight in the verification process
* The level system reflects the trust and verification achieved by the digital asset

#### Example

```typescript theme={null}
const txHash = await attestationService.verifyAttestation(
  attestationUID,
  ethers.utils.parseEther("10")
);
```

### isVerifiedAttester()

> **isVerifiedAttester**(`address`): `Promise`\<`boolean`>

Check if an address is a whitelisted verifier

#### Parameters

##### address

`` `0x${string}` ``

The address to check

#### Returns

`Promise`\<`boolean`>

True if the address is a whitelisted verifier, false otherwise

### addWhitelistVerifier()

> **addWhitelistVerifier**(`attesterAddress`): `Promise`\<`` `0x${string}` ``>

Add a new whitelisted verifier

#### Parameters

##### attesterAddress

`` `0x${string}` ``

The address to add as a whitelisted verifier

#### Returns

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

The transaction hash

### isOwner()

> **isOwner**(`address`): `Promise`\<`boolean`>

Check if an address is the owner of the contract

#### Parameters

##### address

`` `0x${string}` ``

The address to check

#### Returns

`Promise`\<`boolean`>

True if the address is the owner, false otherwise

### getNonce()

> **getNonce**(`address`): `Promise`\<`bigint`>

Get the current nonce for an address

#### Parameters

##### address

`` `0x${string}` ``

The address to get the nonce for

#### Returns

`Promise`\<`bigint`>

The current nonce as a bigint

### getDigitalAssetLevel()

> **getDigitalAssetLevel**(`digitalAssetAddress`, `digitalAssetId`): `Promise`\<`number`>

Get the level of a digital asset

#### Parameters

##### digitalAssetAddress

`` `0x${string}` ``

The address of the digital asset contract

##### digitalAssetId

`bigint`

The token ID of the digital asset

#### Returns

`Promise`\<`number`>

The level of the digital asset (0 = unverified, 1 = basic, 2 = verified/licensable)

#### Remarks

The level system represents the verification status of a digital asset:

* Level 0: Just minted - Initial state of any newly minted digital asset
* Level 1: Attested - Digital asset creator has completed attestation, initial bond and fee paid
* Level 2: Verified Rights - Achieved through community endorsements, meets token threshold or unique attesters requirement

Important Notes:

* All digital assets, regardless of grade, can achieve Verified Rights status
* Verified Rights level 2 is required for licensing and other trust-dependent operations
* Level status is independent of the digital asset's grade

#### Example

```typescript theme={null}
const level = await sdk.attestationService.getDigitalAssetLevel(digitalAssetAddress, tokenId);
console.log('Digital Asset Level Status:',
  level === 0 ? 'Just Minted' :
  level === 1 ? 'Attested' :
  level === 2 ? 'Verified Rights (Licensable)' : 'Unknown'
);
```

### getDigitalAssetUID()

> **getDigitalAssetUID**(`digitalAssetAddress`, `digitalAssetId`): `` `0x${string}` ``

Generate a unique identifier for a digital asset

#### Parameters

##### digitalAssetAddress

`` `0x${string}` ``

The address of the digital asset contract

##### digitalAssetId

`bigint`

The token ID of the digital asset

#### Returns

`` `0x${string}` ``

The unique identifier for the digital asset

### removeVerifiedAttester()

> **removeVerifiedAttester**(`attesterAddress`): `Promise`\<`` `0x${string}` ``>

Remove a whitelisted verifier

#### Parameters

##### attesterAddress

`` `0x${string}` ``

The address to remove from the whitelist

#### Returns

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

The transaction hash

### getRightsBoundAccountFromReceipt()

> **getRightsBoundAccountFromReceipt**(`receipt`): `` `0x${string}` ``

Extracts the rights bound account from a transaction receipt.

#### Parameters

##### receipt

The transaction receipt to extract the rights bound account from

###### logs

`object`\[]

#### Returns

`` `0x${string}` ``

The rights bound account address if found, zero address otherwise

### getAttestationDataFromReceipt()

> **getAttestationDataFromReceipt**(`receipt`): `object`

Extracts attestation data from a transaction receipt.

#### Parameters

##### receipt

The transaction receipt to extract the attestation data from

###### logs

`object`\[]

#### Returns

`object`

The attestation data including UID and rights bound account

##### attestationUid

> **attestationUid**: `` `0x${string}` ``

##### rightsBoundAccount

> **rightsBoundAccount**: `` `0x${string}` ``

#### Throws

Error if the attestation UID is not found in the logs

### generateSignatureParams()

> **generateSignatureParams**(`signature`, `signerAddress`): `object`

Generates signature parameters required for delegated attestation

#### Parameters

##### signature

`` `0x${string}` ``

The signed message signature

##### signerAddress

`` `0x${string}` ``

The address of the signer

#### Returns

`object`

Signature parameters object with signature, signer, v, r, and s values

##### signature

> **signature**: `` `0x${string}` ``

##### signer

> **signer**: `` `0x${string}` ``

##### v

> **v**: `number`

##### r

> **r**: `` `0x${string}` ``

##### s

> **s**: `` `0x${string}` ``

### signForDelegatedAttestation()

> **signForDelegatedAttestation**(`account`): `Promise`\<\{ `signature`: `` `0x${string}` ``; `signer`: `` `0x${string}` ``; `v`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; }>

Signs a message for delegated attestation and returns the signature parameters

#### Parameters

##### account

`` `0x${string}` ``

The account performing the signature

#### Returns

`Promise`\<\{ `signature`: `` `0x${string}` ``; `signer`: `` `0x${string}` ``; `v`: `number`; `r`: `` `0x${string}` ``; `s`: `` `0x${string}` ``; }>

Signature parameters object with signature, signer, v, r, and s values
