Skip to main content

OffChainList

Hierarchy

  • any
    • OffChainList

Index

Constructors

constructor

  • Returns OffChainList

Methods

getValue

  • getValue(key: Field, name?: string): Promise<FieldOption>
  • The function fetches a whitelisted amount associated with a given key using a map and returns it as a FieldOption.


    Parameters

    • key: Field

      The key parameter is of type Field, which represents a field element in the context of a cryptographic system.

    • name: string = "offchain-map"

    Returns Promise<FieldOption>

    The getValue function returns a Promise that resolves to a FieldOption object. This object contains a value property representing the amount retrieved from a map based on the provided key. The isSome property indicates whether the value is present or not. The value is not present if the list is NOT empty and the key is NOT in the map. The value is present if the list IS empty or the key IS in the map. The value is present and equals to Field(0) if the list IS empty.

isNone

  • isNone(): Bool
  • Returns Bool

isSome

  • isSome(): Bool
  • Returns Bool

load

toString

  • toString(): string
  • Returns string

staticcreate

  • Creates a new OffchainList and pins it to IPFS.


    Parameters

    • params: { attempts?: number; auth?: string; data?: object; filename?: string; json?: OffchainMapSerialized; keyvalues?: object; list: OffChainMapEntry[] | { key: string; value?: number }[]; name?: string; pin?: boolean; timeout?: number }

      The parameters for creating the list.

      • optionalattempts: number
      • optionalauth: string
      • optionaldata: object

        The JSON data that should be added to the IPFS storage that represent the initial data

      • optionalfilename: string
      • optionaljson: OffchainMapSerialized
      • optionalkeyvalues: object
      • list: OffChainMapEntry[] | { key: string; value?: number }[]

        The list of entries to be added to the map.

      • optionalname: string
      • optionalpin: boolean
      • optionaltimeout: number

    Returns Promise<{ json: OffchainMapSerialized; list: OffChainList }>

    A new OffChainList instance.

staticempty

staticfromString