From d0e4fbb64f9cf955bea6bfe47eae41bdac36a6fa Mon Sep 17 00:00:00 2001 From: daveusa31 <81916132+daveusa31@users.noreply.github.com> Date: Thu, 20 Jan 2022 18:53:54 +0300 Subject: [PATCH] Add method get_tx to ChainSoAPI --- blockapi/api/chainso.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/blockapi/api/chainso.py b/blockapi/api/chainso.py index e50b9da1..0493a052 100644 --- a/blockapi/api/chainso.py +++ b/blockapi/api/chainso.py @@ -21,7 +21,8 @@ class ChainSoAPI(BlockchainAPI): supported_requests = { 'get_balance': '/get_address_balance/{symbol}/{address}', - 'get_txs': '/address/{symbol}/{address}' + 'get_txs': '/address/{symbol}/{address}', + 'get_tx': '/get_tx_outputs/{symbol}/{TXID}', } def __init__(self, address, api_key=None): @@ -49,15 +50,20 @@ def get_txs(self, offset=None, limit=None, unconfirmed=False): return [self.parse_tx(t) for t in txs] + def get_tx(self, tx_id): + return self._request('get_tx', TXID=tx_id) + @staticmethod def parse_tx(tx): return tx - def _request(self, method): + def _request(self, method, **params): + params["symbol"] = self.symbol + params["address"] = self.address + response = self.request( method, - symbol=self.symbol, - address=self.address, + **params, # with_cloudflare=True ) if response['status'] == 'fail':