UNPKG

@darkpay/dark-api

Version:

JavaScript API for Darkdot blockchain.

49 lines (48 loc) 2.98 kB
import { IpfsCid as RuntimeIpfsCid } from '@darkpay/dark-types/substrate/interfaces'; import { CommonContent, StorefrontContent, ProductContent, OrderingContent, CommentContent, CID, IpfsCid, ProfileContent } from '@darkpay/dark-types/offchain'; import { Content } from '@darkpay/dark-types/substrate/classes'; import { DarkdotContext, ContentResult } from '../utils/types'; import { SocialAccountWithId } from '@darkpay/dark-types/dto'; export declare function getIpfsCidOfSocialAccount(struct: SocialAccountWithId): string | undefined; declare type HasContentField = { content: Content; }; declare type HasIpfsCidSomewhere = HasContentField | SocialAccountWithId; export declare function getIpfsCidOfStruct<S extends HasIpfsCidSomewhere>(struct: S): string | undefined; export declare function getCidsOfStructs(structs: HasIpfsCidSomewhere[]): string[]; declare type IpfsUrl = string; export declare type DarkdotIpfsProps = DarkdotContext & { ipfsNodeUrl: IpfsUrl; offchainUrl: string; }; export declare class DarkdotIpfsApi { private ipfsNodeUrl; private offchainUrl; private useServer?; constructor(props: DarkdotIpfsProps); private testConnection; private ipfsNodeRequest; getUniqueCids(cids: IpfsCid[], contentName?: string): CID[]; getContentArrayFromIpfs<T extends CommonContent>(cids: IpfsCid[], contentName?: string): Promise<ContentResult<T>>; getContentArrayFromOffchain<T extends CommonContent>(cids: IpfsCid[], contentName?: string): Promise<ContentResult<T>>; getContentArray<T extends CommonContent>(cids: IpfsCid[], contentName?: string): Promise<ContentResult<T>>; findStorefronts(cids: IpfsCid[]): Promise<ContentResult<StorefrontContent>>; findProducts(cids: IpfsCid[]): Promise<ContentResult<ProductContent>>; findOrderings(cids: IpfsCid[]): Promise<ContentResult<OrderingContent>>; findComments(cids: IpfsCid[]): Promise<ContentResult<CommentContent>>; findProfiles(cids: IpfsCid[]): Promise<ContentResult<ProfileContent>>; getContent<T extends CommonContent>(cid: IpfsCid, contentName?: string): Promise<T | undefined>; findStorefront(cid: IpfsCid): Promise<StorefrontContent | undefined>; findProduct(cid: IpfsCid): Promise<ProductContent | undefined>; findComment(cid: IpfsCid): Promise<CommentContent | undefined>; findProfile(cid: IpfsCid): Promise<ProfileContent | undefined>; findOrdering(cid: IpfsCid): Promise<OrderingContent | undefined>; removeContent(cid: IpfsCid): Promise<void>; saveContent(content: CommonContent): Promise<RuntimeIpfsCid | undefined>; saveFile(file: File | Blob): Promise<any>; saveStorefront(content: StorefrontContent): Promise<RuntimeIpfsCid | undefined>; saveProduct(content: ProductContent): Promise<RuntimeIpfsCid | undefined>; saveOrdering(content: OrderingContent): Promise<RuntimeIpfsCid | undefined>; saveComment(content: CommentContent): Promise<RuntimeIpfsCid | undefined>; } export {};