/** * This code was AUTOGENERATED using the Codama library. * Please DO NOT EDIT THIS FILE, instead use visitors * to add features, then rerun Codama to update it. * * @see https://github.com/codama-idl/codama */ import { isProgramError, type Address, type SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM, type SolanaError, } from '@solana/kit'; import { PAYMENT_CHANNELS_PROGRAM_ADDRESS } from '../programs/index.js'; export const PAYMENT_CHANNELS_ERROR__NOT_IMPLEMENTED = 0x0; // 0 export const PAYMENT_CHANNELS_ERROR__MISSING_REQUIRED_SIGNATURE = 0x1; // 1 export const PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_STATUS = 0x2; // 2 export const PAYMENT_CHANNELS_ERROR__INVALID_ACCOUNT_DISCRIMINATOR = 0x3; // 3 export const PAYMENT_CHANNELS_ERROR__UNSUPPORTED_CHANNEL_VERSION = 0x4; // 4 export const PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_PAYER = 0x5; // 5 export const PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_PAYEE = 0x6; // 6 export const PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_MINT = 0x7; // 7 export const PAYMENT_CHANNELS_ERROR__INVALID_EVENT_AUTHORITY = 0x8; // 8 export const PAYMENT_CHANNELS_ERROR__NOT_ENOUGH_ACCOUNT_KEYS = 0x9; // 9 export const PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_RENT_PAYER = 0xa; // 10 export const PAYMENT_CHANNELS_ERROR__CHANNEL_ACCOUNT_MISMATCH = 0x32; // 50 export const PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_TOKEN_ACCOUNT = 0x33; // 51 export const PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_TOKEN_EXTENSIONS = 0x34; // 52 export const PAYMENT_CHANNELS_ERROR__MINT_ACCOUNT_MISMATCH = 0x35; // 53 export const PAYMENT_CHANNELS_ERROR__INVALID_MINT_TOKEN_PROGRAM = 0x36; // 54 export const PAYMENT_CHANNELS_ERROR__MALFORMED_MINT_TOKEN_ACCOUNT_DATA = 0x37; // 55 export const PAYMENT_CHANNELS_ERROR__MALFORMED_MINT_TOKEN_EXTENSIONS = 0x38; // 56 export const PAYMENT_CHANNELS_ERROR__PAYER_ACCOUNT_MISMATCH = 0x39; // 57 export const PAYMENT_CHANNELS_ERROR__INVALID_PAYER_TOKEN_ACCOUNT = 0x3a; // 58 export const PAYMENT_CHANNELS_ERROR__INVALID_PAYER_TOKEN_EXTENSIONS = 0x3b; // 59 export const PAYMENT_CHANNELS_ERROR__PAYEE_ACCOUNT_MISMATCH = 0x3c; // 60 export const PAYMENT_CHANNELS_ERROR__INVALID_PAYEE_TOKEN_ACCOUNT = 0x3d; // 61 export const PAYMENT_CHANNELS_ERROR__INVALID_PAYEE_TOKEN_EXTENSIONS = 0x3e; // 62 export const PAYMENT_CHANNELS_ERROR__DEPOSIT_MUST_BE_NON_ZERO = 0xc8; // 200 export const PAYMENT_CHANNELS_ERROR__GRACE_PERIOD_MUST_BE_NON_ZERO = 0xc9; // 201 export const PAYMENT_CHANNELS_ERROR__MISSING_ED25519_VERIFICATION = 0xe6; // 230 export const PAYMENT_CHANNELS_ERROR__MALFORMED_ED25519_INSTRUCTION = 0xe7; // 231 export const PAYMENT_CHANNELS_ERROR__VOUCHER_CHANNEL_MISMATCH = 0xe8; // 232 export const PAYMENT_CHANNELS_ERROR__VOUCHER_EXPIRED = 0xe9; // 233 export const PAYMENT_CHANNELS_ERROR__VOUCHER_WATERMARK_NOT_MONOTONIC = 0xea; // 234 export const PAYMENT_CHANNELS_ERROR__VOUCHER_OVER_DEPOSIT = 0xeb; // 235 export const PAYMENT_CHANNELS_ERROR__VOUCHER_MESSAGE_MISMATCH = 0xec; // 236 export const PAYMENT_CHANNELS_ERROR__VOUCHER_SIGNER_MISMATCH = 0xed; // 237 export const PAYMENT_CHANNELS_ERROR__VOUCHER_BAD_MAGIC = 0xee; // 238 export const PAYMENT_CHANNELS_ERROR__INVALID_RECIPIENT_COUNT = 0x104; // 260 export const PAYMENT_CHANNELS_ERROR__INVALID_SPLIT_CONFIG = 0x105; // 261 export const PAYMENT_CHANNELS_ERROR__DISTRIBUTION_PARTS_OVERFLOW = 0x106; // 262 export const PAYMENT_CHANNELS_ERROR__DUPLICATE_RECIPIENT = 0x107; // 263 export const PAYMENT_CHANNELS_ERROR__DISTRIBUTION_AMOUNT_OVERFLOW = 0x108; // 264 export const PAYMENT_CHANNELS_ERROR__DISTRIBUTION_PREIMAGE_LENGTH_OVERFLOW = 0x109; // 265 export const PAYMENT_CHANNELS_ERROR__CHANNEL_ADDRESS_MISMATCH = 0x7d0; // 2000 export const PAYMENT_CHANNELS_ERROR__PAYER_PAYEE_MUST_DIFFER = 0x7d1; // 2001 export const PAYMENT_CHANNELS_ERROR__INVALID_AUTHORIZED_SIGNER = 0x7d2; // 2002 export const PAYMENT_CHANNELS_ERROR__OPEN_SLOT_OUT_OF_WINDOW = 0x7d3; // 2003 export const PAYMENT_CHANNELS_ERROR__TOP_UP_DEPOSIT_OVERFLOW = 0x834; // 2100 export const PAYMENT_CHANNELS_ERROR__SEAL_DEADLINE_OVERFLOW = 0x898; // 2200 export const PAYMENT_CHANNELS_ERROR__SEAL_GRACE_PERIOD_NOT_ELAPSED = 0x899; // 2201 export const PAYMENT_CHANNELS_ERROR__PAYER_ALREADY_WITHDRAWN = 0x8fc; // 2300 export const PAYMENT_CHANNELS_ERROR__REFUND_CALCULATION_OVERFLOW = 0x8fd; // 2301 export const PAYMENT_CHANNELS_ERROR__CHANNEL_NOT_DISTRIBUTABLE = 0x960; // 2400 export const PAYMENT_CHANNELS_ERROR__TREASURY_ACCOUNT_MISMATCH = 0x961; // 2401 export const PAYMENT_CHANNELS_ERROR__INVALID_TREASURY_TOKEN_ACCOUNT = 0x962; // 2402 export const PAYMENT_CHANNELS_ERROR__INVALID_TREASURY_TOKEN_EXTENSIONS = 0x963; // 2403 export const PAYMENT_CHANNELS_ERROR__RECIPIENT_ACCOUNT_MISMATCH = 0x964; // 2404 export const PAYMENT_CHANNELS_ERROR__INVALID_RECIPIENT_TOKEN_ACCOUNT = 0x965; // 2405 export const PAYMENT_CHANNELS_ERROR__INVALID_RECIPIENT_TOKEN_EXTENSIONS = 0x966; // 2406 export const PAYMENT_CHANNELS_ERROR__INVALID_DISTRIBUTION_HASH = 0x967; // 2407 export const PAYMENT_CHANNELS_ERROR__NOTHING_TO_DISTRIBUTE = 0x968; // 2408 export const PAYMENT_CHANNELS_ERROR__RECIPIENT_ACCOUNT_COUNT_MISMATCH = 0x969; // 2409 export const PAYMENT_CHANNELS_ERROR__DISTRIBUTE_POOL_OVERFLOW = 0x96a; // 2410 export const PAYMENT_CHANNELS_ERROR__DISTRIBUTE_BALANCE_CALCULATION_OVERFLOW = 0x96b; // 2411 export const PAYMENT_CHANNELS_ERROR__RENT_PAYER_BALANCE_OVERFLOW = 0x96c; // 2412 export const PAYMENT_CHANNELS_ERROR__DISTRIBUTE_TRANSFER_QUEUE_OVERFLOW = 0x96d; // 2413 export const PAYMENT_CHANNELS_ERROR__CHANNEL_CLOSE_TOO_EARLY = 0x96e; // 2414 export type PaymentChannelsError = | typeof PAYMENT_CHANNELS_ERROR__CHANNEL_ACCOUNT_MISMATCH | typeof PAYMENT_CHANNELS_ERROR__CHANNEL_ADDRESS_MISMATCH | typeof PAYMENT_CHANNELS_ERROR__CHANNEL_CLOSE_TOO_EARLY | typeof PAYMENT_CHANNELS_ERROR__CHANNEL_NOT_DISTRIBUTABLE | typeof PAYMENT_CHANNELS_ERROR__DEPOSIT_MUST_BE_NON_ZERO | typeof PAYMENT_CHANNELS_ERROR__DISTRIBUTE_BALANCE_CALCULATION_OVERFLOW | typeof PAYMENT_CHANNELS_ERROR__DISTRIBUTE_POOL_OVERFLOW | typeof PAYMENT_CHANNELS_ERROR__DISTRIBUTE_TRANSFER_QUEUE_OVERFLOW | typeof PAYMENT_CHANNELS_ERROR__DISTRIBUTION_AMOUNT_OVERFLOW | typeof PAYMENT_CHANNELS_ERROR__DISTRIBUTION_PARTS_OVERFLOW | typeof PAYMENT_CHANNELS_ERROR__DISTRIBUTION_PREIMAGE_LENGTH_OVERFLOW | typeof PAYMENT_CHANNELS_ERROR__DUPLICATE_RECIPIENT | typeof PAYMENT_CHANNELS_ERROR__GRACE_PERIOD_MUST_BE_NON_ZERO | typeof PAYMENT_CHANNELS_ERROR__INVALID_ACCOUNT_DISCRIMINATOR | typeof PAYMENT_CHANNELS_ERROR__INVALID_AUTHORIZED_SIGNER | typeof PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_MINT | typeof PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_PAYEE | typeof PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_PAYER | typeof PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_RENT_PAYER | typeof PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_STATUS | typeof PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_TOKEN_ACCOUNT | typeof PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_TOKEN_EXTENSIONS | typeof PAYMENT_CHANNELS_ERROR__INVALID_DISTRIBUTION_HASH | typeof PAYMENT_CHANNELS_ERROR__INVALID_EVENT_AUTHORITY | typeof PAYMENT_CHANNELS_ERROR__INVALID_MINT_TOKEN_PROGRAM | typeof PAYMENT_CHANNELS_ERROR__INVALID_PAYEE_TOKEN_ACCOUNT | typeof PAYMENT_CHANNELS_ERROR__INVALID_PAYEE_TOKEN_EXTENSIONS | typeof PAYMENT_CHANNELS_ERROR__INVALID_PAYER_TOKEN_ACCOUNT | typeof PAYMENT_CHANNELS_ERROR__INVALID_PAYER_TOKEN_EXTENSIONS | typeof PAYMENT_CHANNELS_ERROR__INVALID_RECIPIENT_COUNT | typeof PAYMENT_CHANNELS_ERROR__INVALID_RECIPIENT_TOKEN_ACCOUNT | typeof PAYMENT_CHANNELS_ERROR__INVALID_RECIPIENT_TOKEN_EXTENSIONS | typeof PAYMENT_CHANNELS_ERROR__INVALID_SPLIT_CONFIG | typeof PAYMENT_CHANNELS_ERROR__INVALID_TREASURY_TOKEN_ACCOUNT | typeof PAYMENT_CHANNELS_ERROR__INVALID_TREASURY_TOKEN_EXTENSIONS | typeof PAYMENT_CHANNELS_ERROR__MALFORMED_ED25519_INSTRUCTION | typeof PAYMENT_CHANNELS_ERROR__MALFORMED_MINT_TOKEN_ACCOUNT_DATA | typeof PAYMENT_CHANNELS_ERROR__MALFORMED_MINT_TOKEN_EXTENSIONS | typeof PAYMENT_CHANNELS_ERROR__MINT_ACCOUNT_MISMATCH | typeof PAYMENT_CHANNELS_ERROR__MISSING_ED25519_VERIFICATION | typeof PAYMENT_CHANNELS_ERROR__MISSING_REQUIRED_SIGNATURE | typeof PAYMENT_CHANNELS_ERROR__NOT_ENOUGH_ACCOUNT_KEYS | typeof PAYMENT_CHANNELS_ERROR__NOTHING_TO_DISTRIBUTE | typeof PAYMENT_CHANNELS_ERROR__NOT_IMPLEMENTED | typeof PAYMENT_CHANNELS_ERROR__OPEN_SLOT_OUT_OF_WINDOW | typeof PAYMENT_CHANNELS_ERROR__PAYEE_ACCOUNT_MISMATCH | typeof PAYMENT_CHANNELS_ERROR__PAYER_ACCOUNT_MISMATCH | typeof PAYMENT_CHANNELS_ERROR__PAYER_ALREADY_WITHDRAWN | typeof PAYMENT_CHANNELS_ERROR__PAYER_PAYEE_MUST_DIFFER | typeof PAYMENT_CHANNELS_ERROR__RECIPIENT_ACCOUNT_COUNT_MISMATCH | typeof PAYMENT_CHANNELS_ERROR__RECIPIENT_ACCOUNT_MISMATCH | typeof PAYMENT_CHANNELS_ERROR__REFUND_CALCULATION_OVERFLOW | typeof PAYMENT_CHANNELS_ERROR__RENT_PAYER_BALANCE_OVERFLOW | typeof PAYMENT_CHANNELS_ERROR__SEAL_DEADLINE_OVERFLOW | typeof PAYMENT_CHANNELS_ERROR__SEAL_GRACE_PERIOD_NOT_ELAPSED | typeof PAYMENT_CHANNELS_ERROR__TOP_UP_DEPOSIT_OVERFLOW | typeof PAYMENT_CHANNELS_ERROR__TREASURY_ACCOUNT_MISMATCH | typeof PAYMENT_CHANNELS_ERROR__UNSUPPORTED_CHANNEL_VERSION | typeof PAYMENT_CHANNELS_ERROR__VOUCHER_BAD_MAGIC | typeof PAYMENT_CHANNELS_ERROR__VOUCHER_CHANNEL_MISMATCH | typeof PAYMENT_CHANNELS_ERROR__VOUCHER_EXPIRED | typeof PAYMENT_CHANNELS_ERROR__VOUCHER_MESSAGE_MISMATCH | typeof PAYMENT_CHANNELS_ERROR__VOUCHER_OVER_DEPOSIT | typeof PAYMENT_CHANNELS_ERROR__VOUCHER_SIGNER_MISMATCH | typeof PAYMENT_CHANNELS_ERROR__VOUCHER_WATERMARK_NOT_MONOTONIC; let paymentChannelsErrorMessages: Record | undefined; if (process.env['NODE_ENV'] !== 'production') { paymentChannelsErrorMessages = { [PAYMENT_CHANNELS_ERROR__CHANNEL_ACCOUNT_MISMATCH]: `Channel account does not match derived PDA`, [PAYMENT_CHANNELS_ERROR__CHANNEL_ADDRESS_MISMATCH]: `Derived channel account address does not match the user provided address`, [PAYMENT_CHANNELS_ERROR__CHANNEL_CLOSE_TOO_EARLY]: `Channel cannot be fully closed until clock.slot > open_slot + OPEN_SLOT_WINDOW`, [PAYMENT_CHANNELS_ERROR__CHANNEL_NOT_DISTRIBUTABLE]: `Channel is not in OPEN or SEALED`, [PAYMENT_CHANNELS_ERROR__DEPOSIT_MUST_BE_NON_ZERO]: `Deposit must be non-zero`, [PAYMENT_CHANNELS_ERROR__DISTRIBUTE_BALANCE_CALCULATION_OVERFLOW]: `Channel rent rebalance calculation underflow`, [PAYMENT_CHANNELS_ERROR__DISTRIBUTE_POOL_OVERFLOW]: `Distribution pool calculation underflow`, [PAYMENT_CHANNELS_ERROR__DISTRIBUTE_TRANSFER_QUEUE_OVERFLOW]: `Transfer queue capacity exceeded`, [PAYMENT_CHANNELS_ERROR__DISTRIBUTION_AMOUNT_OVERFLOW]: `num_recipients outside [0, 32]`, [PAYMENT_CHANNELS_ERROR__DISTRIBUTION_PARTS_OVERFLOW]: `num_recipients outside [0, 32]`, [PAYMENT_CHANNELS_ERROR__DISTRIBUTION_PREIMAGE_LENGTH_OVERFLOW]: `Distribution preimage length calculation overflow`, [PAYMENT_CHANNELS_ERROR__DUPLICATE_RECIPIENT]: `Distribution plan contains a duplicate recipient address`, [PAYMENT_CHANNELS_ERROR__GRACE_PERIOD_MUST_BE_NON_ZERO]: `Grace period must be non-zero`, [PAYMENT_CHANNELS_ERROR__INVALID_ACCOUNT_DISCRIMINATOR]: `Invalid account discriminator`, [PAYMENT_CHANNELS_ERROR__INVALID_AUTHORIZED_SIGNER]: `authorized_signer must be a valid Ed25519 public key`, [PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_MINT]: `Account does not match channel mint`, [PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_PAYEE]: `Account does not match channel payee`, [PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_PAYER]: `Account does not match channel payer`, [PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_RENT_PAYER]: `Account does not match channel rent_payer`, [PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_STATUS]: `Invalid channel status`, [PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_TOKEN_ACCOUNT]: `Channel token account is not ATA(channel, mint, token_program)`, [PAYMENT_CHANNELS_ERROR__INVALID_CHANNEL_TOKEN_EXTENSIONS]: `Channel token account has invalid extensions`, [PAYMENT_CHANNELS_ERROR__INVALID_DISTRIBUTION_HASH]: `Distribution hash mismatch`, [PAYMENT_CHANNELS_ERROR__INVALID_EVENT_AUTHORITY]: `Invalid event authority`, [PAYMENT_CHANNELS_ERROR__INVALID_MINT_TOKEN_PROGRAM]: `Token program must be SPL Token or Token-2022`, [PAYMENT_CHANNELS_ERROR__INVALID_PAYEE_TOKEN_ACCOUNT]: `Payee token account is invalid`, [PAYMENT_CHANNELS_ERROR__INVALID_PAYEE_TOKEN_EXTENSIONS]: `Payee token account has invalid extensions`, [PAYMENT_CHANNELS_ERROR__INVALID_PAYER_TOKEN_ACCOUNT]: `Payer token account is invalid`, [PAYMENT_CHANNELS_ERROR__INVALID_PAYER_TOKEN_EXTENSIONS]: `Payer token account has invalid extensions`, [PAYMENT_CHANNELS_ERROR__INVALID_RECIPIENT_COUNT]: `num_recipients outside [0, 32]`, [PAYMENT_CHANNELS_ERROR__INVALID_RECIPIENT_TOKEN_ACCOUNT]: `Recipient token account is invalid`, [PAYMENT_CHANNELS_ERROR__INVALID_RECIPIENT_TOKEN_EXTENSIONS]: `Recipient token account has invalid extensions`, [PAYMENT_CHANNELS_ERROR__INVALID_SPLIT_CONFIG]: `Each shareBps must be non-zero and Σbps must be at most 10_000`, [PAYMENT_CHANNELS_ERROR__INVALID_TREASURY_TOKEN_ACCOUNT]: `Treasury token account is invalid`, [PAYMENT_CHANNELS_ERROR__INVALID_TREASURY_TOKEN_EXTENSIONS]: `Treasury token account has invalid extensions`, [PAYMENT_CHANNELS_ERROR__MALFORMED_ED25519_INSTRUCTION]: `Malformed Ed25519 precompile instruction`, [PAYMENT_CHANNELS_ERROR__MALFORMED_MINT_TOKEN_ACCOUNT_DATA]: `Token account or mint TLV trailer is malformed`, [PAYMENT_CHANNELS_ERROR__MALFORMED_MINT_TOKEN_EXTENSIONS]: `Token account or mint TLV trailer is malformed`, [PAYMENT_CHANNELS_ERROR__MINT_ACCOUNT_MISMATCH]: `Mint account does not match channel.mint`, [PAYMENT_CHANNELS_ERROR__MISSING_ED25519_VERIFICATION]: `Missing Ed25519 precompile ix at current-1`, [PAYMENT_CHANNELS_ERROR__MISSING_REQUIRED_SIGNATURE]: `A signature was required but not found`, [PAYMENT_CHANNELS_ERROR__NOT_ENOUGH_ACCOUNT_KEYS]: `Not enough accounts were provided`, [PAYMENT_CHANNELS_ERROR__NOTHING_TO_DISTRIBUTE]: `No newly settled funds to distribute`, [PAYMENT_CHANNELS_ERROR__NOT_IMPLEMENTED]: `Not implemented`, [PAYMENT_CHANNELS_ERROR__OPEN_SLOT_OUT_OF_WINDOW]: `open_slot is in the future or older than the allowed slot window`, [PAYMENT_CHANNELS_ERROR__PAYEE_ACCOUNT_MISMATCH]: `Payee token account is not ATA(payee, token_program, mint)`, [PAYMENT_CHANNELS_ERROR__PAYER_ACCOUNT_MISMATCH]: `Payer token account is not ATA(payer, token_program, mint)`, [PAYMENT_CHANNELS_ERROR__PAYER_ALREADY_WITHDRAWN]: `Payer refund has already been claimed`, [PAYMENT_CHANNELS_ERROR__PAYER_PAYEE_MUST_DIFFER]: `Payer and payee must be different accounts`, [PAYMENT_CHANNELS_ERROR__RECIPIENT_ACCOUNT_COUNT_MISMATCH]: `Recipient ATA tail length does not match the committed plan's entry count`, [PAYMENT_CHANNELS_ERROR__RECIPIENT_ACCOUNT_MISMATCH]: `Recipient token account is not ATA(recipient, token_program, mint)`, [PAYMENT_CHANNELS_ERROR__REFUND_CALCULATION_OVERFLOW]: `Payer refund amount calculation underflow`, [PAYMENT_CHANNELS_ERROR__RENT_PAYER_BALANCE_OVERFLOW]: `Rent payer lamports overflow on channel deallocation`, [PAYMENT_CHANNELS_ERROR__SEAL_DEADLINE_OVERFLOW]: `Deadline overflow on grace period`, [PAYMENT_CHANNELS_ERROR__SEAL_GRACE_PERIOD_NOT_ELAPSED]: `Grace period has not elapsed yet`, [PAYMENT_CHANNELS_ERROR__TOP_UP_DEPOSIT_OVERFLOW]: `Deposit must be non-zero`, [PAYMENT_CHANNELS_ERROR__TREASURY_ACCOUNT_MISMATCH]: `Treasury token account is not ATA(TREASURY_OWNER, mint, token_program)`, [PAYMENT_CHANNELS_ERROR__UNSUPPORTED_CHANNEL_VERSION]: `Unsupported channel version`, [PAYMENT_CHANNELS_ERROR__VOUCHER_BAD_MAGIC]: `Voucher payload magic prefix is invalid`, [PAYMENT_CHANNELS_ERROR__VOUCHER_CHANNEL_MISMATCH]: `Voucher channel_id does not match channel PDA`, [PAYMENT_CHANNELS_ERROR__VOUCHER_EXPIRED]: `Voucher expired`, [PAYMENT_CHANNELS_ERROR__VOUCHER_MESSAGE_MISMATCH]: `Reserved (formerly: Ed25519 message does not match Borsh voucher payload)`, [PAYMENT_CHANNELS_ERROR__VOUCHER_OVER_DEPOSIT]: `Voucher cumulative_amount exceeds channel deposit`, [PAYMENT_CHANNELS_ERROR__VOUCHER_SIGNER_MISMATCH]: `Voucher signer does not match channel authorized_signer`, [PAYMENT_CHANNELS_ERROR__VOUCHER_WATERMARK_NOT_MONOTONIC]: `Voucher watermark not strictly monotonic`, }; } export function getPaymentChannelsErrorMessage(code: PaymentChannelsError): string { if (process.env['NODE_ENV'] !== 'production') { return (paymentChannelsErrorMessages as Record)[code]; } return 'Error message not available in production bundles.'; } export function isPaymentChannelsError( error: unknown, transactionMessage: { instructions: Record; }, code?: TProgramErrorCode, ): error is SolanaError & Readonly<{ context: Readonly<{ code: TProgramErrorCode }> }> { return isProgramError(error, transactionMessage, PAYMENT_CHANNELS_PROGRAM_ADDRESS, code); }