How to use the @zilliqa-js/core.RPCMethod.GetTransaction function in @zilliqa-js/core

To help you get started, we’ve selected a few @zilliqa-js/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Zilliqa / Zilliqa-JavaScript-Library / packages / zilliqa-js-account / src / transaction.ts View on Github external
private async trackTx(txHash: string): Promise {
    const res: RPCResponse = await this.provider.send(
      RPCMethod.GetTransaction,
      txHash,
    );

    if (res.error) {
      this.emit(TxEventName.Error, res.error);
      return false;
    }

    this.id = res.result.ID;
    this.receipt = {
      ...res.result.receipt,
      cumulative_gas: parseInt(res.result.receipt.cumulative_gas, 10),
    };
    this.emit(TxEventName.Receipt, this.receipt);
    this.status =
      this.receipt && this.receipt.success
github Zilliqa / Zilliqa-JavaScript-Library / packages / zilliqa-js-blockchain / src / chain.ts View on Github external
async getTransaction(txHash: string): Promise {
    try {
      const response = await this.provider.send(
        RPCMethod.GetTransaction,
        txHash,
      );

      if (response.error) {
        return Promise.reject(response.error);
      }

      return response.result.receipt.success
        ? Transaction.confirm(toTxParams(response), this.provider)
        : Transaction.reject(toTxParams(response), this.provider);
    } catch (err) {
      throw err;
    }
  }