Skip to content

Commit

Permalink
Update asset_nft_address.sql (#264)
Browse files Browse the repository at this point in the history
Fixed up some issues with stake address join and tx_out table references

Co-authored-by: RdLrT <[email protected]>
  • Loading branch information
hodlonaut and rdlrt committed Jan 11, 2024
1 parent 69a732c commit 3acb686
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions files/grest/rpc/assets/asset_nft_address.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ BEGIN
txo.address,
sa.view AS stake_address
FROM tx_out AS txo
LEFT JOIN stake_address ON txo.stake_address_id = sa.view
LEFT JOIN stake_address AS sa ON txo.stake_address_id = sa.id
WHERE id = (
SELECT MAX(tx_out_id)
FROM ma_tx_out
Expand All @@ -42,11 +42,11 @@ BEGIN
txo.address,
sa.view AS stake_address
FROM tx_out AS txo
INNER JOIN ma_tx_out mto ON mto.tx_out_id = tx_out.id
LEFT JOIN stake_address ON txo.stake_address_id = sa.view
INNER JOIN ma_tx_out mto ON mto.tx_out_id = txo.id
LEFT JOIN stake_address AS sa ON txo.stake_address_id = sa.id
WHERE mto.ident = _asset_id
AND tx_out.consumed_by_tx_in_id IS NULL
ORDER BY tx_out.id DESC
AND txo.consumed_by_tx_in_id IS NULL
ORDER BY txo.id DESC
LIMIT 1;
END IF;
END;
Expand Down

0 comments on commit 3acb686

Please sign in to comment.