Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace TernoaHelpers

Index

Variables

DEFAULT_IPFS_GATEWAY: "https://ipfs.ternoa.dev/api/v0/add" = "https://ipfs.ternoa.dev/api/v0/add"

Functions

  • formatIpfsResponse(res: any): { hash: any; name: any; size: any; type: string }
  • name

    formatIpfsResponse

    summary

    Format the IPFS response from a gateway upload.

    Parameters

    • res: any

      An IPFS post request response.

    Returns { hash: any; name: any; size: any; type: string }

    A formatted object datas with name, hash, size and type.

    • hash: any
    • name: any
    • size: any
    • type: string
  • formatPermill(percent: number): number
  • name

    formatPermill

    summary

    Checks that percent is in range 0 to 100 and format to permill.

    Parameters

    • percent: number

      Number in range from 0 to 100 with max 4 decimals.

    Returns number

    The formated percent in permill format.

  • ipfsFileUpload(file: File, ipfsGateway?: string, apiKey?: string): Promise<{ hash: any; name: any; size: any; type: string }>
  • name

    ipfsFilesUpload

    summary

    Uploads a file on an IFPS gateway.

    Parameters

    • file: File

      File to upload on IPFS.

    • Optional ipfsGateway: string

      IPFS gateway to upload your file on. Default is https://ipfs.ternoa.dev/api/v0/add

    • Optional apiKey: string

      API Key to validate the upload on the IPFS gateway.

    Returns Promise<{ hash: any; name: any; size: any; type: string }>

    A formatted object datas with name, hash, size and type.

  • removeURLSlash(url: string): string
  • roundBalance(amount: string): number

Generated using TypeDoc