From 12bc699f244f022e5e77b3e02a1fadb00face597 Mon Sep 17 00:00:00 2001 From: rdlrt <3169068+rdlrt@users.noreply.github.com> Date: Sat, 30 Nov 2024 17:10:45 +1100 Subject: [PATCH] Add view endpoint --- files/grest/rpc/assets/asset_utxos.sql | 2 +- files/grest/rpc/assets/policy_asset_addresses.sql | 4 ++-- files/grest/rpc/pool/pool_delegators.sql | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/files/grest/rpc/assets/asset_utxos.sql b/files/grest/rpc/assets/asset_utxos.sql index f957f0a2..2090c80f 100644 --- a/files/grest/rpc/assets/asset_utxos.sql +++ b/files/grest/rpc/assets/asset_utxos.sql @@ -66,7 +66,7 @@ BEGIN tx_out.index::smallint, a.address::text, tx_out.value::text, - grest.cip5_hex_to_stake_addr(sa.hash_raw)::text as stake_address, + sa.view::text as stake_address, ENCODE(a.payment_cred, 'hex') AS payment_cred, b.epoch_no, b.block_no, diff --git a/files/grest/rpc/assets/policy_asset_addresses.sql b/files/grest/rpc/assets/policy_asset_addresses.sql index 09bff22e..2d778dd6 100644 --- a/files/grest/rpc/assets/policy_asset_addresses.sql +++ b/files/grest/rpc/assets/policy_asset_addresses.sql @@ -28,7 +28,7 @@ BEGIN SELECT atoc.ma_id, a.address, - grest.cip5_hex_to_stake_addr(sa.hash_raw)::varchar AS stake_address, + sa.view::varchar AS stake_address, atoc.quantity FROM grest.asset_tx_out_cache AS atoc LEFT JOIN multi_asset AS ma ON ma.id = atoc.ma_id @@ -48,7 +48,7 @@ BEGIN SELECT ENCODE(ma.name, 'hex') AS asset_name, a.address, - grest.cip5_hex_to_stake_addr(sa.hash_raw)::varchar AS stake_address, + sa.view::varchar AS stake_address, SUM(mto.quantity)::text FROM multi_asset AS ma LEFT JOIN ma_tx_out AS mto ON mto.ident = ma.id diff --git a/files/grest/rpc/pool/pool_delegators.sql b/files/grest/rpc/pool/pool_delegators.sql index bd67bc67..a3504c45 100644 --- a/files/grest/rpc/pool/pool_delegators.sql +++ b/files/grest/rpc/pool/pool_delegators.sql @@ -115,6 +115,7 @@ BEGIN AND NOT EXISTS (SELECT null FROM stake_deregistration AS sd WHERE sd.addr_id = d.addr_id AND sd.tx_id > d.tx_id) -- AND NOT grest.is_dangling_delegation(d.id) AND NOT EXISTS (SELECT null FROM grest.stake_distribution_cache AS sdc WHERE sdc.stake_address_id = sa.id) + WHERE d.active_epoch_no > (SELECT MAX(no) FROM epoch) ) z, LATERAL grest.account_utxos(array[(SELECT grest.cip5_hex_to_stake_addr(z.stake_address_raw))], false) AS acc_info GROUP BY