Skip to content

Commit

Permalink
Add identities for HashLease
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelBCarter committed Dec 23, 2024
1 parent 5cf9f7a commit d82482c
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import type { Payload } from '@xyo-network/payload-model'
import { AsObjectFactory } from '@xylabs/object'
import {
isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources, type Payload, type WithSources,
} from '@xyo-network/payload-model'

export const HashLeaseSchema = 'network.xyo.hash.lease' as const
export type HashLeaseSchema = typeof HashLeaseSchema
Expand All @@ -12,3 +15,17 @@ export type HashLease = Payload<
},
HashLeaseSchema
>

/**
* Identity function for HashLease payload
*/
export const isHashLease = isPayloadOfSchemaType<HashLease>(HashLeaseSchema)
export const asHashLease = AsObjectFactory.create<HashLease>(isHashLease)
export const asOptionalHashLease = AsObjectFactory.createOptional<HashLease>(isHashLease)

/**
* Identity function for HashLease payload with sources
*/
export const isHashLeaseWithSources = isPayloadOfSchemaTypeWithSources<WithSources<HashLease>>(HashLeaseSchema)
export const asHashLeaseWithSources = AsObjectFactory.create<WithSources<HashLease>>(isHashLeaseWithSources)
export const asOptionalHashLeaseWithSources = AsObjectFactory.createOptional<WithSources<HashLease>>(isHashLeaseWithSources)

0 comments on commit d82482c

Please sign in to comment.