<?php

namespace App\Services\ThirdPartyApiServices\TronApi;

use App\Models\ApiSettings;
use App\Models\DepositAddress;
use App\Services\ThirdPartyApiServices\BaseApiCall;
use Illuminate\Support\Facades\Log;

class TronApi extends BaseApiCall
{
    protected array $data = [];
    protected $config;
    protected $apiUrl;

    public function __construct()
    {
        $this->config = ApiSettings::where('domain_holder', '=', 'tron_api')->first();
        $this->setApiUrl(getSiteSettings('api_mode') == 'live' ? $this->config['live_api_source'] : $this->config['test_api_source']);
        $this->setCredential($this->config['api_key']);
    }
   /**
     * Get transaction by hash
     *
     * @param                $txHash
     * @param $contractAddress
     * @param array|string[] $query
     *
     * @return array|mixed|void
     */
    public function getTransactionByHash($txHash,$contractAddress)
    {
        $this->setContractAddress($contractAddress);
        $this->setQueryData([],['hash' => $txHash], 'eth');
        return $this->callToApi('transaction-info?hash='.$txHash);
    }

}



