@@ -252,27 +252,12 @@ export const findPoolRegisterCertsByTxIds = `
252
252
pool."view" AS pool_id,
253
253
tx.hash AS tx_id,
254
254
CASE
255
- WHEN (
256
- SELECT count(*) = 0
257
- FROM pool_update AS pu
258
- WHERE pu.registered_tx_id BETWEEN (
259
- CASE WHEN (
260
- SELECT count(*) FROM pool_retire AS pr
261
- WHERE pr.announced_tx_id < cert.registered_tx_id
262
- ) > 0 THEN (
263
- SELECT max(pr.announced_tx_id) FROM pool_retire AS pr
264
- WHERE pr.announced_tx_id < cert.registered_tx_id
265
- )
266
- ELSE 0 END
267
- ) AND cert.registered_tx_id - 1
268
- ) THEN pool_deposit
269
- ELSE '0'
255
+ WHEN cert.deposit IS NULL THEN '0'
256
+ ELSE cert.deposit
270
257
END AS deposit
271
258
FROM tx
272
259
JOIN pool_update AS cert ON cert.registered_tx_id = tx.id
273
260
JOIN pool_hash AS pool ON pool.id = cert.hash_id
274
- JOIN block ON block_id = block.id
275
- JOIN epoch_param ON epoch_param.epoch_no = (CASE WHEN block.epoch_no > 1 THEN block.epoch_no ELSE 1 END)
276
261
WHERE tx.id = ANY($1)
277
262
ORDER BY tx.id ASC` ;
278
263
@@ -307,12 +292,10 @@ export const findStakeCertsByTxIds = `
307
292
addr."view" AS address,
308
293
TRUE AS registration,
309
294
tx.hash AS tx_id,
310
- epoch_param.key_deposit AS deposit
295
+ cert.deposit AS deposit
311
296
FROM tx
312
297
JOIN stake_registration AS cert ON cert.tx_id = tx.id
313
298
JOIN stake_address AS addr ON addr.id = cert.addr_id
314
- JOIN block ON block_id = block.id
315
- JOIN epoch_param ON block.epoch_no = epoch_param.epoch_no
316
299
WHERE tx.id = ANY($1)
317
300
ORDER BY tx.id ASC)
318
301
UNION
@@ -321,10 +304,7 @@ export const findStakeCertsByTxIds = `
321
304
addr."view" AS address,
322
305
FALSE AS registration,
323
306
tx.hash AS tx_id,
324
- (SELECT key_deposit FROM stake_registration AS sr
325
- JOIN tx AS tx2 ON sr.tx_id = tx2.id
326
- JOIN block ON tx2.block_id = block.id
327
- JOIN epoch_param ON block.epoch_no = epoch_param.epoch_no
307
+ (SELECT sr.deposit FROM stake_registration AS sr
328
308
WHERE sr.addr_id = cert.addr_id
329
309
AND sr.tx_id < tx.id
330
310
ORDER BY sr.tx_id DESC
0 commit comments