1

In order to use the verifySignature method in Taquito, I need the public key of the wallet. I can only find the public key hash method - am I missing something obvious?

Thanks!

Below is how I obtain the wallet public key hash:

wallet.requestPermissions({ network: { type: 'hangzhounet' } })
      .then(() => wallet.getPKH());
1

2 Answers 2

1

Taquito doesn't have such a feature per se, but you can access this piece of information through the client property of the wallet instance, which contains the same data as the DappClient instance of the @airgap/beacon-sdk package:

const wallet = new BeaconWallet(OPTIONS);
const activeAccount = await wallet.client.getActiveAccount();
const { publicKey } = activeAccount;
0

This requires a RPC query to the node. You can use RpcClient.getManagerKey():

import { RpcClient } from '@taquito/rpc';
const rpcClient = new RpcClient('https://ghostnet.ecadinfra.com/');

const pkh = 'tz1a496f48q8idHSEbhAe3dc9vE9sTX3DEJi'; // Replace with the PKH you want to get the public key for
rpcClient.getManagerKey(pkh).then(publicKey => console.log(`Public key for manager with PKH ${pkh}: ${publicKey}`));

The doc for this function is:

https://tezostaquito.io/typedoc/classes/_taquito_rpc.rpcclient.html#getmanagerkey

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.