Skip to main content

api

API class for interacting with the serverless api

Index

Constructors

constructor

  • new api(jwt: string): api

Properties

endpoint

endpoint: string

The endpoint of the serverless api

jwt

jwt: string

The jwt token for authentication, get it at https://t.me/minanft_bot?start=auth

Methods

publicindexName

  • indexName(data: { name: string }): Promise<{ error?: string; isIndexed: boolean; reason?: string; success: boolean }>
  • Index the NFT using serverless api call The NFT mint transaction should be included in the block before calling this function otherwise it will fail and return isIndexed : false


    Parameters

    • data: { name: string }

      The data for the indexName call

    Returns Promise<{ error?: string; isIndexed: boolean; reason?: string; success: boolean }>

publicjobResult

  • jobResult(data: { jobId: string }): Promise<{ error?: string; result?: any; success: boolean }>
  • Gets the result of the job using serverless api call


    Parameters

    • data: { jobId: string }

      the data for the jobResult call

    Returns Promise<{ error?: string; result?: any; success: boolean }>

    where result is the result of the job if the job is not finished yet, the result will be undefined if the job failed, the result will be undefined and error will be set if the job is finished, the result will be set and error will be undefined if the job is not found, the result will be undefined and error will be set

publiclookupName

  • lookupName(name: string): Promise<{ address?: string; chain?: string; contract?: string; error?: string; found?: boolean; reason?: string; success: boolean }>
  • Gets the address (publicKey) of the NFT using serverless api call


    Parameters

    • name: string

      The name of the NFT

    Returns Promise<{ address?: string; chain?: string; contract?: string; error?: string; found?: boolean; reason?: string; success: boolean }>

publicmint

  • mint(data: { privateKey: string; signature: string; uri: string; useArweave?: boolean }): Promise<{ error?: string; jobId?: string; success: boolean }>
  • Mints a new NFT using serverless api call


    Parameters

    • data: { privateKey: string; signature: string; uri: string; useArweave?: boolean }

      the data for the mint call

    Returns Promise<{ error?: string; jobId?: string; success: boolean }>

    where jonId is the jobId of the minting transaction

publicpost

  • post(data: { commitData: MinaNFTCommitData; nftName: string; ownerPublicKey: string; postName: string }): Promise<{ error?: string; jobId?: string; success: boolean }>
  • Creates a new post for existing NFT using serverless api call


    Parameters

    • data: { commitData: MinaNFTCommitData; nftName: string; ownerPublicKey: string; postName: string }

      the data for the post call

    Returns Promise<{ error?: string; jobId?: string; success: boolean }>

    where jonId is the jobId of the minting transaction

publicproof

  • proof(data: { args: string[]; developer: string; name: string; task: string; transactions: string[] }): Promise<{ error?: string; jobId?: string; success: boolean }>
  • Starts a new job for the proof calculation using serverless api call The developer and name should correspond to the BackupPlugin of the API All other parameters should correspond to the parameters of the BackupPlugin


    Parameters

    • data: { args: string[]; developer: string; name: string; task: string; transactions: string[] }

      the data for the proof call

    Returns Promise<{ error?: string; jobId?: string; success: boolean }>

    where jonId is the jobId of the job

publicqueryBilling

  • queryBilling(): Promise<{ error?: string; result?: any; success: boolean }>
  • Gets the billing report for the jobs sent using JWT


    Returns Promise<{ error?: string; result?: any; success: boolean }>

    where result is the billing report

publicreserveName

  • reserveName(data: { chain: blockchain; contract: string; name: string; publicKey: string }): Promise<{ error?: string; isReserved: boolean; price: object; reason?: string; signature?: string; success: boolean }>
  • Reserves the name of the NFT using serverless api call


    Parameters

    • data: { chain: blockchain; contract: string; name: string; publicKey: string }

      The data for the reserveName call

    Returns Promise<{ error?: string; isReserved: boolean; price: object; reason?: string; signature?: string; success: boolean }>

publicwaitForJobResult

  • waitForJobResult(data: { interval?: number; jobId: string; maxAttempts?: number; maxErrors?: number }): Promise<{ error?: string; result?: any; success: boolean }>
  • Waits for the job to finish


    Parameters

    • data: { interval?: number; jobId: string; maxAttempts?: number; maxErrors?: number }

      the data for the waitForJobResult call

    Returns Promise<{ error?: string; result?: any; success: boolean }>

    where result is the result of the job