github.com/status-im/status-go@v1.1.0/services/wallet/activity/multiTxDetails.sql (about)

     1  -- Query searches for additional details of a multi transaction
     2  -- Pending transactions are saved as multi transactions. Some of data isn't available in multi transaction table, so we need to query pending transactions table to get it.
     3  
     4  -- Tx property is only exctracted when values are not null to prevent errors during the scan.
     5  SELECT
     6  	transfers.tx_hash AS tx_hash,
     7  	transfers.blk_number AS blk_number,
     8  	transfers.network_id AS network_id,
     9  	transfers.type AS type,
    10  	transfers.account_nonce as nonce,
    11  	transfers.contract_address as contract_address,
    12  	CASE
    13  		WHEN json_extract(transfers.tx, '$.gas') = '0x0' THEN NULL
    14  		ELSE transfers.tx
    15  	END as tx,
    16  	transfers.base_gas_fee AS base_gas_fee
    17  FROM
    18  	transfers
    19  WHERE
    20  	multi_transaction_id = ?
    21  UNION
    22  ALL
    23  SELECT
    24  	pt.hash as tx_hash,
    25  	NULL AS blk_number,
    26  	pt.network_id as network_id,
    27  	NULL as type,
    28  	pt.nonce as nonce,
    29  	NULL as contract_address,
    30  	NULL as tx,
    31  	NULL as base_gas_fee
    32  FROM
    33  	pending_transactions as pt
    34  WHERE
    35  	pt.multi_transaction_id = ?