describePox5Error
Looks up a pox-5 error number and returns its contract constant name and a one-line description. Pure computation over tables in the SDK.
Usage
import { describePox5Error } from '@stacks/bitcoin-staking';
describePox5Error(7);
// { code: 7, name: 'ERR_BOND_NOT_FOUND', description: 'No bond was found for the supplied bond index.' }
describePox5Error(43n)?.name; // 'ERR_BOND_ALREADY_STARTED'
describePox5Error(6); // undefined: no pox-5 constant uses u6Notes
Accepts
numberorbigint. The input goes throughNumber()before the lookup.Returns
undefinedfor any number that is not a Pox5ErrorCode value.Pair it with parsePox5Error to describe a failed transaction's
(err uN). A number that came from another contract, such as the signer-manager or the sBTC token, returns a pox-5 description that does not apply, if the number is in use in pox-5.
Signature
Returns
{ code: number; name: string; description: string } | undefined
undefined for an unknown number, otherwise:
code
number
The error number
name
string
The contract constant, for example 'ERR_BOND_NOT_FOUND'
description
string
One-line explanation from the SDK
Parameters
code (required)
Type:
number | bigint
The error number, as from parsePox5Error or an EligibilityResult reason.
Was this helpful?