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);
}

在线示例

在线示例

Turing.getPubKey()

待检测
请使用页面顶部的钱包入口连接后再执行。

此方法无需参数。

代码预览
const { tbcPubKey } = await Turing.getPubKey();
console.log(tbcPubKey);
请确认浏览器插件已启用,或在移动端 Turing Wallet 内打开本文档。