Query editor
with deposit as (select'deposit' as direction, block_date, cast(json_extract(substring(cast(json_extract(action_function_call_args_parsed, '$.memo') as varchar),14), '$.txHash') as varchar) as txhash, cast(json_extract(substring(cast(json_extract(action_function_call_args_parsed, '$.memo') as varchar),14), '$.networkType') as varchar) as network, cast(json_extract(substring(cast(json_extract(action_function_call_args_parsed, '$.memo') as varchar),14), '$.chainId') as varchar) as chainId, cast(json_extract(cast(json_extract(action_function_call_args_parsed, '$.msg') as varchar), '$.receiver_id') as varchar) as receiver_id, *from near.actionswhere block_date = cast('{{date}}' as timestamp)and action_kind = 'FUNCTION_CALL'and action_function_call_call_method_name = 'ft_deposit'and action_function_call_args_parsed like '%BRIDGED%'),withdraw_actions as (selectda.txhash as deposit_tx, da.network as origin_network, da.chainId as chainId, cast(json_extract(wa.action_function_call_args_parsed, '$.receiver_id') as varchar) as receiver_id, cast(json_extract(wa.action_function_call_args_parsed, '$.signed') as array(json)) as signed_array, wa.*from deposit daleft join near.actions wa on wa.action_function_call_args_parsed like '%' || da.receiver_id || '%'and wa.block_date = cast('{{date}}' as timestamp)where wa.block_date = cast('{{date}}' as timestamp)and wa.action_kind = 'FUNCTION_CALL'and wa.action_function_call_call_method_name = 'execute_intents'and wa.action_function_call_args_parsed like '%WITHDRAW%'),unnest_signed as (selectwa.*, signed_elementfrom withdraw_actions wacross join unnest(wa.signed_array) as t(signed_element)),parse_message as (select*, json_parse(cast(json_extract(signed_element, '$.payload.message') as varchar)) as message_jsonfrom unnest_signed),unnest_intents as (select*from parse_messagecross join unnest(cast(json_extract(message_json, '$.intents') as array(json))) as t(intent_element)where json_extract_scalar(intent_element, '$.intent') = 'ft_withdraw')selectblock_date, deposit_tx, origin_network