UNPKG

@oap75/api

Version:
25 lines (24 loc) 1.6 kB
import { IpfsCid, SubstrateId, AnyAccountId, CommonStruct, CID } from '@subsocial/types'; import { PostId, ReactionId, SocialAccount, Reaction, Post, Content } from '@subsocial/types/substrate/interfaces'; import { GenericAccountId } from '@polkadot/types'; import { SubmittableResult } from '@polkadot/api'; import BN from 'bn.js'; export declare type SupportedSubstrateId = SubstrateId | AnyAccountId | ReactionId; export declare type SupportedSubstrateResult = CommonStruct | SocialAccount | Reaction; declare type AnyId = SupportedSubstrateId | IpfsCid; export declare const getUniqueIds: <ID extends AnyId>(ids: (ID | undefined)[]) => ID[]; export declare function asAccountId(id: AnyAccountId): GenericAccountId | undefined; export declare function isAccountId(id: AnyAccountId): boolean; export declare const getSharedPostId: (postData: any) => PostId | undefined; declare type HasPostStruct = { struct: Post; }; /** Return original post id from shared post or root post id if this post is a comment. */ export declare const getPostIdFromExtension: (postData?: HasPostStruct | undefined) => PostId | undefined; export declare const isIpfs: (content?: Content | undefined) => any; export declare const asIpfsCid: (cid: IpfsCid) => CID | undefined; export declare const isValidIpfsCid: (cid: IpfsCid) => boolean; export declare const resolveCidOfContent: (content?: Content | undefined) => string | undefined; export declare type ResultEventType = 'Created' | 'Updated'; export declare function getNewIdsFromEvent(txResult: SubmittableResult, eventType?: ResultEventType): BN[]; export {};