Skip to content

Commit 3acb686

Browse files
hodlonautrdlrt
andcommitted
Update asset_nft_address.sql (#264)
Fixed up some issues with stake address join and tx_out table references Co-authored-by: RdLrT <3169068+rdlrt@users.noreply.github.com>
1 parent 69a732c commit 3acb686

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

files/grest/rpc/assets/asset_nft_address.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ BEGIN
3030
txo.address,
3131
sa.view AS stake_address
3232
FROM tx_out AS txo
33-
LEFT JOIN stake_address ON txo.stake_address_id = sa.view
33+
LEFT JOIN stake_address AS sa ON txo.stake_address_id = sa.id
3434
WHERE id = (
3535
SELECT MAX(tx_out_id)
3636
FROM ma_tx_out
@@ -42,11 +42,11 @@ BEGIN
4242
txo.address,
4343
sa.view AS stake_address
4444
FROM tx_out AS txo
45-
INNER JOIN ma_tx_out mto ON mto.tx_out_id = tx_out.id
46-
LEFT JOIN stake_address ON txo.stake_address_id = sa.view
45+
INNER JOIN ma_tx_out mto ON mto.tx_out_id = txo.id
46+
LEFT JOIN stake_address AS sa ON txo.stake_address_id = sa.id
4747
WHERE mto.ident = _asset_id
48-
AND tx_out.consumed_by_tx_in_id IS NULL
49-
ORDER BY tx_out.id DESC
48+
AND txo.consumed_by_tx_in_id IS NULL
49+
ORDER BY txo.id DESC
5050
LIMIT 1;
5151
END IF;
5252
END;

0 commit comments

Comments
 (0)