Skip to content

Commit

Permalink
refactor!: nest ctype in ICTypeDetails (#766)
Browse files Browse the repository at this point in the history
* refactor: nest ctype in ICTypeDetails
* test: fix integration tests
  • Loading branch information
rflechtner committed Aug 3, 2023
1 parent 2f39c14 commit 064d15e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/__integrationtests__/Ctypes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ describe('When there is an CtypeCreator and a verifier', () => {
if (hasBlockNumbers) {
const retrievedCType = await CType.fetchFromChain(ctype.$id)
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { createdAt, creator, ...originalCtype } = retrievedCType
const { ctype: originalCtype, creator } = retrievedCType
expect(originalCtype).toStrictEqual(ctype)
expect(creator).toBe(ctypeCreator.uri)
await expect(CType.verifyStored(retrievedCType)).resolves.not.toThrow()
await expect(CType.verifyStored(originalCtype)).resolves.not.toThrow()
}
}, 40_000)

Expand Down
8 changes: 5 additions & 3 deletions packages/core/src/ctype/CType.chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export interface CTypeChainDetails {
createdAt: BN
}

export type ICTypeDetails = ICType & CTypeChainDetails
export type ICTypeDetails = { ctype: ICType } & CTypeChainDetails

/**
* Decodes the CType details returned by `api.query.ctype.ctypes()`.
Expand Down Expand Up @@ -226,8 +226,10 @@ export async function fetchFromChain(
const [ctypeInput, creator] = lastRightCTypeCreationCall

return {
...ctypeInput,
$id: cTypeId,
ctype: {
...ctypeInput,
$id: cTypeId,
},
creator,
createdAt,
}
Expand Down

0 comments on commit 064d15e

Please sign in to comment.