Claim Topics

Learn how to interact with claim topics

All claims must align with a claim topic that is also stored on chain. They provide context information about the claim format and allow users to digest the information. A claim cannot be issued if the claim topic hasn’t been created.

Retrieving Claim Topics

Claim Topics can be retrieved using a number of methods shown below:


        const neoCNS = "b434339f25b6f1bec68e99f620dfbf3ec27dacdc"
        const network = {
            name: "network",
            extra: {
                neoscan: "https://p1.neo.blockchain.moonlight.io:4001/api/main_net",
                rpcServer: "https://p1.neo.blockchain.moonlight.io:60333"
            }
        }
        
        //get the claims contract target
        const neoClaimsContract = await sdk.NeoContractNameService.getAddress(network, neoCNS, "moonlight", "claims")
        
        //get the claim topic definition by topic
        let claimTopic = await sdk.NeoContractClaims.getClaimTopicByTopic(network, neoClaimsContract, "email")
        console.log("first res: \n", claimTopic)
        
        //get the claim topic definition by pointer
        claimTopic = await sdk.NeoContractClaims.getClaimTopicByPointer(network, neoClaimsContract, 2)
        console.log("second res: \n", claimTopic)
        
        >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        
        first res:
         { claim_topic: 'email',
          identifiers: [ 'email' ],
          issuer:
           '02498c5c154df8a2b26047a9205d1329aa0d626a1ef9185a7e3ae4993290905afd' }
        
        second res:
         { claim_topic: 'email',
          identifiers: [ 'email' ],
          issuer:
           '02498c5c154df8a2b26047a9205d1329aa0d626a1ef9185a7e3ae4993290905afd' }
    
//to be defined

Creating Claim Topics


        const neoCNS = "b434339f25b6f1bec68e99f620dfbf3ec27dacdc"
        const wif = "KxDgvEKzgSBPPfuVfw67oPQBSjidEiqTHURKSDL1R7yGaGYAeYnr"
        const network = {
            name: "network",
            extra: {
                neoscan: "https://p1.neo.blockchain.moonlight.io:4001/api/main_net",
                rpcServer: "https://p1.neo.blockchain.moonlight.io:60333"
            }
        }
        
        //get the claims contract target
        const neoClaimsContract = await sdk.NeoContractNameService.getAddress(network, neoCNS, "moonlight", "claims")
        
        //create a new claim topic
        await sdk.NeoContractClaims.createClaimTopic(network, neoClaimsContract, "new_topic", ["attestationA"], wif)
        await sdk.NeoCommon.sleep(15000)
        let claimTopic = await sdk.NeoContractClaims.getClaimTopicByTopic(network, neoClaimsContract, "new_topic")
        console.log(claimTopic)
        
        >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        
        { claim_topic: 'new_topic',
          identifiers: [ 'attestationA' ],
          issuer:
           '031a6c6fbbdf02ca351745fa86b9ba5a9452d785ac4f7fc2b7548ca2a46c4fcf4a' }

    
//to be defined