Skip to content

Commit

Permalink
Revert "feat(assets): improve asset query"
Browse files Browse the repository at this point in the history
  • Loading branch information
1000101 committed Mar 1, 2024
1 parent 12b84bc commit cfceb80
Show file tree
Hide file tree
Showing 44 changed files with 435 additions and 30 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- improved `/assets/:asset` performance for assets with many mint txs
- node_modules
- yarn
- updated vitest
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"rimraf": "^5.0.1"
},
"devDependencies": {
"@blockfrost/blockfrost-tests": "1.11.0",
"@types/blake2b": "^2.1.3",
"@types/config": "3.3.1",
"@types/express": "^4.17.17",
Expand Down
22 changes: 7 additions & 15 deletions src/sql/assets/assets_asset.sql
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
WITH queried_asset AS (
SELECT id AS "asset_id"
FROM multi_asset ma
WHERE (
encode(ma.policy, 'hex') || encode(ma.name, 'hex')
) = $1
),
queried_metadata AS (
WITH queried_metadata AS (
SELECT txm.json AS "onchain_metadata",
encode(txm.bytes, 'hex') AS "onchain_metadata_cbor"
FROM tx_metadata txm
WHERE txm.tx_id = (
SELECT MAX(txmmax.tx_id)
FROM ma_tx_mint mtmmax
JOIN multi_asset ma ON (mtmmax.ident = ma.id)
JOIN tx_metadata txmmax ON (mtmmax.tx_id = txmmax.tx_id)
WHERE mtmmax.id = (
SELECT asset_id
FROM queried_asset
)
AND txmmax.key = 721
WHERE txmmax.key = 721
AND quantity > 0
AND (
encode(ma.policy, 'hex') || encode(ma.name, 'hex')
) = $1
)
AND txm.key = 721
)
Expand All @@ -30,8 +23,7 @@ SELECT (
WHEN encode(ma.name, 'hex') <> '' THEN encode(ma.name, 'hex')
ELSE null
END AS "asset_name",
SUM(mtm.quantity)::TEXT AS "quantity",
-- cast to TEXT to avoid number overflow
SUM(mtm.quantity)::TEXT AS "quantity", -- cast to TEXT to avoid number overflow
(
SELECT encode(tx.hash, 'hex')
FROM tx
Expand Down
63 changes: 51 additions & 12 deletions yarn-project.nix

Large diffs are not rendered by default.

Loading

0 comments on commit cfceb80

Please sign in to comment.