Remarks
This client is for testing and demonstration purposes only. Should not be used in production environments.new MockLicensingProtocolClient()
new MockLicensingProtocolClient(publicClient,walletClient,contractAddress,culturaDigitalAssetAddress,attestationServiceAddress,chainType):MockLicensingProtocolClient
Parameters
publicClient
walletClient
contractAddress
`0x${string}`
culturaDigitalAssetAddress
`0x${string}`
attestationServiceAddress
`0x${string}`
chainType
CulturaChainType
Returns
MockLicensingProtocolClient
Methods
licenseDigitalAsset()
licenseDigitalAsset(Simulate registering a token ID as licensed within the mock protocol.collectionAddress,tokenId):Promise<`0x${string}`>
Parameters
collectionAddress
`0x${string}`
The address of the collection that the token is licensed from
tokenId
bigint
The ID of the token to license
Returns
Promise<`0x${string}`>
Transaction hash
Remarks
This method simulates the action of a licensing protocol granting a license for a specific parent token. It records this “license granted” status within the mock contract’s state for the givencollectionAddress and tokenId.
This should typically be called before minting the Licensed Creative Asset.
It represents securing the rights needed for the next step.
In a real-world scenario, this step would involve interacting with an actual
licensing protocol, potentially involving off-chain agreements, payments,
and specific license term negotiations.
Example
verifyLicensedAsset()
verifyLicensedAsset(Simulate verifying the attestation of a Licensed Creative Asset.attestationUID,bondedAmount):Promise<`0x${string}`>
Parameters
attestationUID
`0x${string}`
The attestation UID to verify
bondedAmount
bigint
The amount to bond for verification
Returns
Promise<`0x${string}`>
Transaction hash
Remarks
This method simulates a licensing protocol performing a verification check on an attestation associated with a Licensed Creative Asset. It takes theattestationUID (obtained after calling sdk.attestationService.attest on the
new Licensed Creative Asset) and a bondAmount.
In the context of the mock protocol, this function likely interacts with the main
CAS.verifyAttestation function, effectively acting as a verifier endorsing the
new asset’s attestation. It represents the final step where the licensing body
confirms the validity of the newly created and attested licensed asset.
The bondedAmount is used for the underlying CAS verification.
Example
getLicensedTokens()
getLicensedTokens(Get licensed tokens for a specific address.address):Promise<object[]>
Parameters
address
`0x${string}`
The address to check licensed tokens for
Returns
Promise<object[]>
Array of licensed tokens with their collection addresses and token IDs
isTokenLicensedByAddress()
isTokenLicensedByAddress(Check if a specific address has licensed a specific token.address,collectionAddress,tokenId):Promise<boolean>
Parameters
address
`0x${string}`
The address to check
collectionAddress
`0x${string}`
The collection address to check
tokenId
bigint
The token ID to check
Returns
Promise<boolean>
Boolean indicating whether the address has licensed the token
isLicensedToken()
isLicensedToken(Check if a token is properly licensed by the current walletcollectionAddress,tokenId):Promise<boolean>
Parameters
collectionAddress
`0x${string}`
The collection address to check
tokenId
bigint
The token ID to check
Returns
Promise<boolean>
Boolean indicating whether the token is properly licensed by the current wallet
createLicensedAsset()
createLicensedAsset((Convenience Function) Create and attest a Licensed Creative Asset in one step. This method allows for creation of licenses for both Cultura and external NFTs.licensedAssetDetails,licenseeSignature,schemaUID,bondAmount,grade,parentRights,externalNFT?,termsURI?):Promise<{licensedAssetId:bigint;attestationInfo: {attestationUid:`0x${string}`;rightsBoundAccount:`0x${string}`; };transactionState:"complete"|"failed"; }>
Parameters
licensedAssetDetails
License details including name, description, and termsname
string
description
string
imageUrl?
string
licenseeSignature
SignatureParams
The licensee’s signature validating acceptance of terms
schemaUID
`0x${string}`
Schema UID to use for the attestation
bondAmount
bigint = ...
Amount to bond for the attestation (defaults to 1.1 tokens in wei)
grade
bigint
The grade/level assigned to this license (higher means more permissions)
parentRights
readonlyReadonly<{ parentCollection: `0x${string}`; parentDigitalAssetId: bigint; owner: `0x${string}`; royaltySplit: bigint; }>[]
Array of parent rights information for derivative works
externalNFT?
Optional information about an external NFT being licensedcollection
`0x${string}`
tokenId
bigint
owner
`0x${string}`
termsURI?
string
Optional URI pointing to the terms document (defaults to the imageUrl or a dummy value)
Returns
Promise<{ licensedAssetId: bigint; attestationInfo: { attestationUid: `0x${string}`; rightsBoundAccount: `0x${string}`; }; transactionState: "complete" | "failed"; }>
Object containing the newly created asset details, attestation info, and compliance status
Remarks
Note: This is a convenience function specific to the mock protocol that combines the minting and attestation steps for a Licensed Creative Asset. Crucially, it requires thatlicenseDigitalAsset has already been called
for each parent asset involved to register the license grant within the mock contract.
This function checks for that pre-existing license state; it does not perform
the initial licensing simulation itself.
For a clearer understanding of the individual protocol interactions, refer to the
step-by-step flow:
licenseDigitalAsset(for each parent)sdk.culturaDigitalAsset.mintDigitalAssetsdk.attestationService.attest
- Checks if a license has been registered for the parent asset(s) via prior
calls to
licenseDigitalAssetfor the current wallet address. - Mints a new Licensed Creative Asset NFT via the
CulturaDigitalAssetcontract, linking it to the parents. - Immediately creates an attestation for the newly minted asset via the
CAScontract, using the providedlicenseeSignature,schemaUID,bondAmount, andgrade. - Returns the
licensedAssetId(the tokenId of the new asset) andattestationInfo(including theattestationUid).
transactionState) to indicate success or failure.
Use the externalNFT parameter if the license pertains to an asset outside the
Cultura CulturaDigitalAsset contract.
Example
getVerifiedLicensedAssets()
getVerifiedLicensedAssets(Get assets with verified rights.limit,offset):Promise<{assets:DigitalAsset[];total:number; }>
Parameters
limit
number = 20
Optional limit for the number of results to return (defaults to 20)
offset
number = 0
Optional offset for pagination (defaults to 0)
Returns
Promise<{ assets: DigitalAsset[]; total: number; }>
Object containing an array of verified assets and the total count.

