@circle-fin/app-kit 1.12.1 → 1.14.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 +115 -0
- package/README.md +31 -12
- package/bridge.cjs +3231 -340
- package/bridge.d.cts +141 -17
- package/bridge.d.mts +141 -17
- package/bridge.d.ts +141 -17
- package/bridge.mjs +3233 -342
- package/chains.cjs +261 -8
- package/chains.d.cts +135 -1
- package/chains.d.mts +135 -1
- package/chains.d.ts +135 -1
- package/chains.mjs +260 -9
- package/context.d.cts +141 -17
- package/context.d.mts +141 -17
- package/context.d.ts +141 -17
- package/earn.cjs +887 -63
- package/earn.d.cts +141 -17
- package/earn.d.mts +141 -17
- package/earn.d.ts +141 -17
- package/earn.mjs +883 -63
- package/estimateBridge.cjs +3231 -340
- package/estimateBridge.d.cts +257 -18
- package/estimateBridge.d.mts +257 -18
- package/estimateBridge.d.ts +257 -18
- package/estimateBridge.mjs +3233 -342
- package/estimateSwap.cjs +988 -146
- package/estimateSwap.d.cts +141 -17
- package/estimateSwap.d.mts +141 -17
- package/estimateSwap.d.ts +141 -17
- package/estimateSwap.mjs +987 -146
- package/index.cjs +6828 -894
- package/index.d.cts +1621 -258
- package/index.d.mts +1621 -258
- package/index.d.ts +1621 -258
- package/index.mjs +6830 -896
- package/package.json +6 -6
- package/swap.cjs +988 -146
- package/swap.d.cts +148 -18
- package/swap.d.mts +148 -18
- package/swap.d.ts +148 -18
- package/swap.mjs +987 -146
- package/unifiedBalance.cjs +22219 -9689
- package/unifiedBalance.d.cts +620 -162
- package/unifiedBalance.d.mts +620 -162
- package/unifiedBalance.d.ts +620 -162
- package/unifiedBalance.mjs +22348 -9819
package/unifiedBalance.d.cts
CHANGED
|
@@ -558,6 +558,19 @@ interface GatewayV1Contracts {
|
|
|
558
558
|
* @example "0xD05E7D2E7d30b92c5F17d7d0fC575fce231F1A48"
|
|
559
559
|
*/
|
|
560
560
|
depositForHandler?: string;
|
|
561
|
+
/**
|
|
562
|
+
* The address of the `GenericExecutor` contract.
|
|
563
|
+
*
|
|
564
|
+
* @description Optional. The contract that acts as `mintRecipient` and
|
|
565
|
+
* `destinationCaller` for the CCTP v2 prepaid FORWARD path. It receives the
|
|
566
|
+
* CCTP mint and calls {@link GatewayV1Contracts.depositForHandler} to
|
|
567
|
+
* complete the fast deposit into the {@link GatewayV1Contracts.wallet}.
|
|
568
|
+
* Present only on chains that are fast-deposit destinations; other Gateway
|
|
569
|
+
* chains omit it.
|
|
570
|
+
*
|
|
571
|
+
* @example "0xFa7be2f04F3Ad4ca969260729c6d45B5625984A7"
|
|
572
|
+
*/
|
|
573
|
+
genericExecutor?: string;
|
|
561
574
|
}
|
|
562
575
|
/**
|
|
563
576
|
* Versioned map of Gateway contract configurations.
|
|
@@ -717,6 +730,8 @@ declare enum Blockchain {
|
|
|
717
730
|
Optimism_Sepolia = "Optimism_Sepolia",
|
|
718
731
|
Pharos = "Pharos",
|
|
719
732
|
Pharos_Testnet = "Pharos_Testnet",
|
|
733
|
+
Plasma = "Plasma",
|
|
734
|
+
Plasma_Testnet = "Plasma_Testnet",
|
|
720
735
|
Polkadot_Asset_Hub = "Polkadot_Asset_Hub",
|
|
721
736
|
Polkadot_Westmint = "Polkadot_Westmint",
|
|
722
737
|
Plume = "Plume",
|
|
@@ -744,6 +759,134 @@ declare enum Blockchain {
|
|
|
744
759
|
ZKSync_Era = "ZKSync_Era",
|
|
745
760
|
ZKSync_Sepolia = "ZKSync_Sepolia"
|
|
746
761
|
}
|
|
762
|
+
/**
|
|
763
|
+
* Enumeration of blockchains that support cross-chain bridging via CCTPv2.
|
|
764
|
+
*
|
|
765
|
+
* The enum is derived from the full {@link Blockchain} enum but filtered to only
|
|
766
|
+
* include chains with active CCTPv2 support. When new chains gain CCTPv2 support,
|
|
767
|
+
* they are added to this enum.
|
|
768
|
+
*
|
|
769
|
+
* @enum
|
|
770
|
+
* @category Enums
|
|
771
|
+
*
|
|
772
|
+
* @remarks
|
|
773
|
+
* - This enum is the **canonical source** of bridging-supported chains.
|
|
774
|
+
* - Use this enum (or its string literals) in `kit.bridge()` calls for type safety.
|
|
775
|
+
* - Attempting to use a chain not in this enum will produce a TypeScript compile error.
|
|
776
|
+
*
|
|
777
|
+
* @example
|
|
778
|
+
* ```typescript
|
|
779
|
+
* import { BridgeKit, BridgeChain } from '@circle-fin/bridge-kit'
|
|
780
|
+
*
|
|
781
|
+
* const kit = new BridgeKit()
|
|
782
|
+
*
|
|
783
|
+
* // ✅ Valid - autocomplete suggests only supported chains
|
|
784
|
+
* await kit.bridge({
|
|
785
|
+
* from: { adapter, chain: BridgeChain.Ethereum },
|
|
786
|
+
* to: { adapter, chain: BridgeChain.Base },
|
|
787
|
+
* amount: '100'
|
|
788
|
+
* })
|
|
789
|
+
*
|
|
790
|
+
* // ✅ Also valid - string literals work with autocomplete
|
|
791
|
+
* await kit.bridge({
|
|
792
|
+
* from: { adapter, chain: 'Ethereum_Sepolia' },
|
|
793
|
+
* to: { adapter, chain: 'Base_Sepolia' },
|
|
794
|
+
* amount: '100'
|
|
795
|
+
* })
|
|
796
|
+
*
|
|
797
|
+
* // ❌ Compile error - Algorand is not in BridgeChain
|
|
798
|
+
* await kit.bridge({
|
|
799
|
+
* from: { adapter, chain: 'Algorand' }, // TypeScript error!
|
|
800
|
+
* to: { adapter, chain: 'Base' },
|
|
801
|
+
* amount: '100'
|
|
802
|
+
* })
|
|
803
|
+
* ```
|
|
804
|
+
*
|
|
805
|
+
* @see {@link Blockchain} for the complete list of all known blockchains.
|
|
806
|
+
* @see {@link BridgeChainIdentifier} for the type that accepts these values.
|
|
807
|
+
*/
|
|
808
|
+
declare enum BridgeChain {
|
|
809
|
+
Arbitrum = "Arbitrum",
|
|
810
|
+
Avalanche = "Avalanche",
|
|
811
|
+
Base = "Base",
|
|
812
|
+
Codex = "Codex",
|
|
813
|
+
Cronos = "Cronos",
|
|
814
|
+
Edge = "Edge",
|
|
815
|
+
Ethereum = "Ethereum",
|
|
816
|
+
HyperEVM = "HyperEVM",
|
|
817
|
+
Injective = "Injective",
|
|
818
|
+
Ink = "Ink",
|
|
819
|
+
Linea = "Linea",
|
|
820
|
+
Monad = "Monad",
|
|
821
|
+
Morph = "Morph",
|
|
822
|
+
Optimism = "Optimism",
|
|
823
|
+
Pharos = "Pharos",
|
|
824
|
+
Plasma = "Plasma",
|
|
825
|
+
Plume = "Plume",
|
|
826
|
+
Polygon = "Polygon",
|
|
827
|
+
Sei = "Sei",
|
|
828
|
+
Solana = "Solana",
|
|
829
|
+
Sonic = "Sonic",
|
|
830
|
+
Unichain = "Unichain",
|
|
831
|
+
World_Chain = "World_Chain",
|
|
832
|
+
XDC = "XDC",
|
|
833
|
+
X_Layer = "X_Layer",
|
|
834
|
+
Arc_Testnet = "Arc_Testnet",
|
|
835
|
+
Arbitrum_Sepolia = "Arbitrum_Sepolia",
|
|
836
|
+
Avalanche_Fuji = "Avalanche_Fuji",
|
|
837
|
+
Base_Sepolia = "Base_Sepolia",
|
|
838
|
+
Codex_Testnet = "Codex_Testnet",
|
|
839
|
+
Cronos_Testnet = "Cronos_Testnet",
|
|
840
|
+
Edge_Testnet = "Edge_Testnet",
|
|
841
|
+
Ethereum_Sepolia = "Ethereum_Sepolia",
|
|
842
|
+
HyperEVM_Testnet = "HyperEVM_Testnet",
|
|
843
|
+
Injective_Testnet = "Injective_Testnet",
|
|
844
|
+
Ink_Testnet = "Ink_Testnet",
|
|
845
|
+
Linea_Sepolia = "Linea_Sepolia",
|
|
846
|
+
Monad_Testnet = "Monad_Testnet",
|
|
847
|
+
Morph_Testnet = "Morph_Testnet",
|
|
848
|
+
Optimism_Sepolia = "Optimism_Sepolia",
|
|
849
|
+
Pharos_Testnet = "Pharos_Testnet",
|
|
850
|
+
Plasma_Testnet = "Plasma_Testnet",
|
|
851
|
+
Plume_Testnet = "Plume_Testnet",
|
|
852
|
+
Polygon_Amoy_Testnet = "Polygon_Amoy_Testnet",
|
|
853
|
+
Sei_Testnet = "Sei_Testnet",
|
|
854
|
+
Solana_Devnet = "Solana_Devnet",
|
|
855
|
+
Sonic_Testnet = "Sonic_Testnet",
|
|
856
|
+
Unichain_Sepolia = "Unichain_Sepolia",
|
|
857
|
+
World_Chain_Sepolia = "World_Chain_Sepolia",
|
|
858
|
+
XDC_Apothem = "XDC_Apothem",
|
|
859
|
+
X_Layer_Testnet = "X_Layer_Testnet"
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* Type representing valid bridge chain identifiers.
|
|
863
|
+
*
|
|
864
|
+
* This type constrains chain parameters to only accept chains that support CCTPv2 bridging
|
|
865
|
+
*
|
|
866
|
+
* Accepts:
|
|
867
|
+
* - A {@link BridgeChain} enum value (e.g., `BridgeChain.Ethereum`)
|
|
868
|
+
* - A string literal matching a BridgeChain value (e.g., `'Ethereum'`)
|
|
869
|
+
* - A {@link ChainDefinition} object for a supported chain
|
|
870
|
+
*
|
|
871
|
+
* @example
|
|
872
|
+
* ```typescript
|
|
873
|
+
* import type { BridgeChainIdentifier } from '@circle-fin/bridge-kit'
|
|
874
|
+
* import { BridgeChain } from '@circle-fin/bridge-kit'
|
|
875
|
+
* import { Solana } from '@circle-fin/bridge-kit/chains'
|
|
876
|
+
*
|
|
877
|
+
* // All of these are valid BridgeChainIdentifier values:
|
|
878
|
+
* const chain1: BridgeChainIdentifier = BridgeChain.Ethereum
|
|
879
|
+
* const chain2: BridgeChainIdentifier = 'Base_Sepolia'
|
|
880
|
+
* const chain3: BridgeChainIdentifier = Solana // ChainDefinition
|
|
881
|
+
*
|
|
882
|
+
* // This will cause a TypeScript error:
|
|
883
|
+
* const chain4: BridgeChainIdentifier = 'Algorand' // Error!
|
|
884
|
+
* ```
|
|
885
|
+
*
|
|
886
|
+
* @see {@link BridgeChain} for the enum of supported chains.
|
|
887
|
+
* @see {@link ChainIdentifier} for the less restrictive type accepting all chains.
|
|
888
|
+
*/
|
|
889
|
+
type BridgeChainIdentifier = ChainDefinition | BridgeChain | `${BridgeChain}`;
|
|
747
890
|
/**
|
|
748
891
|
* Enumeration of blockchains that support Gateway V1 operations
|
|
749
892
|
* (deposit, spend, balance, delegate, removeFund).
|
|
@@ -2299,7 +2442,7 @@ interface ExecuteParams {
|
|
|
2299
2442
|
* fromAddress: '0x...',
|
|
2300
2443
|
* toAddress: '0x...',
|
|
2301
2444
|
* amount: '1000000',
|
|
2302
|
-
* apiKey: '
|
|
2445
|
+
* apiKey: 'TEST_API_KEY:...',
|
|
2303
2446
|
* })
|
|
2304
2447
|
*
|
|
2305
2448
|
* // Build token inputs with permit
|
|
@@ -2443,7 +2586,7 @@ interface ExecuteSwapEVMParams extends ActionParameters {
|
|
|
2443
2586
|
* fromAddress: 'YubQzu18FDqJRyNfG8JqHmsdbxhnoQqcKUHBdUkN6tP',
|
|
2444
2587
|
* toAddress: 'YubQzu18FDqJRyNfG8JqHmsdbxhnoQqcKUHBdUkN6tP',
|
|
2445
2588
|
* amount: '1000000',
|
|
2446
|
-
* apiKey: '
|
|
2589
|
+
* apiKey: 'TEST_API_KEY:...',
|
|
2447
2590
|
* })
|
|
2448
2591
|
*
|
|
2449
2592
|
* // Prepare action parameters
|
|
@@ -3917,6 +4060,49 @@ interface ErrorInfo {
|
|
|
3917
4060
|
type?: string;
|
|
3918
4061
|
}
|
|
3919
4062
|
|
|
4063
|
+
/**
|
|
4064
|
+
* Configuration options for the API polling utility.
|
|
4065
|
+
*
|
|
4066
|
+
* @remarks
|
|
4067
|
+
* These settings control the behavior of the API polling process:
|
|
4068
|
+
* - timeout: Maximum time (ms) to wait for each request before aborting
|
|
4069
|
+
* - maxRetries: Maximum number of retry attempts for failed requests
|
|
4070
|
+
* - retryDelay: Base delay (ms); constant wait for `'fixed'` or exponential seed for `'exponential'`
|
|
4071
|
+
* - backoff: Retry-delay strategy, `'fixed'` (default) or `'exponential'`
|
|
4072
|
+
* - maxRetryDelayMs: Optional ceiling (ms) for a single backoff wait
|
|
4073
|
+
* - headers: Optional HTTP headers to include with each request
|
|
4074
|
+
*/
|
|
4075
|
+
interface ApiPollingConfig {
|
|
4076
|
+
/** Maximum time in milliseconds to wait for each request */
|
|
4077
|
+
timeout: number;
|
|
4078
|
+
/** Maximum number of retry attempts for failed requests */
|
|
4079
|
+
maxRetries: number;
|
|
4080
|
+
/**
|
|
4081
|
+
* Delay in milliseconds between retry attempts. With the default
|
|
4082
|
+
* `backoff: 'fixed'` strategy this is the constant wait; with
|
|
4083
|
+
* `backoff: 'exponential'` it is the base the exponential backoff grows
|
|
4084
|
+
* from (see {@link pollApiWithValidation}).
|
|
4085
|
+
*/
|
|
4086
|
+
retryDelay: number;
|
|
4087
|
+
/**
|
|
4088
|
+
* Retry-delay strategy. `'fixed'` (the default when omitted) waits a
|
|
4089
|
+
* constant `retryDelay` between attempts; `'exponential'` grows the wait
|
|
4090
|
+
* exponentially off `retryDelay` and randomizes it with full jitter, which
|
|
4091
|
+
* spreads out retries so rate-limited (429) bursts do not retry in
|
|
4092
|
+
* lockstep. Opt in per caller; existing callers keep the fixed delay.
|
|
4093
|
+
*/
|
|
4094
|
+
backoff?: 'fixed' | 'exponential' | undefined;
|
|
4095
|
+
/**
|
|
4096
|
+
* Optional ceiling, in milliseconds, for a single backoff wait. Only
|
|
4097
|
+
* applies when `backoff` is `'exponential'`: the exponential delay is
|
|
4098
|
+
* capped at this value before jitter is applied. Defaults to
|
|
4099
|
+
* {@link DEFAULT_MAX_RETRY_DELAY_MS} when omitted.
|
|
4100
|
+
*/
|
|
4101
|
+
maxRetryDelayMs?: number | undefined;
|
|
4102
|
+
/** Optional HTTP headers to include with requests */
|
|
4103
|
+
headers?: Record<string, string> | undefined;
|
|
4104
|
+
}
|
|
4105
|
+
|
|
3920
4106
|
/**
|
|
3921
4107
|
* A type-safe event emitter for managing action-based event subscriptions.
|
|
3922
4108
|
*
|
|
@@ -4362,6 +4548,83 @@ interface DepositResult$1 {
|
|
|
4362
4548
|
explorerUrl?: string;
|
|
4363
4549
|
}
|
|
4364
4550
|
|
|
4551
|
+
/**
|
|
4552
|
+
* Fee category describing the origin of a fee line item.
|
|
4553
|
+
*
|
|
4554
|
+
* - `'provider'` — Fee charged by the cross-chain provider (e.g. protocol fee).
|
|
4555
|
+
* - `'gasFee'` — On-chain gas cost denominated in the transfer token (e.g. USDC).
|
|
4556
|
+
* - `'kit'` — Fee charged by the kit / developer integration.
|
|
4557
|
+
* - `'forwarder'` — Fee charged by Circle's Forwarding Service for automatic mint.
|
|
4558
|
+
*/
|
|
4559
|
+
type FeeType = 'provider' | 'gasFee' | 'kit' | 'forwarder';
|
|
4560
|
+
/**
|
|
4561
|
+
* Per-chain breakdown of a fee amount.
|
|
4562
|
+
*
|
|
4563
|
+
* @example
|
|
4564
|
+
* ```typescript
|
|
4565
|
+
* import type { FeeAllocation } from '@core/types'
|
|
4566
|
+
* import { Blockchain } from '@core/chains'
|
|
4567
|
+
*
|
|
4568
|
+
* const allocation: FeeAllocation = {
|
|
4569
|
+
* chain: Blockchain.Ethereum,
|
|
4570
|
+
* amount: '0.00005',
|
|
4571
|
+
* }
|
|
4572
|
+
* ```
|
|
4573
|
+
*/
|
|
4574
|
+
interface FeeAllocation {
|
|
4575
|
+
/** The chain to which this portion of the fee applies. */
|
|
4576
|
+
chain: Blockchain;
|
|
4577
|
+
/** The fee amount on this chain (human-readable decimal string). */
|
|
4578
|
+
amount: string;
|
|
4579
|
+
}
|
|
4580
|
+
/**
|
|
4581
|
+
* A single fee line item within an estimate.
|
|
4582
|
+
*
|
|
4583
|
+
* @remarks
|
|
4584
|
+
* Each entry describes a fee category (`type`), the token it is
|
|
4585
|
+
* denominated in, the aggregate `amount`, and an optional per-chain
|
|
4586
|
+
* `allocations` breakdown.
|
|
4587
|
+
*
|
|
4588
|
+
* @example
|
|
4589
|
+
* ```typescript
|
|
4590
|
+
* import type { FeeEntry } from '@core/types'
|
|
4591
|
+
* import { Blockchain } from '@core/chains'
|
|
4592
|
+
*
|
|
4593
|
+
* // Fee with per-chain allocation breakdown
|
|
4594
|
+
* const providerFee: FeeEntry = {
|
|
4595
|
+
* type: 'provider',
|
|
4596
|
+
* token: 'USDC',
|
|
4597
|
+
* amount: '0.00011',
|
|
4598
|
+
* allocations: [
|
|
4599
|
+
* { chain: Blockchain.Ethereum, amount: '0.00005' },
|
|
4600
|
+
* { chain: Blockchain.Polygon, amount: '0.00006' },
|
|
4601
|
+
* ],
|
|
4602
|
+
* }
|
|
4603
|
+
*
|
|
4604
|
+
* // Flat fee without allocations (e.g. forwarder)
|
|
4605
|
+
* const forwarderFee: FeeEntry = {
|
|
4606
|
+
* type: 'forwarder',
|
|
4607
|
+
* token: 'USDC',
|
|
4608
|
+
* amount: '0.005',
|
|
4609
|
+
* }
|
|
4610
|
+
* ```
|
|
4611
|
+
*/
|
|
4612
|
+
interface FeeEntry {
|
|
4613
|
+
/** The category of this fee. */
|
|
4614
|
+
type: FeeType;
|
|
4615
|
+
/** The token in which this fee is denominated (e.g. `'USDC'`, `'ETH'`). */
|
|
4616
|
+
token: string;
|
|
4617
|
+
/** Aggregate fee amount (human-readable decimal string). */
|
|
4618
|
+
amount: string;
|
|
4619
|
+
/** Per-chain breakdown of the fee. Omitted for flat fees (e.g. forwarder). */
|
|
4620
|
+
allocations?: FeeAllocation[];
|
|
4621
|
+
/**
|
|
4622
|
+
* When `type === 'kit'`, the address that receives the kit fee.
|
|
4623
|
+
* Omitted for other fee types.
|
|
4624
|
+
*/
|
|
4625
|
+
recipientAddress?: string;
|
|
4626
|
+
}
|
|
4627
|
+
|
|
4365
4628
|
/**
|
|
4366
4629
|
* Data payload for a single step in a spend operation.
|
|
4367
4630
|
*
|
|
@@ -4663,6 +4926,15 @@ interface SpendOptions {
|
|
|
4663
4926
|
* @internal
|
|
4664
4927
|
*/
|
|
4665
4928
|
onBroadcast?: (txHash: string) => void;
|
|
4929
|
+
/**
|
|
4930
|
+
* Partial polling config forwarded to every Gateway API request the spend
|
|
4931
|
+
* makes (estimate, transfer, forwarder status, and the balance lookups on
|
|
4932
|
+
* the auto-allocation path). The provider factory populates this from its
|
|
4933
|
+
* `headers` config so a configured header reaches all spend-path calls.
|
|
4934
|
+
*
|
|
4935
|
+
* @internal
|
|
4936
|
+
*/
|
|
4937
|
+
requestConfig?: Partial<ApiPollingConfig>;
|
|
4666
4938
|
}
|
|
4667
4939
|
/**
|
|
4668
4940
|
* Result returned after a successful spend (mint) operation.
|
|
@@ -4712,7 +4984,7 @@ interface SpendResult$1 {
|
|
|
4712
4984
|
* executed spend. Same shape as {@link EstimateSpendResult.fees}.
|
|
4713
4985
|
* Omitted when using `config.retry` (no estimate was run).
|
|
4714
4986
|
*/
|
|
4715
|
-
fees?: FeeEntry
|
|
4987
|
+
fees?: FeeEntry[];
|
|
4716
4988
|
/**
|
|
4717
4989
|
* Gateway transfer identifier. Present when `useForwarder` is enabled
|
|
4718
4990
|
* and can be used to query transfer status via `GET /v1/transfer/{id}`.
|
|
@@ -4734,80 +5006,6 @@ interface SpendResult$1 {
|
|
|
4734
5006
|
*/
|
|
4735
5007
|
steps?: SpendStep[];
|
|
4736
5008
|
}
|
|
4737
|
-
/**
|
|
4738
|
-
* Fee category describing the origin of a fee line item.
|
|
4739
|
-
*
|
|
4740
|
-
* - `'provider'` — Fee charged by the cross-chain provider (e.g. protocol fee).
|
|
4741
|
-
* - `'gasFee'` — On-chain gas cost denominated in the transfer token (e.g. USDC).
|
|
4742
|
-
* - `'kit'` — Fee charged by the kit / developer integration.
|
|
4743
|
-
* - `'forwarder'` — Fee charged by Circle's Forwarding Service for automatic mint.
|
|
4744
|
-
*/
|
|
4745
|
-
type FeeType$1 = 'provider' | 'gasFee' | 'kit' | 'forwarder';
|
|
4746
|
-
/**
|
|
4747
|
-
* Per-chain breakdown of a fee amount.
|
|
4748
|
-
*
|
|
4749
|
-
* @example
|
|
4750
|
-
* ```typescript
|
|
4751
|
-
* import type { FeeAllocation } from '@circle-fin/provider-gateway-v1'
|
|
4752
|
-
*
|
|
4753
|
-
* const allocation: FeeAllocation = {
|
|
4754
|
-
* chain: 'Ethereum',
|
|
4755
|
-
* amount: '0.00005',
|
|
4756
|
-
* }
|
|
4757
|
-
* ```
|
|
4758
|
-
*/
|
|
4759
|
-
interface FeeAllocation$1 {
|
|
4760
|
-
/** The chain to which this portion of the fee applies. */
|
|
4761
|
-
chain: Blockchain;
|
|
4762
|
-
/** The fee amount on this chain (human-readable decimal string). */
|
|
4763
|
-
amount: string;
|
|
4764
|
-
}
|
|
4765
|
-
/**
|
|
4766
|
-
* A single fee line item within an estimate.
|
|
4767
|
-
*
|
|
4768
|
-
* @remarks
|
|
4769
|
-
* Each entry describes a fee category (`type`), the token it is
|
|
4770
|
-
* denominated in, the aggregate `amount`, and an optional per-chain
|
|
4771
|
-
* `allocations` breakdown.
|
|
4772
|
-
*
|
|
4773
|
-
* @example
|
|
4774
|
-
* ```typescript
|
|
4775
|
-
* import type { FeeEntry } from '@circle-fin/provider-gateway-v1'
|
|
4776
|
-
*
|
|
4777
|
-
* // Fee with per-chain allocation breakdown
|
|
4778
|
-
* const providerFee: FeeEntry = {
|
|
4779
|
-
* type: 'provider',
|
|
4780
|
-
* token: 'USDC',
|
|
4781
|
-
* amount: '0.00011',
|
|
4782
|
-
* allocations: [
|
|
4783
|
-
* { chain: 'Ethereum', amount: '0.00005' },
|
|
4784
|
-
* { chain: 'Polygon', amount: '0.00006' },
|
|
4785
|
-
* ],
|
|
4786
|
-
* }
|
|
4787
|
-
*
|
|
4788
|
-
* // Flat fee without allocations (e.g. forwarder)
|
|
4789
|
-
* const forwarderFee: FeeEntry = {
|
|
4790
|
-
* type: 'forwarder',
|
|
4791
|
-
* token: 'USDC',
|
|
4792
|
-
* amount: '0.005',
|
|
4793
|
-
* }
|
|
4794
|
-
* ```
|
|
4795
|
-
*/
|
|
4796
|
-
interface FeeEntry$1 {
|
|
4797
|
-
/** The category of this fee. */
|
|
4798
|
-
type: FeeType$1;
|
|
4799
|
-
/** The token in which this fee is denominated (e.g. `'USDC'`, `'ETH'`). */
|
|
4800
|
-
token: string;
|
|
4801
|
-
/** Aggregate fee amount (human-readable decimal string). */
|
|
4802
|
-
amount: string;
|
|
4803
|
-
/** Per-chain breakdown of the fee. Omitted for flat fees (e.g. forwarder). */
|
|
4804
|
-
allocations?: FeeAllocation$1[];
|
|
4805
|
-
/**
|
|
4806
|
-
* When `type === 'kit'`, the address that receives the kit fee.
|
|
4807
|
-
* Omitted for other fee types.
|
|
4808
|
-
*/
|
|
4809
|
-
recipientAddress?: string;
|
|
4810
|
-
}
|
|
4811
5009
|
/**
|
|
4812
5010
|
* Cost estimation for a spend (mint) operation.
|
|
4813
5011
|
*
|
|
@@ -4855,7 +5053,7 @@ interface FeeEntry$1 {
|
|
|
4855
5053
|
*/
|
|
4856
5054
|
interface EstimateSpendResult$1 {
|
|
4857
5055
|
/** Itemised fee breakdown for the spend operation. */
|
|
4858
|
-
fees: FeeEntry
|
|
5056
|
+
fees: FeeEntry[];
|
|
4859
5057
|
}
|
|
4860
5058
|
|
|
4861
5059
|
/**
|
|
@@ -6242,80 +6440,7 @@ type FeeRecipientChainType = 'evm' | 'solana';
|
|
|
6242
6440
|
* ```
|
|
6243
6441
|
*/
|
|
6244
6442
|
type FeeRecipientsConfig = Partial<Record<FeeRecipientChainType, string>>;
|
|
6245
|
-
|
|
6246
|
-
* Fee category describing the origin of a fee line item.
|
|
6247
|
-
*
|
|
6248
|
-
* - `'provider'` — Fee charged by the cross-chain provider (e.g. protocol fee).
|
|
6249
|
-
* - `'gasFee'` — On-chain gas cost denominated in the transfer token (e.g. USDC).
|
|
6250
|
-
* - `'kit'` — Fee charged by the kit / developer integration.
|
|
6251
|
-
* - `'forwarder'` — Fee charged by Circle's Forwarding Service for automatic mint.
|
|
6252
|
-
*/
|
|
6253
|
-
type FeeType = 'provider' | 'gasFee' | 'kit' | 'forwarder';
|
|
6254
|
-
/**
|
|
6255
|
-
* Per-chain breakdown of a fee amount.
|
|
6256
|
-
*
|
|
6257
|
-
* @example
|
|
6258
|
-
* ```typescript
|
|
6259
|
-
* import type { FeeAllocation } from '@circle-fin/unified-balance-kit'
|
|
6260
|
-
*
|
|
6261
|
-
* const allocation: FeeAllocation = {
|
|
6262
|
-
* chain: 'Ethereum',
|
|
6263
|
-
* amount: '0.00005',
|
|
6264
|
-
* }
|
|
6265
|
-
* ```
|
|
6266
|
-
*/
|
|
6267
|
-
interface FeeAllocation {
|
|
6268
|
-
/** The chain to which this portion of the fee applies. */
|
|
6269
|
-
chain: Blockchain;
|
|
6270
|
-
/** The fee amount on this chain (human-readable decimal string). */
|
|
6271
|
-
amount: string;
|
|
6272
|
-
}
|
|
6273
|
-
/**
|
|
6274
|
-
* A single fee line item within an estimate.
|
|
6275
|
-
*
|
|
6276
|
-
* @remarks
|
|
6277
|
-
* Each entry describes a fee category (`type`), the token it is
|
|
6278
|
-
* denominated in, the aggregate `amount`, and an optional per-chain
|
|
6279
|
-
* `allocations` breakdown.
|
|
6280
|
-
*
|
|
6281
|
-
* @example
|
|
6282
|
-
* ```typescript
|
|
6283
|
-
* import type { FeeEntry } from '@circle-fin/unified-balance-kit'
|
|
6284
|
-
*
|
|
6285
|
-
* // Fee with per-chain allocation breakdown
|
|
6286
|
-
* const providerFee: FeeEntry = {
|
|
6287
|
-
* type: 'provider',
|
|
6288
|
-
* token: 'USDC',
|
|
6289
|
-
* amount: '0.00011',
|
|
6290
|
-
* allocations: [
|
|
6291
|
-
* { chain: 'Ethereum', amount: '0.00005' },
|
|
6292
|
-
* { chain: 'Polygon', amount: '0.00006' },
|
|
6293
|
-
* ],
|
|
6294
|
-
* }
|
|
6295
|
-
*
|
|
6296
|
-
* // Flat fee without allocations (e.g. forwarder)
|
|
6297
|
-
* const forwarderFee: FeeEntry = {
|
|
6298
|
-
* type: 'forwarder',
|
|
6299
|
-
* token: 'USDC',
|
|
6300
|
-
* amount: '0.005',
|
|
6301
|
-
* }
|
|
6302
|
-
* ```
|
|
6303
|
-
*/
|
|
6304
|
-
interface FeeEntry {
|
|
6305
|
-
/** The category of this fee. */
|
|
6306
|
-
type: FeeType;
|
|
6307
|
-
/** The token in which this fee is denominated (e.g. `'USDC'`, `'ETH'`). */
|
|
6308
|
-
token: string;
|
|
6309
|
-
/** Aggregate fee amount (human-readable decimal string). */
|
|
6310
|
-
amount: string;
|
|
6311
|
-
/** Per-chain breakdown of the fee. Omitted for flat fees (e.g. forwarder). */
|
|
6312
|
-
allocations?: FeeAllocation[];
|
|
6313
|
-
/**
|
|
6314
|
-
* When `type === 'kit'`, the address that receives the kit fee.
|
|
6315
|
-
* Omitted for other fee types.
|
|
6316
|
-
*/
|
|
6317
|
-
recipientAddress?: string;
|
|
6318
|
-
}
|
|
6443
|
+
|
|
6319
6444
|
/**
|
|
6320
6445
|
* Cost estimation for a spend (mint) operation.
|
|
6321
6446
|
*
|
|
@@ -6494,6 +6619,41 @@ interface UnifiedBalanceKitConfig<TExtraProviders extends FlexibleGatewayProvide
|
|
|
6494
6619
|
* @defaultValue false
|
|
6495
6620
|
*/
|
|
6496
6621
|
excludeDefaultProviders?: boolean;
|
|
6622
|
+
/**
|
|
6623
|
+
* Custom HTTP headers forwarded with every Circle Gateway API request the
|
|
6624
|
+
* default Gateway v1 provider makes (balances, deposits, spend estimate,
|
|
6625
|
+
* transfer, forwarder status, and `/v1/info`).
|
|
6626
|
+
*
|
|
6627
|
+
* @remarks
|
|
6628
|
+
* Headers are merged on top of the SDK defaults (such as `Content-Type`)
|
|
6629
|
+
* rather than replacing them. Each header is forwarded as-is to Circle's
|
|
6630
|
+
* API; the SDK does not interpret it. Only applies to the default provider —
|
|
6631
|
+
* has no effect when `excludeDefaultProviders` is `true` or on custom
|
|
6632
|
+
* providers supplied via `providers`.
|
|
6633
|
+
*
|
|
6634
|
+
* @example
|
|
6635
|
+
* ```typescript
|
|
6636
|
+
* const kit = new UnifiedBalanceKit({
|
|
6637
|
+
* headers: { 'X-Access-Key': process.env.GATEWAY_ACCESS_KEY! },
|
|
6638
|
+
* })
|
|
6639
|
+
* ```
|
|
6640
|
+
*/
|
|
6641
|
+
headers?: Record<string, string>;
|
|
6642
|
+
}
|
|
6643
|
+
|
|
6644
|
+
/**
|
|
6645
|
+
* USD exchange-rate metadata.
|
|
6646
|
+
*
|
|
6647
|
+
* Non-binding, useful for USD-denominated fee estimates. `feeTokenUsd` prices
|
|
6648
|
+
* the source-chain fee token (the token `feeTotalAmount` is denominated in).
|
|
6649
|
+
*
|
|
6650
|
+
* @internal
|
|
6651
|
+
*/
|
|
6652
|
+
interface FeeQuoteExchangeRates {
|
|
6653
|
+
/** USD price of the fee token, as a decimal string. */
|
|
6654
|
+
readonly feeTokenUsd: string;
|
|
6655
|
+
/** USD price of the destination token, as a decimal string. */
|
|
6656
|
+
readonly destinationTokenUsd: string;
|
|
6497
6657
|
}
|
|
6498
6658
|
|
|
6499
6659
|
/**
|
|
@@ -6535,7 +6695,7 @@ type AllowanceStrategy = 'approve' | 'permit' | 'authorize';
|
|
|
6535
6695
|
* }
|
|
6536
6696
|
* ```
|
|
6537
6697
|
*/
|
|
6538
|
-
interface DepositParams<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities, TChainIdentifier extends
|
|
6698
|
+
interface DepositParams<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities, TChainIdentifier extends BridgeChainIdentifier = BridgeChainIdentifier> {
|
|
6539
6699
|
/**
|
|
6540
6700
|
* The adapter context identifying the depositor and chain.
|
|
6541
6701
|
*/
|
|
@@ -6548,7 +6708,7 @@ interface DepositParams<TAdapterCapabilities extends AdapterCapabilities = Adapt
|
|
|
6548
6708
|
amount: string;
|
|
6549
6709
|
/**
|
|
6550
6710
|
* The token to deposit.
|
|
6551
|
-
* Accepts any case (e.g. `'usdc'`, `'Usdc'`);
|
|
6711
|
+
* Accepts any case (e.g. `'usdc'`, `'Usdc'`); normalized to uppercase internally.
|
|
6552
6712
|
*
|
|
6553
6713
|
* @defaultValue 'USDC'
|
|
6554
6714
|
*/
|
|
@@ -6556,9 +6716,40 @@ interface DepositParams<TAdapterCapabilities extends AdapterCapabilities = Adapt
|
|
|
6556
6716
|
/**
|
|
6557
6717
|
* The token allowance strategy to authorize the deposit.
|
|
6558
6718
|
*
|
|
6719
|
+
* Only valid for same-chain (STANDARD) deposits. Must not be set when
|
|
6720
|
+
* `to` is provided (FAST cross-chain deposits do not use an allowance
|
|
6721
|
+
* strategy).
|
|
6722
|
+
*
|
|
6559
6723
|
* @defaultValue 'authorize'
|
|
6560
6724
|
*/
|
|
6561
6725
|
allowanceStrategy?: AllowanceStrategy;
|
|
6726
|
+
/**
|
|
6727
|
+
* Destination chain for a FAST cross-chain deposit.
|
|
6728
|
+
*
|
|
6729
|
+
* When set, the deposit follows the prepaid-FORWARD CCTP v2 path:
|
|
6730
|
+
* the burned USDC is minted to the GenericExecutor on the destination
|
|
6731
|
+
* chain, which then calls Gateway `deposit` in a single relayed flow.
|
|
6732
|
+
*
|
|
6733
|
+
* Must not be set when `config.transferSpeed` is `'STANDARD'`.
|
|
6734
|
+
*/
|
|
6735
|
+
to?: {
|
|
6736
|
+
chain: UnifiedBalanceChainIdentifier;
|
|
6737
|
+
};
|
|
6738
|
+
/**
|
|
6739
|
+
* Transfer configuration for the deposit.
|
|
6740
|
+
*
|
|
6741
|
+
* @defaultValue `{ transferSpeed: 'STANDARD' }`. Set `transferSpeed: 'FAST'`
|
|
6742
|
+
* explicitly for cross-chain deposits (when `to` is provided).
|
|
6743
|
+
*/
|
|
6744
|
+
config?: DepositConfig;
|
|
6745
|
+
/**
|
|
6746
|
+
* Opaque signed fee-quote bytes from the Quote API.
|
|
6747
|
+
*
|
|
6748
|
+
* Pass this to commit to the fee price returned by a previous
|
|
6749
|
+
* {@link estimateDeposit} call (see {@link EstimateDepositResult.quote}).
|
|
6750
|
+
* When omitted a fresh quote is fetched automatically (FAST path only).
|
|
6751
|
+
*/
|
|
6752
|
+
quote?: string;
|
|
6562
6753
|
}
|
|
6563
6754
|
/**
|
|
6564
6755
|
* Parameters for depositing tokens into *another* Gateway account.
|
|
@@ -6585,7 +6776,7 @@ interface DepositParams<TAdapterCapabilities extends AdapterCapabilities = Adapt
|
|
|
6585
6776
|
* }
|
|
6586
6777
|
* ```
|
|
6587
6778
|
*/
|
|
6588
|
-
interface DepositForParams<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities, TChainIdentifier extends
|
|
6779
|
+
interface DepositForParams<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities, TChainIdentifier extends BridgeChainIdentifier = BridgeChainIdentifier> extends Omit<DepositParams<TAdapterCapabilities, TChainIdentifier>, 'allowanceStrategy'> {
|
|
6589
6780
|
/**
|
|
6590
6781
|
* The Gateway account address to credit with the deposit.
|
|
6591
6782
|
*
|
|
@@ -6594,6 +6785,34 @@ interface DepositForParams<TAdapterCapabilities extends AdapterCapabilities = Ad
|
|
|
6594
6785
|
*/
|
|
6595
6786
|
depositAccount: string;
|
|
6596
6787
|
}
|
|
6788
|
+
/**
|
|
6789
|
+
* Relay progress for a cross-chain (FAST) deposit.
|
|
6790
|
+
*
|
|
6791
|
+
* Set after `depositFastCrossChain` completes the ~60-second relay wait.
|
|
6792
|
+
* Always present on the FAST path; absent on same-chain STANDARD deposits.
|
|
6793
|
+
*
|
|
6794
|
+
* @example
|
|
6795
|
+
* ```typescript
|
|
6796
|
+
* if (result.progress?.status === 'DONE') {
|
|
6797
|
+
* console.log('Minted on destination:', result.txHash)
|
|
6798
|
+
* } else if (result.progress?.status === 'PENDING') {
|
|
6799
|
+
* console.log('Relay still in progress — poll getDepositStatus later')
|
|
6800
|
+
* } else if (result.progress?.status === 'FAILED') {
|
|
6801
|
+
* console.log('Relay failed — manual mint may be required')
|
|
6802
|
+
* }
|
|
6803
|
+
* ```
|
|
6804
|
+
*/
|
|
6805
|
+
interface DepositProgress {
|
|
6806
|
+
/**
|
|
6807
|
+
* Relay outcome after the burn is confirmed on the source chain.
|
|
6808
|
+
*
|
|
6809
|
+
* - `'DONE'` — Circle's relayer minted USDC on the destination chain.
|
|
6810
|
+
* - `'PENDING'` — Relay timed out (~60 s); the mint may still complete.
|
|
6811
|
+
* - `'FAILED'` — Relayer reported a permanent failure; manual mint may
|
|
6812
|
+
* be required.
|
|
6813
|
+
*/
|
|
6814
|
+
status: 'DONE' | 'PENDING' | 'FAILED';
|
|
6815
|
+
}
|
|
6597
6816
|
/**
|
|
6598
6817
|
* Result returned after a successful deposit operation.
|
|
6599
6818
|
*
|
|
@@ -6623,22 +6842,232 @@ interface DepositResult {
|
|
|
6623
6842
|
depositedTo: string;
|
|
6624
6843
|
/** The address that signed and funded the deposit. */
|
|
6625
6844
|
depositedBy: string;
|
|
6626
|
-
/**
|
|
6845
|
+
/**
|
|
6846
|
+
* The chain where the deposit balance lands.
|
|
6847
|
+
*
|
|
6848
|
+
* @remarks For cross-chain (FAST) deposits this is the destination chain
|
|
6849
|
+
* where the minted USDC is credited. For same-chain (STANDARD) deposits it
|
|
6850
|
+
* is the chain the deposit occurred on. Prefer `sourceChain` /
|
|
6851
|
+
* `destinationChain` for cross-chain flows.
|
|
6852
|
+
*/
|
|
6627
6853
|
chain: Blockchain;
|
|
6628
6854
|
/**
|
|
6629
|
-
*
|
|
6630
|
-
*
|
|
6855
|
+
* Transaction hash of the completed deposit.
|
|
6856
|
+
*
|
|
6857
|
+
* @remarks
|
|
6858
|
+
* For same-chain (STANDARD) deposits this is the on-chain deposit
|
|
6859
|
+
* transaction. For cross-chain (FAST) deposits with
|
|
6860
|
+
* `progress.status === 'DONE'` this is the Circle-relayed mint on the
|
|
6861
|
+
* destination chain; when the relay is still pending or has failed it
|
|
6862
|
+
* falls back to the source-chain burn hash.
|
|
6631
6863
|
*/
|
|
6632
6864
|
txHash: string;
|
|
6633
6865
|
/**
|
|
6634
|
-
* Link to view the transaction
|
|
6635
|
-
* blockchain explorer.
|
|
6866
|
+
* Link to view the transaction on a block explorer.
|
|
6636
6867
|
*
|
|
6637
6868
|
* @remarks
|
|
6638
|
-
*
|
|
6639
|
-
* for the chain.
|
|
6869
|
+
* Follows the same chain as {@link txHash}: points to the destination-chain
|
|
6870
|
+
* mint for a completed FAST deposit, or the source-chain burn otherwise.
|
|
6871
|
+
* May be `undefined` when the chain has no configured explorer URL.
|
|
6640
6872
|
*/
|
|
6641
6873
|
explorerUrl?: string;
|
|
6874
|
+
/**
|
|
6875
|
+
* Source chain of the cross-chain deposit (FAST path only).
|
|
6876
|
+
*
|
|
6877
|
+
* Present when `to` was specified in the deposit params.
|
|
6878
|
+
*/
|
|
6879
|
+
sourceChain?: Blockchain;
|
|
6880
|
+
/**
|
|
6881
|
+
* Destination chain of the cross-chain deposit (FAST path only).
|
|
6882
|
+
*
|
|
6883
|
+
* Present when `to` was specified in the deposit params.
|
|
6884
|
+
*/
|
|
6885
|
+
destinationChain?: Blockchain;
|
|
6886
|
+
/**
|
|
6887
|
+
* Itemised fee breakdown for the cross-chain deposit (FAST path only).
|
|
6888
|
+
*
|
|
6889
|
+
* Contains at least a `gasFee` entry and a `forwarder` entry (Circle
|
|
6890
|
+
* FORWARD fee). The `gasFee` covers the source-chain burn gas; when a
|
|
6891
|
+
* `usdc.approve` was required it also includes the actual on-chain approve
|
|
6892
|
+
* gas derived from the transaction receipt.
|
|
6893
|
+
*/
|
|
6894
|
+
fees?: FeeEntry[];
|
|
6895
|
+
/**
|
|
6896
|
+
* Relay progress after the source-chain burn (FAST path only).
|
|
6897
|
+
*
|
|
6898
|
+
* Present on every FAST deposit result. Use this to determine whether
|
|
6899
|
+
* the destination-chain mint completed within the ~60-second relay window.
|
|
6900
|
+
*/
|
|
6901
|
+
progress?: DepositProgress;
|
|
6902
|
+
}
|
|
6903
|
+
/**
|
|
6904
|
+
* Transfer-speed configuration for a deposit operation.
|
|
6905
|
+
*
|
|
6906
|
+
* @example
|
|
6907
|
+
* ```typescript
|
|
6908
|
+
* import type { DepositConfig } from '@circle-fin/unified-balance-kit'
|
|
6909
|
+
*
|
|
6910
|
+
* const config: DepositConfig = { transferSpeed: 'FAST' }
|
|
6911
|
+
* ```
|
|
6912
|
+
*/
|
|
6913
|
+
interface DepositConfig {
|
|
6914
|
+
/**
|
|
6915
|
+
* Requested transfer speed for a cross-chain fast deposit.
|
|
6916
|
+
*
|
|
6917
|
+
* @defaultValue `'STANDARD'`
|
|
6918
|
+
*/
|
|
6919
|
+
transferSpeed?: 'FAST' | 'STANDARD';
|
|
6920
|
+
}
|
|
6921
|
+
/**
|
|
6922
|
+
* Parameters for estimating the fees of a fast cross-chain deposit.
|
|
6923
|
+
*
|
|
6924
|
+
* The result is plain, serializable data — no live adapter reference is
|
|
6925
|
+
* included. Pass the result (plus `from`) directly to
|
|
6926
|
+
* {@link DepositParams} or {@link DepositForParams} for execution:
|
|
6927
|
+
*
|
|
6928
|
+
* ```typescript
|
|
6929
|
+
* const estimate = await kit.estimateDeposit({ from, amount, token, to })
|
|
6930
|
+
* const result = await kit.deposit({ ...estimate, from })
|
|
6931
|
+
* ```
|
|
6932
|
+
*
|
|
6933
|
+
* @typeParam TAdapterCapabilities - Adapter capability constraints.
|
|
6934
|
+
* @typeParam TChainIdentifier - Accepted chain identifier type.
|
|
6935
|
+
*
|
|
6936
|
+
* @example
|
|
6937
|
+
* ```typescript
|
|
6938
|
+
* import type { EstimateDepositParams } from '@circle-fin/unified-balance-kit'
|
|
6939
|
+
*
|
|
6940
|
+
* const params: EstimateDepositParams = {
|
|
6941
|
+
* from: { adapter: evmAdapter, chain: 'Ethereum' },
|
|
6942
|
+
* amount: '100',
|
|
6943
|
+
* to: { chain: 'Arc_Testnet' },
|
|
6944
|
+
* config: { transferSpeed: 'FAST' },
|
|
6945
|
+
* }
|
|
6946
|
+
* ```
|
|
6947
|
+
*/
|
|
6948
|
+
interface EstimateDepositParams<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities, TChainIdentifier extends BridgeChainIdentifier = BridgeChainIdentifier> {
|
|
6949
|
+
/**
|
|
6950
|
+
* The adapter context identifying the depositor and source chain.
|
|
6951
|
+
* The adapter is used for source-chain gas estimation.
|
|
6952
|
+
*/
|
|
6953
|
+
from: AdapterContext<TAdapterCapabilities, TChainIdentifier>;
|
|
6954
|
+
/**
|
|
6955
|
+
* The amount of tokens to deposit (human-readable decimal string).
|
|
6956
|
+
*
|
|
6957
|
+
* @example "100", "0.5"
|
|
6958
|
+
*/
|
|
6959
|
+
amount: string;
|
|
6960
|
+
/**
|
|
6961
|
+
* The token to deposit.
|
|
6962
|
+
*
|
|
6963
|
+
* @defaultValue 'USDC'
|
|
6964
|
+
*/
|
|
6965
|
+
token?: SupportedTokenInput;
|
|
6966
|
+
/**
|
|
6967
|
+
* Destination chain for a FAST cross-chain deposit.
|
|
6968
|
+
*
|
|
6969
|
+
* Required when `config.transferSpeed` is `'FAST'`.
|
|
6970
|
+
* Must not be set when `config.transferSpeed` is `'STANDARD'` (the default).
|
|
6971
|
+
*/
|
|
6972
|
+
to?: {
|
|
6973
|
+
chain: UnifiedBalanceChainIdentifier;
|
|
6974
|
+
};
|
|
6975
|
+
/**
|
|
6976
|
+
* Transfer configuration.
|
|
6977
|
+
*
|
|
6978
|
+
* @defaultValue `{ transferSpeed: 'STANDARD' }`
|
|
6979
|
+
*/
|
|
6980
|
+
config?: DepositConfig;
|
|
6981
|
+
/**
|
|
6982
|
+
* Gateway account address to credit (for a `depositFor` round-trip).
|
|
6983
|
+
*
|
|
6984
|
+
* When provided, this value is echoed on the result so
|
|
6985
|
+
* `kit.depositFor({ ...estimate, from })` works without re-specifying it.
|
|
6986
|
+
*/
|
|
6987
|
+
depositAccount?: string;
|
|
6988
|
+
/**
|
|
6989
|
+
* Allowance strategy echoed to the result for round-trip convenience.
|
|
6990
|
+
*/
|
|
6991
|
+
allowanceStrategy?: AllowanceStrategy;
|
|
6992
|
+
}
|
|
6993
|
+
/**
|
|
6994
|
+
* Fee-preview result returned by `estimateDeposit`.
|
|
6995
|
+
*
|
|
6996
|
+
* Plain, serializable data — no live adapter reference. Pass the result
|
|
6997
|
+
* directly to `deposit` or `depositFor` (re-attaching only `from`):
|
|
6998
|
+
*
|
|
6999
|
+
* ```typescript
|
|
7000
|
+
* const estimate = await kit.estimateDeposit({ from, amount, token, to })
|
|
7001
|
+
* const result = await kit.deposit({ ...estimate, from })
|
|
7002
|
+
* ```
|
|
7003
|
+
*
|
|
7004
|
+
* @example
|
|
7005
|
+
* ```typescript
|
|
7006
|
+
* import type { EstimateDepositResult } from '@circle-fin/unified-balance-kit'
|
|
7007
|
+
*
|
|
7008
|
+
* const result: EstimateDepositResult = {
|
|
7009
|
+
* amount: '100',
|
|
7010
|
+
* token: 'USDC',
|
|
7011
|
+
* to: { chain: 'Arc_Testnet' },
|
|
7012
|
+
* config: { transferSpeed: 'FAST' },
|
|
7013
|
+
* fees: [
|
|
7014
|
+
* { type: 'gasFee', token: 'ETH', amount: '0.0002' },
|
|
7015
|
+
* { type: 'forwarder', token: 'USDC', amount: '0.12' },
|
|
7016
|
+
* ],
|
|
7017
|
+
* quote: '0x…',
|
|
7018
|
+
* }
|
|
7019
|
+
* ```
|
|
7020
|
+
*/
|
|
7021
|
+
interface EstimateDepositResult {
|
|
7022
|
+
/** Deposit amount (human-readable decimal string). */
|
|
7023
|
+
amount: string;
|
|
7024
|
+
/** Normalized token to deposit. */
|
|
7025
|
+
token: SupportedToken;
|
|
7026
|
+
/**
|
|
7027
|
+
* Destination chain (echoed from input).
|
|
7028
|
+
*
|
|
7029
|
+
* Present for FAST transfers; absent for STANDARD.
|
|
7030
|
+
*/
|
|
7031
|
+
to?: {
|
|
7032
|
+
chain: UnifiedBalanceChainIdentifier;
|
|
7033
|
+
};
|
|
7034
|
+
/** Transfer configuration (echoed with defaults applied). */
|
|
7035
|
+
config: Required<DepositConfig>;
|
|
7036
|
+
/**
|
|
7037
|
+
* Itemized fee breakdown.
|
|
7038
|
+
*
|
|
7039
|
+
* Always contains at least a `gasFee` entry. For FAST transfers the gas
|
|
7040
|
+
* cost includes the source-chain burn; when the current USDC allowance is
|
|
7041
|
+
* insufficient it also includes the `usdc.approve` transaction. For
|
|
7042
|
+
* STANDARD deposits on EVM with `allowanceStrategy: 'approve'`, or any
|
|
7043
|
+
* `depositFor` on EVM, the gas cost includes both the
|
|
7044
|
+
* `usdc.increaseAllowance` and the deposit transaction. A `forwarder`
|
|
7045
|
+
* entry is always present for FAST cross-chain transfers.
|
|
7046
|
+
*/
|
|
7047
|
+
fees: FeeEntry[];
|
|
7048
|
+
/**
|
|
7049
|
+
* Opaque signed fee-quote bytes from the Quote API.
|
|
7050
|
+
*
|
|
7051
|
+
* Present for FAST cross-chain deposits; absent for STANDARD or
|
|
7052
|
+
* same-chain. Pass this to {@link deposit} or {@link depositFor} to
|
|
7053
|
+
* commit to the quoted price.
|
|
7054
|
+
*/
|
|
7055
|
+
quote?: string;
|
|
7056
|
+
/**
|
|
7057
|
+
* Gateway account to credit (echoed from input for `depositFor` round-trip).
|
|
7058
|
+
*/
|
|
7059
|
+
depositAccount?: string;
|
|
7060
|
+
/**
|
|
7061
|
+
* Allowance strategy (echoed from input for `deposit` round-trip).
|
|
7062
|
+
*/
|
|
7063
|
+
allowanceStrategy?: AllowanceStrategy;
|
|
7064
|
+
/**
|
|
7065
|
+
* Optional USD exchange-rate metadata from the Quote API.
|
|
7066
|
+
*
|
|
7067
|
+
* Present when the Quote API returns exchange rates for the fee token
|
|
7068
|
+
* and destination token. Non-binding; useful for USD-denominated display.
|
|
7069
|
+
*/
|
|
7070
|
+
exchangeRates?: FeeQuoteExchangeRates;
|
|
6642
7071
|
}
|
|
6643
7072
|
|
|
6644
7073
|
/**
|
|
@@ -7386,6 +7815,35 @@ declare class AppKitUnifiedBalance {
|
|
|
7386
7815
|
* ```
|
|
7387
7816
|
*/
|
|
7388
7817
|
depositFor(params: DepositForParams): Promise<DepositResult>;
|
|
7818
|
+
/**
|
|
7819
|
+
* Estimate the fees for a deposit without executing it.
|
|
7820
|
+
*
|
|
7821
|
+
* Return plain, serializable data that can be spread directly into
|
|
7822
|
+
* {@link AppKitUnifiedBalance.deposit} or
|
|
7823
|
+
* {@link AppKitUnifiedBalance.depositFor}.
|
|
7824
|
+
*
|
|
7825
|
+
* @param params - Estimate details including the depositor context, amount,
|
|
7826
|
+
* destination chain, and optional transfer speed.
|
|
7827
|
+
* @returns Promise resolving to the itemised fee estimate.
|
|
7828
|
+
* @throws {KitError} If the estimate parameters are invalid or the route is
|
|
7829
|
+
* unsupported.
|
|
7830
|
+
*
|
|
7831
|
+
* @example
|
|
7832
|
+
* ```typescript
|
|
7833
|
+
* const estimate = await kit.unifiedBalance.estimateDeposit({
|
|
7834
|
+
* from: { adapter, chain: 'Ethereum' },
|
|
7835
|
+
* amount: '100',
|
|
7836
|
+
* to: { chain: 'Polygon' },
|
|
7837
|
+
* config: { transferSpeed: 'FAST' },
|
|
7838
|
+
* })
|
|
7839
|
+
*
|
|
7840
|
+
* const result = await kit.unifiedBalance.deposit({
|
|
7841
|
+
* ...estimate,
|
|
7842
|
+
* from: { adapter, chain: 'Ethereum' },
|
|
7843
|
+
* })
|
|
7844
|
+
* ```
|
|
7845
|
+
*/
|
|
7846
|
+
estimateDeposit(params: EstimateDepositParams): Promise<EstimateDepositResult>;
|
|
7389
7847
|
/**
|
|
7390
7848
|
* Spend (mint) USDC on a destination chain by pulling funds from one or
|
|
7391
7849
|
* more account sources.
|