All files / src/Asset/DbSyncAssetProvider queries.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 0/0
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 4136x                     36x                           36x               36x           36x  
export const findLastNftMintTx = `
	SELECT tx.hash AS tx_hash
	FROM ma_tx_mint AS mint
	JOIN multi_asset AS ma ON mint.ident = ma.id
	JOIN tx_metadata AS meta ON meta.tx_id = mint.tx_id
	JOIN tx ON tx.id = mint.tx_id
	WHERE ma.policy = $1 AND ma.name = $2 AND meta.key = 721
	ORDER BY mint.id DESC
	LIMIT 1
`;
 
export const findMultiAsset = `
SELECT
  fingerprint,
  COUNT(*) AS count,
  SUM(quantity) AS sum
FROM multi_asset
JOIN ma_tx_mint
  ON ident = multi_asset.id
WHERE
  policy = $1 AND name = $2
GROUP BY
  fingerprint
`;
 
export const findMultiAssetHistory = `
	SELECT tx.hash AS hash, mint.quantity AS quantity
	FROM ma_tx_mint AS mint
	JOIN multi_asset AS ma ON mint.ident = ma.id
	JOIN tx ON tx.id = mint.tx_id
	WHERE ma.policy = $1 AND ma.name = $2
`;
 
const Queries = {
  findLastNftMintTx,
  findMultiAsset,
  findMultiAssetHistory
};
 
export default Queries;