@zethub/bridge
Reference

Error codes

Every ErrorCode the SDK raises, with its default ErrorMessage copy.

Every BridgeError.code is one of the values on the exported ErrorCode map. Import both to switch on codes with autocomplete.

import { BridgeError, ErrorCode, ErrorMessage } from "@zethub/bridge";

Input validation

CodeDefault message
AMOUNT_REQUIREDEnter an amount.
AMOUNT_INVALIDEnter a valid number.
AMOUNT_TOO_SMALLAmount must be greater than zero.
AMOUNT_EXCEEDS_BALANCEAmount exceeds your USDC balance.
RECIPIENT_REQUIREDEnter a recipient address.
RECIPIENT_INVALID_EVMRecipient must be a 0x prefixed Ethereum style address (40 hex characters).
RECIPIENT_INVALID_STELLARRecipient must be a Stellar address starting with G (account) or C (contract).
MEMO_INVALID_TEXTMemo text must be 28 characters or fewer (ASCII).
MEMO_INVALID_IDMemo ID must be an unsigned integer.
MEMO_INVALID_HASHMemo hash/return must be 32 bytes (64 hex characters).

Routing

CodeDefault message
MISSING_SOURCEPick a source chain.
MISSING_DESTINATIONPick a destination chain.
MISSING_EVM_CHAIN_IDNetwork is missing its EVM chain id.
MISSING_FORWARDERStellar network is missing the CctpForwarder configuration.
MISSING_TRUSTLINEThe Stellar recipient has no trustline for this asset. Establish the trustline before bridging.
UNSUPPORTED_ASSETThe selected asset is not supported on this route.
UNSUPPORTED_ROUTENo chain connector registered for one side of this route.
MISMATCHED_ENVIRONMENTSSource and destination must be on the same environment (mainnet or testnet).
SAME_NETWORKSource and destination networks must differ.

Wallet side (classified from provider errors)

Set by BridgeError.from(err) when it recognises a wallet library error.

CodeDefault message
WRONG_NETWORKSwitch your wallet to the correct network.
WALLET_SIGN_REJECTEDTransaction was rejected in the wallet.

Network / off chain

CodeDefault message
RPC_ERRORRPC request failed. Check your network and retry.
RPC_TIMEOUTRPC request timed out. Retrying with a fallback endpoint.
ATTESTATION_TIMEOUTTimed out waiting for Circle to issue the attestation. Your transfer is safe; retry the mint step.

On chain outcome

CodeDefault message
BURN_FAILEDBurn transaction failed on the source chain.

Fallback

CodeDefault message
UNKNOWNSomething went wrong. Check the developer console for details.

Overriding a message

import { ErrorMessage } from "@zethub/bridge";

const custom: typeof ErrorMessage = {
  ...ErrorMessage,
  MISSING_TRUSTLINE: "Please add a USDC trustline before bridging to this account.",
};

The types stay open so you can compose your own maps without losing autocomplete.

On this page