Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Tzip7Helpers

TZIP-7 Util class for Tezos FA1.2 tokens related Atomex helper functions

Hierarchy

Index

Constructors

constructor

  • new Tzip7Helpers(tezos: TezosToolkit, entrypoints: Record<string, any>, contractAddress: string, timeBetweenBlocks: number, gasLimit: number, minimalFees: number, minimalNanotezPerGasUnit: number, minimalNanotezPerByte: number, costPerByte: number, redeemTxSize: number, initiateTxSize: number): Tzip7Helpers
  • Parameters

    • tezos: TezosToolkit
    • entrypoints: Record<string, any>
    • contractAddress: string
    • timeBetweenBlocks: number
    • gasLimit: number
    • minimalFees: number
    • minimalNanotezPerGasUnit: number
    • minimalNanotezPerByte: number
    • costPerByte: number
    • redeemTxSize: number
    • initiateTxSize: number

    Returns Tzip7Helpers

Methods

buildAddTransaction

buildInitiateTransaction

buildRedeemTransaction

buildRefundTransaction

calcFees

  • calcFees(gas?: number, storageDiff?: number, txSize?: number): number
  • Parameters

    • Default value gas: number = 0
    • Default value storageDiff: number = 0
    • Default value txSize: number = 0

    Returns number

encodePublicKey

  • encodePublicKey(pubKey: string): string

encodeSignature

  • encodeSignature(signature: string): string

estimateInitiateFees

  • estimateInitiateFees(source: string): Promise<number>

estimateRedeemFees

  • estimateRedeemFees(recipient: string): Promise<RedeemFees>

findContractCall

  • findContractCall(block: BlockResponse, txID: string): OperationContentsAndResultTransaction

getAuthMessage

  • getAuthMessage(message: string, address: string): AuthMessage

getBlockDetails

  • getBlockDetails(block: BlockResponse): { level: number; numEndorsements: number; timestamp: number }
  • Get Block endorsements and level

    Parameters

    • block: BlockResponse

    Returns { level: number; numEndorsements: number; timestamp: number }

    endorsements , level of the block and block generation time

    • level: number
    • numEndorsements: number
    • timestamp: number

isValidAddress

  • isValidAddress(address: string): boolean

parseInitiateParameters

  • parseInitiateParameters(content: OperationContentsAndResultTransaction): InitiateParameters

validateInitiateTransaction

  • validateInitiateTransaction(blockHeight: number, txID: string, secretHash: string, receivingAddress: string, netAmount: number, minRefundTimestamp: number, minConfirmations?: number): Promise<SwapTransactionStatus>

Static create

  • Connects to the supported tezos chain

    Parameters

    • network: Network

      networks supported by atomex, can be either mainnet or testnet

    • currency: TezosBasedCurrency

      either native currency (XTZ) or any supported FA1.2/FA2 token symbol

    • Optional rpcUri: undefined | string

    Returns Promise<TezosHelpers>

    chain id of the connected chain

Generated using TypeDoc