-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update DAppSigner.ts #170
Update DAppSigner.ts #170
Conversation
When working with HSuite they were encountering issues with signing transactions, this is the change we applied to hashconnect in order to fix the issue. Signed-off-by: Tyler Cote <[email protected]>
Coverage report
Show files with reduced coverage 🔻
Test suite run success25 tests passing in 2 suites. Report generated by 🧪jest coverage report action from 17cad0d |
It is possible the entire signing function here is wrong, I will do some more testing on this as its quite different to what we are doing in hashconnect |
Maybe we can use an approach similar to this function: keep setting the nodes if the transaction does not have any set, and use the node from the transaction if it does. /**
* Sets default consensus nodes that a transaction will be submitted to. Node Account ID(s)
* must be set before a transaction can be frozen. If they have already been set, this
* function will not modify the transaction.
* @param transaction - any instance of a class that extends `Transaction`
*
* @see {@link https://docs.hedera.com/hedera/networks/testnet/testnet-nodes | Full list of Testnet-nodes}
* @see {@link https://docs.hedera.com/hedera/networks/mainnet/mainnet-nodes | Full list of Mainnet-nodes}
*/
export function setDefaultNodeAccountIds<T extends Transaction>(transaction: T): void {
const isNodeAccountIdNotSet =
!transaction.nodeAccountIds || transaction.nodeAccountIds.length === 0
if (!transaction.isFrozen() && isNodeAccountIdNotSet)
transaction.setNodeAccountIds([new AccountId(3), new AccountId(4), new AccountId(5)])
} |
thanks guys,trule appreciated! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Fran Fernandez <[email protected]>
e878ba1
to
ed364dc
Compare
@franfernandez20 this changes the original suggested change approved by @gregscullard here: d47e8a7 It might be helpful in the future to do a PR into another branch that has an open PR so that we can better see the diff. I've added some notes here - https://github.com/hashgraph/hedera-wallet-connect/pull/213/files Fran's updates effectively check to see if the transaction has nodeAccountIds and then uses the first one, otherwise uses the internal function to get a random node account id. This logic makes sense to me. |
github action annotations might make it harder to read the diff in this PR, if you press |
Signed-off-by: Tyler McDonald <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Tyler McDonald <[email protected]>
When working with HSuite they were encountering issues with signing transactions, this is the change we applied to hashconnect in order to fix the issue. When signing a transaction multiple times (multisig), you want to preserve the node id.
May resolve this: #124