enviodev / hyperindex

📖 Blazing-fast multi-chain indexer
https://envio.dev
79 stars 6 forks source link

Feature: Support for field_selection on fuel indexer #266

Open xpluscal opened 1 month ago

xpluscal commented 1 month ago

Currently on fuel, field_selection is not available. It would be great to be able to get message sender aka transaction from and to and other fields for a transaction.

JasoonS commented 1 month ago

Can you share with me the version of the indexer that did have transaction from? I can't see when this was ever possible.

In the fuel schema there isn't a clean to and from that I can see on logs: https://docs.envio.dev/docs/HyperSync/hyperfuel-query (look under FieldSelection) Fuel isn't simple like EVM in this regard.

For example in this transaction for Mira: https://app-mainnet.fuel.network/tx/0x0b93ce3b98aa1284aa0a347feb9d90e167417b6a0693230ae71c5a5253fe29cd/simple

curl --request POST \
  --url https://fuel.hypersync.xyz/query \
  --header 'Content-Type: application/json' \
  --data '{
  "from_block": 3439718,
  "to_block": 3439719,
  "receipts": [
    {
      "root_contract_id": [
        "0x2e40f2b244b98ed6b8204b3de0156c6961f98525c8162f80162fcf53eebd90e7"
      ],
      "receipt_type": [ 6 ],
      "rb": [
        12224862438738316526
      ],
      "tx_status": [ 1 ]
    }
  ],
  "field_selection": {
    "block": [
        "id",
        "da_height",
        "consensus_parameters_version",
        "state_transition_bytecode_version",
        "transactions_count",
        "message_receipt_count",
        "transactions_root",
        "message_outbox_root",
        "event_inbox_root",
        "height",
        "prev_root",
        "time",
        "application_hash"
    ],
    "transaction": [
        "block_height",
        "id",
        "input_asset_ids",
        "input_contracts",
        "input_contract_utxo_id",
        "input_contract_balance_root",
        "input_contract_state_root",
        "input_contract_tx_pointer_tx_index",
        "input_contract",
        "policies_tip",
        "policies_witness_limit",
        "policies_maturity",
        "policies_max_fee",
        "script_gas_limit",
        "maturity",
        "mint_amount",
        "mint_asset_id",
        "mint_gas_price",
        "tx_pointer_block_height",
        "tx_pointer_tx_index",
        "tx_type",
        "output_contract_input_index",
        "output_contract_balance_root",
        "output_contract_state_root",
        "witnesses",
        "receipts_root",
        "status",
        "time",
        "reason",
        "script",
        "script_data",
        "bytecode_witness_index",
        "bytecode_root",
        "subsection_index",
        "subsections_number",
        "proof_set",
        "consensus_parameters_upgrade_purpose_witness_index",
        "consensus_parameters_upgrade_purpose_checksum",
        "state_transition_upgrade_purpose_root",
        "salt"
    ],
    "receipt": [
        "receipt_index",
        "root_contract_id",
        "tx_id",
        "tx_status",
        "tx_type",
        "block_height",
        "pc",
        "is",
        "to",
        "to_address",
        "amount",
        "asset_id",
        "gas",
        "param1",
        "param2",
        "val",
        "ptr",
        "digest",
        "reason",
        "ra",
        "rb",
        "rc",
        "rd",
        "len",
        "receipt_type",
        "result",
        "gas_used",
        "data",
        "sender",
        "recipient",
        "nonce",
        "contract_id",
        "sub_id"
    ]
  }
}'

I'm sure I'm missing something, and maybe some of those fields are hidden in plain sight :grimacing:

We can add all of these as field_selection, but I'm not sure how you'd get the 'to' 'from'. The 'sender', 'receipient' and 'to' fields on receipts are all related to Mint/Burn/Transfer receipts afaik.