@circle-fin/provider-cctp-v2 1.6.2 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -166,6 +166,43 @@ interface BaseChainDefinition {
166
166
  * ```
167
167
  */
168
168
  kitContracts?: KitContracts;
169
+ /**
170
+ * Optional Gateway contract configuration for Gateway protocol support.
171
+ *
172
+ * @description When provided, the chain supports the Gateway protocol for
173
+ * cross-chain transfers. Gateway provides an alternative bridging mechanism
174
+ * with its own set of smart contracts (GatewayWallet and GatewayMinter).
175
+ *
176
+ * Use the {@link isGatewayV1Supported} type guard to check if a chain
177
+ * supports Gateway v1 before accessing these properties.
178
+ *
179
+ * @example
180
+ * ```typescript
181
+ * // Chain with Gateway v1 support
182
+ * const chainWithGateway: ChainDefinition = {
183
+ * // ... other properties
184
+ * gateway: {
185
+ * domain: 6,
186
+ * forwarderSupported: { source: true, destination: true },
187
+ * contracts: {
188
+ * v1: {
189
+ * wallet: '0x1234567890abcdef1234567890abcdef12345678',
190
+ * minter: '0xabcdef1234567890abcdef1234567890abcdef12'
191
+ * }
192
+ * }
193
+ * }
194
+ * }
195
+ *
196
+ * // Check Gateway support
197
+ * if (isGatewayV1Supported(chainWithGateway)) {
198
+ * console.log('Gateway wallet:', chainWithGateway.gateway.contracts.v1.wallet)
199
+ * }
200
+ * ```
201
+ *
202
+ * @see {@link GatewayConfig} for the structure of Gateway configuration.
203
+ * @see {@link isGatewayV1Supported} for checking Gateway v1 support.
204
+ */
205
+ gateway?: GatewayConfig;
169
206
  }
170
207
  /**
171
208
  * Represents chain definitions for Ethereum Virtual Machine (EVM) compatible blockchains.
@@ -447,6 +484,128 @@ interface CCTPConfig {
447
484
  * ```
448
485
  */
449
486
  type KitContractType = 'bridge' | 'adapter';
487
+ /**
488
+ * Configuration for Gateway v1 contracts.
489
+ *
490
+ * @description Contains the addresses for the GatewayWallet and GatewayMinter
491
+ * smart contracts that enable Gateway functionality on a chain.
492
+ *
493
+ * @example
494
+ * ```typescript
495
+ * import type { GatewayV1Contracts } from '@core/chains'
496
+ *
497
+ * const v1Contracts: GatewayV1Contracts = {
498
+ * wallet: '0x1234567890abcdef1234567890abcdef12345678',
499
+ * minter: '0xabcdef1234567890abcdef1234567890abcdef12'
500
+ * }
501
+ * ```
502
+ */
503
+ interface GatewayV1Contracts {
504
+ /**
505
+ * The address of the GatewayWallet smart contract.
506
+ *
507
+ * @description The GatewayWallet contract manages wallet operations
508
+ * for Gateway transactions.
509
+ *
510
+ * Address format varies by blockchain:
511
+ * - EVM chains: 40-character hexadecimal with 0x prefix (e.g., "0x1234...")
512
+ * - Solana: Base58-encoded 32-byte address (e.g., "9WzDX...")
513
+ *
514
+ * @example "0x1234567890abcdef1234567890abcdef12345678"
515
+ */
516
+ wallet: string;
517
+ /**
518
+ * The address of the GatewayMinter smart contract.
519
+ *
520
+ * @description The GatewayMinter contract handles minting operations
521
+ * for Gateway transactions.
522
+ *
523
+ * Address format varies by blockchain:
524
+ * - EVM chains: 40-character hexadecimal with 0x prefix (e.g., "0x1234...")
525
+ * - Solana: Base58-encoded 32-byte address (e.g., "9WzDX...")
526
+ *
527
+ * @example "0xabcdef1234567890abcdef1234567890abcdef12"
528
+ */
529
+ minter: string;
530
+ }
531
+ /**
532
+ * Versioned map of Gateway contract configurations.
533
+ *
534
+ * @description Maps protocol versions to their contract addresses, following
535
+ * the same pattern as {@link CCTPContracts}. Each version is optional so that
536
+ * chains can support any combination of Gateway protocol versions.
537
+ *
538
+ * @example
539
+ * ```typescript
540
+ * import type { GatewayContracts } from '@core/chains'
541
+ *
542
+ * const contracts: GatewayContracts = {
543
+ * v1: {
544
+ * wallet: '0x1234567890abcdef1234567890abcdef12345678',
545
+ * minter: '0xabcdef1234567890abcdef1234567890abcdef12'
546
+ * }
547
+ * }
548
+ * ```
549
+ */
550
+ type GatewayContracts = Partial<{
551
+ v1: GatewayV1Contracts;
552
+ }>;
553
+ /**
554
+ * Configuration for the Gateway protocol on a blockchain.
555
+ *
556
+ * @description Contains the Gateway domain identifier and version-specific
557
+ * contract configurations. Follows the same structure as {@link CCTPConfig}:
558
+ * a domain number plus a versioned contracts map.
559
+ *
560
+ * @example
561
+ * ```typescript
562
+ * import type { GatewayConfig } from '@core/chains'
563
+ *
564
+ * const gatewayConfig: GatewayConfig = {
565
+ * domain: 0,
566
+ * forwarderSupported: { source: true, destination: true },
567
+ * contracts: {
568
+ * v1: {
569
+ * wallet: '0x1234567890abcdef1234567890abcdef12345678',
570
+ * minter: '0xabcdef1234567890abcdef1234567890abcdef12'
571
+ * }
572
+ * }
573
+ * }
574
+ * ```
575
+ */
576
+ interface GatewayConfig {
577
+ /**
578
+ * The Gateway domain identifier for this chain.
579
+ *
580
+ * @description Similar to CCTP domains, this number uniquely identifies
581
+ * the chain within the Gateway protocol.
582
+ *
583
+ * @example 0 for Ethereum, 6 for Base
584
+ */
585
+ domain: number;
586
+ /**
587
+ * Version-specific Gateway contract addresses.
588
+ *
589
+ * @description Contains the addresses for each supported Gateway protocol
590
+ * version, following the same pattern as {@link CCTPContracts}.
591
+ */
592
+ contracts: GatewayContracts;
593
+ /**
594
+ * Indicate whether the chain supports the Forwarding Service as a source
595
+ * and/or destination within the Gateway protocol.
596
+ *
597
+ * @example
598
+ * ```typescript
599
+ * forwarderSupported: { source: true, destination: true }
600
+ * ```
601
+ */
602
+ forwarderSupported: {
603
+ /** Whether this chain can be used as a source in forwarded transfers. */
604
+ source: boolean;
605
+ /** Whether this chain can be used as a destination in forwarded transfers. */
606
+ destination: boolean;
607
+ };
608
+ }
450
609
  /**
451
610
  * Kit-specific contract addresses for enhanced chain functionality.
452
611
  *
@@ -521,6 +680,8 @@ declare enum Blockchain {
521
680
  Noble_Testnet = "Noble_Testnet",
522
681
  Optimism = "Optimism",
523
682
  Optimism_Sepolia = "Optimism_Sepolia",
683
+ Pharos = "Pharos",
684
+ Pharos_Testnet = "Pharos_Testnet",
524
685
  Polkadot_Asset_Hub = "Polkadot_Asset_Hub",
525
686
  Polkadot_Westmint = "Polkadot_Westmint",
526
687
  Plume = "Plume",
@@ -761,10 +922,39 @@ type EvmPreparedChainRequestParams = {
761
922
  functionName: string;
762
923
  /** The arguments to pass to the function. */
763
924
  args: unknown[];
925
+ /**
926
+ * Specific block number to read contract state at (read-only calls only).
927
+ * Used for historical reads, e.g. checking delegate status at Gateway's
928
+ * processed height rather than the latest block. Ignored for write
929
+ * operations (transactions).
930
+ */
931
+ blockNumber?: bigint;
764
932
  } & Partial<EvmEstimateOverrides>;
933
+ /**
934
+ * Parameters for preparing an EIP-712 typed data signing request (EVM).
935
+ * When executed, returns the signature hex string.
936
+ */
937
+ interface EvmSignTypedDataPreparedChainRequestParams {
938
+ type: 'evm-sign-typed-data';
939
+ typedData: {
940
+ types: Record<string, unknown[]>;
941
+ domain: Record<string, unknown>;
942
+ primaryType: string;
943
+ message: Record<string, unknown>;
944
+ };
945
+ }
765
946
  /**
766
947
  * Solana-specific parameters for preparing a transaction.
767
- * @interface SolanaPreparedChainRequestParams
948
+ *
949
+ * @example
950
+ * ```typescript
951
+ * import type { SolanaPreparedChainRequestParams } from '@core/adapter'
952
+ *
953
+ * const params: SolanaPreparedChainRequestParams = {
954
+ * instructions: [transferInstruction],
955
+ * addressLookupTables: [],
956
+ * }
957
+ * ```
768
958
  */
769
959
  interface SolanaPreparedChainRequestParams {
770
960
  /**
@@ -805,6 +995,24 @@ interface SolanaPreparedChainRequestParams {
805
995
  */
806
996
  addressLookupTableAddresses?: string[];
807
997
  }
998
+ /**
999
+ * Parameters for preparing a message signing request (Solana).
1000
+ * When executed, returns the signature.
1001
+ *
1002
+ * @example
1003
+ * ```typescript
1004
+ * import type { SolanaSignMessagePreparedChainRequestParams } from '@core/adapter'
1005
+ *
1006
+ * const params: SolanaSignMessagePreparedChainRequestParams = {
1007
+ * type: 'solana-sign-message',
1008
+ * message: new TextEncoder().encode('Sign this message'),
1009
+ * }
1010
+ * ```
1011
+ */
1012
+ interface SolanaSignMessagePreparedChainRequestParams {
1013
+ type: 'solana-sign-message';
1014
+ message: Uint8Array;
1015
+ }
808
1016
  /**
809
1017
  * Solana-specific configuration for transaction estimation.
810
1018
  * @interface SolanaEstimateOverrides
@@ -877,7 +1085,7 @@ interface NoopPreparedChainRequest {
877
1085
  * Union type for all supported contract execution parameters.
878
1086
  * Currently only supports EVM chains, but can be extended for other chains.
879
1087
  */
880
- type PreparedChainRequestParams = EvmPreparedChainRequestParams | SolanaPreparedChainRequestParams;
1088
+ type PreparedChainRequestParams = EvmPreparedChainRequestParams | EvmSignTypedDataPreparedChainRequestParams | SolanaPreparedChainRequestParams | SolanaSignMessagePreparedChainRequestParams;
881
1089
  /**
882
1090
  * Response from waiting for a transaction to be mined and confirmed on the blockchain.
883
1091
  *
@@ -2228,6 +2436,18 @@ interface USDCActionMap {
2228
2436
  * This is a read-only operation.
2229
2437
  */
2230
2438
  balanceOf: Omit<BaseUSDCActions['balanceOf'], 'tokenAddress'>;
2439
+ /**
2440
+ * Get the EIP-712 domain name of the USDC contract on the current chain.
2441
+ *
2442
+ * Automatically uses the USDC contract address for the current chain.
2443
+ * This is a read-only operation with no parameters.
2444
+ */
2445
+ name: ActionParameters & {
2446
+ /**
2447
+ * Optional chain override; defaults to the operation context chain.
2448
+ */
2449
+ chain?: ChainDefinition;
2450
+ };
2231
2451
  }
2232
2452
 
2233
2453
  /**
@@ -2270,6 +2490,252 @@ interface USDTActionMap {
2270
2490
  transfer: BaseUSDTActions['transfer'];
2271
2491
  }
2272
2492
 
2493
+ /**
2494
+ * Versioned wrapper for Gateway action namespaces.
2495
+ *
2496
+ * Follows the same pattern as {@link CCTPActionMap}: each version is a
2497
+ * nested namespace so that action keys read `gateway.v1.deposit`, etc.
2498
+ *
2499
+ * @see {@link GatewayV1ActionMap} for v1 action definitions
2500
+ */
2501
+ interface GatewayActionMap {
2502
+ /** Gateway protocol v1 operations. */
2503
+ readonly v1: GatewayV1ActionMap;
2504
+ }
2505
+ /**
2506
+ * Action map for Circle Gateway Wallet v1 contract operations.
2507
+ *
2508
+ * Mirrors the GatewayWallet interface: deposit variants, delegate management,
2509
+ * and balance queries.
2510
+ *
2511
+ * @see https://developers.circle.com/gateway/references/contract-interfaces-and-events
2512
+ * @see https://developers.circle.com/gateway/references/solana-programs
2513
+ */
2514
+ interface GatewayV1ActionMap {
2515
+ /**
2516
+ * Deposit tokens after approving the Gateway contract. Balance is credited to the caller.
2517
+ *
2518
+ * Corresponds to `deposit(address token, uint256 value)`.
2519
+ */
2520
+ deposit: ActionParameters & {
2521
+ /** Token contract address (e.g. USDC). */
2522
+ token: string;
2523
+ /** Amount in token's smallest unit. */
2524
+ value: bigint;
2525
+ /** Chain with Gateway v1 (optional; defaults to operation context chain). */
2526
+ chain?: ChainDefinition;
2527
+ };
2528
+ /**
2529
+ * Deposit tokens on behalf of another address after approving. Balance is credited to `depositor`.
2530
+ *
2531
+ * Corresponds to `depositFor(address token, address depositor, uint256 value)`.
2532
+ */
2533
+ depositFor: ActionParameters & {
2534
+ /** Token contract address. */
2535
+ token: string;
2536
+ /** Address that will own the resulting balance. */
2537
+ depositor: string;
2538
+ /** Amount in token's smallest unit. */
2539
+ value: bigint;
2540
+ /** Chain with Gateway v1 (optional; defaults to operation context chain). */
2541
+ chain?: ChainDefinition;
2542
+ };
2543
+ /**
2544
+ * Deposit with EIP-2612 permit (gasless approval via signature).
2545
+ *
2546
+ * Corresponds to `depositWithPermit(token, owner, value, deadline, signature)` (bytes)
2547
+ * or the overload with (v, r, s). Use `signature` for EIP-7597 (SCA); use (v, r, s) for EOA.
2548
+ */
2549
+ depositWithPermit: ActionParameters & {
2550
+ /** Token contract address. */
2551
+ token: string;
2552
+ /** Depositor's address (owner in permit). */
2553
+ owner: string;
2554
+ /** Amount in token's smallest unit. */
2555
+ value: bigint;
2556
+ /** Permit deadline (Unix timestamp) or max uint256 for no expiration. */
2557
+ deadline: bigint;
2558
+ /** Signature as bytes (EIP-7597) or omit and use v, r, s. */
2559
+ signature?: `0x${string}`;
2560
+ /** ECDSA v (when not using signature bytes). */
2561
+ v?: number;
2562
+ /** ECDSA r (when not using signature bytes). */
2563
+ r?: `0x${string}`;
2564
+ /** ECDSA s (when not using signature bytes). */
2565
+ s?: `0x${string}`;
2566
+ /** Chain with Gateway v1 (optional; defaults to operation context chain). */
2567
+ chain?: ChainDefinition;
2568
+ };
2569
+ /**
2570
+ * Deposit with EIP-3009 transferWithAuthorization (receiveWithAuthorization).
2571
+ *
2572
+ * Corresponds to `depositWithAuthorization(token, from, value, validAfter, validBefore, nonce, signature)`
2573
+ * or the overload with (v, r, s).
2574
+ */
2575
+ depositWithAuthorization: ActionParameters & {
2576
+ /** Token contract address. */
2577
+ token: string;
2578
+ /** Depositor's address (from in authorization). */
2579
+ from: string;
2580
+ /** Amount in token's smallest unit. */
2581
+ value: bigint;
2582
+ /** Unix timestamp after which the authorization is valid. */
2583
+ validAfter: bigint;
2584
+ /** Unix timestamp before which the authorization is valid. */
2585
+ validBefore: bigint;
2586
+ /** Unique nonce (bytes32). */
2587
+ nonce: `0x${string}`;
2588
+ /** Signature as bytes (EIP-7598) or omit and use v, r, s. */
2589
+ signature?: `0x${string}`;
2590
+ /** ECDSA v (when not using signature bytes). */
2591
+ v?: number;
2592
+ /** ECDSA r (when not using signature bytes). */
2593
+ r?: `0x${string}`;
2594
+ /** ECDSA s (when not using signature bytes). */
2595
+ s?: `0x${string}`;
2596
+ /** Chain with Gateway v1 (optional; defaults to operation context chain). */
2597
+ chain?: ChainDefinition;
2598
+ };
2599
+ /**
2600
+ * Grant spending rights to a delegate on the caller's Gateway account.
2601
+ *
2602
+ * Corresponds to `addDelegate(address token, address delegate)`.
2603
+ */
2604
+ addDelegate: ActionParameters & {
2605
+ /** Token contract address (e.g. USDC). */
2606
+ token: string;
2607
+ /** Address to authorize as a delegate. */
2608
+ delegate: string;
2609
+ /** Chain with Gateway v1 (optional; defaults to operation context chain). */
2610
+ chain?: ChainDefinition;
2611
+ };
2612
+ /**
2613
+ * Revoke spending rights from a delegate on the caller's Gateway account.
2614
+ *
2615
+ * Corresponds to `removeDelegate(address token, address delegate)`.
2616
+ */
2617
+ removeDelegate: ActionParameters & {
2618
+ /** Token contract address (e.g. USDC). */
2619
+ token: string;
2620
+ /** Address to revoke as a delegate. */
2621
+ delegate: string;
2622
+ /** Chain with Gateway v1 (optional; defaults to operation context chain). */
2623
+ chain?: ChainDefinition;
2624
+ };
2625
+ /**
2626
+ * Check whether an address is authorized as a delegate for a depositor's balance.
2627
+ *
2628
+ * Corresponds to `isAuthorizedForBalance(address token, address depositor, address addr)`.
2629
+ */
2630
+ isDelegate: ActionParameters & {
2631
+ /** Token contract address (e.g. USDC). */
2632
+ token: string;
2633
+ /** The depositor (balance owner) address. */
2634
+ depositor: string;
2635
+ /** The address to check for delegate status. */
2636
+ delegate: string;
2637
+ /** Chain with Gateway v1 (optional; defaults to operation context chain). */
2638
+ chain?: ChainDefinition;
2639
+ /** EVM: specific block number to read state at (for finality-aware checks). */
2640
+ blockNumber?: bigint;
2641
+ /** Solana: commitment level for the account read. */
2642
+ commitment?: 'confirmed' | 'finalized';
2643
+ };
2644
+ /**
2645
+ * Start a delayed fund removal from a Gateway account.
2646
+ *
2647
+ * Corresponds to `initiateWithdrawal(address token, uint256 value)` (EVM)
2648
+ * or the `initiate_withdrawal` instruction (Solana).
2649
+ */
2650
+ initiateWithdrawal: ActionParameters & {
2651
+ /** Token contract address (e.g. USDC). */
2652
+ token: string;
2653
+ /** Amount in token's smallest unit. */
2654
+ value: bigint;
2655
+ /** Chain with Gateway v1 (optional; defaults to operation context chain). */
2656
+ chain?: ChainDefinition;
2657
+ };
2658
+ /**
2659
+ * Complete a fund removal after the withdrawal delay has elapsed.
2660
+ *
2661
+ * Corresponds to `withdraw(address token)` (EVM) or the `withdraw`
2662
+ * instruction (Solana). No amount parameter -- the contract returns the
2663
+ * full pending withdrawal balance.
2664
+ */
2665
+ withdraw: ActionParameters & {
2666
+ /** Token contract address (e.g. USDC). */
2667
+ token: string;
2668
+ /** Chain with Gateway v1 (optional; defaults to operation context chain). */
2669
+ chain?: ChainDefinition;
2670
+ };
2671
+ /**
2672
+ * Read the pending withdrawal balance for a depositor.
2673
+ *
2674
+ * Corresponds to `withdrawingBalance(address token, address depositor)` (EVM)
2675
+ * or reading `withdrawing_amount` from the `GatewayDeposit` PDA (Solana).
2676
+ */
2677
+ withdrawingBalance: ActionParameters & {
2678
+ /** Token contract address (e.g. USDC). */
2679
+ token: string;
2680
+ /** The depositor whose pending withdrawal to query. */
2681
+ depositor: string;
2682
+ /** Chain with Gateway v1 (optional; defaults to operation context chain). */
2683
+ chain?: ChainDefinition;
2684
+ };
2685
+ /**
2686
+ * Read the block number at which a pending withdrawal can be completed.
2687
+ *
2688
+ * Corresponds to `withdrawalBlock(address token, address depositor)` (EVM)
2689
+ * or reading `withdrawal_block` from the `GatewayDeposit` PDA (Solana).
2690
+ */
2691
+ withdrawalBlock: ActionParameters & {
2692
+ /** Token contract address (e.g. USDC). */
2693
+ token: string;
2694
+ /** The depositor whose withdrawal block to query. */
2695
+ depositor: string;
2696
+ /** Chain with Gateway v1 (optional; defaults to operation context chain). */
2697
+ chain?: ChainDefinition;
2698
+ };
2699
+ /**
2700
+ * Execute gatewayBurn on the Gateway Wallet contract.
2701
+ * Burns tokens from a source chain as part of a cross-chain spend.
2702
+ *
2703
+ * Corresponds to `gatewayBurn(bytes calldataBytes, bytes signature)`.
2704
+ */
2705
+ gatewayBurn: ActionParameters & {
2706
+ /** ABI-encoded burn intent calldata. */
2707
+ calldataBytes: `0x${string}`;
2708
+ /** Signature over the burn intent(s). */
2709
+ signature: `0x${string}`;
2710
+ /** Chain with Gateway v1 (optional; defaults to operation context chain). */
2711
+ chain?: ChainDefinition;
2712
+ };
2713
+ /**
2714
+ * Execute gatewayMint on the Gateway Minter contract.
2715
+ * Mints tokens on the destination chain to complete a cross-chain spend.
2716
+ *
2717
+ * Corresponds to `gatewayMint(bytes attestationPayload, bytes signature)`.
2718
+ */
2719
+ gatewayMint: ActionParameters & {
2720
+ /** Attestation payload from the Gateway API. */
2721
+ attestation: `0x${string}`;
2722
+ /** Signature over the attestation. */
2723
+ signature: `0x${string}`;
2724
+ /** Chain with Gateway v1 (optional; defaults to operation context chain). */
2725
+ chain?: ChainDefinition;
2726
+ };
2727
+ /**
2728
+ * Sign burn intents using EIP-712 typed data (EVM) or binary encoding (Solana).
2729
+ * Returns the signature needed for the Gateway API transfer call.
2730
+ */
2731
+ signBurnIntents: ActionParameters & {
2732
+ /** EIP-712 typed data for EVM, or binary-encoded data for Solana. */
2733
+ typedData: unknown;
2734
+ /** Chain with Gateway v1 (optional; defaults to operation context chain). */
2735
+ chain?: ChainDefinition;
2736
+ };
2737
+ }
2738
+
2273
2739
  /**
2274
2740
  * Native token-related action maps for the bridge kit.
2275
2741
  *
@@ -2324,14 +2790,16 @@ interface NativeActionMap {
2324
2790
  interface ActionMap {
2325
2791
  /** CCTP-specific operations with automatic address resolution. */
2326
2792
  readonly cctp: CCTPActionMap;
2793
+ /** Gateway Wallet operations, versioned (e.g. gateway.v1.deposit). */
2794
+ readonly gateway: GatewayActionMap;
2795
+ /** Native token operations (ETH, SOL, MATIC, etc.). */
2796
+ readonly native: NativeActionMap;
2327
2797
  /** General token operations requiring explicit token addresses. */
2328
2798
  readonly token: TokenActionMap;
2329
2799
  /** USDC-specific operations with automatic address resolution. */
2330
2800
  readonly usdc: USDCActionMap;
2331
2801
  /** USDT-specific operations with automatic address resolution. */
2332
2802
  readonly usdt: USDTActionMap;
2333
- /** Native token operations. */
2334
- readonly native: NativeActionMap;
2335
2803
  /** Swap operations for DEX aggregator integrations. */
2336
2804
  readonly swap: SwapActionMap;
2337
2805
  }
@@ -3234,6 +3702,7 @@ declare module './types' {
3234
3702
  POL: true;
3235
3703
  PLUME: true;
3236
3704
  MON: true;
3705
+ cirBTC: true;
3237
3706
  }
3238
3707
  }
3239
3708
 
@@ -4428,6 +4897,63 @@ TChainDefinition extends ChainDefinition = ChainDefinition> {
4428
4897
  */
4429
4898
  invocationMeta?: InvocationMeta;
4430
4899
  }
4900
+ /**
4901
+ * Machine-readable classification of a {@link BridgeStep} error.
4902
+ *
4903
+ * Consumers may use this field for UX decisions (e.g. distinguish a user
4904
+ * rejection from a wallet capability error) without string-matching on
4905
+ * {@link BridgeStep.errorMessage}. The original human-readable error
4906
+ * message is always preserved for display/logging.
4907
+ *
4908
+ * @remarks
4909
+ * The categories map to the most common failure shapes observed across
4910
+ * the EIP-5792 batched bridge path and the sequential bridge path:
4911
+ *
4912
+ * - `user_rejected` — user declined a wallet request (JSON-RPC `4001`).
4913
+ * - `atomic_unsupported` — wallet reported it cannot perform EIP-5792
4914
+ * atomic batching on this chain. Covers JSON-RPC `5700` (unsupported
4915
+ * capabilities), `5710` (chain not supported for the requested
4916
+ * capability), and `5750` (atomicity requires a wallet upgrade which
4917
+ * the user declined), or equivalent viem-wrapped messages.
4918
+ * - `batch_too_large` — wallet rejected the batch for exceeding its
4919
+ * size limit (JSON-RPC `5740`).
4920
+ * - `duplicate_batch_id` — wallet reported a duplicate batchId
4921
+ * (JSON-RPC `5720`).
4922
+ * - `unknown_bundle` — wallet reported an unknown bundle id during
4923
+ * status polling (JSON-RPC `5730`).
4924
+ * - `polling_timeout` — SDK polled `wallet_getCallsStatus` until the
4925
+ * configured timeout without receiving a terminal status.
4926
+ * - `failed_offchain` — wallet reported EIP-5792 `statusCode: 400`
4927
+ * (batch not included onchain, wallet will not retry).
4928
+ * - `reverted_onchain` — wallet reported EIP-5792 `statusCode: 500`
4929
+ * (batch reverted completely onchain).
4930
+ * - `partial_reverted` — wallet reported EIP-5792 `statusCode: 600`
4931
+ * (batch reverted partially onchain).
4932
+ * - `chain_revert` — transaction was mined but reverted on-chain
4933
+ * (sequential path).
4934
+ * - `unknown` — error did not match any of the above categories.
4935
+ *
4936
+ * @since 2.0.0
4937
+ *
4938
+ * @example
4939
+ * ```typescript
4940
+ * import type { BridgeStep } from '@core/provider'
4941
+ *
4942
+ * const step: BridgeStep = {
4943
+ * name: 'approve',
4944
+ * state: 'error',
4945
+ * errorMessage: 'User rejected the request',
4946
+ * errorCategory: 'user_rejected',
4947
+ * }
4948
+ *
4949
+ * if (step.errorCategory === 'user_rejected') {
4950
+ * // silent abort: user intentionally cancelled
4951
+ * } else if (step.errorCategory === 'atomic_unsupported') {
4952
+ * // hint the user about switching to step-by-step signing
4953
+ * }
4954
+ * ```
4955
+ */
4956
+ type BridgeStepErrorCategory = 'user_rejected' | 'atomic_unsupported' | 'batch_too_large' | 'duplicate_batch_id' | 'unknown_bundle' | 'polling_timeout' | 'failed_offchain' | 'reverted_onchain' | 'partial_reverted' | 'chain_revert' | 'unknown';
4431
4957
  /**
4432
4958
  * A step in the bridge process.
4433
4959
  *
@@ -4484,6 +5010,21 @@ interface BridgeStep {
4484
5010
  errorMessage?: string;
4485
5011
  /** Optional raw error object (can be Viem/Ethers/Chain error) */
4486
5012
  error?: unknown;
5013
+ /**
5014
+ * Optional machine-readable classification of the error.
5015
+ *
5016
+ * Present when the step is in `state: 'error'` and the SDK was able to
5017
+ * categorize the failure. See {@link BridgeStepErrorCategory} for the
5018
+ * list of categories and how they map to underlying error shapes.
5019
+ *
5020
+ * @remarks
5021
+ * The human-readable {@link errorMessage} is always preserved for
5022
+ * logging and display; this field is additive and should be preferred
5023
+ * over string-matching `errorMessage` for machine decisions.
5024
+ *
5025
+ * @since 2.0.0
5026
+ */
5027
+ errorCategory?: BridgeStepErrorCategory;
4487
5028
  }
4488
5029
  /**
4489
5030
  * Result object returned after a successful cross-chain bridge operation.