Query editor
-- Parameters are set in the Dune UI below the editor-- {{user_addr}} - set type to Text, value e.g. 0x4ece718fbe64f7a50929d0f05cf5bf8f67bec3d5-- Contract (hardcoded): 0xe6d8d8ac54461b1c5ed15740eee322043f696c08WITH txs AS (-- Direct user -> contract transactions (top-level)SELECTt.block_time, t.hash AS tx_hash, 'tx' AS interaction, 'user->contract' AS direction, CAST(t."value" AS double) / 1e18 AS eth_value, CAST(NULL AS bigint) AS gas_used, CAST(NULL AS boolean) AS successFROM ethereum.transactions tWHERE t."from" = {{user_addr}}AND t."to" = 0xe6d8d8ac54461b1c5ed15740eee322043f696c08),calls AS (-- Internal calls between the two addresses (either direction)SELECTtr.block_time, tr.tx_hash AS tx_hash, 'internal_call' AS interaction, CASEWHEN tr."from" = {{user_addr}} AND tr."to" = 0xe6d8d8ac54461b1c5ed15740eee322043f696c08 THEN 'user->contract'WHEN tr."from" = 0xe6d8d8ac54461b1c5ed15740eee322043f696c08 AND tr."to" = {{user_addr}} THEN 'contract->user'ELSE 'other'END AS direction, CAST(tr."value" AS double) / 1e18 AS eth_value, tr.gas_used, tr.successFROM ethereum.traces trWHERE (tr."from" = {{user_addr}} AND tr."to" = 0xe6d8d8ac54461b1c5ed15740eee322043f696c08)OR (tr."from" = 0xe6d8d8ac54461b1c5ed15740eee322043f696c08 AND tr."to" = {{user_addr}}))SELECT *FROM txsUNION ALLSELECT * FROM callsORDER BY block_time DESC;