Skip to content
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

HashConnect signTransaction returns wrong signature #208

Open
AlbertoMolinaIoBuilders opened this issue Apr 19, 2024 · 0 comments
Open

HashConnect signTransaction returns wrong signature #208

AlbertoMolinaIoBuilders opened this issue Apr 19, 2024 · 0 comments

Comments

@AlbertoMolinaIoBuilders

Hashconnect version : 3.0.13
Hashpack version : 9.8.1
@hashgraph/sdk version : 2.41.0

import { Transaction, Signer, AccountId } from '@hashgraph/sdk';
import { HashConnect} from 'hashconnect';

export class HashpackTransactionAdapter{
   private hc: HashConnect;
   public signer: Signer ;
   public account: AccountId;

   constructor(){
        this.hc = new HashConnect(hashpackNetwork, projectId, {
				name: SDK.appMetadata.name,
				description: SDK.appMetadata.description,
				url: SDK.appMetadata.url,
				icons: [],
			});
   }

   private async setSigner(): Promise<void> {
		this.signer = this.hc.getSigner(this.account);
   }

   async sign(message: Transaction): Promise<string> {
                       const signedTrans = await this.signer.signTransaction(message);
		       const list = signedTrans.getSignatures();
                       const nodes_signature = list.get(
				this.networkService.consensusNodes[0].nodeId,
			);
                       const pk_signature = nodes_signature.get(PublicKey_Der_Encoded);
   }
}

The retrieved signature "pk_signature" is apparently wrong, Hedera Testnet returns an "INVALID_SIGNATURE" error when we add the signature to the original transaction then submit it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant