Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Protocol

Protocols define the application running on the Tezos blockchain. For more information see the Protocols API documentation on tzKT.

remark

Protocols can be upgraded without interrupting or forking the blockchain.

Hierarchy

  • Protocol

Index

Constructors

constructor

  • new Protocol(code: number, hash: null | string, firstLevel: number, lastLevel: null | number, constants: null | any[], metadata: any): Protocol
  • internal

    Parameters

    • code: number
    • hash: null | string
    • firstLevel: number
    • lastLevel: null | number
    • constants: null | any[]
    • metadata: any

    Returns Protocol

Properties

Readonly code

code: number

Readonly constants

constants: null | any[]

Readonly firstLevel

firstLevel: number

Readonly hash

hash: null | string

Readonly lastLevel

lastLevel: null | number

Readonly metadata

metadata: any

Methods

Static byCode

  • byCode(code: number, domain?: string): Promise<Protocol>
  • Fetches protocols by proto code from tzKT.

    see

    get protocol by code.

    example

    Fetch Protocol By Code

    Usage

    let protocol: Protocol = await Protocol.byCode(0);
    

    Parameters

    • code: number
    • domain: string = 'https://api.tzkt.io'

    Returns Promise<Protocol>

    Returns a protocol with the specified proto code.

Static byCycle

  • byCycle(cycle: number, domain?: string): Promise<Protocol>
  • Fetches protocols at the specified cycle from tzKT.

    see

    get protocol by cycle.

    example

    Fetch Protocol By Cycle

    Usage

    let cycle: number = 30000;
    let protocol: Protocol = await Protocol.byCycle(cycle);
    

    Parameters

    • cycle: number
    • domain: string = 'https://api.tzkt.io'

    Returns Promise<Protocol>

    Returns a protocol at the specified cycle.

Static byHash

  • byHash(hash: string, domain?: string): Promise<Protocol>
  • Fetches protocols with the specified hash from tzKT.

    see

    get protocol by hash.

    example

    Fetch Protocol By Hash

    Usage

    let hash: string = 'Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P';
    let protocol: Protocol = await Protocol.byHash(hash);
    

    Parameters

    • hash: string
    • domain: string = 'https://api.tzkt.io'

    Returns Promise<Protocol>

    Returns a protocol with the specified hash.

Static count

  • count(domain?: string): Promise<number>
  • Fetches a number of protocols from tzKT.

    see

    get protocols count.

    example

    Fetch Protocol Count

    Usage

    let protocolCount: number = await Protocol.count();
    

    Parameters

    • domain: string = 'https://api.tzkt.io'

    Returns Promise<number>

    Returns the total number of protocols.

Static current

  • current(domain?: string): Promise<Protocol>
  • Fetches the current protocol from tzKT.

    see

    get current protocol.

    example

    Fetch Current Protocol

    Usage

    let currentProtocol: Protocol = await Protocol.current();
    

    Parameters

    • domain: string = 'https://api.tzkt.io'

    Returns Promise<Protocol>

    Returns the current protocol

Static fromAPI

Static get

Static suggestions

  • suggestions(query: string, domain?: string): Promise<any[]>
  • Suggests known protocols by part of alias. This endpoint is useful for autocomplete.

    see

    Suggest protocols

    example

    Fetch Protocol Suggestions

    Usage

    let suggestions: any[] = await Protocol.suggestions('Flo');
    

    Parameters

    • query: string
    • domain: string = 'https://api.tzkt.io'

    Returns Promise<any[]>

    proposal suggestions.

Generated using TypeDoc