@circle-fin/app-kit 1.2.0 → 1.3.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/CHANGELOG.md +20 -0
- package/README.md +6 -2
- package/chains.cjs +77 -5
- package/chains.d.ts +4 -3
- package/chains.mjs +77 -5
- package/index.cjs +1388 -940
- package/index.d.ts +62 -14
- package/index.mjs +1388 -940
- package/package.json +31 -3
package/index.d.ts
CHANGED
|
@@ -616,8 +616,9 @@ declare enum Blockchain {
|
|
|
616
616
|
/**
|
|
617
617
|
* Enum representing chains that support same-chain swaps through the Swap Kit.
|
|
618
618
|
*
|
|
619
|
-
* Unlike the full {@link Blockchain} enum, SwapChain includes
|
|
620
|
-
* networks
|
|
619
|
+
* Unlike the full {@link Blockchain} enum, SwapChain includes mainnet
|
|
620
|
+
* networks and explicitly whitelisted testnets (e.g., {@link Arc_Testnet})
|
|
621
|
+
* where adapter contracts are deployed (CCTPv2 support).
|
|
621
622
|
*
|
|
622
623
|
* Dynamic validation via {@link isSwapSupportedChain} ensures chains
|
|
623
624
|
* automatically work when adapter contracts and supported tokens are deployed.
|
|
@@ -658,20 +659,21 @@ declare enum SwapChain {
|
|
|
658
659
|
Sonic = "Sonic",
|
|
659
660
|
XDC = "XDC",
|
|
660
661
|
HyperEVM = "HyperEVM",
|
|
661
|
-
Monad = "Monad"
|
|
662
|
+
Monad = "Monad",
|
|
663
|
+
Arc_Testnet = "Arc_Testnet"
|
|
662
664
|
}
|
|
663
665
|
/**
|
|
664
666
|
* Chain definition that supports swap operations.
|
|
665
667
|
*
|
|
666
668
|
* @remarks
|
|
667
|
-
* Expanded from 4 to ~
|
|
669
|
+
* Expanded from 4 to ~18 supported chains based on:
|
|
668
670
|
* - CCTPv2 support (adapter contract deployed)
|
|
669
|
-
* - Mainnet
|
|
671
|
+
* - Mainnet chains plus whitelisted testnets (e.g., Arc Testnet)
|
|
670
672
|
*
|
|
671
673
|
* Use `isSwapSupportedChain()` for runtime validation.
|
|
672
674
|
*/
|
|
673
675
|
type SwapChainDefinition = ChainDefinition & {
|
|
674
|
-
chain: Blockchain.Ethereum | Blockchain.Base | Blockchain.Polygon | Blockchain.Solana | Blockchain.Arbitrum | Blockchain.Optimism | Blockchain.Avalanche | Blockchain.Linea | Blockchain.Ink | Blockchain.World_Chain | Blockchain.Unichain | Blockchain.Plume | Blockchain.Sei | Blockchain.Sonic | Blockchain.XDC | Blockchain.HyperEVM | Blockchain.Monad;
|
|
676
|
+
chain: Blockchain.Ethereum | Blockchain.Base | Blockchain.Polygon | Blockchain.Solana | Blockchain.Arbitrum | Blockchain.Optimism | Blockchain.Avalanche | Blockchain.Linea | Blockchain.Ink | Blockchain.World_Chain | Blockchain.Unichain | Blockchain.Plume | Blockchain.Sei | Blockchain.Sonic | Blockchain.XDC | Blockchain.HyperEVM | Blockchain.Monad | Blockchain.Arc_Testnet;
|
|
675
677
|
};
|
|
676
678
|
/**
|
|
677
679
|
* Chain identifier accepted by swap operations.
|
|
@@ -1002,6 +1004,7 @@ declare const ArcTestnet: {
|
|
|
1002
1004
|
};
|
|
1003
1005
|
readonly kitContracts: {
|
|
1004
1006
|
readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d";
|
|
1007
|
+
readonly adapter: "0xBBD70b01a1CAbc96d5b7b129Ae1AAabdf50dd40b";
|
|
1005
1008
|
};
|
|
1006
1009
|
};
|
|
1007
1010
|
|
|
@@ -1692,7 +1695,7 @@ declare const HyperEVM: {
|
|
|
1692
1695
|
};
|
|
1693
1696
|
readonly chainId: 999;
|
|
1694
1697
|
readonly isTestnet: false;
|
|
1695
|
-
readonly explorerUrl: "https://
|
|
1698
|
+
readonly explorerUrl: "https://hyperevmscan.io/tx/{hash}";
|
|
1696
1699
|
readonly rpcEndpoints: readonly ["https://rpc.hyperliquid.xyz/evm"];
|
|
1697
1700
|
readonly eurcAddress: null;
|
|
1698
1701
|
readonly usdcAddress: "0xb88339CB7199b77E23DB6E890353E22632Ba630f";
|
|
@@ -2794,7 +2797,7 @@ declare const Solana: {
|
|
|
2794
2797
|
};
|
|
2795
2798
|
readonly forwarderSupported: {
|
|
2796
2799
|
readonly source: true;
|
|
2797
|
-
readonly destination:
|
|
2800
|
+
readonly destination: true;
|
|
2798
2801
|
};
|
|
2799
2802
|
};
|
|
2800
2803
|
readonly kitContracts: {
|
|
@@ -2841,7 +2844,7 @@ declare const SolanaDevnet: {
|
|
|
2841
2844
|
};
|
|
2842
2845
|
readonly forwarderSupported: {
|
|
2843
2846
|
readonly source: true;
|
|
2844
|
-
readonly destination:
|
|
2847
|
+
readonly destination: true;
|
|
2845
2848
|
};
|
|
2846
2849
|
};
|
|
2847
2850
|
readonly kitContracts: {
|
|
@@ -6787,6 +6790,12 @@ declare const InputError: {
|
|
|
6787
6790
|
readonly name: "INPUT_UNSUPPORTED_ACTION";
|
|
6788
6791
|
readonly type: ErrorType;
|
|
6789
6792
|
};
|
|
6793
|
+
/** No route satisfies the slippage or minimum-output constraint */
|
|
6794
|
+
readonly SLIPPAGE_CONSTRAINT_NOT_MET: {
|
|
6795
|
+
readonly code: 1009;
|
|
6796
|
+
readonly name: "INPUT_SLIPPAGE_CONSTRAINT_NOT_MET";
|
|
6797
|
+
readonly type: ErrorType;
|
|
6798
|
+
};
|
|
6790
6799
|
/** General validation failure for complex validation rules */
|
|
6791
6800
|
readonly VALIDATION_FAILED: {
|
|
6792
6801
|
readonly code: 1098;
|
|
@@ -12176,8 +12185,9 @@ interface SwapResult {
|
|
|
12176
12185
|
* - Resolved chain identifiers to full ChainDefinition objects
|
|
12177
12186
|
* - Extracted and validated wallet addresses
|
|
12178
12187
|
*
|
|
12179
|
-
* Note:
|
|
12180
|
-
*
|
|
12188
|
+
* Note: Raw user input is validated first, then `tokenIn` and `tokenOut` may
|
|
12189
|
+
* be canonicalized for downstream routing (for example, Arc Testnet
|
|
12190
|
+
* `NATIVE` → `USDC`). Address resolution is handled by the provider layer.
|
|
12181
12191
|
*
|
|
12182
12192
|
* This type is consumed by swap providers and internal operations but is not
|
|
12183
12193
|
* exposed to end users. It extends ServiceSwapParams which is the format expected
|
|
@@ -12194,8 +12204,8 @@ interface SwapResult {
|
|
|
12194
12204
|
* chain: Ethereum, // Full chain definition
|
|
12195
12205
|
* address: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
|
|
12196
12206
|
* },
|
|
12197
|
-
* tokenIn: 'USDC', //
|
|
12198
|
-
* tokenOut: 'USDT', //
|
|
12207
|
+
* tokenIn: 'USDC', // Canonicalized for provider routing
|
|
12208
|
+
* tokenOut: 'USDT', // Canonicalized for provider routing
|
|
12199
12209
|
* amountIn: '100500000', // Converted to base units (100.5 USDC with 6 decimals)
|
|
12200
12210
|
* to: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
|
|
12201
12211
|
* config: {
|
|
@@ -12815,6 +12825,44 @@ declare class AppKit {
|
|
|
12815
12825
|
* ```
|
|
12816
12826
|
*/
|
|
12817
12827
|
bridge(params: BridgeParams): Promise<BridgeResult>;
|
|
12828
|
+
/**
|
|
12829
|
+
* Retry a failed cross-chain USDC bridge transfer.
|
|
12830
|
+
*
|
|
12831
|
+
* Resume a bridge operation that failed due to a transient error.
|
|
12832
|
+
* Use {@link isRetryableError} to check whether a failed step's error
|
|
12833
|
+
* is eligible for retry before calling this method.
|
|
12834
|
+
*
|
|
12835
|
+
* @param result - The bridge result from the failed operation
|
|
12836
|
+
* @param retryContext - The retry context with source and optional
|
|
12837
|
+
* destination adapters
|
|
12838
|
+
* @returns Promise resolving to the bridge result with transaction
|
|
12839
|
+
* details
|
|
12840
|
+
* @throws If the provider from the original result is not found
|
|
12841
|
+
* @throws If the retry operation fails
|
|
12842
|
+
*
|
|
12843
|
+
* @example
|
|
12844
|
+
* ```typescript
|
|
12845
|
+
* import { AppKit, isRetryableError } from '@circle-fin/app-kit'
|
|
12846
|
+
*
|
|
12847
|
+
* const kit = new AppKit()
|
|
12848
|
+
*
|
|
12849
|
+
* const result = await kit.bridge({
|
|
12850
|
+
* from: sourceAdapter,
|
|
12851
|
+
* to: { adapter: destAdapter, chain: 'Polygon' },
|
|
12852
|
+
* amount: '100.50',
|
|
12853
|
+
* })
|
|
12854
|
+
*
|
|
12855
|
+
* const failedStep = result.steps.find(s => s.error)
|
|
12856
|
+
* if (result.state === 'error' && failedStep?.error && isRetryableError(failedStep.error)) {
|
|
12857
|
+
* const retried = await kit.retryBridge(result, {
|
|
12858
|
+
* from: sourceAdapter,
|
|
12859
|
+
* to: destAdapter,
|
|
12860
|
+
* })
|
|
12861
|
+
* console.log('Retry result:', retried.state)
|
|
12862
|
+
* }
|
|
12863
|
+
* ```
|
|
12864
|
+
*/
|
|
12865
|
+
retryBridge(result: BridgeResult, retryContext: RetryContext): Promise<BridgeResult>;
|
|
12818
12866
|
/**
|
|
12819
12867
|
* Estimate the bridge operation.
|
|
12820
12868
|
*
|
|
@@ -13201,4 +13249,4 @@ declare function isTokenAddress(token: string, chain: ChainDefinition): token is
|
|
|
13201
13249
|
declare function validateToken(token: string, chain: ChainDefinition): TokenValidationResult;
|
|
13202
13250
|
|
|
13203
13251
|
export { AppKit, BalanceError, Blockchain, BridgeChain, InputError, KitError, NetworkError, OnchainError, RateLimitError, RpcError, ServiceError, SwapChain, TOKEN_ALIASES, TransferSpeed, getErrorCode, getErrorMessage, getTokenDecimals, isBalanceError, isFatalError, isInputError, isKitError, isNetworkError, isOnchainError, isRateLimitError, isRetryableError, isRpcError, isServiceError, isTokenAddress, isTokenAlias, isUserCancellationError, setExternalPrefix, validateToken };
|
|
13204
|
-
export type { ActionHandler, AdapterContext, AllowanceStrategy, AppKitConfig, AppKitContext, BaseChainDefinition, BridgeConfig, CustomFeePolicy$1 as BridgeCustomFeePolicy, BridgeParams, BridgeResult, BridgeStep, CCTPConfig, CCTPMergedConfig, CCTPSplitConfig, ChainDefinition, Currency, DeveloperFeeHooks, EVMChainDefinition, ErrorDetails, EstimateResult$1 as EstimateResult, EstimatedGas, KitContractType, NonEVMChainDefinition, OperationType, Recoverability, SendParams, SwapConfig, CustomFeePolicy as SwapCustomFeePolicy, SwapEstimate, SwapFeeContext, SwapKitConfig, SwapKitContext, SwapParams, SwapResult, TokenInfo, VersionConfig };
|
|
13252
|
+
export type { ActionHandler, AdapterContext, AllowanceStrategy, AppKitConfig, AppKitContext, BaseChainDefinition, BridgeConfig, CustomFeePolicy$1 as BridgeCustomFeePolicy, BridgeParams, BridgeResult, BridgeStep, CCTPConfig, CCTPMergedConfig, CCTPSplitConfig, ChainDefinition, Currency, DeveloperFeeHooks, EVMChainDefinition, ErrorDetails, EstimateResult$1 as EstimateResult, EstimatedGas, KitContractType, NonEVMChainDefinition, OperationType, Recoverability, RetryContext, SendParams, SwapConfig, CustomFeePolicy as SwapCustomFeePolicy, SwapEstimate, SwapFeeContext, SwapKitConfig, SwapKitContext, SwapParams, SwapResult, TokenInfo, VersionConfig };
|