In the Near, transactions signed by a 2FA-protected wallet are done in a special way (contract confirmation) and are not like regular transactions. Signer and receiver id the same wallet. Sample transaction: https://explorer.near.org/transactions/9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY
How to work with them properly, where to find them in Indexer? How do I get the data correctly, what contract and method the user signs?
NEAR Indexer for Explorer core contributor and maintainer here.
Looking at the transaction you've provided in your question https://explorer.near.org/transactions/9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY it was a FUNCTION CALL
of the method confirm
And I believe your concern is that you cannot see the result of your transaction in the public NEAR Indexer for Explorer database by querying the transactions
table with the hash.
And by saying that 2FA transactions "are not like regular transactions" you mean the nature of cross-contract calls involved.
Here's how to find out what is happening
SELECT transaction_hash, converted_into_receipt_id FROM transactions WHERE transaction_hash = '9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY';
transaction_hash | converted_into_receipt_id
----------------------------------------------+----------------------------------------------
9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY | FP5UmXxdDBBicGkzgXXdhS28hxgBWVByFcqbwh25qHzN
According to the fact that this transaction you've sent was a confirmation of some ft_transfer
call, we expect that there will happen a cross contract call to the gems.l2e.near
contract.
We want to find all the receipts produced after execution of the receipt id FP5UmXxdDBBicGkzgXXdhS28hxgBWVByFcqbwh25qHzN
(we found it in step 1)
SELECT produced_receipt_id FROM execution_outcome_receipts WHERE executed_receipt_id = 'FP5UmXxdDBBicGkzgXXdhS28hxgBWVByFcqbwh25qHzN';
produced_receipt_id
----------------------------------------------
9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU
3mtnLaGFYpXXzZ4H9vYczSXz9JbdS7XueSobDjQDAYb3
(2 rows)
SELECT receipt_id, action_kind, receipt_predecessor_account_id, receipt_receiver_account_id, args FROM action_receipt_actions WHERE receipt_id IN ('9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU', '3mtnLaGFYpXXzZ4H9vYczSXz9JbdS7XueSobDjQDAYb3');
receipt_id | action_kind | receipt_predecessor_account_id | receipt_receiver_account_id | args
----------------------------------------------+---------------+--------------------------------+-----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3mtnLaGFYpXXzZ4H9vYczSXz9JbdS7XueSobDjQDAYb3 | TRANSFER | system | shishkerin.near | {"deposit": "12306467158537048105440"}
9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU | FUNCTION_CALL | shishkerin.near | gems.l2e.near | {"gas": 220000000000000, "deposit": "1", "args_json": {"amount": "2970000", "receiver_id": "hot1.l2e.near"}, "args_base64": "eyJyZWNlaXZlcl9pZCI6ImhvdDEubDJlLm5lYXIiLCJhbW91bnQiOiIyOTcwMDAwIn0=", "method_name": "ft_transfer"}
(2 rows)
Here we can see that Receipt 9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU
is actually making a FUNCTION_CALL
to gems.l2e.near
signed by shishkerin.near
We can also look at args and find out that the method is calls is ft_transfer
and arguments are {"amount": "2970000", "receiver_id": "hot1.l2e.near"}
(The other receipt 3mtnLaGFYpXXzZ4H9vYczSXz9JbdS7XueSobDjQDAYb3
is a transfer signed by system
which is basically a cash-back for attached gas)
SELECT receipt_id, status FROM execution_outcomes WHERE receipt_id = '9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU';
receipt_id | status
----------------------------------------------+---------------
9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU | SUCCESS_VALUE
And I hope this answers your question.