@fhenixprotocol/cofhe-errors

中文文档
1.0.2发布于 2026/01/28CommonJS零依赖构建来源已验证近 30 天下载 3602

COFHE智能合同的错误定义和识别符

中文使用文档
文档目录23 节
  1. 为什么是这个包?
  2. 问题: “ 执行还原” 出错
  3. 解决方案:即时错误解码
  4. 里面有什么东西
  5. 覆盖错误
  6. QQ 快速启动
  7. 可选: 安装供程序使用
  8. QQ 如何使用
  9. 命令行接口( CLI)
  10. 程序化 API( JavaScript/ TypeScript)
  11. 类型脚本支持
  12. QQ 完整错误引用
  13. 错误数据库( 53 个错误)
  14. 常见案件
  15. 1. 调试失败交易
  16. 2. 散装出错分析
  17. 3. 监测错误和记录错误
  18. 4. 文档和错误目录
  19. AI 编码助理
  20. QQ 错误选择器格式
  21. 有关资源
  22. 许可证
  23. 捐款

@fhenixprotocol/cofhe-errors (英语)

解码固态智能合同错误并立即解决"执行还原"消息

npm version License

为什么是这个包?

问题: “ 执行还原” 出错

在与"团结"智能合约合作时,你可能遇到了加密错误消息,如:

Error: execution reverted: 0x118cdaa7
Transaction reverted without a reason string
execution reverted

这些错误令人沮丧,因为:

  • 不透明:您只获得一个4字节错误选择器(例如, 0x118cdaa7(中文(简体) )
  • 难于调试: 没有可读错误信息
  • 耗时: 合同代码或区块勘探者的人工查询
  • 中断 AI 助手流: Claude Code, Cursor, GitHub 副驾驶等工具没有上下文无法帮助

解决方案:即时错误解码

此软件包提供 即时, 人类可读错误解码 为了你的团结合同。 它将选择者错误地映射到他们的全签名,名称和参数.

不需要安装! 使用 npx 以立即解码出错 :

npx cofhe-errors 0x118cdaa7
# Returns: OwnableUnauthorizedAccount(address)

里面有什么东西

此套件包含:

  • 53个自定义错误 从 13份智能合同
  • 带有参数类型的完整错误签名
  • 原始合同资料
  • 快速 CLI 搜索工具
  • 程序化 JavaScript/ TypeScript API

覆盖错误

  • ACL 阿拉伯法律联盟: 8 个错误
  • 地址: 1 出错
  • 常见: 2 个错误
  • ECDSA 数据交换系统: 3 个错误
  • ERC-1967UTIs (英语): 4个错误
  • 错误: 4个错误
  • 同性恋: 1 出错
  • 可升级: 4个错误
  • 纯文本图集: 1 出错
  • 保险箱: 4个错误
  • 字符串: 3 个错误
  • 任务管理器: 16个错误
  • UUPS 可升级: 2 个错误

QQ 快速启动

不需要安装! 使用 npx 立即运行 :

npx cofhe-errors 0x118cdaa7

可选: 安装供程序使用

只有在您需要导入代码中的错误数据库时才会安装 :

# NPM
npm install @fhenixprotocol/cofhe-errors

# Yarn
yarn add @fhenixprotocol/cofhe-errors

# PNPM
pnpm add @fhenixprotocol/cofhe-errors

QQ 如何使用

命令行接口( CLI)

解码出错选择器

当你看到"执行还原:0x..."

npx cofhe-errors 0x118cdaa7

输出 :

Name:      OwnableUnauthorizedAccount
Selector:  0x118cdaa7
Signature: OwnableUnauthorizedAccount(address)
Source:    ACL
Inputs:    address

按名称搜索错误

当您知道部分错误名称时有用 :

npx cofhe-errors --name Permission

输出 :

0x4c40eccb PermissionInvalid_IssuerSignature (ACL)
0x8e143bf7 PermissionInvalid_RecipientSignature (ACL)
0xcbd3a966 PermissionInvalid_Disabled (ACL)
0xed0764a1 PermissionInvalid_Expired (ACL)

列出所有已知错误

浏览完整错误数据库:

npx cofhe-errors --list

JSON 脚本输出

与您的工具和脚本整合 :

npx cofhe-errors --json 0x118cdaa7

输出 :

{
  "name": "OwnableUnauthorizedAccount",
  "selector": "0x118cdaa7",
  "signature": "OwnableUnauthorizedAccount(address)",
  "source": "ACL",
  "inputs": ["account"],
  "inputTypes": ["address"]
}

程序化 API( JavaScript/ TypeScript)

在应用程序代码中使用 :

const errors = require('@fhenixprotocol/cofhe-errors/errors.json');

// Find error by selector
const error = errors.find(e => e.selector === '0x118cdaa7');
console.log(`Error: ${error.name}`);
console.log(`Signature: ${error.signature}`);

// Search by name
const permissionErrors = errors.filter(e =>
  e.name.toLowerCase().includes('permission')
);

// Get all errors from a specific contract
const aclErrors = errors.filter(e => e.source === 'ACL');

类型脚本支持

错误. json 文件与 TypeScript 无缝:

import errors from '@fhenixprotocol/cofhe-errors/errors.json';

interface SolidityError {
  name: string;
  selector: string;
  signature: string;
  source: string;
  inputs: string[];
  inputTypes: string[];
}

const error = errors.find(e => e.selector === '0x118cdaa7') as SolidityError;

QQ 完整错误引用

错误数据库( 53 个错误)

选择器名称合同签署
0x01d4fab6无效的切换器常见InvalidHexCharacter(bytes1)
0x118cdaa7非授权账户可升级OwnableUnauthorizedAccount(address)
0x1d15ae44字符串无效地址格式字符串StringsInvalidAddressFormat()
0x1e4fbdf7自有无效的奥纳可升级OwnableInvalidOwner(address)
0x24775e06SafeCast Coverflowed Uint To Int 安全控制系统保险箱SafeCastOverflowedUintToInt(uint256)
0x24cbcf36无效的安全区任务管理器InvalidSecurityZone(int32,int32,int32)
0x2b0399d5过多输入任务管理器TooManyInputs(string,uint256,uint256)
0x30dc9203发件人无法被删除ACL 阿拉伯法律联盟SenderCannotBeDelegateeAddress()
0x327269a7SafeCast 重叠下播保险箱SafeCastOverflowedIntDowncast(uint8,int256)
0x3809a243直接全罗禁止ACL 阿拉伯法律联盟DirectAllowForbidden(address)
0x42b01bce缺少编译错误MissingPrecompile(address)
0x4c40eccb权限无效 签名ACL 阿拉伯法律联盟PermissionInvalid_IssuerSignature()
0x4c9c8ce3ERC1967 无效执行ERC-1967UTIs (英语)ERC1967InvalidImplementation(address)
0x4d13139eACL 不允许任务管理器ACLNotAllowed(uint256,address)
0x52b50ae1无效的Type或安全区任务管理器InvalidTypeOrSecurityZone(string)
0x62e77ba2ERC1967 无效AdminERC-1967UTIs (英语)ERC1967InvalidAdmin(address)
0x64ced0ecERC1967 无效 BeaconERC-1967UTIs (英语)ERC1967InvalidBeacon(address)
0x67cf3071无效的已复制输入同性恋InvalidEncryptedInput(uint8,uint8)
0x6dfcc650安全控制重叠 UintDowncast保险箱SafeCastOverflowedUintDowncast(uint8,uint256)
0x70cf6554解密结果不准备任务管理器DecryptionResultNotReady(uint256)
0x7ba5ffb5无效的符号任务管理器InvalidSigner(address,address)
0x884a0e9d无效的输入类型任务管理器InvalidInputType(uint8,uint8)
0x8baa579f无效的签名任务管理器InvalidSignature()
0x8e143bf7允许无效 接收签名ACL 阿拉伯法律联盟PermissionInvalid_RecipientSignature()
0x8f568bf8安全区边界外常见SecurityZoneOutOfBounds(int32)
0x91b4b378无效的输入功能任务管理器InvalidInputForFunction(string,uint8)
0x94e2737e字符串无效Char字符串StringsInvalidChar()
0x98e08ab0随机功能不支持任务管理器RandomFunctionNotSupported()
0x9996b315地址编码地址AddressEmptyCode(address)
0x9a84351c无效的输入自动挂载任务管理器InvalidInputsAmount(string,uint256,uint256)
0xa8ce4432SafeCast 重叠输入保险箱SafeCastOverflowedIntToUint(int256)
0xa974a0fe仅限隔离任务管理器OnlyAggregatorAllowed(address)
0xaa1d49a4UUPS 不支持的近似UUUIDUUPS 可升级UUPSUnsupportedProxiableUUID(bytes32)
0xb06ebf3d部署失败错误FailedDeployment()
0xb31612aa无效的操作输入任务管理器InvalidOperationInputs(string)
0xb398979fERC1967 无薪ERC-1967UTIs (英语)ERC1967NonPayable()
0xcabe5ce4不支持类型任务管理器UnsupportedType(uint256)
0xcbd3a966许可无效 已失效ACL 阿拉伯法律联盟PermissionInvalid_Disabled()
0xcf479181证据不足错误InsufficientBalance(uint256,uint256)
0xd0d25976发件人不全数ACL 阿拉伯法律联盟SenderNotAllowed(address)
0xd1860468已授权ACL 阿拉伯法律联盟AlreadyDelegated()
0xd6bda275调用失败错误FailedCall()
0xd78bce0cECDSA 无效签名SECDSA 数据交换系统ECDSAInvalidSignatureS(bytes32)
0xd7e6bcf8启动可升级NotInitializing()
0xd8aba367无法使用任务管理器CofheIsUnavailable()
0xdce3ec0a只有任务管理员全部放弃纯文本图集OnlyTaskManagerAllowed(address)
0xe07c8dba授权UUPS 调用语句UUPS 可升级UUPSUnauthorizedCallContext()
0xe22e27eb字符串不足HexLength字符串StringsInsufficientHexLength(uint256,uint256)
0xe6c4247b无效的添加任务管理器InvalidAddress()
0xed0764a1允许无效 已过期ACL 阿拉伯法律联盟PermissionInvalid_Expired()
0xf645eedfECDSA 无效签名ECDSA 数据交换系统ECDSAInvalidSignature()
0xf92ee8a9无效的初始化可升级InvalidInitialization()
0xfce698f7ECDSA 无效签名LengthECDSA 数据交换系统ECDSAInvalidSignatureLength(uint256)

常见案件

1. 调试失败交易

# Your transaction failed with:
# Error: execution reverted: 0x118cdaa7

# Decode it instantly:
npx cofhe-errors 0x118cdaa7

# Output shows:
# Name: OwnableUnauthorizedAccount
# This means: The caller doesn't have ownership permissions

2. 散装出错分析

# Get all errors from a specific contract
npx cofhe-errors --list | grep "ACL"

# Search for all permission-related errors
npx cofhe-errors --name Permission

3. 监测错误和记录错误

const errors = require('@fhenixprotocol/cofhe-errors/errors.json');

// Decode error from blockchain event
function decodeError(errorData) {
  const selector = errorData.slice(0, 10); // First 4 bytes
  const error = errors.find(e => e.selector === selector);

  if (error) {
    console.log(`Error: ${error.name}`);
    console.log(`Contract: ${error.source}`);
    console.log(`Signature: ${error.signature}`);
  }
}

4. 文档和错误目录

为您的智能合同生成错误文档 :

npx cofhe-errors --list > CONTRACT_ERRORS.md

AI 编码助理

此软件包包括 AI.md 包含AI助手(Claude Code, Cursor, GitHub Copilot等)的详细说明,说明调试工作流程中何时以及如何建议这个工具.

快速引用 : 当你看到 execution reverted: 0x...建议:

npx cofhe-errors <error-selector>

QQ 错误选择器格式

固态自定义错误使用4字节选择器计算为:

selector = keccak256("ErrorName(type1,type2,...)").slice(0, 4)

示例

error OwnableUnauthorizedAccount(address account);

成为:

  • 签署: OwnableUnauthorizedAccount(address)
  • 选择器 : keccak256("OwnableUnauthorizedAccount(address)") = 0x118cdaa7...
  • 前4个字节 : 0x118cdaa7

许可证

详情见LICENSE文件.

捐款

找到窃听器还是有什么建议? 请打开GitHub的一期!


软件包版本 : 1.0.2 联合国

产生者: 固态- 过分识别- 行动

SEO 标记 : 固态错误解码器 执行还原 智能合同出错 ethereum解码器 web3 错误处理 固态自定义出错 交易还原 错误选择器查询 区块链解码器 固态 ethereum 出错 智能合同 区块链 解码器 执行还原器 出错解码器 固态-errors,web3

版本与发布记录

@fhenixprotocol/cofhe-errors 共发布 3 个版本,首次发布于 2025/12/29;过去 12 个月发布了 3 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.0.2latest2026/01/289 个月前
1.0.12026/01/0110 个月前
1.0.02025/12/2910 个月前

关于 @fhenixprotocol/cofhe-errors 的常见问题

@fhenixprotocol/cofhe-errors 是什么?

COFHE智能合同的错误定义和识别符

如何安装 @fhenixprotocol/cofhe-errors?

在项目目录运行 npm install @fhenixprotocol/cofhe-errors,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 cofhe-errors,可以用 npx cofhe-errors 直接运行。

@fhenixprotocol/cofhe-errors 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/fhenixprotocol__cofhe-errors 是否存在。

@fhenixprotocol/cofhe-errors 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@fhenixprotocol/cofhe-errors 可以商用吗?

@fhenixprotocol/cofhe-errors 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@fhenixprotocol/cofhe-errors 的下载量有多少?

根据 npm 官方下载统计,@fhenixprotocol/cofhe-errors 在 2026/10/15 – 2026/11/13 这 30 天内被下载 3,602 次,日均约 120 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fhenixprotocol/cofhe-errors 还在维护吗?

最新版本 1.0.2 发布于 2026/01/28(9 个月前);至今共发布 3 个版本,其中过去 12 个月发布了 3 个;首次发布于 2025/12/29。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。