[英]NEAR Indexer and 2FA secured wallet transactions
In the Near, transactions signed by a 2FA-protected wallet are done in a special way (contract confirmation) and are not like regular transactions.在 Near 中,受 2FA 保护的钱包签署的交易以特殊方式(合约确认)完成,与常规交易不同。 Signer and receiver id the same wallet.
签名者和接收者 id 相同的钱包。 Sample transaction: https://explorer.near.org/transactions/9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY
交易样本: https://explorer.near.org/transactions/9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY
How to work with them properly, where to find them in Indexer?如何正确使用它们,在 Indexer 中哪里可以找到它们? How do I get the data correctly, what contract and method the user signs?
我如何正确获取数据,用户签署什么合同和方式?
NEAR Indexer for Explorer core contributor and maintainer here.此处为 Explorer 核心贡献者和维护者的 NEAR 索引器。
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
查看您在问题https 中提供的交易 https://explorer.near.org/transactions/9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY它是方法
confirm
的FUNCTION CALL
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.我相信您担心的是,通过使用 hash 查询
transactions
表,您无法在公共NEAR Indexer for Explorer 数据库中看到交易结果。
And by saying that 2FA transactions "are not like regular transactions" you mean the nature of cross-contract calls involved.并且通过说 2FA 交易“不像常规交易”,你的意思是涉及跨合约调用的性质。
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.根据您发送的这笔交易是对某个
ft_transfer
调用的确认,我们预计会对gems.l2e.near
合约进行跨合约调用。
We want to find all the receipts produced after execution of the receipt id FP5UmXxdDBBicGkzgXXdhS28hxgBWVByFcqbwh25qHzN
(we found it in step 1)我们要查找执行收据id
FP5UmXxdDBBicGkzgXXdhS28hxgBWVByFcqbwh25qHzN
后产生的所有收据(我们在步骤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
在这里我们可以看到 Receipt
9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU
实际上正在对由gems.l2e.near
签名的shishkerin.near
进行FUNCTION_CALL
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"}
我们也可以查看args,发现method is calls是
ft_transfer
和arguments是{"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) (另一张收据
3mtnLaGFYpXXzZ4H9vYczSXz9JbdS7XueSobDjQDAYb3
是system
签名的转账,基本上是附加 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.我希望这能回答你的问题。
In addition to what @khorolets already mentioned, receipts
table has originated_from_transaction_hash
column which can help you to fetch all the receipts attributed to the transaction:除了@khorolets 已经提到的内容之外,
receipts
表还有originated_from_transaction_hash
列,它可以帮助您获取归因于交易的所有收据:
SELECT * FROM receipts WHERE originated_from_transaction_hash = '9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY';
receipt_id | included_in_block_hash | included_in_chunk_hash | index_in_chunk | included_in_block_timestamp | predecessor_account_id | receiver_account_id | receipt_kind | originated_from_transaction_hash
----------------------------------------------+----------------------------------------------+----------------------------------------------+----------------+-----------------------------+------------------------+---------------------+--------------+----------------------------------------------
DiL4YA5iyKpsgkwdjdZkuiCatvKHmbVKPGAKpYJV1qS7 | AyX7umWGpR3RgQGnz4LAgTRnRGbF42krvAAjmXo4s4EV | 9VkhZdALu1EY6D2czKaKSV7qQZsLR6vxfAPXqBkgmAGg | 2 | 1644263681934508460 | system | shishkerin.near | ACTION | 9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY
3mtnLaGFYpXXzZ4H9vYczSXz9JbdS7XueSobDjQDAYb3 | CyDT5XdZK8pKZM4VP559KxEXvUXTKaZbGVN3mVfoc5TX | FbfPdNLhYZEH3AncDiPa5qQZsaxCL8kfAtEaTV2geDi6 | 3 | 1644263680552610497 | system | shishkerin.near | ACTION | 9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY
9zem8CxJvdTHKkZKCc1pFhg4Ky4st6TBrQmE19gv4sAU | CyDT5XdZK8pKZM4VP559KxEXvUXTKaZbGVN3mVfoc5TX | FbfPdNLhYZEH3AncDiPa5qQZsaxCL8kfAtEaTV2geDi6 | 2 | 1644263680552610497 | shishkerin.near | gems.l2e.near | ACTION | 9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY
FP5UmXxdDBBicGkzgXXdhS28hxgBWVByFcqbwh25qHzN | 5zvPFNeVytBNWfTzvmBaeCQtDrLuHfujKQqZ7qHhY4di | 4JngM4mhJnM9em6x8e7kJhyiSdPj1A9ZBzze9ZqJM8DP | 0 | 1644263679256841002 | shishkerin.near | shishkerin.near | ACTION | 9uPvkdmcL4iNnWrHXZocf7NLAJUUVa4zSMrtFtJhrjcY
(4 rows)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.