Skip to content

Commit

Permalink
Add hash record type
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelBCarter committed Aug 27, 2024
1 parent 54440d2 commit 6666973
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/payload/packages/xns/plugins/record/src/Hash/Payload.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type { Hash } from '@xylabs/hex'
import type { Payload, WithMeta } from '@xyo-network/payload-model'
import { isPayloadOfSchemaType } from '@xyo-network/payload-model'

import type { DomainFields } from '../Domain/index.ts'

export type HashRecordSchema = 'network.xyo.ns.record.hash'
export const HashRecordSchema: HashRecordSchema = 'network.xyo.ns.record.hash'

export interface HashRecordFields extends DomainFields {
/**
* The hash the record points to
*/
hash: Hash[]
}

/**
* An hash record points a domain to an hash
*/
export type HashRecord = Payload<HashRecordFields, HashRecordSchema>

export const isHashRecord = isPayloadOfSchemaType<HashRecord>(HashRecordSchema)
export const isHashRecordWithMeta = isPayloadOfSchemaType<WithMeta<HashRecord>>(HashRecordSchema)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Payload.ts'
1 change: 1 addition & 0 deletions packages/payload/packages/xns/plugins/record/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export * from './DNS/index.ts'
export * from './Domain/index.ts'
export * from './DomainRegistration/index.ts'
export * from './Duration/index.ts'
export * from './Hash/index.ts'

0 comments on commit 6666973

Please sign in to comment.