Query editor
WITH resp AS (SELECT http_post('https://subgraph.246club.xyz/','{"query":"query RestakingByChain { restakings(where: { chainId: 9745 }) { items { chainId delegationPairId assetToken { address symbol decimals } debtToken { address symbol decimals } underlyingToken { address symbol decimals } created enabled creditBufferRatio accInterestPerScaledAmount totalScaledUsage totalScaledSupply liquidityIndex baseApy restakeApy pool { chainId paused } } pageInfo { hasNextPage endCursor } } }"}',ARRAY['Content-Type: application/json']) AS js)SELECTCAST(json_extract_scalar(x, '$.chainId') AS INTEGER) AS chain_id,json_extract_scalar(x, '$.delegationPairId') AS delegation_pair_id,json_extract_scalar(x, '$.assetToken.address') AS asset_address,json_extract_scalar(x, '$.assetToken.symbol') AS asset_symbol,CAST(json_extract_scalar(x, '$.assetToken.decimals') AS INTEGER) AS asset_decimals,json_extract_scalar(x, '$.debtToken.address') AS debt_address,json_extract_scalar(x, '$.debtToken.symbol') AS debt_symbol,CAST(json_extract_scalar(x, '$.debtToken.decimals') AS INTEGER) AS debt_decimals,json_extract_scalar(x, '$.underlyingToken.address') AS underlying_address,json_extract_scalar(x, '$.underlyingToken.symbol') AS underlying_symbol,CAST(json_extract_scalar(x, '$.underlyingToken.decimals') AS INTEGER) AS underlying_decimals,CAST(json_extract_scalar(x, '$.created') AS BOOLEAN) AS created,CAST(json_extract_scalar(x, '$.enabled') AS BOOLEAN) AS enabled,CAST(json_extract_scalar(x, '$.creditBufferRatio') AS DOUBLE)/1e16 AS credit_buffer_ratio,CAST(json_extract_scalar(x, '$.accInterestPerScaledAmount') AS DOUBLE)/1e18 AS acc_interest_per_scaled_amount,CAST(json_extract_scalar(x, '$.totalScaledUsage') AS DOUBLE)/1e6 AS total_scaled_usage,CAST(json_extract_scalar(x, '$.totalScaledSupply') AS DOUBLE)/1e6 AS total_scaled_supply,CAST(json_extract_scalar(x, '$.totalScaledUsage') AS DOUBLE) /CAST(json_extract_scalar(x, '$.totalScaledSupply') AS DOUBLE) AS current_utilization_rate,CAST(json_extract_scalar(x, '$.totalScaledUsage') AS DOUBLE) /CAST(json_extract_scalar(x, '$.totalScaledSupply') AS DOUBLE) *100 AS current_utilization_pct,CAST(json_extract_scalar(x, '$.liquidityIndex') AS DOUBLE) AS liquidity_index,CAST(json_extract_scalar(x, '$.baseApy') AS DOUBLE)/1e25 AS base_apy,CAST(json_extract_scalar(x, '$.restakeApy') AS DOUBLE)/1e16 AS restake_apy,CAST(json_extract_scalar(x, '$.baseApy') AS DOUBLE)/1e25 +CAST(json_extract_scalar(x, '$.restakeApy') AS DOUBLE)/1e16 + 6.14 AS total_apy,CAST(json_extract_scalar(x, '$.pool.chainId') AS INTEGER) AS pool_chain_id,CAST(json_extract_scalar(x, '$.pool.paused') AS BOOLEAN) AS pool_pausedFROM (SELECT CAST(json_parse(js) AS JSON) j FROM resp), UNNEST(CAST(json_extract(j, '$.data.restakings.items') AS ARRAY<JSON>)) t(x);