Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @taquito/utils

Index

Variables

Const VERSION

VERSION: { commitHash: string; version: string } = ...

Type declaration

  • commitHash: string
  • version: string

Const prefix

prefix: { Co: Uint8Array; KT: Uint8Array; KT1: Uint8Array; LLo: Uint8Array; Lo: Uint8Array; Net: Uint8Array; P: Uint8Array; TZ: Uint8Array; b: Uint8Array; edesk: Uint8Array; edpk: Uint8Array; edsig: Uint8Array; edsk: Uint8Array; edsk2: Uint8Array; expr: Uint8Array; id: Uint8Array; nce: Uint8Array; o: Uint8Array; p2esk: Uint8Array; p2pk: Uint8Array; p2sig: Uint8Array; p2sk: Uint8Array; sig: Uint8Array; spesk: Uint8Array; sppk: Uint8Array; spsig: Uint8Array; spsk: Uint8Array; tz1: Uint8Array; tz2: Uint8Array; tz3: Uint8Array } = ...

Type declaration

  • Co: Uint8Array
  • KT: Uint8Array
  • KT1: Uint8Array
  • LLo: Uint8Array
  • Lo: Uint8Array
  • Net: Uint8Array
  • P: Uint8Array
  • TZ: Uint8Array
  • b: Uint8Array
  • edesk: Uint8Array
  • edpk: Uint8Array
  • edsig: Uint8Array
  • edsk: Uint8Array
  • edsk2: Uint8Array
  • expr: Uint8Array
  • id: Uint8Array
  • nce: Uint8Array
  • o: Uint8Array
  • p2esk: Uint8Array
  • p2pk: Uint8Array
  • p2sig: Uint8Array
  • p2sk: Uint8Array
  • sig: Uint8Array
  • spesk: Uint8Array
  • sppk: Uint8Array
  • spsig: Uint8Array
  • spsk: Uint8Array
  • tz1: Uint8Array
  • tz2: Uint8Array
  • tz3: Uint8Array

Const prefixLength

prefixLength: {} = ...

Type declaration

  • [key: string]: number

Functions

Const b58cdecode

  • b58cdecode(enc: string, prefixArg: Uint8Array): Uint8Array

b58cencode

  • b58cencode(value: string | Uint8Array, prefix: Uint8Array): any
  • description

    Base58 encode a string or a Uint8Array and append a prefix to it

    Parameters

    • value: string | Uint8Array

      Value to base58 encode

    • prefix: Uint8Array

      prefix to append to the encoded string

    Returns any

b58decode

  • b58decode(payload: string): string

Const buf2hex

  • buf2hex(buffer: Buffer): string

bytes2Char

  • bytes2Char(hex: string): string

char2Bytes

  • char2Bytes(str: string): string

encodeExpr

  • encodeExpr(value: string): any
  • description

    Hash a string using the BLAKE2b algorithm, base58 encode the hash obtained and appends the prefix 'expr' to it

    Parameters

    • value: string

      Value in hex

    Returns any

encodeKey

  • encodeKey(value: string): any

encodeKeyHash

  • encodeKeyHash(value: string): any

encodeOpHash

  • encodeOpHash(value: string): any

encodePubKey

  • encodePubKey(value: string): any

Const hex2buf

  • hex2buf(hex: string): Uint8Array

isValidPrefix

  • isValidPrefix(value: any): value is Prefix

Const mergebuf

  • mergebuf(b1: Uint8Array, b2: Uint8Array): Uint8Array

Const mic2arr

  • mic2arr(s: any): any

validateAddress

  • description

    Used to check if an address or a contract address is valid.

    example
    import { validateAddress } from '@taquito/utils';
    const pkh = 'tz1L9r8mWmRPndRhuvMCWESLGSVeFzQ9NAWx'
    const validation = validateAddress(pkh)
    console.log(validation)
    // This example return 3 which correspond to VALID
    

    Parameters

    • value: any

    Returns ValidationResult

    0 (NO_PREFIX_MATCHED), 1 (INVALID_CHECKSUM), 2 (INVALID_LENGTH) or 3 (VALID).

validateChain

  • description

    Used to check if a chain id is valid.

    example
    import { validateChain } from '@taquito/utils';
    const chainId = 'NetXdQprcVkpaWU'
    const validation = validateChain(chainId)
    console.log(validation)
    // This example return 3 which correspond to VALID
    

    Parameters

    • value: any

    Returns ValidationResult

    0 (NO_PREFIX_MATCHED), 1 (INVALID_CHECKSUM), 2 (INVALID_LENGTH) or 3 (VALID).

validateContractAddress

  • description

    Used to check if a contract address is valid.

    example
    import { validateContractAddress } from '@taquito/utils';
    const contractAddress = 'KT1JVErLYTgtY8uGGZ4mso2npTSxqVLDRVbC'
    const validation = validateContractAddress(contractAddress)
    console.log(validation)
    // This example return 3 which correspond to VALID
    

    Parameters

    • value: any

    Returns ValidationResult

    0 (NO_PREFIX_MATCHED), 1 (INVALID_CHECKSUM), 2 (INVALID_LENGTH) or 3 (VALID).

validateKeyHash

  • description

    Used to check if a key hash is valid.

    example
    import { validateKeyHash } from '@taquito/utils';
    const keyHashWithoutPrefix = '1L9r8mWmRPndRhuvMCWESLGSVeFzQ9NAWx'
    const validation = validateKeyHash(keyHashWithoutPrefix)
    console.log(validation)
    // This example return 0 which correspond to NO_PREFIX_MATCHED
    

    Parameters

    • value: any

    Returns ValidationResult

    0 (NO_PREFIX_MATCHED), 1 (INVALID_CHECKSUM), 2 (INVALID_LENGTH) or 3 (VALID).

validatePublicKey

  • description

    Used to check if a signature is valid.

    example
    import { validatePublicKey } from '@taquito/utils';
    const publicKey = 'edsigtkpiSSschcaCt9pUVrpNPf7TTcgvgDEDD6NCEHMy8NNQJCGnMfLZzYoQj74yLjo9wx6MPVV29CvVzgi7qEcEUok3k7AuMg'
    const validation = validatePublicKey(publicKey)
    console.log(validation)
    // This example return 3 which correspond to VALID
    

    Parameters

    • value: any

    Returns ValidationResult

    0 (NO_PREFIX_MATCHED), 1 (INVALID_CHECKSUM), 2 (INVALID_LENGTH) or 3 (VALID).

validateSignature

  • description

    Used to check if a signature is valid.

    example
    import { validateSignature } from '@taquito/utils';
    const signature = 'edsigtkpiSSschcaCt9pUVrpNPf7TTcgvgDEDD6NCEHMy8NNQJCGnMfLZzYoQj74yLjo9wx6MPVV29CvVzgi7qEcEUok3k7AuMg'
    const validation = validateSignature(signature)
    console.log(validation)
    // This example return 3 which correspond to VALID
    

    Parameters

    • value: any

    Returns ValidationResult

    0 (NO_PREFIX_MATCHED), 1 (INVALID_CHECKSUM), 2 (INVALID_LENGTH) or 3 (VALID).

Generated using TypeDoc