@circle-fin/provider-cctp-v2 1.6.3 → 1.8.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
@@ -666,6 +666,8 @@ declare enum Blockchain {
666
666
  Hedera_Testnet = "Hedera_Testnet",
667
667
  HyperEVM = "HyperEVM",
668
668
  HyperEVM_Testnet = "HyperEVM_Testnet",
669
+ Injective = "Injective",
670
+ Injective_Testnet = "Injective_Testnet",
669
671
  Ink = "Ink",
670
672
  Ink_Testnet = "Ink_Testnet",
671
673
  Linea = "Linea",
@@ -680,6 +682,8 @@ declare enum Blockchain {
680
682
  Noble_Testnet = "Noble_Testnet",
681
683
  Optimism = "Optimism",
682
684
  Optimism_Sepolia = "Optimism_Sepolia",
685
+ Pharos = "Pharos",
686
+ Pharos_Testnet = "Pharos_Testnet",
683
687
  Polkadot_Asset_Hub = "Polkadot_Asset_Hub",
684
688
  Polkadot_Westmint = "Polkadot_Westmint",
685
689
  Plume = "Plume",
@@ -3700,6 +3704,7 @@ declare module './types' {
3700
3704
  POL: true;
3701
3705
  PLUME: true;
3702
3706
  MON: true;
3707
+ cirBTC: true;
3703
3708
  }
3704
3709
  }
3705
3710
 
@@ -4894,6 +4899,63 @@ TChainDefinition extends ChainDefinition = ChainDefinition> {
4894
4899
  */
4895
4900
  invocationMeta?: InvocationMeta;
4896
4901
  }
4902
+ /**
4903
+ * Machine-readable classification of a {@link BridgeStep} error.
4904
+ *
4905
+ * Consumers may use this field for UX decisions (e.g. distinguish a user
4906
+ * rejection from a wallet capability error) without string-matching on
4907
+ * {@link BridgeStep.errorMessage}. The original human-readable error
4908
+ * message is always preserved for display/logging.
4909
+ *
4910
+ * @remarks
4911
+ * The categories map to the most common failure shapes observed across
4912
+ * the EIP-5792 batched bridge path and the sequential bridge path:
4913
+ *
4914
+ * - `user_rejected` — user declined a wallet request (JSON-RPC `4001`).
4915
+ * - `atomic_unsupported` — wallet reported it cannot perform EIP-5792
4916
+ * atomic batching on this chain. Covers JSON-RPC `5700` (unsupported
4917
+ * capabilities), `5710` (chain not supported for the requested
4918
+ * capability), and `5750` (atomicity requires a wallet upgrade which
4919
+ * the user declined), or equivalent viem-wrapped messages.
4920
+ * - `batch_too_large` — wallet rejected the batch for exceeding its
4921
+ * size limit (JSON-RPC `5740`).
4922
+ * - `duplicate_batch_id` — wallet reported a duplicate batchId
4923
+ * (JSON-RPC `5720`).
4924
+ * - `unknown_bundle` — wallet reported an unknown bundle id during
4925
+ * status polling (JSON-RPC `5730`).
4926
+ * - `polling_timeout` — SDK polled `wallet_getCallsStatus` until the
4927
+ * configured timeout without receiving a terminal status.
4928
+ * - `failed_offchain` — wallet reported EIP-5792 `statusCode: 400`
4929
+ * (batch not included onchain, wallet will not retry).
4930
+ * - `reverted_onchain` — wallet reported EIP-5792 `statusCode: 500`
4931
+ * (batch reverted completely onchain).
4932
+ * - `partial_reverted` — wallet reported EIP-5792 `statusCode: 600`
4933
+ * (batch reverted partially onchain).
4934
+ * - `chain_revert` — transaction was mined but reverted on-chain
4935
+ * (sequential path).
4936
+ * - `unknown` — error did not match any of the above categories.
4937
+ *
4938
+ * @since 2.0.0
4939
+ *
4940
+ * @example
4941
+ * ```typescript
4942
+ * import type { BridgeStep } from '@core/provider'
4943
+ *
4944
+ * const step: BridgeStep = {
4945
+ * name: 'approve',
4946
+ * state: 'error',
4947
+ * errorMessage: 'User rejected the request',
4948
+ * errorCategory: 'user_rejected',
4949
+ * }
4950
+ *
4951
+ * if (step.errorCategory === 'user_rejected') {
4952
+ * // silent abort: user intentionally cancelled
4953
+ * } else if (step.errorCategory === 'atomic_unsupported') {
4954
+ * // hint the user about switching to step-by-step signing
4955
+ * }
4956
+ * ```
4957
+ */
4958
+ 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';
4897
4959
  /**
4898
4960
  * A step in the bridge process.
4899
4961
  *
@@ -4950,6 +5012,21 @@ interface BridgeStep {
4950
5012
  errorMessage?: string;
4951
5013
  /** Optional raw error object (can be Viem/Ethers/Chain error) */
4952
5014
  error?: unknown;
5015
+ /**
5016
+ * Optional machine-readable classification of the error.
5017
+ *
5018
+ * Present when the step is in `state: 'error'` and the SDK was able to
5019
+ * categorize the failure. See {@link BridgeStepErrorCategory} for the
5020
+ * list of categories and how they map to underlying error shapes.
5021
+ *
5022
+ * @remarks
5023
+ * The human-readable {@link errorMessage} is always preserved for
5024
+ * logging and display; this field is additive and should be preferred
5025
+ * over string-matching `errorMessage` for machine decisions.
5026
+ *
5027
+ * @since 2.0.0
5028
+ */
5029
+ errorCategory?: BridgeStepErrorCategory;
4953
5030
  }
4954
5031
  /**
4955
5032
  * Result object returned after a successful cross-chain bridge operation.