ton-connect / sdk

SDK for TON Connect 2.0 — a comprehensive communication protocol between wallets and apps in TON ecosystem
Apache License 2.0
326 stars 92 forks source link

[<UI-REACT>]: response of tonconnectUI.sendTransaction() for tonhub app/tonkeeper app #242

Open YanYuanFE opened 3 months ago

YanYuanFE commented 3 months ago

Describe the bug

Transactions logged in by scanning QR codes in the app and transactions initiated directly in the telegram app or mobile browser cannot correctly parse the hash.

I use signTransaction to call tonhub app to initiate a transaction. It returns a BOC. I parse the hash from the BOC, but this hash cannot be found in the block explorer and is inconsistent with the transaction in my wallet.

boc:

{
    "boc": "te6cckECMgEACdoAAZw6yGkWy9HULFL05rul48rspKUssEzw7/VhEMmE07x6YvQ2w0nkWXVUOosK37XPGsUU12ulj3Z4V14Gr4DCh80DKamjF2bEUHcAAADVAAMBA5FiAFyo0sVTHusYrhha9ktDaJNQIJQClhu2a1SN+EY7VQtEIHc1lAAAAAAAAAAAAAAAAAACMUD0clwAAAAAAAAAAAAAAAAAAAAKAissART/APSkE/S88sgLAwIBYgQoAgLJBRYCASAGCwIBIAcKAZ/QyIccAkl8D4NDTAwFxsJJfA+D6QDAB0x/TPyKCEJocd2m6jhk0W/BX+EPHBfKj0z8w+ES68q9w+EP4RPBY4DMBghBQPRyXuuMCXwOED/LwggB/PBXAoIQBCwdgL7ysPhCwAHyaNTTPzD4ZIhSEPkAAfkAuvJkINc58qrTBwHAA/KrIddlqgCmAlIg+UFfA/hEAdQwgED0Dm+hMfKtcfhD+ETwWPhC+ESCENDV9AXIyx8Uyz8SzBLLP8sAyXGAEMjLBfhDzxZw+gLLaszJgwb7AAkAAABjpGQQ4IBMRYlsZ4sA0YDvOBA4xwoCPVSGUxgS1AlQAlUDgVIQ4AAimHMYGdUBZ4Dk6EABA67gDAH2IIIwDeC2s6dkAAC5jhGCMA3gtrOnZAAAUgKphPA7o+BwIYKwWAO8xcuWNLpM+yIT94QBkxjtTctgF4gPqjW+jiMwgogZXlTF3UIXf1OicXL6nsYwJignqiOpBIIbeC2s6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AYBkqYQCASAkJwIBICUmACdr5AHByyMsBywASywfL/8nQ+kAwgAl92omhpgAD8MX0gAPwx6Z+YfDJAAZ2BZGWAAOeLZZ/k9qpAIBWCkqAA268T8Ff4QoACW7wB8Ff4RPhCyMsA+EPPFss/yYAFNAA8ddbtuI5CDXohC7dPC4JpNSCWq/7oIHDHYfY9f13GaQAAAAAAAAACgJRgPHch56rAr6YqYOt/SDXtq1BPbm29Boe5Ed9yk8ye1fGwACLSIDz6AuLyhIAQEDBif4eKM5F3Si8pJDyYSAcskW4JIM4d3wLtrF9bvmegABIgEgMDEAVyAAaBZWXlkPRV4bwIz8g+AGvDbQkpk26kUudJOYWsW2B3KLpDt0ADNhtgBAKEgBAbJrIuMX1HH1lhcFuo4qKfhEBW+ygf4T1GR3LIvZaSSdAABE6+j2"
}

use this code to get hash:

import { Cell } from '@ton/core';

const hash = Cell.fromBase64(boc).hash().toString('hex');

//4e76aa2b6c1e709b2c31bc43c31ab8a6841f12d7fddde3a8dcf4727da9bf065e

https://testnet.tonviewer.com/transaction/4e76aa2b6c1e709b2c31bc43c31ab8a6841f12d7fddde3a8dcf4727da9bf065e

this link is 404.

but my transaction hash in wallet is 13724831173c47c420db70e4121e885255420ea1fb1ab2518bf6184a09bc3fc1.

This problem only occurs in the wallet app and works fine on the browser plugin。

Expected behavior

The hash is parsed normally and the hash can be found in the browser.

Current behavior

The hash cannot be found in the tonviewer

Steps to Reproduce

I use signTransaction to call tonhub app to initiate a transaction. It returns a BOC. I parse the hash from the BOC, but this hash cannot be found in the block explorer and is inconsistent with the transaction in my wallet. boc:

{
    "boc": "te6cckECMgEACdoAAZw6yGkWy9HULFL05rul48rspKUssEzw7/VhEMmE07x6YvQ2w0nkWXVUOosK37XPGsUU12ulj3Z4V14Gr4DCh80DKamjF2bEUHcAAADVAAMBA5FiAFyo0sVTHusYrhha9ktDaJNQIJQClhu2a1SN+EY7VQtEIHc1lAAAAAAAAAAAAAAAAAACMUD0clwAAAAAAAAAAAAAAAAA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o4mAYI4CteOvFrGIAAAoQGCOCgOYBFO24BdA4I4BWvHXi1jEAAAqYTeIYI4BWvHXi1jEAAAvo4mAYI4BWvHXi1jEAAAoQGCOA68X7QXRhIREII4BWvHXi1jEAAAqYTeIYIyteOvFrGIAAC+4wAhHyAASgGCMrXjrxaxiAAAoQGCOAjwD3YKSy21XYI4BWvHXi1jEAAAqYQB7IIxWvHXi1jEAAC+jiUBgjFa8deLWMQAAKEBgjgG9fF3V4iTeTeCOAVrx14tYxAAAKmE3iGCOAVrx14tYxAAACGgUROCOArXjrxaxiAAAKmEZqBRE4I4EENWGogpMAAAqYRmoFETgjgVrx14tYxAAACphGagURMhAeqCOBsa5Nbi71AAAKmEZqBRE4I4IIasNRBSYAAAqYRmoFETgjgl8nOTPbVwAACphGagUROCIFa8deLWMaoWqYRmoFETgjgwygJPmHuQAACphGagUROCODY1ya3F3qAAAKmEZqBRE4I4O6GRC/NBsAAAqYRmoAMiAEKCOEENWGogpMAAAKmEEqCCOAVrx14tYxAAAKmEAYBkqYQCASAkJwIBICUmACdr5AHByyMsBywASywfL/8nQ+kAwgAl92omhpgAD8MX0gAPwx6Z+YfDJAAZ2BZGWAAOeLZZ/k9qpAIBWCkqAA268T8Ff4QoACW7wB8Ff4RPhCyMsA+EPPFss/yYAFNAA8ddbtuI5CDXohC7dPC4JpNSCWq/7oIHDHYfY9f13GaQAAAAAAAAACgJRgPHch56rAr6YqYOt/SDXtq1BPbm29Boe5Ed9yk8ye1fGwACLSIDz6AuLyhIAQEDBif4eKM5F3Si8pJDyYSAcskW4JIM4d3wLtrF9bvmegABIgEgMDEAVyAAaBZWXlkPRV4bwIz8g+AGvDbQkpk26kUudJOYWsW2B3KLpDt0ADNhtgBAKEgBAbJrIuMX1HH1lhcFuo4qKfhEBW+ygf4T1GR3LIvZaSSdAABE6+j2"
}

use this code to get hash:

import { Cell } from '@ton/core';

const hash = Cell.fromBase64(boc).hash().toString('hex');

//4e76aa2b6c1e709b2c31bc43c31ab8a6841f12d7fddde3a8dcf4727da9bf065e

https://testnet.tonviewer.com/transaction/4e76aa2b6c1e709b2c31bc43c31ab8a6841f12d7fddde3a8dcf4727da9bf065e

this link is 404.

but my transaction hash in wallet is 13724831173c47c420db70e4121e885255420ea1fb1ab2518bf6184a09bc3fc1.

This problem only occurs in the wallet app and works fine on the browser plugin。

Environment

tonhub version:2.3.11 ui-connect: 2.0.9

Additional context

No response

YanYuanFE commented 3 months ago

test snapshot image

alexcraviotto commented 3 months ago

Hello.

Maybe you have something wrong configured in your signature.

I just tried it myself with the TonKeeper app on IOS and it worked perfectly from telegram.

YanYuanFE commented 3 months ago

image https://github.com/YanYuanFE/demo-dapp-with-react-ui

I added a demo to reproduce this problem. You can run this demo and enter the page, scan the code to connect to the wallet app, sign the transaction and view the console log.

YanYuanFE commented 3 months ago

@alexcraviotto you can try this demo,

I use tonhub app in Android.

YanYuanFE commented 3 months ago

https://docs.ton.org/develop/dapps/cookbook#how-to-find-transaction-for-a-certain-ton-connect-result I found a new method of querying transaction hash in the TON documentation. After my test, the tonkeeper app can work normally, both on the ios test network and the Android main network, but on the tonhub app main network and test network Neither works properly, I think it might be a problem with the tonhub app. I have updated the demo and can test it in the demo demo: https://github.com/YanYuanFE/demo-dapp-with-react-ui