Skip to content

Commit

Permalink
test if ctype exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Ad96el committed Oct 30, 2023
1 parent 81987ea commit a9ece08
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/messaging/interface/verifier/response.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Credential, Did } from '@kiltprotocol/sdk-js'
import { CType, Credential, Did } from '@kiltprotocol/sdk-js'
import { DidResolveKey, ICredential } from '@kiltprotocol/types'

import { ISession, IEncryptedMessage, ISubmitCredential } from '../../../types/index.js'
Expand Down Expand Up @@ -42,6 +42,7 @@ export async function submitCredential(

const content = await Promise.all(
cTypes.map(async (ctype) => {
await CType.fetchFromChain(`kilt:ctype:${ctype.cTypeHash}`)
const filteredCredential = credentials.filter(
(c) => c.claim.cTypeHash === ctype.cTypeHash && (owner ? c.claim.owner === owner : true)
)
Expand Down

0 comments on commit a9ece08

Please sign in to comment.