Skip to content

Commit

Permalink
merge with develop
Browse files Browse the repository at this point in the history
  • Loading branch information
soad003 committed Dec 10, 2024
2 parents da718ef + 62d0cee commit 8ca2b6a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 20 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [24.11.2] - 2024-12-03

### Fixed

- Return concepts with tags

## [24.11.1] - 2024-11-27

### Added

- added parameters `include_nonstandard_io` and `include_io_index` for endpoints `/{currency}/txs/{tx_hash}` and `/{currency}/txs/{tx_hash}/{io}` (by default false)

## [24.11.0] - 2024-11-20

### Added
Expand Down
42 changes: 22 additions & 20 deletions gsrest/service/txs_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ async def get_trace_txs(request, currency, tx, trace_index=None):
db = request.app["db"]
result = await db.fetch_transaction_trace(currency, tx, trace_index)

if result:
if result and result["tx_hash"] == tx["tx_hash"]:
result["type"] = "internal"
result["timestamp"] = tx["block_timestamp"]

Expand All @@ -203,12 +203,14 @@ async def get_trace_txs(request, currency, tx, trace_index=None):
else:
result["contract_creation"] = result["trace_type"] == "create"

return from_row(
currency,
result,
(await get_rates(request, currency, result["block_id"]))["rates"],
db.get_token_configuration(currency),
)
return from_row(
currency,
result,
(await get_rates(request, currency, result["block_id"]))["rates"],
db.get_token_configuration(currency),
)
else:
return None


async def get_tx(
Expand All @@ -223,17 +225,17 @@ async def get_tx(
db = request.app["db"]

trace_index = None
try:
if f"{SUBTX_IDENT_SEPERATOR_CHAR}I" in tx_hash:
h, postfix, *_ = tx_hash.split(SUBTX_IDENT_SEPERATOR_CHAR)
trace_index = int(postfix.strip("IT"))
tx_hash = h
elif f"{SUBTX_IDENT_SEPERATOR_CHAR}T" in tx_hash:
h, postfix, *_ = tx_hash.split(SUBTX_IDENT_SEPERATOR_CHAR)
token_tx_id = int(postfix.strip("IT")) or token_tx_id
tx_hash = h
except ValueError:
pass

tx_ident = tx_hash

if f"{SUBTX_IDENT_SEPERATOR_CHAR}I" in tx_hash:
h, postfix, *_ = tx_hash.split(SUBTX_IDENT_SEPERATOR_CHAR)
trace_index = int(postfix.strip("IT"))
tx_hash = h
elif f"{SUBTX_IDENT_SEPERATOR_CHAR}T" in tx_hash:
h, postfix, *_ = tx_hash.split(SUBTX_IDENT_SEPERATOR_CHAR)
token_tx_id = int(postfix.strip("IT")) or token_tx_id
tx_hash = h

if token_tx_id is not None:
if is_eth_like(currency):
Expand All @@ -244,7 +246,7 @@ async def get_tx(
if len(results):
return results[0]
else:
raise TransactionNotFoundException(currency, tx_hash, token_tx_id)
raise TransactionNotFoundException(currency, tx_ident, token_tx_id)
else:
raise BadUserInputException(
f"{currency} does not support token transactions."
Expand All @@ -257,7 +259,7 @@ async def get_tx(
if res:
return res
else:
raise TransactionNotFoundException(currency, tx_hash, token_tx_id)
raise TransactionNotFoundException(currency, tx_ident, token_tx_id)

else:
raise BadUserInputException(
Expand Down

0 comments on commit 8ca2b6a

Please sign in to comment.