Skip to content

getPubKey ​

Get the TBC public key from the connected wallet.

Usage ​

ts
const { tbcPubKey } = await Turing.getPubKey();
console.log(tbcPubKey);

Parameters ​

This method takes no parameters.

Returns ​

ts
interface GetPubKeyResponse {
  tbcPubKey: string;  // TBC public key in hex format
}
FieldTypeDescription
tbcPubKeystringThe TBC public key string

Error Handling ​

ts
try {
  const { tbcPubKey } = await Turing.getPubKey();
  console.log("Public key:", tbcPubKey);
} catch (error) {
  console.error("Failed to get public key:", error);
}

Live Example ​

Live Example

Turing.getPubKey()

Detecting Wallet...
Detecting Wallet...
Code Preview