Query editor
WITHproxy_ex_len AS (SELECTextrinsic_id,max(length(call_id)) as max_call_lenFROMpolkadot.callsWHEREcall_section = 'proxy'AND call_method = 'proxy'GROUP BYextrinsic_id),delegate_with_proxy as (SELECT DISTINCTextrinsic_id,JSON_EXTRACT_SCALAR(JSON_PARSE(call_args), '$.to.id') as delegated_toFROMpolkadot.callsWHEREcall_section = 'convictionVoting'and call_method = 'delegate'and extrinsic_id in (SELECTextrinsic_idFROMpolkadot.callsWHEREcall_section = 'proxy'and call_method = 'proxy')),real_voter_index as (SELECT DISTINCTcalls.extrinsic_id,delegate_with_proxy.delegated_to as delegated_to,JSON_EXTRACT_SCALAR(JSON_PARSE(call_args), '$.real.id') as real_voterFROMpolkadot.calls as callsLEFT JOIN proxy_ex_len on proxy_ex_len.extrinsic_id = calls.extrinsic_idLEFT JOIN delegate_with_proxy on call_args like '%"to":{"id":"' || delegate_with_proxy.delegated_to || '%'WHEREcall_section = 'proxy'and call_method = 'proxy'AND length(call_id) = max_call_lenand calls.extrinsic_id in (SELECTextrinsic_idFROMpolkadot.callsWHEREcall_section = 'convictionVoting'and call_method = 'delegate')),delegate AS (SELECTCOALESCE(proxy_del.real_voter, signer_ss58) as delegator,calls.extrinsic_id,JSON_EXTRACT_SCALAR(JSON_PARSE(call_args), '$.class') AS origin,