Skip to content

Commit

Permalink
Change TTL values in tx_info to string, Fix asset_info/asset_policy_i…
Browse files Browse the repository at this point in the history
…nfo to show latest mint tx data (#141)

## Description
<!--- Describe your changes -->
1. [Minor output (data-type) change] - Convert tx_info: TTL values to string (as some values are far beyond billion) - assists cardano-community/koios-java-client#100
2. [Non-breaking] - Fix asset_info/asset_policy_info to show latest mint tx data (was an error in change before intended to do the same), and update asset_info->tx_hash to show latest (instead of oldest) tx
  • Loading branch information
rdlrt committed Dec 6, 2022
1 parent 34fbff6 commit 6671fc9
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 26 deletions.
6 changes: 3 additions & 3 deletions files/grest/rpc/assets/asset_info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ BEGIN
WHERE
MTM.ident = _asset_id AND MTM.quantity > 0
ORDER BY
MTM.tx_id ASC
MTM.tx_id DESC
LIMIT 1
) AS tx_hash,
minting_data.total_supply,
Expand All @@ -62,15 +62,15 @@ BEGIN
) as minting_tx_metadata
FROM
(
SELECT TM.key, TM.json, MAX(MTM.tx_id)
SELECT TM.key, TM.json, MTM.tx_id
FROM tx_metadata TM
INNER JOIN ma_tx_mint MTM
ON TM.tx_id = MTM.tx_id
WHERE
MTM.ident = _asset_id
AND MTM.tx_id = (SELECT max(tx_id) from ma_tx_mint where ident = _asset_id)
AND MTM.quantity > 0
AND TM.JSON IS NOT NULL
GROUP BY TM.key, TM.json
) x
) AS minting_tx_metadata,
(
Expand Down
2 changes: 1 addition & 1 deletion files/grest/rpc/assets/asset_policy_info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ BEGIN
MTM.ident = ANY(_policy_asset_ids) AND MTM.quantity > 0
ORDER BY
MTM.ident,
TM.tx_id ASC
TM.tx_id DESC
),
token_registry_metadatas AS (
SELECT DISTINCT ON (asset_policy, asset_name)
Expand Down
8 changes: 4 additions & 4 deletions files/grest/rpc/transactions/tx_info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ CREATE FUNCTION grest.tx_info (_tx_hashes text[])
total_output text,
fee text,
deposit text,
invalid_before word64type,
invalid_after word64type,
invalid_before text,
invalid_after text,
collateral_inputs jsonb,
collateral_output jsonb,
reference_inputs jsonb,
Expand Down Expand Up @@ -696,8 +696,8 @@ BEGIN
ATX.total_output::text,
ATX.fee::text,
ATX.deposit::text,
ATX.invalid_before,
ATX.invalid_after,
ATX.invalid_before::text,
ATX.invalid_after::text,
COALESCE((
SELECT JSONB_AGG(tx_collateral_inputs)
FROM (
Expand Down
6 changes: 3 additions & 3 deletions specs/results/koiosapi-guild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2723,11 +2723,11 @@ components:
description: Total Deposits included in transaction (for example, if it is registering a pool/key)
example: 0
invalid_before:
type: integer
type: string
description: Slot before which transaction cannot be validated (if supplied, else null)
nullable: true
invalid_after:
type: integer
type: string
description: Slot after which transaction cannot be validated
example: 42332172
nullable: true
Expand Down Expand Up @@ -3107,7 +3107,7 @@ components:
example: asset1ua6pz3yd5mdka946z8jw2fld3f8d0mmxt75gv9
minting_tx_hash:
type: string
description: Hash of the first mint transaction
description: Hash of the latest mint transaction
example: cb07b7e51b77079776c4a78f2daf8f14f9945d2b047da7bfcb71d7fbb9f86712
mint_cnt:
type: integer
Expand Down
6 changes: 3 additions & 3 deletions specs/results/koiosapi-mainnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2723,11 +2723,11 @@ components:
description: Total Deposits included in transaction (for example, if it is registering a pool/key)
example: 0
invalid_before:
type: integer
type: string
description: Slot before which transaction cannot be validated (if supplied, else null)
nullable: true
invalid_after:
type: integer
type: string
description: Slot after which transaction cannot be validated
example: 42332172
nullable: true
Expand Down Expand Up @@ -3107,7 +3107,7 @@ components:
example: asset1ua6pz3yd5mdka946z8jw2fld3f8d0mmxt75gv9
minting_tx_hash:
type: string
description: Hash of the first mint transaction
description: Hash of the latest mint transaction
example: cb07b7e51b77079776c4a78f2daf8f14f9945d2b047da7bfcb71d7fbb9f86712
mint_cnt:
type: integer
Expand Down
6 changes: 3 additions & 3 deletions specs/results/koiosapi-preprod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2723,11 +2723,11 @@ components:
description: Total Deposits included in transaction (for example, if it is registering a pool/key)
example: 0
invalid_before:
type: integer
type: string
description: Slot before which transaction cannot be validated (if supplied, else null)
nullable: true
invalid_after:
type: integer
type: string
description: Slot after which transaction cannot be validated
example: 42332172
nullable: true
Expand Down Expand Up @@ -3107,7 +3107,7 @@ components:
example: asset1ua6pz3yd5mdka946z8jw2fld3f8d0mmxt75gv9
minting_tx_hash:
type: string
description: Hash of the first mint transaction
description: Hash of the latest mint transaction
example: cb07b7e51b77079776c4a78f2daf8f14f9945d2b047da7bfcb71d7fbb9f86712
mint_cnt:
type: integer
Expand Down
6 changes: 3 additions & 3 deletions specs/results/koiosapi-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2723,11 +2723,11 @@ components:
description: Total Deposits included in transaction (for example, if it is registering a pool/key)
example: 0
invalid_before:
type: integer
type: string
description: Slot before which transaction cannot be validated (if supplied, else null)
nullable: true
invalid_after:
type: integer
type: string
description: Slot after which transaction cannot be validated
example: 42332172
nullable: true
Expand Down Expand Up @@ -3107,7 +3107,7 @@ components:
example: asset1ua6pz3yd5mdka946z8jw2fld3f8d0mmxt75gv9
minting_tx_hash:
type: string
description: Hash of the first mint transaction
description: Hash of the latest mint transaction
example: cb07b7e51b77079776c4a78f2daf8f14f9945d2b047da7bfcb71d7fbb9f86712
mint_cnt:
type: integer
Expand Down
6 changes: 3 additions & 3 deletions specs/results/koiosapi-testnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2723,11 +2723,11 @@ components:
description: Total Deposits included in transaction (for example, if it is registering a pool/key)
example: 0
invalid_before:
type: integer
type: string
description: Slot before which transaction cannot be validated (if supplied, else null)
nullable: true
invalid_after:
type: integer
type: string
description: Slot after which transaction cannot be validated
example: 42332172
nullable: true
Expand Down Expand Up @@ -3107,7 +3107,7 @@ components:
example: asset1ua6pz3yd5mdka946z8jw2fld3f8d0mmxt75gv9
minting_tx_hash:
type: string
description: Hash of the first mint transaction
description: Hash of the latest mint transaction
example: cb07b7e51b77079776c4a78f2daf8f14f9945d2b047da7bfcb71d7fbb9f86712
mint_cnt:
type: integer
Expand Down
6 changes: 3 additions & 3 deletions specs/templates/4-api-schemas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1085,11 +1085,11 @@ schemas:
description: Total Deposits included in transaction (for example, if it is registering a pool/key)
example: 0
invalid_before:
type: integer
type: string
description: Slot before which transaction cannot be validated (if supplied, else null)
nullable: true
invalid_after:
type: integer
type: string
description: Slot after which transaction cannot be validated
example: 42332172
nullable: true
Expand Down Expand Up @@ -1469,7 +1469,7 @@ schemas:
example: asset1ua6pz3yd5mdka946z8jw2fld3f8d0mmxt75gv9
minting_tx_hash:
type: string
description: Hash of the first mint transaction
description: Hash of the latest mint transaction
example: cb07b7e51b77079776c4a78f2daf8f14f9945d2b047da7bfcb71d7fbb9f86712
mint_cnt:
type: integer
Expand Down

0 comments on commit 6671fc9

Please sign in to comment.