UNPKG

@darkpay/dark-types

Version:

JavaScript type definitions for Darkdot blockchain.

33 lines (32 loc) 1.56 kB
import { Storefront, Product, Ordering, SocialAccount, Profile } from '../substrate/interfaces'; import { CommonContent, StorefrontContent, ProductContent, OrderingContent, CommentContent, ProfileContent } from '../offchain'; import { CommonStruct } from '../substrate'; import { AccountId } from '@polkadot/types/interfaces'; export declare type CommonData<S extends CommonStruct, C extends CommonContent> = { struct: S; content?: C; }; export declare type SocialAccountWithId = SocialAccount & { id: AccountId; }; export declare type StorefrontData = CommonData<Storefront, StorefrontContent>; export declare type ProductData = CommonData<Product, ProductContent>; export declare type CommentData = CommonData<Product, CommentContent>; export declare type OrderingData = CommonData<Ordering, OrderingContent>; export declare type ProfileData = CommonData<SocialAccountWithId, ProfileContent> & { profile?: Profile; }; export declare type AnyDarkdotData = StorefrontData | ProductData | CommentData | ProfileData | OrderingData; export declare type ProductWithSomeDetails = { product: ProductData; ext?: Exclude<ProductWithSomeDetails, 'ext'>; owner?: ProfileData; storefront?: StorefrontData; }; export declare type ProductWithOwner = Exclude<ProductWithSomeDetails, 'owner'> & { owner: ProfileData; }; export declare type ProductWithStorefront = Exclude<ProductWithSomeDetails, 'storefront'> & { storefront: StorefrontData; }; export declare type ProductWithAllDetails = ProductWithOwner & ProductWithStorefront;