Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TxAPI

Hierarchy

  • BaseAPI
    • TxAPI

Index

Constructors

Properties

Methods

  • Broadcast the transaction using "sync" mode, then wait for its inclusion in a block.

    This method polls txInfo using the txHash to confirm the transaction's execution.

    Parameters

    • tx: Tx

      transaction to broadcast

    • chainID: string

      chain ID

    • timeout: number = 30000

      time in milliseconds to wait for transaction to be included in a block. defaults to 30000

    Returns Promise<WaitTxBroadcastResult>

  • broadcastAsync(tx: Tx, chainID: string): Promise<Async>
  • Broadcast the transaction using the "async" mode, returns immediately (transaction might fail).

    Parameters

    • tx: Tx

      transaction to broadcast

    • chainID: string

      chain ID

    Returns Promise<Async>

  • NOTE: This is not a synchronous function and is unconventionally named. This function can be await as it returns a Promise.

    Broadcast the transaction using the "sync" mode, returning after CheckTx() is performed.

    Parameters

    • tx: Tx

      transaction to broadcast

    • chainID: string

      chain ID

    Returns Promise<SyncTxBroadcastResult>

  • computeTax(): Promise<Coins>
  • Builds a [[StdSignMsg]] that is ready to be signed by a Key. The appropriate account number and sequence will be fetched live from the blockchain and added to the resultant [[StdSignMsg]]. If no fee is provided, fee will be automatically estimated using the parameters, simulated using a "dummy fee" with sourceAddress's nonzero denominations in its balance.

    Parameters

    Returns Promise<Tx>

  • decode(encodedTx: string): Tx
  • encode(tx: Tx, isClassic?: boolean): string
  • Encode a transaction to base64-encoded protobuf

    Parameters

    • tx: Tx

      transaction to encode

    • Optional isClassic: boolean

    Returns string

  • estimateGas(tx: Tx, chainID: string, options?: { gasAdjustment?: Value; signers?: SignerData[] }): Promise<number>
  • getReqFromAddress(address: string): APIRequester
  • getReqFromChainID(chainID: string): APIRequester
  • hash(tx: Tx): Promise<string>
  • txInfo(txHash: string, chainID: string, params?: APIParams): Promise<TxInfo>
  • Looks up a transaction on the blockchain, addressed by its hash

    Parameters

    • txHash: string

      transaction's hash

    • chainID: string

      chainID

    • params: APIParams = {}

    Returns Promise<TxInfo>

  • txInfosByHeight(chainID: string, height: undefined | number): Promise<TxInfo[]>
  • Looks up transactions on the blockchain for the block height. If height is undefined, gets the transactions for the latest block.

    Parameters

    • chainID: string

      chain ID

    • height: undefined | number

      block height

    Returns Promise<TxInfo[]>