Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • SolstoryClientAPI

Index

Constructors

Properties

program: SolstoryAPI

Methods

  • This function will assume a full refresh is desired, and will refresh SolstoryAPI's internal cache of the metadata.k

    This will default to only getting validated metadata, meaning metadata approved by the system. If you'd like to get even non-validated accounts, initiate the API with the "includeNonValidatedWriters" option set to true.

    Parameters

    • cacheOverChain: boolean = false

      if this is true, we'll try to use the local cache instead of calling the blockhain. Setting this to true means getAllMetadata might return stale data.

    Returns Promise<SolstoryMetadata[]>

  • getHead(writerKey: PublicKey, mintKey: PublicKey): Promise<SolstoryHead>
  • getHeadsForNFT(mintKey: PublicKey, showInvisible?: boolean, forceRefreshMetadata?: boolean): Promise<SolstoryHead[]>
  • This will retrieve all metadatas, then find all the ones that have a connection with the given NFT.

    Just like the getAllMetadata this will default to only getting validated metadata. If you'd like to get even non-validated accounts, initiate the API with the "includeNonValidatedWriters" option set to true.

    Parameters

    • mintKey: PublicKey
    • showInvisible: boolean = false

      Stories can mark themselves as "invisible" when they are used for system things. For example, a serverless NFT game might store game data intended for use by the system, in which case it signal that this story wasn't for human consumption by marking "invisible" as true. Setting this flag will load the data anyway (useful for debugging or curiosity).

    • forceRefreshMetadata: boolean = false

    Returns Promise<SolstoryHead[]>

  • getMetadata(writerKey: PublicKey, allowCachedMetadata?: boolean): Promise<SolstoryMetadata>
  • getStory(writerKey: PublicKey, mintKey: PublicKey, initialItems?: number): Promise<SolstoryStory>
  • If a CDN is not used, getStory will require serial web requests. One way to get around this and do progressive loading, is to request 1 item and then repeatedly call getAdditionalItems.

    Parameters

    • writerKey: PublicKey
    • mintKey: PublicKey
    • initialItems: number = 1

    Returns Promise<SolstoryStory>

  • Takes a SolstoryHead describing a particular story and returns the actual items in thats story.

    Parameters

    Returns Promise<SolstoryStory>

    A SolstoryStory with the up to the requested number of items loaded.

    Performance characteristics:

    If a CDN is not used, getStoryFromWriter will require serial web requests. One way to get around this and do progressive loading, is to request 1 item and then call getAdditionalItems, which will progressively add as many items as requested to the now initialized SolstoryStory.

  • verifyItem(currentHash: string, verified: { itemHash: string; itemRaw: string; nextHash: string; timestamp: number }): boolean
  • internal

    If you intend to use this function, please see how it works in getAdditionalItems.

    Parameters

    • currentHash: string
    • verified: { itemHash: string; itemRaw: string; nextHash: string; timestamp: number }
      • itemHash: string
      • itemRaw: string
      • nextHash: string
      • timestamp: number

    Returns boolean

  • When verifying a story, we only verify that items that have been already loaded.

    When loading via blockchain this process is performed automatically.

    Parameters

    Returns Promise<boolean>

Generated using TypeDoc