Query editor
withfill_order as (--the COALESCE can run into issues when token_accounts has not been updated yet or the account was open/closed in same transaction.SELECTio.call_block_time-- , get_href(get_chain_explorer('solana') || '/tx/' || io.call_tx_id, 'tx') as tx, COALESCE(tr_in.token_mint_address,'So11111111111111111111111111111111111111112') as input_mint, io.makingAmount as in_amount --making amount matches pretty close to exactly, COALESCE(tr_out.token_mint_address,'So11111111111111111111111111111111111111112') as output_mint, COALESCE(tr_out_sol.lamports, tr_out.amount) as out_amount --can't use maxTakingAmount because it can fluctuate, 'fillOrder' as instruction, io.call_block_slot, io.call_tx_id, io.account_maker, io.account_orderFROM jupiter_limit_order_solana.limit_order_call_fillOrder ioLEFT JOIN solana_utils.token_accounts tr_in ON tr_in.address = io.account_takerOutputAccountLEFT JOIN tokens_solana.transfers tr_out ON tr_out.outer_instruction_index = io.call_outer_instruction_indexAND tr_out.inner_instruction_index = COALESCE(io.call_inner_instruction_index, 0) + 2AND tr_out.tx_id = io.call_tx_idAND tr_out.block_slot = io.call_block_slotAND tr_out.block_time = io.call_block_timeLEFT JOIN system_program_solana.system_program_call_Transfer tr_out_sol ON tr_out_sol.call_outer_instruction_index = io.call_outer_instruction_indexAND tr_out_sol.call_inner_instruction_index = COALESCE(io.call_inner_instruction_index, 0) + 2AND tr_out_sol.call_tx_id = io.call_tx_idAND tr_out_sol.call_block_slot = io.call_block_slotAND tr_out_sol.call_block_time = io.call_block_timeAND tr_out_sol.lamports/1e9 > 1 --filter out small transfers to make table smaller), flash_fill_order as (SELECTpre.call_block_time-- , get_href(get_chain_explorer('solana') || '/tx/' || pre.call_tx_id, 'tx') as tx, pre.account_inputMint as input_mint, pre.makingAmount as in_amount, post.account_outputMint as output_mint, COALESCE(tr_out_sol.lamports, tr_out.amount) as out_amount, 'flashFillOrder' as instruction, pre.call_block_slot, pre.call_tx_id, post.account_maker, pre.account_orderFROM jupiter_limit_order_solana.limit_order_call_preFlashFillOrder preLEFT JOIN jupiter_limit_order_solana.limit_order_call_flashFillOrder post ON pre.call_tx_id = post.call_tx_idAND pre.call_block_time = post.call_block_timeAND pre.account_order = post.account_orderLEFT JOIN tokens_solana.transfers tr_out ON tr_out.outer_instruction_index = post.call_outer_instruction_indexAND tr_out.inner_instruction_index = COALESCE(post.call_inner_instruction_index, 0) + 1AND tr_out.tx_id = post.call_tx_idAND tr_out.block_slot = post.call_block_slotAND tr_out.block_time = post.call_block_timeLEFT JOIN system_program_solana.system_program_call_Transfer tr_out_sol ON tr_out_sol.call_outer_instruction_index = post.call_outer_instruction_indexAND tr_out_sol.call_inner_instruction_index = COALESCE(post.call_inner_instruction_index, 0) + 1AND tr_out_sol.call_tx_id = post.call_tx_idAND tr_out_sol.call_block_slot = post.call_block_slotAND tr_out_sol.call_block_time = post.call_block_timeAND tr_out_sol.lamports/1e9 > 1 --filter out small transfers to make table smaller)