hashgraph / hedera-wallet-connect

This package is a messaging relay between decentralized applications and wallets in Hedera network based on Wallet Connect relays.
Apache License 2.0
13 stars 22 forks source link

fix: improves receipt handling for transactions with multiple signatures #339

Closed kantorcodes closed 23 hours ago

kantorcodes commented 1 week ago

Description:

We discovered that certain transactions e.g. AccountCreateTransactions with a threshold key would fail to return a receipt when executeWithSigner was called on the transaction.

Under the hood, call was being executed in the DAppSigner and attempting to run the query through the wallet. Because these queries are free, we should utilize getReceipt instead to ensure consistency and reliability for these complex transactions.

Additionally, we should avoid guessing and running both a query and transaction when call is used by the Hedera SDK. This would return the following incorrect error

Error: (BUG) body.data was not set in the protobuf
    at Transaction.fromBytes (/hedera-sdk-js/src/transaction/Transaction.js:361:27)
    at /hedera-sdk-js/src/checkUpdate.mjs:55:40
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Related issue(s):

Fixes https://github.com/hashgraph/hedera-wallet-connect/issues/337

Notes for reviewer:

  1. You can test this new functionality by running dev:react-demo and running the newest example for creating a multi signature account at the bottom of the demo. The receipt will return instantly instead of hanging.

Checklist

github-actions[bot] commented 1 week ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟑 Statements
77.1% (+0.81% πŸ”Ό)
478/620
🟑 Branches
63.08% (+0.47% πŸ”Ό)
82/130
🟑 Functions
77.03% (+0.64% πŸ”Ό)
114/148
🟑 Lines
78.26% (+0.79% πŸ”Ό)
450/575
Show files with reduced coverage πŸ”»
|
St.:grey_question:
| File | Statements | Branches | Functions | Lines | | :-: | :- | :- | :- | :- | :- | | 🟒 | lib/dapp/index.ts | 86.83% |
76.19% (-1.31% πŸ”»)
| 83.33% | 87.83% | | 🟒 |
`...` / DAppSigner.ts
|
95.83% (-2.99% πŸ”»)
|
77.78% (-4.83% πŸ”»)
| 100% |
96.52% (-3.48% πŸ”»)
|

Test suite run success

115 tests passing in 11 suites.

Report generated by πŸ§ͺjest coverage report action from 45e61a6e396c9616e234751ebeb1aeabc4664f09

kantorcodes commented 1 day ago

Cause I ain't part of the wallet crew, and got distracted.

Thanks for adding your feedback :)