Skip to content

getPubKey

获取已连接钱包的 TBC 公钥。

用法

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

参数

此方法无需参数。

返回值

ts
interface GetPubKeyResponse {
  tbcPubKey: string;  // TBC 公钥(hex 格式)
}
字段类型说明
tbcPubKeystringTBC 公钥字符串

错误处理

ts
try {
  const { tbcPubKey } = await Turing.getPubKey();
  console.log("公钥:", tbcPubKey);
} catch (error) {
  console.error("获取公钥失败:", error);
}