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

[<SDK or UI>]:Get boc by "tonConnectUI?.sendTransaction(transaction)" can not parser #221

Open longqingzhao opened 3 months ago

longqingzhao commented 3 months ago

Describe the bug

const payload = payId ? beginCell().storeUint(0, 32).storeStringTail(payId).endCell().toBoc().toString('base64') : void 0
const transaction = {
    validUntil: Math.floor(Date.now() / 1000) + 360,
    messages: [{ address: toAddress, amount: toNano(amount).toString(), payload }]
 }
 const {boc} = await tonConnectUI?.sendTransaction(transaction)
 const code_cell = Cell.fromBoc(Buffer.from(boc, 'base64'))?.[0]
 const tx = loadTransaction(code_cell.beginParse())

1、boc=te6cckEBAgEAugAB4YgBJQyqFYFV1pJllWcOr4hDOUcr/rXd7trBiXL3Gr4IqqYFyUp5ETJgSMVb31frYvnpMY97xOEel2mGU9ApV0PCVMl7uJt/yQuulYRKsGJApBRyvkv2uTBB0Mm+w2Y3ELX4EU1NGLs1T0owAAAAQAAcAQCIQgAo2iWwzvU7s+j6H3IAOqFeOXmE3PCYafNAdHisno3N1xzEtAAAAAAAAAAAAAAAAAAAAAAAADE3MjI0MTEwMDU3MDMOJnpP loadTransaction report an error: Invalid data

Expected behavior

loadTransactioncan return normal data.

Current behavior

loadTransactionreport an error: Invalid data

Steps to Reproduce

1、run sendTransaction and get a boc 2、parse boc by loadTransaction

Environment

1、`` +-- @orbs-network/ton-access@2.3.3 -> .\node_modules\.pnpm\@orbs-network+ton-access@2.3.3\node_modules\@orbs-network\ton-access +-- @ton/core@0.56.3 -> .\node_modules\.pnpm\@ton+core@0.56.3_@ton+crypto@3.2.0\node_modules\@ton\core +-- @ton/ton@14.0.0 -> .\node_modules\.pnpm\@ton+ton@14.0.0_@ton+core@0.56.3_@ton+crypto@3.2.0__@ton+crypto@3.2.0\node_modules\@ton\ton +-- @tonconnect/ui@2.0.6 -> .\node_modules\.pnpm\@tonconnect+ui@2.0.6\node_modules\@tonconnect\ui +-- buffer@6.0.3 -> .\node_modules\.pnpm\buffer@6.0.3\node_modules\buffer +-- vite-plugin-node-polyfills@0.22.0 -> .\node_modules\.pnpm\vite-plugin-node-polyfills@0.22.0_rollup@4.19.0_vite@5.3.4\node_modules\vite-plugin-node-polyfills -- vite@5.3.4 -> .\node_modules.pnpm\vite@5.3.4\node_modules\vite


2、windows11
3、Chrome 127.0.6533.74

### Additional context

_No response_
alexcraviotto commented 3 months ago

Did you find a solution?

ProgramCrafter commented 2 months ago

Well, it doesn't return a transaction (at least because TON Connect 2 doesn't wait until it is even recorded in blockchain), but only an external message to user's wallet.