Integrate HashPack wallet for Hedera blockchain authentication. Use for: (1) Adding HashPack login to webapps, (2) Signing Hbar transactions, (3) Connecting to Hedera DApps, (4) Getting account balance.
typescript
// 检测 HashPack
const hashpack = (window as any).hashpack;
// 连接
const result = await hashpack.connect();
// 获取账户 ID
const accountId = result.accountId; // 例如:0.0.12345
Hedera 账户 ID 格式为:0.0.12345(分片.领域.编号)
typescript
// 连接(弹出窗口)
await hashpack.connect();
// 签名并提交交易
const tx = new TransferTransaction()
.addHbarTransfer(from, -10)
.addHbarTransfer(to, 10);
await hashpack.signTransaction(tx);
// 获取余额
const balance = await new AccountBalanceQuery()
.setAccountId(accountId)
.execute(client);
// 断开连接
hashpack.disconnect();
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 hashpack-wallet-1776420052 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 hashpack-wallet-1776420052 技能
skillhub install hashpack-wallet-1776420052
文件大小: 1.26 KB | 发布时间: 2026-4-17 20:12